[antlr-interest] [BUG] 3.0b4 no complaint on parser reference to lexical fragment

John B. Brodie jbb at acm.org
Sun Nov 12 19:02:34 PST 2006


>well, ANTLR treats fragment rules specially, but not *that* specially.
>fragment X creates a valid token type even though rule X cannot and
>does not return a token by itself. OTOH another rule can use that
>token type and set it manually, thus passing X tokens to the parser.

and is this a feature or a bug?

i am trying to assert that this is a bug.

from the fact that "fragment X <...snip...> rule X cannot and does not return a
token by itself."

we must conclude that "<...snip...>, thus passing X tokens to the parser."
shall *not* be permitted.

i understand that the current antlr v3 implementation (3.b04) does not
consider references to lexical fragments by the parser as an error.  i am
just trying to assert that this current implementation is problematic.



More information about the antlr-interest mailing list