-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[incubator-kie-drools-5948] [new-parser] Broken testIncompatibleListO… #5975
[incubator-kie-drools-5948] [new-parser] Broken testIncompatibleListO… #5975
Conversation
…nAccumulateFunction
( DRL_INIT LPAREN initBlockStatements=chunk? RPAREN COMMA? DRL_ACTION LPAREN actionBlockStatements=chunk? RPAREN COMMA? ( DRL_REVERSE LPAREN reverseBlockStatements=chunk? RPAREN COMMA?)? DRL_RESULT LPAREN resultBlockStatements=chunk RPAREN | ||
( DRL_INIT LPAREN initBlockStatements=chunk? RPAREN COMMA? DRL_ACTION LPAREN actionBlockStatements=chunk? RPAREN COMMA? DRL_REVERSE LPAREN reverseBlockStatements=chunk? RPAREN COMMA? DRL_RESULT LPAREN resultBlockStatements=chunk RPAREN | ||
| DRL_INIT LPAREN initBlockStatements=chunk? RPAREN COMMA? DRL_ACTION LPAREN actionBlockStatements=chunk? RPAREN COMMA? DRL_RESULT LPAREN resultBlockStatements=chunk RPAREN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not an elegant change. But in the previous rule, chunk?
for the DRL_ACTION greedily eats DRL_RESULT result
. So I changed to this one, which makes DRL_RESULT higher priority. If there is a better way to write, please let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, I've come up with a chunk rule version that can do parenthesis matching and nesting and is not greedy:
chunk : .*? (LPAREN chunk RPAREN .*?)* ;
If you want to experiment, change the chunk rule like that and revert lines 343-344. BUT there seems to be a serious performance problem with this approach as manifested by org.drools.testcoverage.regression.FusionAfterBeforeTest#testExpireEventsWhenSharingAllRules
that times out with this chunk version.
I was curious if it's possible to make the chunk rule behave the same as the nesting chunk method in the old parser. It's nice that it can be done but it seems unusable for larger inputs. It's a reminder that we should be careful about using nongreedy parser subrules as also suggested in the docs:
Nongreedy subrules should be used sparingly because they complicate the recognition problem and sometimes make it tricky to decipher how the lexer will match text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yurloc @mariofusco @gitgabrio Please review, thanks! |
…nAccumulateFunction (apache#5975)
…nAccumulateFunction (apache#5975)
…nAccumulateFunction (apache#5975)
…nAccumulateFunction (apache#5975)
…nAccumulateFunction
Issue: