Search in sources :

Example 1 with ASTBuilderVisitor

use of org.kie.dmn.feel.parser.feel11.ASTBuilderVisitor in project drools by kiegroup.

the class FEELImpl method compileExpressionList.

public CompiledExpression compileExpressionList(String expression, CompilerContext ctx) {
    FEEL_1_1Parser parser = FEELParser.parse(getEventsManager(ctx.getListeners()), expression, ctx.getInputVariableTypes(), ctx.getInputVariables(), ctx.getFEELFunctions(), profiles);
    ParseTree tree = parser.expressionList();
    ASTBuilderVisitor v = new ASTBuilderVisitor(ctx.getInputVariableTypes());
    BaseNode expr = v.visit(tree);
    CompiledExpression ce = new CompiledExpressionImpl(expr);
    return ce;
}
Also used : ASTBuilderVisitor(org.kie.dmn.feel.parser.feel11.ASTBuilderVisitor) BaseNode(org.kie.dmn.feel.lang.ast.BaseNode) FEEL_1_1Parser(org.kie.dmn.feel.parser.feel11.FEEL_1_1Parser) ParseTree(org.antlr.v4.runtime.tree.ParseTree) CompiledExpression(org.kie.dmn.feel.lang.CompiledExpression)

Example 2 with ASTBuilderVisitor

use of org.kie.dmn.feel.parser.feel11.ASTBuilderVisitor in project drools by kiegroup.

the class FEELImpl method compile.

@Override
public CompiledExpression compile(String expression, CompilerContext ctx) {
    FEEL_1_1Parser parser = FEELParser.parse(getEventsManager(ctx.getListeners()), expression, ctx.getInputVariableTypes(), ctx.getInputVariables(), ctx.getFEELFunctions(), profiles);
    ParseTree tree = parser.compilation_unit();
    ASTBuilderVisitor v = new ASTBuilderVisitor(ctx.getInputVariableTypes());
    BaseNode expr = v.visit(tree);
    CompiledExpression ce = new CompiledExpressionImpl(expr);
    return ce;
}
Also used : ASTBuilderVisitor(org.kie.dmn.feel.parser.feel11.ASTBuilderVisitor) BaseNode(org.kie.dmn.feel.lang.ast.BaseNode) FEEL_1_1Parser(org.kie.dmn.feel.parser.feel11.FEEL_1_1Parser) ParseTree(org.antlr.v4.runtime.tree.ParseTree) CompiledExpression(org.kie.dmn.feel.lang.CompiledExpression)

Aggregations

ParseTree (org.antlr.v4.runtime.tree.ParseTree)2 CompiledExpression (org.kie.dmn.feel.lang.CompiledExpression)2 BaseNode (org.kie.dmn.feel.lang.ast.BaseNode)2 ASTBuilderVisitor (org.kie.dmn.feel.parser.feel11.ASTBuilderVisitor)2 FEEL_1_1Parser (org.kie.dmn.feel.parser.feel11.FEEL_1_1Parser)2