private static List<Part> parse(String path, FromSourceLocation sourceLocation) {
        String[] components = path.split("\\.");
        List<Part> result = new ArrayList<>();
        for (String component : components) {
            if (component.contains("[")) {
                int slicePartIndex = component.indexOf("[");
                String slicePart = component.substring(slicePartIndex);
                if (!slicePart.endsWith("]")) {
                    throw new InvalidRulesException("Invalid path component: %s. Must end with `]`",
                            sourceLocation);
                }
                try {
                    String number = slicePart.substring(1, slicePart.length() - 1);
                    int slice = Integer.parseInt(number);
                    if (slice < 0) {
                        throw new InvalidRulesException("Invalid path component: slice index must be >= 0",
                                sourceLocation);
                    }
                    if (slicePartIndex > 0) {
                        result.add(Part.Key.of(component.substring(0, slicePartIndex)));
                    }
                    result.add(new Part.Index(slice));
                } catch (NumberFormatException ex) {
                    throw new InvalidRulesException(String.format("%s could not be parsed as a number", slicePart),
                            sourceLocation);
                }
            } else {
                result.add(Part.Key.of(component));
            }
        }
        if (result.isEmpty()) {
            throw new InvalidRulesException("Invalid argument to GetAttr: path may not be empty", sourceLocation);
        }
        return result;
    }
Parses the path argument to getAttr.

@param path           path argument in the form `a.b[5]`
@param sourceLocation Source location for tracking errors
@return List of parsed `Part`s
smithy-rules-engine/src/main/java/software/amazon/smithy/rulesengine/language/syntax/expressions/functions/GetAttr.java