[antlr-interest] Failure to ignore newline

David Riddle david at mcgilly.com
Fri Nov 18 07:01:36 PST 2011


Hi Bart -

Yes, it's a \n, and I thought I told the grammar to set '\n' to a hidden
channel.  So, why is it not hidden?

~ Dave

On Fri, Nov 18, 2011 at 12:21 AM, Bart Kiers <bkiers at gmail.com> wrote:

> 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.
>
>


-- 
David Riddle
Servoy Developer
(510) 854-6221
www.mcgilly.com


More information about the antlr-interest mailing list