[antlr-interest] White space skip in antlr 3.1

Ostrov, Alexei (GMIT-TASS) Alexei_Ostrov at ml.com
Tue Jan 15 06:22:38 PST 2008


Thank you very much! 

(' '|'\t'|'\f'|'\n'|'\r'){ $channel=HIDDEN; }; //no '+' needed
works for me handsomely :).
{Skip();}; works nicely as well!

Good stuff.


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 Harald Mueller
Sent: Tuesday, January 15, 2008 6:58 AM
To: Adam Connelly; antlr-interest at antlr.org
Subject: Re: [antlr-interest] White space skip in antlr 3.1

Skip() (with uppercase S) works for me ...

Regards
Harald 

-------- Original-Nachricht --------
> Datum: Tue, 15 Jan 2008 11:45:57 +0000
> Von: "Adam Connelly" <adam.rpconnelly at googlemail.com>
> An: antlr-interest at antlr.org
> Betreff: Re: [antlr-interest] White space skip in antlr 3.1

> 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#.
> 
> Adam
> 
> On 15/01/2008, Ostrov, Alexei (GMIT-TASS) <Alexei_Ostrov at ml.com> wrote:
> >
> >   I found multiple examples for skipping white space:
> >
> > ...
> >
> > WS       :           (' '|'\t'|'\f'|'\n'|'\r')+{ skip(); };
> >
> > COMA  :           WS','WS;
> >
> > ...
> >
> >
> >
> > This works in AntlrWorks but does not work after code generation for
> > CSharp.
> >
> > I also tried some others:
> >
> > Antlr::Token::SKIP
> >
> > Token.Skip()
> >
> >
> >
> > I suspect these are for C++/C and Java, though...
> >
> > Can someone please give me a hint about how to ignore white space?
> >
> >
> >
> > Alexei
> >
> > Alexei Ostrov
> > Desk A0513, 11th floor, 222 Broadway, NY, NY10038
> > 212.670.1784
> > 917.520.0205
> >
> >
> >  ------------------------------
> >  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.
> >  ------------------------------
> >
> >

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger?did=10
--------------------------------------------------------

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