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

Johannes Luber jaluber at gmx.de
Mon Aug 25 06:44:51 PDT 2008


Thomas Brandon schrieb:
> 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.

You could always push your changes upstream. :)

Johannes
> 
> 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
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 



More information about the antlr-interest mailing list