Class ListOrRangeGrammarMatcher
- java.lang.Object
-
- com.singularsys.extensions.lambda.ListOrRangeGrammarMatcher
-
- All Implemented Interfaces:
GrammarMatcher
,java.io.Serializable
public class ListOrRangeGrammarMatcher extends java.lang.Object implements GrammarMatcher
A GrammarMatcher which matches lists of items with the syntax[a..b]
, or a simple list[1,2,3,4]
.- See Also:
- Serialized Form
-
-
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)
Test whether the input matches this pattern.
-
-
-
Constructor Detail
-
ListOrRangeGrammarMatcher
public ListOrRangeGrammarMatcher(Token open, Token close, Token comma, Token rng, Operator rangeOp)
Create a ListGrammarMatcher- Parameters:
open
- token representing an opening bracketclose
- token representing a closing bracketcomma
- token representing a list item separatorrng
- token representing the range operatorrangeOp
- operator representing the range
-
-
Method Detail
-
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.
-
match
public Node match(Lookahead2Iterator<Token> it, GrammarParser parser) throws ParseException
Description copied from interface:GrammarMatcher
Test whether the input matches this pattern.- Specified by:
match
in interfaceGrammarMatcher
- Parameters:
it
- An iterator inspecting the inputparser
- the parser to use when evaluating sub expressions- Returns:
- if matched returns a node representing the content, return null is does not match
- Throws:
ParseException
- if there is a syntactical error in the input.
-
-