[antlr-interest] v3: can't seem to work out filter=true

Terence Parr parrt at cs.usfca.edu
Mon May 28 17:59:14 PDT 2007


On May 28, 2007, at 5:52 PM, Mark Mandel wrote:

> Heya,
>
> I'm trying to wrap my head around filter=true, and failing.
>
> I'm currently just trying to implement a grammar that will pick up
> <tag> 's anywhere in a string, regardless of the string.
>
> I figured a perfect opportunity for filter=true, which I had thought
> would ignore what I didn't want, and allow me to filter down a list of
> intended tokens in order (which is very handy).. but I can't seem to
> get it to work for me.
>
> When I do a test string of '<h>' against the below grammar, I get a
> TokenException, but if I take out the filter=true, then it works
> fine... I'm confused?
>
> Can someone please point me in the right direction?
>
> grammar TAG:
>
> options
> {
> 	output=AST;
> 	filter=true;
> }

filter=true only works in the lexer. :) You should not really have a  
parser in this case because you cannot really apply a grammatical  
structure to the incomplete stream of tokens emanating from a lexer  
that filters most stuff out.


  I would take a look at the fuzzy python lexer or was a Java in the  
examples tarball.

Ter


More information about the antlr-interest mailing list