[antlr-interest] Grammar for block comments?

Jim Idle jimi at temporal-wave.com
Tue Jul 15 12:35:46 PDT 2008


On Tue, 2008-07-15 at 18:45 +0100, Andy Doddington wrote:

> I am trying to write a grammar that includes support for C-style block
> comments - i.e. bracketed by '/*' and '*/'.
> 
> I have taken the example in the cpp.g grammar on the antlr web site, which
> appears as shown below:
> 
> 	COMMENT: '/*'  ( options {greedy=false;} : . )*  '*/' { _channel=99; };
> 
> Unfortunately, when this encounters a comment containing asterisks, I get the error:
> 
>         line <line>:<column> mismatched character '*' expecting '/'
> 
> Is there any better solution, that avoids this problem?


What version of ANTLR are you using here?

Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080715/bdb140bc/attachment.html 


More information about the antlr-interest mailing list