public class JavaForRule extends java.lang.Object implements GrammaticalRuleI
for(i=0;i<10;++i) x+=i;
.
<JavaForRule> ::= <for> <open> <expression> <sep> <expression> <sep> <expression> <close> <statement>Any of the expressions can be empty Successful parse will return a
LoopNode
.Constructor and Description |
---|
JavaForRule(SymbolToken forToken,
SymbolToken open,
GrammaticalRuleI expression,
SymbolToken sep,
SymbolToken close,
GrammaticalRuleI statement)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
init(Jep jep)
Delayed initialisation, this methods is called whenever components of the jep instance are changed.
|
Node |
match(Lookahead2Iterator<Token> it,
GrammarParser parser)
Attempt to parse the input using the rule
|
public JavaForRule(SymbolToken forToken, SymbolToken open, GrammaticalRuleI expression, SymbolToken sep, SymbolToken close, GrammaticalRuleI statement)
forToken
- token representing "for"open
- opening bracketexpression
- rule for parsing an expressionsep
- separator between part of statementclose
- closing bracketstatement
- rule for parsing a statementpublic Node match(Lookahead2Iterator<Token> it, GrammarParser parser) throws ParseException
GrammaticalRuleI
match
in interface GrammaticalRuleI
match
in interface GrammarMatcher
it
- iterator with tokens to parseparser
- the parser to parse any components of the ruleParseException
- if there is a syntactical errorpublic void init(Jep jep)
GrammarMatcher
init
in interface GrammarMatcher
jep
- the current jep instance.Copyright © 2018 Singular Systems http://www.singularsys.com/jep