[antlr-interest] The filter option
Wincent Colaiuta
win at wincent.com
Mon Aug 6 08:56:32 PDT 2007
El 6/8/2007, a las 16:30, Terence Parr escribió:
> On Aug 6, 2007, at 2:28 AM, Wincent Colaiuta wrote:
>
>> El 3/8/2007, a las 1:30, Marcos Marín escribió:
>>
>>> On 8/2/07, Jim Idle <jimi at temporal-wave.com> wrote:
>>>>
>>>> As the last rule in your lexer you could use:
>>>>
>>>>
>>>>
>>>> ANY : . { $channel = HIDDEN; }
>>>>
>>>
>>>
>>> Actually, after testing more this does not work, it no longer
>>> complains
>>> about curly braces but it does complain about anything else that
>>> is not one
>>> of my rules. My guess is it does not complain about curly braces
>>> and it does
>>> of other things because curly braces is only one char, so I tried
>>> ANY: .+
>>> {$channel = HIDDEN;} ; but it gave me a warning of the rule being
>>> unreachable.
>>>
>>> I'm going to try creating a standalone lexer and parser.
>>
>> For reference, this has come up in the past. In my opinion this is
>> a bug in ANTLR, so I sent in a patch for this back in June but
>> nobody replied:
>>
>> http://www.antlr.org/pipermail/antlr-interest/2007-June/
>> 021243.html
>
> From your post:
>
> 2. "filter = true" doesn't work for lexer grammars which are declared
> in a separate file as "lexer grammars"
>
> That is strange as that is the only place they work for me: n the
> lexer alone.
>
> See the fuzzyjava example.
Note sure exactly why I wrote that. I believe that at the time I did
a simple test and compared the lexer generated from a combined
grammar with an effectively identical one written as a lexer-only
grammar and there were some differences; but now on repeating that
same test the generated code is identical for both ways (tried with
Java target and confirmed with C target just to be sure), so right
now I can't remember why I wrote that...
:-|
Wincent
More information about the antlr-interest
mailing list