use of org.kie.dmn.feel.lang.ast.ContextTypeNode in project drools by kiegroup.
the class ASTBuilderVisitor method visitContextType.
@Override
public BaseNode visitContextType(FEEL_1_1Parser.ContextTypeContext ctx) {
List<String> pNames = new ArrayList<>();
for (TerminalNode id : ctx.Identifier()) {
pNames.add(id.getText());
}
if (!pNames.get(0).equals("context")) {
throw new IllegalStateException("grammar rule changed.");
} else {
pNames.remove(0);
}
List<TypeNode> pTypes = new ArrayList<>();
for (TypeContext t : ctx.type()) {
pTypes.add((TypeNode) visit(t));
}
Map<String, TypeNode> gens = new HashMap<>();
for (int i = 0; i < pNames.size(); i++) {
gens.put(pNames.get(i), pTypes.get(i));
}
return new ContextTypeNode(ctx, gens);
}
Aggregations