Class PossiblyTerminatedExpressionRule

java.lang.Object
com.singularsys.extensions.structure.PossiblyTerminatedExpressionRule
All Implemented Interfaces:
GrammaticalRuleI, GrammarMatcher, Serializable

public class PossiblyTerminatedExpressionRule extends Object implements GrammaticalRuleI
Parse an expression followed by an optional separator.
 <PossiblyTerminatedExpressionRule> ::=
  || <Expression>
        || <Expression> <sep>
 
See Also:
  • Constructor Details

    • PossiblyTerminatedExpressionRule

      public PossiblyTerminatedExpressionRule(ExpressionRule expressionRule, SymbolToken sep)
      Constructor.
      Parameters:
      expressionRule - The rule for an expression
      sep - token at end of a statement
  • Method Details

    • match

      public Node match(Lookahead2Iterator<Token> it, GrammarParser parser) throws ParseException
      Description copied from interface: GrammaticalRuleI
      Attempt to parse the input using the rule
      Specified by:
      match in interface GrammarMatcher
      Specified by:
      match in interface GrammaticalRuleI
      Parameters:
      it - iterator with tokens to parse
      parser - the parser to parse any components of the rule
      Returns:
      successful parses should return a Node, null if unsuccessful
      Throws:
      ParseException - if there is a syntactical error
    • 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.