Class StatementRule

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

public class StatementRule extends Object implements GrammaticalRuleI
Parse a single statement from a list of possibilities.
 <StatementRule> ::=
        | <expression1>
        | <JavaWhileRule2>
  | ....
 
Returns the result of the first successful statement parsed.
Author:
Richard Morris
See Also:
  • Constructor Details

    • StatementRule

      public StatementRule()
  • Method Details

    • addRule

      public boolean addRule(GrammaticalRuleI rule)
      Adds a new rule.
      Parameters:
      rule - the rule to be added.
      Returns:
      true
    • getRules

      public List<GrammaticalRuleI> getRules()
      The list of rules
      Returns:
      the list of rules.
    • 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.