[antlr-interest] Reg Multi-line comments

Michael micha-1 at fantasymail.de
Thu Jul 16 05:34:41 PDT 2009


Am Thursday 16 July 2009 14:22:51 schrieb Jim Idle:
> This an FAQ really. I beleive I have nswered it mire than once on the
> list, but:
>
> MLB : '/*' ( options { greedy = false; } : .* )
> ( '*/' | { print error message }
> { skip(); }
> ;
>
> You might need EOF rather just empty alt.

I tried that too and it gives an error:

lexer grammar C;

MLB : '/*' ( options { greedy = false; } : .* )
( '*/' | EOF { print error message } )
{ skip(); }
;


error(201): C.g:3:44: The following alternatives can never be matched: 1

with and without the EOF

 Michael



More information about the antlr-interest mailing list