Search in sources :

Example 1 with SimpleFunctionExpression

use of org.apache.camel.language.simple.ast.SimpleFunctionExpression in project camel by apache.

the class SimpleBackwardsCompatibleParser method doParseExpression.

private static Expression doParseExpression(String expression, boolean allowEscape) {
    // should have no function tokens
    for (int i = 0; i < expression.length(); i++) {
        SimpleToken token = SimpleTokenizer.nextToken(expression, i, allowEscape, TokenType.functionStart, TokenType.functionEnd);
        if (token.getType().getType() == TokenType.functionStart || token.getType().getType() == TokenType.functionEnd) {
            return null;
        }
    }
    // okay there is no function tokens, then try to parse it as a simple function expression
    SimpleToken token = new SimpleToken(new SimpleTokenType(TokenType.functionStart, expression), 0);
    SimpleFunctionExpression function = new SimpleFunctionExpression(token);
    function.addText(expression);
    return function.createExpression(expression, false);
}
Also used : SimpleTokenType(org.apache.camel.language.simple.types.SimpleTokenType) SimpleFunctionExpression(org.apache.camel.language.simple.ast.SimpleFunctionExpression) SimpleToken(org.apache.camel.language.simple.types.SimpleToken)

Aggregations

SimpleFunctionExpression (org.apache.camel.language.simple.ast.SimpleFunctionExpression)1 SimpleToken (org.apache.camel.language.simple.types.SimpleToken)1 SimpleTokenType (org.apache.camel.language.simple.types.SimpleTokenType)1