yurloc commented on code in PR #5969:
URL:
https://github.com/apache/incubator-kie-drools/pull/5969#discussion_r1613000767
##########
drools-drl/drools-drl-parser/src/main/antlr4/org/drools/drl/parser/antlr4/DRLParser.g4:
##########
@@ -445,7 +445,7 @@ attribute : name=( 'salience' | 'enabled' )
conditionalAttributeValue #expressio
| name=( 'agenda-group' | 'activation-group' | 'ruleflow-group' |
'date-effective' | 'date-expires' | 'dialect' ) DRL_STRING_LITERAL
#stringAttribute
| name='calendars' DRL_STRING_LITERAL ( COMMA DRL_STRING_LITERAL )*
#stringListAttribute
| name='timer' ( DECIMAL_LITERAL | LPAREN chunk RPAREN )
#intOrChunkAttribute
- | name='duration' ( DECIMAL_LITERAL | TIME_INTERVAL | LPAREN
TIME_INTERVAL RPAREN ) #durationAttribute
+ | name='duration' ( DECIMAL_LITERAL | LPAREN chunk RPAREN )
#intOrChunkAttribute
Review Comment:
> Hi @tkobayas IIUC a method has been removed related to this test. Is there
also a "fails" test or similar, i.e. something that demonstrates a managed
excpetion, or error, when the duration input si "wrong" ?
@gitgabrio
1. Using the `chunk` rule makes the parser extremely benevolent wrt. the
duration attribute's value. The input basically cannot be wrong because the
`chunk` rule accepts _anything_ between the two parentheses. So no need for a
negative test, IMO.
2. Wrt. the removed method - the method name corresponds to the rule
alternative's
[label](https://github.com/antlr/antlr4/blob/master/doc/parser-rules.md#alternative-labels)
(string after `#`). In this case, the label has changed from
`durationAttribute` to `intOrChunkAttribute` making the
`visitDurationAttribute()` method unused. The `visitIntOrChunkAttribute()`
method already exists (it handles for example the timer subrule one line above)
so no need to add a new method.
--
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]