use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class ASTBuilderVisitor method visitUenpmPrimary.
@Override
public BaseNode visitUenpmPrimary(FEEL_1_1Parser.UenpmPrimaryContext ctx) {
BaseNode expr = visit(ctx.primary());
if (ctx.qualifiedName() != null) {
BaseNode path = visit(ctx.qualifiedName());
expr = ASTBuilderFactory.newPathExpressionNode(ctx, expr, path);
}
if (ctx.parameters() != null) {
ListNode params = (ListNode) visit(ctx.parameters());
return buildFunctionCall(ctx, expr, params);
}
return expr;
}
use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class ASTBuilderVisitor method visitFunctionDefinition.
@Override
public BaseNode visitFunctionDefinition(FEEL_1_1Parser.FunctionDefinitionContext ctx) {
ListNode parameters = null;
if (ctx.formalParameters() != null) {
parameters = (ListNode) visit(ctx.formalParameters());
}
boolean external = ctx.external != null;
BaseNode body = visit(ctx.body);
return ASTBuilderFactory.newFunctionDefinition(ctx, parameters, external, body);
}
use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class ASTBuilderVisitor method visitUnaryTests_negated.
@Override
public BaseNode visitUnaryTests_negated(FEEL_1_1Parser.UnaryTests_negatedContext ctx) {
// negating a unary tests: BOOLEAN-type anyway
BaseNode name = ASTBuilderFactory.newNameRefNode(ctx, "not", BuiltInType.BOOLEAN);
ListNode value = (ListNode) visit(ctx.positiveUnaryTests());
return ASTBuilderFactory.newUnaryTestListNode(ctx, value.getElements(), UnaryTestListNode.State.Negated);
}
use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class ASTBuilderVisitor method visitAddExpression.
@Override
public BaseNode visitAddExpression(FEEL_1_1Parser.AddExpressionContext ctx) {
BaseNode left = visit(ctx.additiveExpression());
BaseNode right = visit(ctx.multiplicativeExpression());
String op = ctx.op.getText();
return ASTBuilderFactory.newInfixOpNode(ctx, left, op, right);
}
use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class ASTBuilderVisitor method visitQuantExprEvery.
@Override
public BaseNode visitQuantExprEvery(FEEL_1_1Parser.QuantExprEveryContext ctx) {
ListNode list = (ListNode) visit(ctx.iterationContexts());
BaseNode expr = visit(ctx.expression());
return ASTBuilderFactory.newQuantifiedExpression(ctx, QuantifiedExpressionNode.Quantifier.EVERY, list, expr);
}
Aggregations