Class JccArrayAccessGrammarMatcher

java.lang.Object
com.singularsys.jep.configurableparser.matchers.JccArrayAccessGrammarMatcher
All Implemented Interfaces:
GrammarMatcher, Serializable

public class JccArrayAccessGrammarMatcher extends Object implements GrammarMatcher
Matches syntax for array element access v[3], the node tree produced by this matcher matches those produced by the standard Jep JccParser. which has structure
   ASTOpNode(Ele)
     ASTVarNode(v)
     ASTOpNode(List)
        ASTConstant(3)
rather than the structure produced by ArrayAccessGrammarMatcher:
   ASTOpNode(Ele)
     ASTVarNode(v)
     ASTConstant(3)
See Also:
  • Constructor Details

    • JccArrayAccessGrammarMatcher

      public JccArrayAccessGrammarMatcher(SymbolToken open, SymbolToken close)
      Construct a matcher for array access.
      Parameters:
      open - token representing the opening delimiter
      close - token representing the closing delimiter
  • Method Details

    • init

      public void init(Jep jep)
      Description copied from interface: GrammarMatcher
      Delayed initialisation, this method is called whenever components of the jep instance are changed.
      Specified by:
      init in interface GrammarMatcher
      Parameters:
      jep - the current jep instance.
    • match

      public Node match(Lookahead2Iterator<Token> it, GrammarParser parser) throws ParseException
      Description copied from interface: GrammarMatcher
      Test whether the input matches this pattern.
      Specified by:
      match in interface GrammarMatcher
      Parameters:
      it - An iterator inspecting the input
      parser - the parser to use when evaluating sub expressions
      Returns:
      if matched returns a node representing the content, return null is does not match
      Throws:
      ParseException - if there is a syntactical error in the input.