[antlr-interest] White space skip in antlr 3.1

Ostrov, Alexei (GMIT-TASS) Alexei_Ostrov at ml.com
Wed Jan 16 06:42:46 PST 2008


Actually, I ended up using HIDEN. Skip() did something weird when
parsing  one of my clauses (It might have been my bug, obviously). It
seemed to put parsing into an infinite loop... I do not have details on
this, so do not want to confuse anyone... I will report it if I get back
to this and get more information on this.

Cheers

Alexei Ostrov
Desk A0513, 11th floor, 222 Broadway, NY, NY10038
212.670.1784
917.520.0205

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Adam Connelly
Sent: Wednesday, January 16, 2008 7:45 AM
To: Gavin Lambert
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] White space skip in antlr 3.1

So I take it that in general (unless you have memory limitations or
want to avoid creating unnecessary tokens) you want to use $channel =
HIDDEN?

Adam

On 15/01/2008, Gavin Lambert <antlr at mirality.co.nz> wrote:
> At 00:45 16/01/2008, Adam Connelly wrote:
>
> >I think I've noticed that before.  I tend to just set the channel
> >to hidden:
> >
> >WS       :           (' '|'\t'|'\f'|'\n'|'\r')+{ $channel=HIDDEN;
> >};
> >
> >This means that the parser does not see the whitespace, but isn't
> >exactly the same as skip() (I don't think) although I don't know
> >the difference.  Anyhow, it's always worked for me in C#.
>
> skip() will avoid generating a token entirely.  $channel = HIDDEN
> will still generate a token, but mark it as on a different channel
> from the normal parsing, which will make the parser ignore it but
> leave it accessible to actions if need be.
>
>
--------------------------------------------------------

This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing.
--------------------------------------------------------


More information about the antlr-interest mailing list