Skip to content
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

[DROOLS-7310] parse nested parentheses #42

Conversation

tkobayas
Copy link
Collaborator

No description provided.

Copy link
Contributor

@gitgabrio gitgabrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkobayas @mariofusco
Sorry guys, but this code is getting impossible to understand.
Please add comments/explanations to methods/variables, otherwise it will become another only-one-person-in-the-world can manage it.

BaseDescr descr = visitLhsPatternBind(ctx.lhsPatternBind());
existsDescr.addDescr(descr);
if (ctx.lhsOrDef() != null) {
BaseDescr descr = visitDescrChildren(ctx.lhsOrDef()).get(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkobayas
Please check and manage the case where this -> visitDescrChildren(ctx.lhsOrDef()) returns an empty list

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll work on it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@tkobayas
Copy link
Collaborator Author

@tkobayas @mariofusco Sorry guys, but this code is getting impossible to understand. Please add comments/explanations to methods/variables, otherwise it will become another only-one-person-in-the-world can manage it.

@gitgabrio Thank you very much for the suggestion. I'll add more comments/explanation for this PR.

And also I will add comments/explanation on overall drools-parser codebase (and probably "developer notes") as a separated JIRA https://issues.redhat.com/browse/DROOLS-7577

@gitgabrio
Copy link
Contributor

@tkobayas @mariofusco Sorry guys, but this code is getting impossible to understand. Please add comments/explanations to methods/variables, otherwise it will become another only-one-person-in-the-world can manage it.

@gitgabrio Thank you very much for the suggestion. I'll add more comments/explanation for this PR.

And also I will add comments/explanation on overall drools-parser codebase (and probably "developer notes") as a separated JIRA https://issues.redhat.com/browse/DROOLS-7577

Great, many thanks @tkobayas !!!

@@ -2835,7 +2833,6 @@ public void parse_TypeDeclarationWithFields() throws Exception {

}

@Disabled("Priority : High | Failed to parse or with parentheses in LHS")
@Test
public void parse_RuleWithLHSNesting() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tkobayas : Does this (or other) test cover multi-level nesting ?
If not, could you please add one that cover that specific case (multiple level of nested parentheses) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test case is one level nest (renamed to parenthesesOneLevelNestWithThreeSiblings).

However, we already had multipleLevelNestAndOrOrOrAnd() (renamed).

I also added 2 test cases of tricky multiple level nesting : multipleLevelNestWithThreeOrSiblings and existsMultipleLevelNestWithThreeOrSiblings

Thanks!

- Adding more nested level tests
@tkobayas
Copy link
Collaborator Author

Updated with more comments (only for this PR related part. I'll do overall review with https://issues.redhat.com/browse/DROOLS-7577). @gitgabrio , feel free to let me know if you want more explanations on some specific places. Thanks!

Copy link
Contributor

@gitgabrio gitgabrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tkobayas LGTM!

@mariofusco mariofusco merged commit 42b1183 into kiegroup:main Oct 27, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants