use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class ASTBuilderVisitor method visitPowExpression.
@Override
public BaseNode visitPowExpression(FEEL_1_1Parser.PowExpressionContext ctx) {
BaseNode left = visit(ctx.powerExpression());
BaseNode right = visit(ctx.filterPathExpression());
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 visitNamedParameter.
@Override
public BaseNode visitNamedParameter(FEEL_1_1Parser.NamedParameterContext ctx) {
NameDefNode name = (NameDefNode) visit(ctx.name);
BaseNode value = visit(ctx.value);
return ASTBuilderFactory.newNamedParameterNode(ctx, name, value);
}
use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class ASTBuilderVisitor method visitCondOr.
@Override
public BaseNode visitCondOr(FEEL_1_1Parser.CondOrContext ctx) {
BaseNode left = visit(ctx.left);
BaseNode right = visit(ctx.right);
return ASTBuilderFactory.newInfixOpNode(ctx, left, ctx.op.getText(), right);
}
use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class FEELParserTest method testFunctionInvocationEmptyParams.
@Test
public void testFunctionInvocationEmptyParams() {
String inputExpression = "my.test.Function()";
BaseNode functionBase = parse(inputExpression);
assertThat(functionBase, is(instanceOf(FunctionInvocationNode.class)));
assertThat(functionBase.getText(), is(inputExpression));
FunctionInvocationNode function = (FunctionInvocationNode) functionBase;
assertThat(function.getName(), is(instanceOf(QualifiedNameNode.class)));
assertThat(function.getName().getText(), is("my.test.Function"));
assertThat(function.getParams(), is(instanceOf(ListNode.class)));
assertThat(function.getParams().getElements(), is(empty()));
}
use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class FEELParserTest method testContextPathExpression.
@Test
public void testContextPathExpression() {
String inputExpression = "{ x : \"foo\" }.x";
BaseNode pathBase = parse(inputExpression);
assertThat(pathBase, is(instanceOf(PathExpressionNode.class)));
assertThat(pathBase.getText(), is(inputExpression));
assertThat(pathBase.getResultType(), is(BuiltInType.STRING));
PathExpressionNode pathExpr = (PathExpressionNode) pathBase;
assertThat(pathExpr.getExpression(), is(instanceOf(ContextNode.class)));
assertThat(pathExpr.getExpression().getText(), is("{ x : \"foo\" }"));
assertThat(pathExpr.getName(), is(instanceOf(NameRefNode.class)));
assertThat(pathExpr.getName().getText(), is("x"));
}
Aggregations