Search in sources :

Example 1 with MaptokenContext

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

the class Walker method visitMapinitializer.

@Override
public ANode visitMapinitializer(MapinitializerContext ctx) {
    List<AExpression> keys = new ArrayList<>();
    List<AExpression> values = new ArrayList<>();
    for (MaptokenContext maptoken : ctx.maptoken()) {
        keys.add((AExpression) visit(maptoken.expression(0)));
        values.add((AExpression) visit(maptoken.expression(1)));
    }
    return new EMapInit(location(ctx), keys, values);
}
Also used : EMapInit(org.elasticsearch.painless.node.EMapInit) MaptokenContext(org.elasticsearch.painless.antlr.PainlessParser.MaptokenContext) AExpression(org.elasticsearch.painless.node.AExpression) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 MaptokenContext (org.elasticsearch.painless.antlr.PainlessParser.MaptokenContext)1 AExpression (org.elasticsearch.painless.node.AExpression)1 EMapInit (org.elasticsearch.painless.node.EMapInit)1