[antlr-interest] compilation error on grammar

Randall R Schulz rschulz at sonic.net
Thu Aug 2 16:59:14 PDT 2007


On Thursday 02 August 2007 16:52, Warner Onstine wrote:
> On 8/2/07, Randall R Schulz <rschulz at sonic.net> wrote:
> > ...
> >
> > I advise against using line comments in the actions of ANTLR
> > grammars. All the lines of an action are passed through, without
> > regard to whether they happen to be partially or fully commented.
> > The problem comes from the fact that ANTLR (the target
> > language-specific string templates, I guess) sometimes expand
> > portions of the actions with content that includes a newline, thus
> > prematurely terminating the comment.
> >
> > Instead, use only /* explicitly bounded */ comments inside actions.
>
> Ok, how do I turn this off? I'm not doing any comments in the Model.g
> file itself, all of the comments that show up in Java are generated
> by antlr. (If that's the problem you're referring to).

Sorry. I didn't notice where your grammar ended and the excerpted Java 
code began.

Since you didn't have any line comments in your grammar, that's not the 
problem.

Unfortunately, since you didn't turn off line wrapping when you posted 
your message, it's not clear what the code really looked like. Perhaps 
you could re-post it as a text attachment or without line wrapping?


> -warner


Randall Schulz


More information about the antlr-interest mailing list