tkobayas commented on code in PR #5855:
URL:
https://github.com/apache/incubator-kie-drools/pull/5855#discussion_r1574243299
##########
drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/DescrCommonPropertyTest.java:
##########
@@ -181,21 +208,28 @@ void annotationDescr() {
" $p : Person( name == \"Mario\" ) @watch(!*, age)\n" +
"then\n" +
"end\n";
- final PackageDescr pkg = parser.parse(source);
+ final PackageDescr pkg = parseAndGetPackageDescr(source);
final RuleDescr rule = pkg.getRules().get(0);
AnnotationDescr annotation =
rule.getLhs().getAllPatternDescr().get(0).getAnnotations().stream().findFirst().get();
- assertProperties(annotation, 65, 79, 4, 33, 4, 47);
+ assertProperties(annotation, 65, 80, 4, 33, 4, 47);
}
@Test
void typeFieldDescr() {
final String source = "declare MyType\n" +
" name : String\n" +
"end";
- final PackageDescr pkg = parser.parse(source);
+ final PackageDescr pkg = parseAndGetPackageDescr(source);
final TypeDeclarationDescr typeDeclaration =
pkg.getTypeDeclarations().get(0);
TypeFieldDescr typeField = typeDeclaration.getFields().get("name");
- assertProperties(typeField, 17, 29, 2, 2, 2, 14);
+ // Backward Compatibility Notes:
+ // The old DRL6Parser uses only the attribute value token for common
properties (seem to be wrong), so startCharacter and column are different
between old and new parser.
+ // Backward compatibility doesn't seem to be required in this case.
Review Comment:
`Backward Compatibility Notes` : B) Old parser seems to be wrong
For TypeFieldDescr `name : String` ,
Old parser handles only `String` for common properties. So `startCharacter`
is the position of `S`
New parser handles the whole expression (like other Descr), so
`startCharacter` is the position of `n`
--
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]