Class StatementRule
java.lang.Object
com.singularsys.extensions.structure.StatementRule
- All Implemented Interfaces:
GrammaticalRuleI,GrammarMatcher,Serializable
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddRule(GrammaticalRuleI rule) Adds a new rule.getRules()The list of rulesvoidDelayed initialisation, this method is called whenever components of the jep instance are changed.match(Lookahead2Iterator<Token> it, GrammarParser parser) Attempt to parse the input using the rule
-
Constructor Details
-
StatementRule
public StatementRule()
-
-
Method Details
-
addRule
Adds a new rule.- Parameters:
rule- the rule to be added.- Returns:
- true
-
getRules
The list of rules- Returns:
- the list of rules.
-
match
Description copied from interface:GrammaticalRuleIAttempt to parse the input using the rule- Specified by:
matchin interfaceGrammarMatcher- Specified by:
matchin interfaceGrammaticalRuleI- Parameters:
it- iterator with tokens to parseparser- 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
Description copied from interface:GrammarMatcherDelayed initialisation, this method is called whenever components of the jep instance are changed.- Specified by:
initin interfaceGrammarMatcher- Parameters:
jep- the current jep instance.
-