Search in sources :

Example 1 with IncrementExpr

use of kalang.ast.IncrementExpr in project kalang by kasonyang.

the class AstBuilder method getIncrementExpr.

public IncrementExpr getIncrementExpr(ExpressionContext expressionContext, String op, boolean isPrefix) {
    ExprNode expr = visitExpression(expressionContext);
    if (!(expr instanceof AssignableExpr)) {
        AstBuilder.this.handleSyntaxError("require assignable expression", expressionContext);
        return null;
    }
    boolean isDesc = op.equals("--");
    return new IncrementExpr((AssignableExpr) expr, isDesc, isPrefix);
}
Also used : ExprNode(kalang.ast.ExprNode) IncrementExpr(kalang.ast.IncrementExpr) AssignableExpr(kalang.ast.AssignableExpr)

Aggregations

AssignableExpr (kalang.ast.AssignableExpr)1 ExprNode (kalang.ast.ExprNode)1 IncrementExpr (kalang.ast.IncrementExpr)1