use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class ASTBuilderVisitor method visitRelExpressionValue.
@Override
public BaseNode visitRelExpressionValue(RelExpressionValueContext ctx) {
BaseNode value = visit(ctx.val);
BaseNode test = visit(ctx.expression());
return ASTBuilderFactory.newInNode(ctx, value, test);
}
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);
}
return expr;
}
use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class ASTBuilderVisitor method visitQuantExprSome.
@Override
public BaseNode visitQuantExprSome(FEEL_1_1Parser.QuantExprSomeContext ctx) {
ListNode list = (ListNode) visit(ctx.iterationContexts());
BaseNode expr = visit(ctx.expression());
return ASTBuilderFactory.newQuantifiedExpression(ctx, QuantifiedExpressionNode.Quantifier.SOME, list, expr);
}
use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class FEELParserTest method testPositiveFloatLiteral.
@Test
public void testPositiveFloatLiteral() {
String inputExpression = "+10.5";
BaseNode number = parse(inputExpression);
assertThat(number, is(instanceOf(SignedUnaryNode.class)));
assertThat(number.getResultType(), is(BuiltInType.NUMBER));
assertLocation(inputExpression, number);
SignedUnaryNode sun = (SignedUnaryNode) number;
assertThat(sun.getSign(), is(SignedUnaryNode.Sign.POSITIVE));
assertThat(sun.getExpression(), is(instanceOf(NumberNode.class)));
assertThat(sun.getExpression().getText(), is("10.5"));
}
use of org.kie.dmn.feel.lang.ast.BaseNode in project drools by kiegroup.
the class FEELParserTest method testMultiplication.
@Test
public void testMultiplication() {
String inputExpression = "10 * x";
BaseNode infix = parse(inputExpression, mapOf(entry("x", BuiltInType.NUMBER)));
assertThat(infix, is(instanceOf(InfixOpNode.class)));
assertThat(infix.getResultType(), is(BuiltInType.NUMBER));
assertThat(infix.getText(), is(inputExpression));
InfixOpNode mult = (InfixOpNode) infix;
assertThat(mult.getLeft(), is(instanceOf(NumberNode.class)));
assertThat(mult.getLeft().getText(), is("10"));
assertThat(mult.getOperator(), is(InfixOpNode.InfixOperator.MULT));
assertThat(mult.getRight(), is(instanceOf(NameRefNode.class)));
assertThat(mult.getRight().getText(), is("x"));
}
Aggregations