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

David-Sarah Hopwood david-sarah at jacaranda.org
Sun Aug 16 19:04:30 PDT 2009


David-Sarah Hopwood wrote:
> consiliens at gmail.com wrote:
>> grammar bug;
>> bug	:	 EOF;
>> fragment NEWLINE : '\n' '\r'? {$channel=HIDDEN;};
>>
>> Console:
>> [19:14:16] /output/bugLexer.java:50: cannot find symbol
>> [19:14:16] symbol  : variable _channel
>> [19:14:16] location: class bugLexer
>> [19:14:16]             _channel=HIDDEN;
>> [19:14:16]             ^
>> [19:14:16] 1 error
> 
> The generated code for mNEWLINE does not contain
> 
>     int _channel = DEFAULT_TOKEN_CHANNEL;
>     ...
>     state.channel = _channel;

Oh, this is as expected for fragment rules. See John Brodie's reply.

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



More information about the antlr-interest mailing list