[antlr-interest] Literals not handled in grammars with import

Thomas Brandon tbrandonau at gmail.com
Mon Aug 25 06:38:23 PDT 2008


Yeah, that's a slightly different issue. That's literals in the parser
which cause problems for new users who mistakenly think that they are
handled in the parser rather than being a shortcut to generate lexer
rules. This is a literal in a tree parser which doesn't have those
problems. Still, I tend to avoid literals as a style thing, and would
happily change but I'm reusing an existing grammar so I don't really
want to change it to ease bringing across future changes to the reused
grammar.

Tom.
On Mon, Aug 25, 2008 at 6:06 PM, Raphael Reitzig <r_reitzi at cs.uni-kl.de> wrote:
> Hi Thomas!
>
> I do not know what goes wrong there, but I learned the general rule:
>
> Thou shalt not use literals in parser or walker rules!
>
> Thus, I would expect your problem, be there a bug or not, to vanish if you
> create a lexer rule and refer to this token at all occurrences of your
> string.
> Improves maintainability, too.
>
> Regards
>
> Raphael


More information about the antlr-interest mailing list