Class DictionaryGrammarMatcher
java.lang.Object
com.singularsys.jep.misc.dictionary.DictionaryGrammarMatcher
- All Implemented Interfaces:
GrammarMatcher,Serializable
A GrammarMatcher for JSON like map syntax.
On parsing this produces an
map = {'x':2, 'y':3}
ASTOpNode with the MapPfmc,
each child is another ASTOpNode with the MapPfmc.MapEntryPfmc
and two children, the key and value.- Since:
- Jep 4.1
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDictionaryGrammarMatcher(DictionaryGrammarMatcher.Type type, Token open, Token close, Token colon, Token comma, Operator dict, Operator entry) Create a DictionaryGrammarMatcher -
Method Summary
Modifier and TypeMethodDescriptionvoidDelayed initialisation, this method is called whenever components of the jep instance are changed.match(Lookahead2Iterator<Token> it, GrammarParser parser) Attempt to match a function, calls the GrammarParser.parseSubExpression() to match function arguments.
-
Field Details
-
type
-
-
Constructor Details
-
DictionaryGrammarMatcher
public DictionaryGrammarMatcher(DictionaryGrammarMatcher.Type type, Token open, Token close, Token colon, Token comma, Operator dict, Operator entry) Create a DictionaryGrammarMatcher- Parameters:
open- token representing an opening bracketclose- token representing a closing bracketcolon- token representing the key value separatorcomma- token representing a list item separatordict- the operator used for creating mapsentry- the operator used for creating map entries
-
-
Method Details
-
init
Description copied from interface:GrammarMatcherDelayed initialisation, this method is called whenever components of the jep instance are changed.- Specified by:
initin interfaceGrammarMatcher- Parameters:
jep- the current jep instance.
-
match
Attempt to match a function, calls the GrammarParser.parseSubExpression() to match function arguments.- Specified by:
matchin 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.
-