[antlr-interest] Re: Problem with x: (A)(B)? ;
Lubos Vnuk
lubos.vnuk at rts.at
Wed Feb 25 09:28:59 PST 2004
Well, if your x rule is NOT referenced in any other parser rule,
ANTLR assumes it is a top-level rule and as such it can be called
directly from your main(). Now if you take a look at the rule
definition, it is clear that token A will be processed followed by
the optional B. That's it => B/EOF switch. I consider this a feature,
not a bug but I could possibly be missing your point.
HTH,
Lubos.
--- In antlr-interest at yahoogroups.com, "dotlessbraille"
<easjolly at i...> wrote:
> OK, let me try again.
>
> I have a large grammar which works fine. Lexer rules of the form
> A:'a'('b')? and A:'a'('b')* both generate the expected
> implementation (in Java). A parser rule of the form x:A(B)* also
> works as expected.
>
> However, when I added a parser rule of the form x:A(B)?, ANTLR
> generated a switch statement which requires an EOF in the case
there
> is not a B.
>
> Is this a bug or a feature?
>
> Thanks.
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