Hello! I'm trying to write a grammar that will accept lines of zero or more
IDs and I'd like to allow the last line to end in a new line *or *EOF. I
came up with this grammar:
grammar test;
start
: input*
;
input
: ID* ('\n' | EOF)
;
ID
: ('a'..'z')*
;
WHITESPACE
: ' '+ {skip();}
;
But got this error from ANTLRWorks saying start has un-reachable
alternatives:
[15:38:33] error(201): test2.g:9:5: The following alternatives can never be
matched: 2
If I remove the reference to EOF than everything works but I have to end the
last line in a new line and I don't want to have to do that. Any
suggestions?
Thanks,
Chris
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.