[antlr-interest] Sequential Javadoc Comments in Grammar Files

Terence Parr parrt at cs.usfca.edu
Mon Jul 21 16:25:58 PDT 2008


the syntax only allows Java doc comments in front of a rule and just  
one :)
Ter
On Jul 21, 2008, at 2:36 PM, Jones, Larry wrote:

> To my surprise, I discovered that ANTLR produces an error if a  
> grammer file contains two consecutive Javadoc comments.
>
> For example, the following grammar:
> grammar T;
>
> /**
>  * Does Java accept two consecutive comments?
>  */
>
> /** Match things like 'call foo;' */
> r  : 'call' ID ';' {System.out.println("invoke " + $ID.text);} ;
> ID : 'a'..'z'+ ;
> WS : ( ' ' | '\n' | '\r' )+ { $channel=HIDDEN; } ; // ignore  
> whitespace
> Produces the following errors (built using Ant):
>
> generate:
>      [java] ANTLR Parser Generator  Version 3.1b2 (July 17, 2008)   
> 1989-2008
>      [java] error(100): T.g:7:1: syntax error: antlr: T.g:7:1:  
> unexpected token: /** Match things like 'call foo;' */
>      [java] Java Result: 1
> I did notice that if the first comment block is not a Javadoc style  
> comment, it compiles correctly.
>
> What am I missing?
>
> Thanks.
>
> --
>
> Lawrence Allan Jones
> Senior Developer / Technical Advisor
> Aspen Technology, Inc.
> 2500 CityWest Blvd. Suite 1500
> Houston, Texas 77042
> USA
> 281-504-3324 (work)
> 281-504-3395 (fax)
> larry.jones at aspentech.com
> www.aspentech.com
>
>
>
>
>
> This e-mail and any attachments are intended only for use by the  
> addressee(s) named herein and may contain legally privileged and/or  
> confidential information. If you are not the intended recipient of  
> this e-mail, you are hereby notified any dissemination, distribution  
> or copying of this email, and any attachments thereto, is strictly  
> prohibited. If you receive this email in error please immediately  
> notify the sender and permanently delete the original copy and any  
> copy of any e-mail, and any printout thereof.



More information about the antlr-interest mailing list