[antlr-interest] 3.1: reference to undefined rule attribute in a comment is treated as an error

Gavin Lambert antlr at mirality.co.nz
Mon Apr 28 01:41:06 PDT 2008


At 20:13 28/04/2008, Felix Dorner wrote:
 >I don't know if this has been reported. I run Antlr3.1. Inside a 

 >comment I refer to an undefined attribute $rulename.attribute. 
It
 >seems like Antlr doesn't like this, and fails to build the 
parser.
 >But as it's inside a comment, antlr shouldn't put his fingers 
there..

ANTLR only does very basic parsing within target language blocks, 
since it doesn't really understand the target language 
syntax.  Comments are part of the target language syntax, so ANTLR 
doesn't understand them either, and will try to do the translation 
regardless.

You could try writing \$ at the start instead of $.  I'm not sure, 
but that might make ANTLR forget about trying to translate that 
instance.



More information about the antlr-interest mailing list