public class SequenceSeparatorRule extends SequenceRule
<SequenceRule> ::= <statement> (<sep> <statement>)* <sep>?A successful parses will return a SequenceNode with one child per statement. If there is only one child then just that child will be parsed.
Constructor and Description |
---|
SequenceSeparatorRule(GrammaticalRuleI statement,
SymbolToken sep)
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
|
Node |
match(Lookahead2Iterator<Token> it,
SymbolToken end,
GrammarParser parser)
Repeatedly parse statements until end token is encountered or end of input
|
public SequenceSeparatorRule(GrammaticalRuleI statement, SymbolToken sep)
statement
- rule for processing individual statementssep
- separator between statementspublic Node match(Lookahead2Iterator<Token> it, SymbolToken end, GrammarParser parser) throws ParseException
SequenceRule
match
in class SequenceRule
it
- the input list of tokensend
- symbol marking end of sequenceparser
- parser to parse individual statementsParseException
- if input cannot be parsedpublic Node match(Lookahead2Iterator<Token> it, GrammarParser parser) throws ParseException
GrammaticalRuleI
match
in interface GrammaticalRuleI
match
in interface GrammarMatcher
match
in class SequenceRule
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
init
in class SequenceRule
jep
- the current jep instance.Copyright © 2018 Singular Systems http://www.singularsys.com/jep