Class JavaWhileRule
java.lang.Object
com.singularsys.extensions.structure.JavaWhileRule
- All Implemented Interfaces:
GrammaticalRuleI,GrammarMatcher,Serializable
Parse a Java-style while loop
while(x<10) x=x+1;
<JavaWhileRule> ::=
<while> <open> <expression> <close> <statement>
A successful parse will return a LoopNode.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJavaWhileRule(SymbolToken whileToken, SymbolToken open, GrammaticalRuleI expression, SymbolToken close, GrammaticalRuleI statement) -
Method Summary
Modifier and TypeMethodDescriptionvoidDelayed 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
-
JavaWhileRule
public JavaWhileRule(SymbolToken whileToken, SymbolToken open, GrammaticalRuleI expression, SymbolToken close, GrammaticalRuleI statement) - Parameters:
whileToken- token for the while symbolopen- opening bracketexpression- rule to parse an expressionclose- closing bracketstatement- rule to parse a statement
-
-
Method Details
-
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.
-