You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "tkobayas (via GitHub)" <gi...@apache.org> on 2024/05/10 07:16:26 UTC
[PR] [incubator-kie-drools-5918] [new-parser] Annotations can appear in lh… [incubator-kie-drools]
tkobayas opened a new pull request, #5921:
URL: https://github.com/apache/incubator-kie-drools/pull/5921
…sOr and lhsAnd
**Issue**:
* https://github.com/apache/incubator-kie-drools/issues/5918
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-drools-5918] [new-parser] Annotations can appear in lh… [incubator-kie-drools]
Posted by "yurloc (via GitHub)" <gi...@apache.org>.
yurloc commented on code in PR #5921:
URL: https://github.com/apache/incubator-kie-drools/pull/5921#discussion_r1596450578
##########
drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/MiscDRLParserTest.java:
##########
@@ -3990,6 +3990,50 @@ void lhsPatternAnnotation() {
assertThat(annotationDescr.getSingleValueAsString()).isEqualTo("!*, age");
}
+ @Test
+ void andDescrAnnotation() {
+ ParserTestUtils.enableOldParser();
Review Comment:
Committed unintentionally, I believe.
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-drools-5918] [new-parser] Annotations can appear in lh… [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #5921:
URL: https://github.com/apache/incubator-kie-drools/pull/5921#discussion_r1596367071
##########
drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/antlr4/DRLVisitorImpl.java:
##########
@@ -1032,7 +1038,13 @@ private BaseDescr createAndDescr(ParserRuleContext ctx) {
// B() C()
// So, we need to flatten it so that AndDescr has A(), B() and C() as children.
List<BaseDescr> flattenedDescrs = flattenAndDescr(descrList);
- flattenedDescrs.forEach(andDescr::addDescr);
+ flattenedDescrs.forEach(descr -> {
+ if (descr instanceof AnnotationDescr annotationDescr) {
+ andDescr.addAnnotation(annotationDescr);
+ } else {
+ andDescr.addDescr(descr);
+ }
+ });
Review Comment:
I know there is a duplication in this part and the above one (`visitLhsOr`). But `addDescr` method is not defined in a common parent class of `AndDescr` and `OrDescr`, so I cannot write a reusable clean private method. (Changing Descr class hierarchy sounds also too much).
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-drools-5918] [new-parser] Annotations can appear in lh… [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #5921:
URL: https://github.com/apache/incubator-kie-drools/pull/5921#issuecomment-2104064202
@yurloc @mariofusco @gitgabrio Please review, thanks!
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-drools-5918] [new-parser] Annotations can appear in lh… [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #5921:
URL: https://github.com/apache/incubator-kie-drools/pull/5921#discussion_r1596367071
##########
drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/antlr4/DRLVisitorImpl.java:
##########
@@ -1032,7 +1038,13 @@ private BaseDescr createAndDescr(ParserRuleContext ctx) {
// B() C()
// So, we need to flatten it so that AndDescr has A(), B() and C() as children.
List<BaseDescr> flattenedDescrs = flattenAndDescr(descrList);
- flattenedDescrs.forEach(andDescr::addDescr);
+ flattenedDescrs.forEach(descr -> {
+ if (descr instanceof AnnotationDescr annotationDescr) {
+ andDescr.addAnnotation(annotationDescr);
+ } else {
+ andDescr.addDescr(descr);
+ }
+ });
Review Comment:
I know there is a duplication in this part and the above one (`visitLhsOr`). But `addDescr` method is not defined in a common parent class of `AndDescr` and `OrDescr`, so I cannot refactor them to a reusable clean private method. (Changing Descr class hierarchy sounds also too much).
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-drools-5918] [new-parser] Annotations can appear in lh… [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #5921:
URL: https://github.com/apache/incubator-kie-drools/pull/5921#discussion_r1596539341
##########
drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/MiscDRLParserTest.java:
##########
@@ -3990,6 +3990,50 @@ void lhsPatternAnnotation() {
assertThat(annotationDescr.getSingleValueAsString()).isEqualTo("!*, age");
}
+ @Test
+ void andDescrAnnotation() {
+ ParserTestUtils.enableOldParser();
Review Comment:
Thank you! Fixed.
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-drools-5918] [new-parser] Annotations can appear in lh… [incubator-kie-drools]
Posted by "mariofusco (via GitHub)" <gi...@apache.org>.
mariofusco merged PR #5921:
URL: https://github.com/apache/incubator-kie-drools/pull/5921
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [incubator-kie-drools-5918] [new-parser] Annotations can appear in lh… [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #5921:
URL: https://github.com/apache/incubator-kie-drools/pull/5921#issuecomment-2104305912
> To be compliant with the old parser, we also need to process annotations from each expression joined by infix OR/AND:
Thank you! I added test cases and also fixed the implementation to collect the annotations.
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org