[antlr-interest] Failure to ignore newline

Norman Dunbar Norman at dunbar-it.co.uk
Thu Nov 17 23:16:23 PST 2011


Morning David,

On 18/11/11 06:55, David Riddle wrote:
> grammar Test;
>
> prog: ID+;
>
> ID: 'a'..'z'+;
>
> WS: '\n'+ {$channel=HIDDEN;};

I just pasted your grammer into ANTLRWorks and it seemed happy. In the 
interpreter I entered the following:

a
b

With a real newline between them, it gave the correct output. See 
attached - if this list allows attachments, failing that I got:

<grammar Test>
       |
      prog
       |
      ---
     |   |
     a   b

Are you sure you used a real newline as opposed to the two characters "/n"?


Cheers,
Norm.

Disclaimer: I'm not a compiler writer nor do I play one on TV.

-- 
Norman Dunbar
Dunbar IT Consultants Ltd

Registered address:
Thorpe House
61 Richardshaw Lane
Pudsey
West Yorkshire
United Kingdom
LS28 7EL

Company Number: 05132767
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestGrammar.jpg
Type: image/jpeg
Size: 3971 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20111118/30c7712a/attachment.jpg 


More information about the antlr-interest mailing list