Class ConfigurableParserWithRange

java.lang.Object
com.singularsys.jep.configurableparser.ConfigurableParser
com.singularsys.jep.configurableparser.ConfigurableParserWithRange
All Implemented Interfaces:
JepComponent, Parser, Serializable

public class ConfigurableParserWithRange extends ConfigurableParser
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:
  • Constructor Details

    • ConfigurableParserWithRange

      public ConfigurableParserWithRange(String rangeSymbols)
      Create a ConfigurableParserWithRange with the specified symbol for the range operator.
      Parameters:
      rangeSymbols - symbol used for the range operator