[antlr-interest] White space skip in antlr 3.1

Adam Connelly adam.rpconnelly at googlemail.com
Tue Jan 15 03:45:57 PST 2008


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.
>  ------------------------------
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080115/203254a9/attachment.html 


More information about the antlr-interest mailing list