public class JavaIfRule extends java.lang.Object implements GrammaticalRuleI
if(expr) statement [ else statement ]
<JavaInRule> ::= || <if> <open> <expression> <close> <statement> || <if> <open> <expression> <close> <statement> <else> <statement>
Constructor and Description |
---|
JavaIfRule(SymbolToken ifToken,
SymbolToken open,
GrammaticalRuleI expression,
SymbolToken close,
GrammaticalRuleI statement,
SymbolToken elseToken) |
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 JavaIfRule(SymbolToken ifToken, SymbolToken open, GrammaticalRuleI expression, SymbolToken close, GrammaticalRuleI statement, SymbolToken elseToken)
ifToken
- token representing "if"open
- opening bracketexpression
- rule for parsing expressionsclose
- closing bracketstatement
- rule for parsing statementselseToken
- token representing "else"public void init(Jep jep)
GrammarMatcher
init
in interface GrammarMatcher
jep
- the current jep instance.public 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 errorCopyright © 2018 Singular Systems http://www.singularsys.com/jep