Search in sources :

Example 1 with ExpressionContext

use of org.elasticsearch.painless.antlr.PainlessParser.ExpressionContext in project elasticsearch by elastic.

the class Walker method visitNewstandardarray.

@Override
public ANode visitNewstandardarray(NewstandardarrayContext ctx) {
    String type = ctx.TYPE().getText();
    List<AExpression> expressions = new ArrayList<>();
    for (ExpressionContext expression : ctx.expression()) {
        expressions.add((AExpression) visit(expression));
    }
    return buildPostfixChain(new ENewArray(location(ctx), type, expressions, false), ctx.postdot(), ctx.postfix());
}
Also used : ENewArray(org.elasticsearch.painless.node.ENewArray) ExpressionContext(org.elasticsearch.painless.antlr.PainlessParser.ExpressionContext) AExpression(org.elasticsearch.painless.node.AExpression) ArrayList(java.util.ArrayList) EString(org.elasticsearch.painless.node.EString)

Example 2 with ExpressionContext

use of org.elasticsearch.painless.antlr.PainlessParser.ExpressionContext in project elasticsearch by elastic.

the class Walker method visitNewinitializedarray.

@Override
public ANode visitNewinitializedarray(NewinitializedarrayContext ctx) {
    String type = ctx.TYPE().getText();
    List<AExpression> expressions = new ArrayList<>();
    for (ExpressionContext expression : ctx.expression()) {
        expressions.add((AExpression) visit(expression));
    }
    return buildPostfixChain(new ENewArray(location(ctx), type, expressions, true), null, ctx.postfix());
}
Also used : ENewArray(org.elasticsearch.painless.node.ENewArray) ExpressionContext(org.elasticsearch.painless.antlr.PainlessParser.ExpressionContext) AExpression(org.elasticsearch.painless.node.AExpression) ArrayList(java.util.ArrayList) EString(org.elasticsearch.painless.node.EString)

Aggregations

ArrayList (java.util.ArrayList)2 ExpressionContext (org.elasticsearch.painless.antlr.PainlessParser.ExpressionContext)2 AExpression (org.elasticsearch.painless.node.AExpression)2 ENewArray (org.elasticsearch.painless.node.ENewArray)2 EString (org.elasticsearch.painless.node.EString)2