[antlr-interest] Why is Filter thwarting me?

Gavin Lambert antlr at mirality.co.nz
Wed Mar 5 23:05:20 PST 2008


At 19:53 6/03/2008, alan brown wrote:
>I'm using 'filter=true' because I'm just trying to pluck out 
>parts of the input stream.  However, setting filter to true seems 
>to prevent my java code from running.  Here's an example:
>
>
>grammar wibble;
>
>options {filter=false;}

There's your problem right there :)  (Assuming you'd put 
filter=true instead.)

'filter=true' is a lexer option, and only works in lexer-only 
grammars.  It should actually produce a compiler error in other 
cases, but sadly at the moment it doesn't.

Change your "grammar" to "lexer grammar" and remove the parser 
rules, and it should work properly.  (You can then create a 
separate "parser grammar" to deal with the output, if you want.)



More information about the antlr-interest mailing list