Hi,
I have the following toy grammar:
-------------------------
date : DIGIT+ SLASH DIGIT+ SLASH DIGIT+ ;
SLASH : '/' ;
DIGITS : DIGIT+ ;
fragment DIGIT : '0'..'9' ;
-------------------------
(No options{} declarations etc.)
I know I shouldn't be using fragments in this way, but it was an accident -
'DIGIT' used to be a lexer rule, but then I changed it into a fragment,
added DIGITS as a new lexer rule, and forgot to remove DIGIT+ from the
parser rule.
The problem I encountered was that even though the grammar check succeeded
and the lexer/parser classes were successfully generated, the 'date' rule
doesn't match the intended input.
It seems like the right solution would be for Antlr to generate an error
when a fragment is used in a parser rule.
Or is there a reason I'm not thinking of to allow them?
Thanks.
--
Ken Williams
Sr. Research Scientist
Thomson Reuters
Phone: 651-848-7712
[email protected]
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.