[antlr-interest] v3 ignore=WS gone?
Martin d'Anjou
martin.danjou at neterion.com
Tue Feb 20 05:39:00 PST 2007
Yes, I have read about HIDDEN and skip(), but that's not what I meant. I
meant ignoring whitespace in the lexer rules before the tokens get to the
parser: ie how to tell the INCLUDE lexer rule below to ignore whitespace
between it's '#include' and QUOTED_STRING tokens:
WS : ' ';
INCLUDE :
options { ignore=WS; }
'#include' QUOTED_STRING ;
;
QUOTED_STRING :
'"' ( 'a'..'z' | 'A'..'Z' | '.' | ... etc. ) '"'
;
Thanks,
Martin
On Tue, 20 Feb 2007, Dr. Kocher, Hartmut wrote:
> No, the new lexer uses channels to ignore WS.
>
> Two options:
> { $channel = HIDDEN; } if you want WS in the token stream (but invisible). This might be handy for pretty printing etc.
> Of
> { skip(); } skips over WS altogether.
>
> See the v3 docs.
>
> Regards
> Hartmut
>
> -----Ursprüngliche Nachricht-----
> Von: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] Im Auftrag von Martin d'Anjou
> Gesendet: Dienstag, 20. Februar 2007 00:17
> An: antlr-interest at antlr.org
> Betreff: [antlr-interest] v3 ignore=WS gone?
>
> Hi,
>
> options { ignore=WS; } no longer works.
>
> Whitespace can only be ignored in the parser?
>
> Thanks,
> Martin
>
>
> --------------------------------------------------------------------
> Pharmatechnik GmbH & Co. KG
> Münchner Straße 15
> D-82319 Starnberg
>
> Sitz der Gesellschaft: Starnberg
> HRA: 64434, HRB: 66369, Amtsgericht München
> Geschäftsführer: Dr. Detlef Graessner, Werner Torns, Stephan Jörgens
>
More information about the antlr-interest
mailing list