Class ConditionParser


  • public final class ConditionParser
    extends Object
    Recursive-descent parser for the composable WHERE expression language.
    • Constructor Detail

      • ConditionParser

        public ConditionParser​(List<Token> tokens,
                               int start)
        Creates a parser positioned at one token of a shared list.
        Parameters:
        tokens - the token list to read
        start - the index to begin parsing at
    • Method Detail

      • parse

        public static Condition parse​(String expression)
                               throws ParseException
        Parses a complete standalone expression string, requiring the whole input be consumed.
        Parameters:
        expression - the expression source
        Returns:
        the parsed condition
        Throws:
        ParseException - if the input is malformed or has trailing tokens
      • position

        public int position()
        Returns:
        the index of the next unconsumed token
      • parseExpression

        public Condition parseExpression()
                                  throws ParseException
        Parses one condition from the current position, stopping at the first token the grammar cannot continue with.
        Returns:
        the parsed condition
        Throws:
        ParseException - if the tokens do not form a valid condition