[antlr-interest] Failure to ignore newline

Bart Kiers bkiers at gmail.com
Fri Nov 18 00:21:27 PST 2011


On Fri, Nov 18, 2011 at 7:55 AM, David Riddle <david at mcgilly.com> wrote:

> Hi -
>
> This should be a very simple thing - I'm attempting to have my grammar hide
> newline, carriage returns, etc. However, every concievable form of a
> grammar that attempts to skip over these things or send them to the hidden
> channel seems to fail for me. Here's a very basic example:
>
> grammar Test;
>
> prog: ID+;
>
> ID: 'a'..'z'+;
>
> WS: '\n'+ {$channel=HIDDEN;};
>
> // Input: a \n b
> // Output: a n b
>

I'm guessing that's no 0xA (new line char) in your input, but a backslash
followed by a 'n'.

Regards,

Bart.


More information about the antlr-interest mailing list