Class Parser


  • public final class Parser
    extends Object
    This parser object parses the expressions, break these in expression tokens and perform lexical analysis on these tokens. All kind of expressions can be parsed like arithmetic, function call, and property accessor etc. By default, it ignores the extra blanks.

    Some examples of expression

    1). 123 + 124 - 67 * 45 div 90 + (12 + 34 div 67) .
    2). principal * pow(( 1 - rate div 100 ), time) .
    3). 120 * pow(sin(20) div tan(30), 2) .
    4). values[0] + values[1] + values[2] + 120 * 45 div num[1][1] .
    5). person.address.city.name + students[0].rollNo .
    6). /person/address/city/name + /person/children[name='Ram'] + /person/children[1] .
    7). abc=xyz || 1!=2 && 3 >= xyz && xvz <= 30 .

    • Constructor Detail

      • Parser

        public Parser()
        Deprecated.
        seems of no use, since Parser is always created from Compiler with Grammar instance
        Constructs the Parser with default DefaultXMLGrammar instance
      • Parser

        public Parser​(Grammar grammar)
        Constructs the Parser with given DefaultXMLGrammar object
        Parameters:
        grammar - the grammar using which it parse the expression.
        Throws:
        IllegalArgumentException - if the grammar is null.