Class ConfigurableParserWithRange
java.lang.Object
com.singularsys.jep.configurableparser.ConfigurableParser
com.singularsys.jep.configurableparser.ConfigurableParserWithRange
- All Implemented Interfaces:
JepComponent,Parser,Serializable
A modified version of the
StandardConfigurableParser
which includes a grammar matcher for matching lists [1,2,3] and ranges [1..10].
It also uses a custom pattern for matching numbers which
with prevents confusions with the defaults range operator symbol ...
The symbol used for the range operator is specified in the constructor,
other standard symbols ( ) [ ] , are read from the resource bundle.
The full confurations is like
String lbracket = "(";
String rbracket = "(";
String lsqbracket = "[";
String rsqbracket = "]";
String seperator = ",";
this.addHashComments();
this.addSlashComments();
this.addSingleQuoteStrings();
this.addDoubleQuoteStrings();
this.addWhiteSpace();
this.addTokenMatcher(
new NumberTokenMatcher("((\\d+\\.\\d+)|(\\d+\\.(?!\\.))|(\\.\\d+)|(\\d+))(?:[eE][+-]?\\d+)?"));
this.addSymbols(lbracket, rbracket, lsqbracket, rsqbracket, seperator, rangeSymbols);
this.setImplicitMultiplicationSymbols(lbracket, lsqbracket);
this.addOperatorTokenMatcher();
this.addIdentifiers();
this.addSemiColonTerminator();
this.addWhiteSpaceCommentFilter();
this.addBracketMatcher(lbracket, rbracket);
this.addFunctionMatcher(lbracket, rbracket, seperator);
this.addGrammarMatcher(
new ListOrRangeGrammarMatcher(
this.getSymbolToken(lsqbracket),
this.getSymbolToken(rsqbracket),
this.getSymbolToken(seperator),
this.getSymbolToken(rangeSymbols)
));
this.addArrayAccessMatcher(lsqbracket, rsqbracket);
@since Jep 4.1
@see com.singularsys.jep.configurableparser.matchers.ListOrRangeGrammarMatcher
@see com.singularsys.jep.configurableparser.RangeOperator
@see com.singularsys.jep.misc.functions.Range
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConfigurableParserWithRange(String rangeSymbols) Create a ConfigurableParserWithRange with the specified symbol for the range operator. -
Method Summary
Methods inherited from class com.singularsys.jep.configurableparser.ConfigurableParser
addArrayAccessMatcher, addBracketMatcher, addDoubleQuoteStrings, addExponentNumbers, addFunctionMatcher, addGrammarMatcher, addHashComments, addIdentifiers, addListMatcher, addListOrBracketMatcher, addOperatorTokenMatcher, addSemiColonTerminator, addSimpleNumbers, addSingleQuoteStrings, addSlashComments, addSymbols, addTokenFilter, addTokenMatcher, addWhiteSpace, addWhiteSpaceCommentFilter, continueParse, filter, getGrammarMatchers, getGrammarParserFactory, getJep, getLightWeightInstance, getOperatorTokenMatcher, getSymbolToken, getSymbolTokenMatcher, getToken, getTokenFilters, getTokenizerFactory, getTokenMatchers, init, parse, parse, replaceGrammarMatcher, replaceTokenMatcher, restart, scan, scan, setGrammarParserFactory, setImplicitMultiplicationSymbols, setTokenizerFactory
-
Constructor Details
-
ConfigurableParserWithRange
Create a ConfigurableParserWithRange with the specified symbol for the range operator.- Parameters:
rangeSymbols- symbol used for the range operator
-