class PathElement {

  static PathElement create(Element element, Map<String, Type> anchorTypes) {
    String label = element.matcher.getLabel();
    Anchor.Type anchorType =
        anchorTypes.containsKey(label)
            ? anchorTypes.get(label)
            : isStringLiteralLabel(label)
                ? STRING_LITERAL
                : isCharLiteralLabel(label) ? CHAR_LITERAL : null;

    return new PathElement(anchorType, label, element.level, element.startIndex);
  }

    PathElement(@Nullable Anchor.Type anchorType, String label, int level, int startIndex);

}