Package com.tonic.analysis.query.parser
Class ConditionParser
- java.lang.Object
-
- com.tonic.analysis.query.parser.ConditionParser
-
public final class ConditionParser extends Object
Recursive-descent parser for the composableWHEREexpression language.
-
-
Constructor Summary
Constructors Constructor Description ConditionParser(List<Token> tokens, int start)Creates a parser positioned at one token of a shared list.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Conditionparse(String expression)Parses a complete standalone expression string, requiring the whole input be consumed.ConditionparseExpression()Parses one condition from the current position, stopping at the first token the grammar cannot continue with.intposition()
-
-
-
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
-
-