[antlr-interest] Simple Grammar breaks ANTLRWorks Interpreter & Debugger?

David-Sarah Hopwood david-sarah at jacaranda.org
Sun Aug 16 18:08:50 PDT 2009


consiliens at gmail.com wrote:
> I looked at ANTLRStringStreams consume() method and noticed that it 
> checks for a '\n'. In the current grammar I'm skip()ing newlines, 
> instead of placing them on a hidden channel.
> 
> I made the following modification to the grammar in ANTLRWorks which 
> promptly broke the compiler.
> fragment NEWLINE : '\n' '\r'? {$channel=HIDDEN;};
> fragment WS      : ('\n'|'\r'|'\t'|' ')+ {$channel=HIDDEN;};
> 
> The error message is "cannot find symbol : variable _channel".

That's quite strange; I'm using $channel = HIDDEN in ANTLRWorks (version
1.2.3) with no problems. Could something be wrong with your ANTLR/ANTLRWorks
installation?

Can you reduce the grammar to the minimum necessary to reproduce the above
error message, and post it here?

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com



More information about the antlr-interest mailing list