yurloc commented on issue #5932: URL: https://github.com/apache/incubator-kie-drools/issues/5932#issuecomment-2123330091
> ``` > functiondef : DRL_FUNCTION typeTypeOrVoid? drlIdentifier formalParameters drlBlock ; > ``` > > Probably `drlBlock` can be replaced with `LBRACE chunk? RBRACE` just like old parser. That's the easy solution. I'm not against it as our goal for the ANTL4 rewrite is not to improve the parser's capability. But another solution exists.  If you traverse the parser rules according to the parse tree above, you'll find out that `classCreatorRest` is declared in `DRL6Expressions.g4` and it effectively overrides a rule with the same name in `JavaParser.g4`. The difference between the two rules is that the one in `DRL6Expressions.g4` does not allow class body: https://github.com/apache/incubator-kie-drools/blob/899795609c10d5c8e182449fc1b4684ec93bca01/drools-drl/drools-drl-parser/src/main/antlr4/org/drools/drl/parser/antlr4/DRL6Expressions.g4#L843-L845 The obvious fix would be to uncomment `classBody?` but that would be an unnecessary change in the `DRL6Expressions.g4` grammar. I would prefer simply renaming the `classCreatorRest` rule in `DRL6Expressions.g4` leaving its behavior unchanged and letting the `drlCreator` rule in `DRLParser.g4` use the `classCreatorRest` from `JavaParser.g4`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
