[antlr-interest] The filter option
Jim Idle
jimi at temporal-wave.com
Thu Aug 2 16:33:19 PDT 2007
You can't use .+ like that in a lexer J. What that (kind of) means is that the first character to trigger the rule would try and eat everything up to the end of the text.
Perhaps you are better off using a filtering lexer in a stand alone grammar and then calling it from your parser.
Jim
From: Marcos Marín [mailto:marcosmarin at gmail.com]
Sent: Thursday, August 02, 2007 4:30 PM
To: Jim Idle
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] The filter option
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.
Which preserves the text but the parser won't see it. You can also use skip(); (Java target, I think).
Jim
From: Marcos Marín [mailto:marcosmarin at gmail.com]
Sent: Thursday, August 02, 2007 1:24 PM
To: Jim Idle
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] The filter option
On 8/2/07, Jim Idle <jimi at temporal-wave.com> wrote:
You are probably missing something but were you trying to use a filtering lexer with a parser? A filtering lexer is currently stand alone.
So you mean that I can't use a parser if I specify the filter option? if this is the case, is there any way I can ignore everything else without the filter option?
I'm sorry, this is all very new and confusing to me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070802/8ab9443a/attachment.html
More information about the antlr-interest
mailing list