[antlr-interest] Compiling the Generated Code

Gavin Lambert antlr at mirality.co.nz
Tue Apr 24 07:55:28 PDT 2007


At 02:49 25/04/2007, you wrote:
 >They happen in the parser: one of my rules has {greedy=false;}, 
and
 >this is put in the Java code, but the compiler complains that 
greedy
 >doesn't exist. When I comment it out, it complains about a
 >RecognitionException that can't be thrown, so I'd have to remove 

 >the try, catch and finally structure. Is it supposed to be like 
that?

You need to put 'options' before the greedy bit, and a colon 
after, like so:

rulename: (options { greedy=false; }: .)+;

Without those it'd be interpreted as a raw code snippet you wanted 
to add to the generated code.



More information about the antlr-interest mailing list