[antlr-interest] Sequential Javadoc Comments in Grammar Files

Jones, Larry Larry.Jones at aspentech.com
Mon Jul 21 14:36:36 PDT 2008


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 <http://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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080721/12dcd4b8/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 2078 bytes
Desc: email_2_03.gif
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080721/12dcd4b8/attachment-0002.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 200 bytes
Desc: email_2_04.gif
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080721/12dcd4b8/attachment-0003.gif 


More information about the antlr-interest mailing list