[antlr-interest] compilation error on grammar

Warner Onstine warnero at gmail.com
Thu Aug 2 17:01:47 PDT 2007


On 8/2/07, Randall R Schulz <rschulz at sonic.net> wrote:
> 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?

Sure (I don't think Gmail has an option for line-wrapping). I've
attached the grammar and the generated parser class.

-warner

>
>
> > -warner
>
>
> Randall Schulz
>


-- 
Warner Onstine - Programmer/Author
New book on Tapestry 4!
Tapestry 101 available at
http://sourcebeat.com/books/tapestrylive.html
warner at warneronstine.com
http://warneronstine.com/blog
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Model.g
Type: application/octet-stream
Size: 640 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20070802/b6750b98/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ModelParser.java
Type: application/octet-stream
Size: 11010 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20070802/b6750b98/attachment-0003.obj 


More information about the antlr-interest mailing list