[antlr-interest] Newbie question:using lexer grammar
Gavin Lambert
antlr at mirality.co.nz
Sun Aug 26 13:19:36 PDT 2007
At 01:40 27/08/2007, Johannes Luber wrote:
>grammar MauroTest;
>
>options {
> filter=true;
>}
>
>ALTERNATIVE1: 'Destination not found';
>ALTERNATIVE2: 'Please make your choice by clicking on the
>destination name below';
>ALTERNATIVE3: 'Hotels found';
>
>document
> : ALTERNATIVE1 {System.out.println("OK 1");}
> | ALTERNATIVE2 {System.out.println("OK 2");}
> | ALTERNATIVE3 {System.out.println("OK 3");}
> ;
>
>For whatever reason, there was no output of "OK 1", despite
>ALTERNATIVE1 being recognized. Maybe one has to use separate
>lexer and parser grammars...
Yes, "filter = true" requires "lexer grammar". (And removing the
'document' rule entirely; you can put the printlns on the lexer
rules instead.)
More information about the antlr-interest
mailing list