Class SimpleExpressionParser

java.lang.Object
com.github.basking2.sdsai.itrex.SimpleExpressionParser

public class SimpleExpressionParser extends Object
A parser that is JSON-esque, but removes some commas and quotes to better suite the particulars of this language. The JSON [ "map", ["curry", "f"], ["list", 1, 2, 3]] may be parsed to the same expression [map [curry f] [list 1 2 3]] String may still be used, but we allow for unquoted tokens.
  • Field Details

    • SKIP_WS

      public static final Pattern SKIP_WS
    • COMMA

      public static final Pattern COMMA
    • OPEN_BRACKET

      public static final Pattern OPEN_BRACKET
    • CLOSE_BRACKET

      public static final Pattern CLOSE_BRACKET
    • BLOCK_COMMENT

      public static final Pattern BLOCK_COMMENT
    • FIRST_QUOTE

      public static final Pattern FIRST_QUOTE
    • QUOTED_STRING

      public static final Pattern QUOTED_STRING
    • BOOLEAN

      public static final Pattern BOOLEAN
    • INTEGER

      public static final Pattern INTEGER
    • LONG

      public static final Pattern LONG
    • FLOAT

      public static final Pattern FLOAT
    • DOUBLE

      public static final Pattern DOUBLE
    • WORD

      public static final Pattern WORD
  • Constructor Details

    • SimpleExpressionParser

      public SimpleExpressionParser(String expression)
      Construct the parser, but do not parse.
      Parameters:
      expression - An expression to parse.
      See Also:
  • Method Details

    • parse

      public final Object parse()
    • parseExpression

      public static Object parseExpression(String expression)
    • getPosition

      public int getPosition()
      Return the position in the expression string where parsing left off.
      Returns:
      the position in the expression string where parsing left off.