Jim Idle schreef:
> On Thu, 2008-10-30 at 16:10 +0100, Hendrik Maryns wrote:
>> Hendrik Maryns schreef:
>> > Johannes Luber schreef:
> 
>> Why doesn’t
>>
>> LABEL : ~(WHITESPACE | '(' | ')')+ ;
>>
> 
> Your WHITESPACE rule probably defines a sequence rather than a set.

Nope, but it does declare $channel = HIDDEN, maybe that is the problem?

WHITESPACE : (' '|'\r'|'\t'|'\u000C'|'\n') {$channel=HIDDEN;} ;

> Create a:
> 
> fragment WSCHARS : (' ' | '\t' | '\f');
> 
> Then:
> 
> LABEL : ( ~ (WSCHARS | '(' | ')' ) )+;
> 
> Will probably work, though you are probably gong to create huge lexer
> tables (which we are hoping to do something about shortly).

This does not work either: it parses O)) successfully, but I do not
understand why.

Even substituting the whitespace characters explicitly doesn’t work.

Similarly,

LABEL :  ( '!'..'\'' | '*'..'\uffff' )+ ;

accepts the input O)) as well.  This seems like a bug to me.  Oh, when
talking about bugs: antlr doesn’t allow characters like ’ and other
Unicode in a grammar, not even in a comment!

H.
-- 
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html

Attachment: signature.asc
Description: OpenPGP digital signature

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address

Reply via email to