handlebars/src/main/java/com/github/jknack/handlebars/PathCompiler.java
private static List<PathExpression> parse(final String path, final boolean local) {
    List<PathExpression> resolvers = new PathExpressionList(path);

    if (THIS.equals(path) || DOT_PATH.equals(path) || DOT.equals(path)) {
      resolvers.add(new ResolveThisPath(path));
      return resolvers;
    }
    if (PARENT.equals(path)) {
      resolvers.add(new ResolveParentPath());
      return resolvers;
    }
    if (path.startsWith(PARENT_PATH)) {
      resolvers.add(new ParentPath());
      resolvers.addAll(parse(path.substring(PARENT_PATH.length()), local));
      return resolvers;
    }
    if (path.startsWith(DOT_PATH)) {
      resolvers.add(new ThisPath(DOT_PATH));
      resolvers.addAll(parse(path.substring(DOT_PATH.length()), local));
      return resolvers;
    }
    Matcher matcher = pattern.matcher(path);
    boolean data = false;
    while (matcher.find()) {
      String key = matcher.group(1);
      if (THIS.equals(key)) {
        resolvers.add(new ThisPath(key));
      } else if (PARENT_PATH.equals(key)) {
        resolvers.add(new ParentPath());
      } else if (key.charAt(0) == AT) {
        if (key.length() == 1) {
          data = true;
        } else {
          resolvers.add(new DataPath(key));
        }
      } else {
        if (key.charAt(0) == LP && key.charAt(key.length() - 1) == RP) {
          key = key.substring(1, key.length() - 1);
        }
        try {
          resolvers.add(new IndexedPath(Integer.parseInt(key), key, local));
        } catch (NumberFormatException ex) {
          if (data) {
            resolvers.add(new DataPath(AT + key));
          } else {
            resolvers.add(new PropertyPath(key, local));
          }
        }
      }
    }
    return resolvers;
  }
/**
   * Split the property name by separator (except within a [] escaped blocked)
   * and create an array of it.
   *
   * @param path The property's path.
   * @param local True, if we want to restrict lookup to current scope.
   * @return A path representation of the property (array based).
   */
Split the property name by separator (except within a [] escaped blocked)
and create an array of it.

@param path The property's path.
@param local True, if we want to restrict lookup to current scope.
@return A path representation of the property (array based).
Split the property name by separator ( except within a [] escaped blocked ) and create an array of it . @param path The property ' s path . @param local True if we want to restrict lookup to current scope . @return A path representation of the property ( array based ) .
private static List<PathExpression> parse(final String path, final boolean local) {
    List<PathExpression> resolvers = new PathExpressionList(path);
    if (THIS.equals(path) || DOT_PATH.equals(path) || DOT.equals(path)) {
      resolvers.add(new ResolveThisPath(path));
      return resolvers;
    }
    if (PARENT.equals(path)) {
      resolvers.add(new ResolveParentPath());
      return resolvers;
    }
    if (path.startsWith(PARENT_PATH)) {
      resolvers.add(new ParentPath());
      resolvers.addAll(parse(path.substring(PARENT_PATH.length()), local));
      return resolvers;
    }
    if (path.startsWith(DOT_PATH)) {
      resolvers.add(new ThisPath(DOT_PATH));
      resolvers.addAll(parse(path.substring(DOT_PATH.length()), local));
      return resolvers;
    }
    Matcher matcher = pattern.matcher(path);
    boolean data = false;
    while (matcher.find()) {
      String key = matcher.group(1);
      if (THIS.equals(key)) {
        resolvers.add(new ThisPath(key));
      } else if (PARENT_PATH.equals(key)) {
        resolvers.add(new ParentPath());
      } else if (key.charAt(0) == AT) {
        if (key.length() == 1) {
          data = true;
        } else {
          resolvers.add(new DataPath(key));
        }
      } else {
        if (key.charAt(0) == LP && key.charAt(key.length() - 1) == RP) {
          key = key.substring(1, key.length() - 1);
        }
        try {
          resolvers.add(new IndexedPath(Integer.parseInt(key), key, local));
        } catch (NumberFormatException ex) {
          if (data) {
            resolvers.add(new DataPath(AT + key));
          } else {
            resolvers.add(new PropertyPath(key, local));
          }
        }
      }
    }
    return resolvers;
  }
private static List < PathExpression > parse ( final String path , final boolean local ) { List < PathExpression > resolvers = new PathExpressionList ( path ) ; if ( THIS . equals ( path ) || DOT_PATH . equals ( path ) || DOT . equals ( path ) ) { resolvers . add ( new ResolveThisPath ( path ) ) ; return resolvers ; } if ( PARENT . equals ( path ) ) { resolvers . add ( new ResolveParentPath ( ) ) ; return resolvers ; } if ( path . startsWith ( PARENT_PATH ) ) { resolvers . add ( new ParentPath ( ) ) ; resolvers . addAll ( parse ( path . substring ( PARENT_PATH . length ( ) ) , local ) ) ; return resolvers ; } if ( path . startsWith ( DOT_PATH ) ) { resolvers . add ( new ThisPath ( DOT_PATH ) ) ; resolvers . addAll ( parse ( path . substring ( DOT_PATH . length ( ) ) , local ) ) ; return resolvers ; } Matcher matcher = pattern . matcher ( path ) ; boolean data = false ; while ( matcher . find ( ) ) { String key = matcher . group ( 1 ) ; if ( THIS . equals ( key ) ) { resolvers . add ( new ThisPath ( key ) ) ; } else if ( PARENT_PATH . equals ( key ) ) { resolvers . add ( new ParentPath ( ) ) ; } else if ( key . charAt ( 0 ) == AT ) { if ( key . length ( ) == 1 ) { data = true ; } else { resolvers . add ( new DataPath ( key ) ) ; } } else { if ( key . charAt ( 0 ) == LP && key . charAt ( key . length ( ) - 1 ) == RP ) { key = key . substring ( 1 , key . length ( ) - 1 ) ; } try { resolvers . add ( new IndexedPath ( Integer . parseInt ( key ) , key , local ) ) ; } catch ( NumberFormatException ex ) { if ( data ) { resolvers . add ( new DataPath ( AT + key ) ) ; } else { resolvers . add ( new PropertyPath ( key , local ) ) ; } } } } return resolvers ; }
Split the property name by separator (except within a [] escaped blocked)
 and create an array of it.
Split the property name by separator ( except within a [] escaped blocked ) and create an array of it .