[antlr-interest] Empty alternative causes error
Jamie Penney
jpen054 at ec.auckland.ac.nz
Mon Feb 18 14:04:40 PST 2008
Hi All,
I have the following rules:
type_argument_list_handler
: (type_argument_list)=> type_argument_list -> ^(OPTIONAL
type_argument_list)
| /*empty*/ -> ^(OPTIONAL)
;
type_argument_list
: LT type_parameters GT -> ^(OPEN_GENERICS[$LT] type_parameters
CLOSE_GENERICS[$GT])
;
If I try to remove the empty alternative, I get warnings about
type_argument_list_handler being able to handle LT using multiple
alternatives, yet there are no alternatives. If I leave it there, I get
a test for the UP token generated from that rule, yet UP does not exist.
I have two possible answers to this problem.
1) The grammar is wrong. Is there another way of specifying empty rules?
2) ANTLR is wrong. I know that Token.UP is really what it is searching
for, yet it uses UP instead. Is this possibly a bug?
Thanks,
Jamie
More information about the antlr-interest
mailing list