Search in sources :

Example 1 with OperatorPower

use of org.springframework.expression.spel.ast.OperatorPower in project spring-framework by spring-projects.

the class InternalSpelExpressionParser method eatPowerIncDecExpression.

// powerExpr  : unaryExpression (POWER^ unaryExpression)? (INC || DEC) ;
private SpelNodeImpl eatPowerIncDecExpression() {
    SpelNodeImpl expr = eatUnaryExpression();
    if (peekToken(TokenKind.POWER)) {
        //consume POWER
        Token t = nextToken();
        SpelNodeImpl rhExpr = eatUnaryExpression();
        checkRightOperand(t, rhExpr);
        return new OperatorPower(toPos(t), expr, rhExpr);
    }
    if (expr != null && peekToken(TokenKind.INC, TokenKind.DEC)) {
        //consume INC/DEC
        Token t = nextToken();
        if (t.getKind() == TokenKind.INC) {
            return new OpInc(toPos(t), true, expr);
        }
        return new OpDec(toPos(t), true, expr);
    }
    return expr;
}
Also used : OpInc(org.springframework.expression.spel.ast.OpInc) SpelNodeImpl(org.springframework.expression.spel.ast.SpelNodeImpl) OperatorPower(org.springframework.expression.spel.ast.OperatorPower) OpDec(org.springframework.expression.spel.ast.OpDec)

Aggregations

OpDec (org.springframework.expression.spel.ast.OpDec)1 OpInc (org.springframework.expression.spel.ast.OpInc)1 OperatorPower (org.springframework.expression.spel.ast.OperatorPower)1 SpelNodeImpl (org.springframework.expression.spel.ast.SpelNodeImpl)1