use of org.kie.dmn.feel.lang.ast.ASTNode in project drools by kiegroup.
the class FEELShowcase method getNodesString.
private void getNodesString(final StringBuilder str, final ASTNode expr, final int level) {
if (expr == null) {
return;
}
str.append(repeat(level));
str.append(String.join("", expr.getText().split("\n")).trim().replaceAll(" +", " "));
str.append(": ");
str.append(expr.getResultType().getName());
str.append("\n");
for (final ASTNode astNode : expr.getChildrenNode()) {
getNodesString(str, astNode, level + 1);
}
}
use of org.kie.dmn.feel.lang.ast.ASTNode in project drools by kiegroup.
the class TemporalConstantFoldingParserTest method testKie.
@Test
public void testKie() {
CompilerContext ctx = FEEL_KIE.newCompilerContext();
CompiledExpression compile = FEEL_KIE.compile(expression, ctx);
ASTNode ast = extractAST(compile);
assertThat(ast).isInstanceOf(FunctionInvocationNode.class);
assertThat(((FunctionInvocationNode) ast).getTcFolded()).isNotNull();
}
use of org.kie.dmn.feel.lang.ast.ASTNode in project drools by kiegroup.
the class TemporalConstantFoldingParserTest method testStrict.
@Test
public void testStrict() {
CompilerContext ctx = FEEL_STRICT.newCompilerContext();
CompiledExpression compile = FEEL_STRICT.compile(expression, ctx);
ASTNode ast = extractAST(compile);
assertThat(ast).isInstanceOf(FunctionInvocationNode.class);
assertThat(((FunctionInvocationNode) ast).getTcFolded()).isNotNull();
}
use of org.kie.dmn.feel.lang.ast.ASTNode in project drools by kiegroup.
the class FEELParserSeverityTest method testUnexistentOperatorGTGT.
@Test
public void testUnexistentOperatorGTGT() {
// RHDM-1119
String inputExpression = "1 >> 2";
ASTNode number = parseSeverity(inputExpression, FEELEvent.Severity.WARN);
assertThat(number, is(instanceOf(InfixOpNode.class)));
assertThat(number.getResultType(), is(BuiltInType.BOOLEAN));
assertLocation(inputExpression, number);
}
use of org.kie.dmn.feel.lang.ast.ASTNode in project drools by kiegroup.
the class FEELParserSeverityTest method testUnexistentOperatorInvokeLTLT.
@Test
public void testUnexistentOperatorInvokeLTLT() {
// RHDM-1119
String inputExpression = "{ m: <<18 }.m(16)";
ASTNode number = parseSeverity(inputExpression, FEELEvent.Severity.WARN);
assertThat(number, is(instanceOf(FunctionInvocationNode.class)));
assertThat(number.getResultType(), is(instanceOf(Type.class)));
assertLocation(inputExpression, number);
}
Aggregations