diff --git a/drools-drl/drools-drl10-parser/src/main/antlr4/org/drools/parser/DRLLexer.g4 b/drools-drl/drools-drl10-parser/src/main/antlr4/org/drools/parser/DRLLexer.g4 index 0eb6d961bce..8264c7b87e6 100644 --- a/drools-drl/drools-drl10-parser/src/main/antlr4/org/drools/parser/DRLLexer.g4 +++ b/drools-drl/drools-drl10-parser/src/main/antlr4/org/drools/parser/DRLLexer.g4 @@ -49,6 +49,7 @@ DRL_INIT : 'init'; DRL_ACTION : 'action'; DRL_REVERSE : 'reverse'; DRL_RESULT : 'result'; +DRL_ENTRY_POINT : 'entry-point'; DRL_SALIENCE : 'salience'; DRL_ENABLED : 'enabled'; diff --git a/drools-drl/drools-drl10-parser/src/main/antlr4/org/drools/parser/DRLParser.g4 b/drools-drl/drools-drl10-parser/src/main/antlr4/org/drools/parser/DRLParser.g4 index 1b96c788b3b..791ad29258b 100644 --- a/drools-drl/drools-drl10-parser/src/main/antlr4/org/drools/parser/DRLParser.g4 +++ b/drools-drl/drools-drl10-parser/src/main/antlr4/org/drools/parser/DRLParser.g4 @@ -265,6 +265,7 @@ mapEntry */ patternSource : fromExpression | fromAccumulate + | fromEntryPoint ; fromExpression : conditionalOrExpression ; @@ -291,6 +292,7 @@ accumulateFunction := label? ID parameters */ accumulateFunction : label? IDENTIFIER LPAREN drlExpression RPAREN; +fromEntryPoint : DRL_ENTRY_POINT stringId ; /* lhsExists := EXISTS diff --git a/drools-drl/drools-drl10-parser/src/main/java/org/drools/parser/DRLVisitorImpl.java b/drools-drl/drools-drl10-parser/src/main/java/org/drools/parser/DRLVisitorImpl.java index e3e5a499df8..7f4c0528e6d 100644 --- a/drools-drl/drools-drl10-parser/src/main/java/org/drools/parser/DRLVisitorImpl.java +++ b/drools-drl/drools-drl10-parser/src/main/java/org/drools/parser/DRLVisitorImpl.java @@ -14,6 +14,7 @@ import org.drools.drl.ast.descr.AnnotationDescr; import org.drools.drl.ast.descr.AttributeDescr; import org.drools.drl.ast.descr.BaseDescr; +import org.drools.drl.ast.descr.EntryPointDescr; import org.drools.drl.ast.descr.ExistsDescr; import org.drools.drl.ast.descr.ExprConstraintDescr; import org.drools.drl.ast.descr.FromDescr; @@ -296,6 +297,11 @@ public AccumulateDescr.AccumulateFunctionCallDescr visitAccumulateFunction(DRLPa return new AccumulateDescr.AccumulateFunctionCallDescr(function, bind, false, params); } + @Override + public EntryPointDescr visitFromEntryPoint(DRLParser.FromEntryPointContext ctx) { + return new EntryPointDescr(safeStripStringDelimiters(ctx.stringId().getText())); + } + @Override public List visitConstraints(DRLParser.ConstraintsContext ctx) { if (ctx == null) { diff --git a/drools-drl/drools-drl10-parser/src/test/java/org/drools/parser/MiscDRLParserTest.java b/drools-drl/drools-drl10-parser/src/test/java/org/drools/parser/MiscDRLParserTest.java index 96134e5ee28..2bd999facef 100644 --- a/drools-drl/drools-drl10-parser/src/test/java/org/drools/parser/MiscDRLParserTest.java +++ b/drools-drl/drools-drl10-parser/src/test/java/org/drools/parser/MiscDRLParserTest.java @@ -2902,7 +2902,6 @@ public void parse_RuleWithLHSNesting() throws Exception { assertThat(g.getObjectType()).isEqualTo("G"); } - @Disabled("Priority : High | Implement from entry-point") @Test public void parse_EntryPoint() throws Exception { final String text = "rule X when StockTick( symbol==\"ACME\") from entry-point StreamA then end"; @@ -2923,7 +2922,6 @@ public void parse_EntryPoint() throws Exception { assertThat(entry.getEntryId()).isEqualTo("StreamA"); } - @Disabled("Priority : High | Implement from entry-point") @Test public void parse_EntryPoint2() throws Exception { final String text = "rule X when StockTick( symbol==\"ACME\") from entry-point \"StreamA\" then end";