[antlr-interest] Grammar handling of whitespaces

Erik Kratochvil discontinuum at gmail.com
Thu Feb 7 05:54:17 PST 2008


Could you provide an example?

On 2/7/08, Shawn Poulson <spoulson3 at yahoo.com> wrote:
> Hello all,
>
> I've had success so far with generating my grammar for my C# target,
> with help from several individuals here.  One of the tips I've used is
> to use a lexer rule to skip whitespaces using a rule like:
>
> WS : (' '|'\r'|'\t'|'\n') { $channel=HIDDEN; }
>
> This is very helpful for most parser rules, so I don't have to
> explicitly put whitespaces throughout my parser rules.  But, there are
> times where I don't want whitespaces between certain elements.  Is
> there a way to handle this?
>
> Thanks.
>
> ---
> Shawn Poulson
> spoulson at explodingcoder.com
>


-- 
Erik Kratochvíl


More information about the antlr-interest mailing list