Class ListOrBracketGrammarMatcher
java.lang.Object
com.singularsys.jep.configurableparser.matchers.ListOrBracketGrammarMatcher
- All Implemented Interfaces:
GrammarMatcher
,Serializable
A GrammarMatcher which matches overloaded lists of items or brackets.
If there is more than one element in the list it will be interpreted as a list,
otherwise it will be interpreted as a normal bracketed expression.
- See Also:
-
Constructor Summary
ConstructorDescriptionListOrBracketGrammarMatcher
(Token open, Token close, Token comma) Create a ListOrBracketGrammarMatcher -
Method Summary
Modifier and TypeMethodDescriptionvoid
Delayed initialisation, this method is called whenever components of the jep instance are changed.match
(Lookahead2Iterator<Token> it, GrammarParser parser) Test whether the input matches this pattern.
-
Constructor Details
-
ListOrBracketGrammarMatcher
Create a ListOrBracketGrammarMatcher- Parameters:
open
- token representing an opening bracketclose
- token representing a closing bracketcomma
- token representing a list item separator
-
-
Method Details
-
init
Description copied from interface:GrammarMatcher
Delayed initialisation, this method is called whenever components of the jep instance are changed.- Specified by:
init
in interfaceGrammarMatcher
- Parameters:
jep
- the current jep instance.
-
match
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.
-