Class BlockRule
- java.lang.Object
-
- com.singularsys.extensions.structure.BlockRule
-
- All Implemented Interfaces:
GrammaticalRuleI
,GrammarMatcher
,java.io.Serializable
public class BlockRule extends java.lang.Object implements GrammaticalRuleI
Parse a statement block{ sequence }
. Equivalent to the productionBlockRule ::= open statement close
- Author:
- Richard Morris
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BlockRule(SymbolToken open, SequenceRule statement, SymbolToken close)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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
-
-
-
Constructor Detail
-
BlockRule
public BlockRule(SymbolToken open, SequenceRule statement, SymbolToken close)
- Parameters:
open
- opening bracketstatement
- rule to parseclose
- closing bracket
-
-
Method Detail
-
match
public Node match(Lookahead2Iterator<Token> it, GrammarParser parser) throws ParseException
Description copied from interface:GrammaticalRuleI
Attempt to parse the input using the rule- Specified by:
match
in interfaceGrammarMatcher
- Specified by:
match
in 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
public void init(Jep jep)
Description copied from interface:GrammarMatcher
Delayed initialisation, this methods is called whenever components of the jep instance are changed.- Specified by:
init
in interfaceGrammarMatcher
- Parameters:
jep
- the current jep instance.
-
-