[antlr-interest] Re: optional rule confusion
Lubos Vnuk
lubos.vnuk at rts.at
Wed Mar 3 05:38:38 PST 2004
I think you can get some information from a similar thread
titled: "Problem with x: (A)(B)? ; "
Regards,
Lubos.
--- In antlr-interest at yahoogroups.com, Igor Fedorenko
<ifedorenko at r...> wrote:
> I must be missing something really simple, but I cannot get antlr
> generate reasonable parser for javadoc-like java method names (like
> com.something.MyClass#method).
>
> Here is what my parser rule looks like
>
> protected javaname: ID (DOT ID)* (POUND ID)?
>
> And here is what antlr generates for the last part
>
> switch ( LA(1)) {
> case POUND:
> {
> match(POUND);
> m = LT(1);
> match(ID);
> break;
> }
> case EOF:
> {
> break;
> }
> default:
> {
> throw new NoViableAltException(LT(1), getFilename());
> }
> }
>
>
> Why would antlr generate NoViableAltException for something which
is
> optional?
>
>
> Regards,
> Igor Fedorenko
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list