Search in sources :

Example 1 with LogicalOperatorType

use of org.apache.camel.language.simple.types.LogicalOperatorType in project camel by apache.

the class SimplePredicateParser method logicalOperator.

protected boolean logicalOperator() {
    if (accept(TokenType.logicalOperator)) {
        // remember the logical operator
        LogicalOperatorType operatorType = LogicalOperatorType.asOperator(token.getText());
        nextToken();
        // there should be at least one whitespace after the operator
        expectAndAcceptMore(TokenType.whiteSpace);
        // then we expect either some quoted text, another function, or a numeric, boolean or null value
        if (singleQuotedLiteralWithFunctionsText() || doubleQuotedLiteralWithFunctionsText() || functionText() || numericValue() || booleanValue() || nullValue()) {
            // then after the right hand side value, there should be a whitespace if there is more tokens
            nextToken();
            if (!token.getType().isEol()) {
                expect(TokenType.whiteSpace);
            }
        } else {
            throw new SimpleParserException("Logical operator " + operatorType + " does not support token " + token, token.getIndex());
        }
        return true;
    }
    return false;
}
Also used : SimpleParserException(org.apache.camel.language.simple.types.SimpleParserException) LogicalOperatorType(org.apache.camel.language.simple.types.LogicalOperatorType)

Aggregations

LogicalOperatorType (org.apache.camel.language.simple.types.LogicalOperatorType)1 SimpleParserException (org.apache.camel.language.simple.types.SimpleParserException)1