use of org.kie.dmn.feel.lang.ast.ListNode in project drools by kiegroup.
the class ASTBuilderVisitor method visitNegatedUnaryTests.
@Override
public BaseNode visitNegatedUnaryTests(FEEL_1_1Parser.NegatedUnaryTestsContext ctx) {
// negating a unary tests: BOOLEAN-type anyway
BaseNode name = ASTBuilderFactory.newNameRefNode(ctx.not_key(), BuiltInType.BOOLEAN);
ListNode value = (ListNode) visit(ctx.simpleUnaryTests());
return buildFunctionCall(ctx, name, value);
}
use of org.kie.dmn.feel.lang.ast.ListNode in project drools by kiegroup.
the class FEELParserTest method testInValueList.
@Test
public void testInValueList() {
// TODO review this test might be wrong as list is not homogeneous
String inputExpression = "x / 4 in ( 10+y, true, 80, someVar )";
BaseNode inNode = parse(inputExpression);
assertThat(inNode, is(instanceOf(InNode.class)));
assertThat(inNode.getResultType(), is(BuiltInType.BOOLEAN));
assertThat(inNode.getText(), is(inputExpression));
InNode in = (InNode) inNode;
assertThat(in.getValue(), is(instanceOf(InfixOpNode.class)));
assertThat(in.getValue().getText(), is("x / 4"));
assertThat(in.getExprs(), is(instanceOf(ListNode.class)));
assertThat(in.getExprs().getText(), is("10+y, true, 80, someVar"));
ListNode list = (ListNode) in.getExprs();
assertThat(list.getElements().get(0), is(instanceOf(InfixOpNode.class)));
assertThat(list.getElements().get(1), is(instanceOf(BooleanNode.class)));
assertThat(list.getElements().get(2), is(instanceOf(NumberNode.class)));
assertThat(list.getElements().get(3), is(instanceOf(NameRefNode.class)));
}
Aggregations