[antlr-interest] Grammar for block comments?

Gavin Lambert antlr at mirality.co.nz
Wed Jul 16 14:19:19 PDT 2008


At 05:53 17/07/2008, Andy Doddington wrote:
 >> COMMENT: '/*' (~'*' | '*' ~'/')* '*/' { $channel = HIDDEN; };
 >>
 >Your suggestion made a lot of sense - however, it doesn't seem 
to
 >have had any effect on my problem, which seems strange - even 
the
 >error message is identical :-(

Very strange; something like that has always worked for me.

Well, I suppose one more thing you could try is to force the 
lookahead with a synpred:

COMMENT
   : '/*'
     ( ~'*'
     | ('*' ~'/') => '*' ~'/'
     )*
     '*/'
   { $channel = HIDDEN; }
   ;



More information about the antlr-interest mailing list