[antlr-interest] Possible bug in subrule invertion

Terence Parr parrt at cs.usfca.edu
Fri Apr 9 10:26:20 PDT 2004


On Apr 9, 2004, at 10:09 AM, Mike Lischke wrote:

> Hi all,
>
> It seems like I found a bug in the subrule invertion parser. When I 
> try to invert a set of tokens like:
>
> ~('*' | LINE_FEED)
>
> Where LINE_FEED is a (lexer) token defined as '\r'. ANTLR throws an 
> error ("This subrule cannot be inverted....") however when I use
>
> ~('*' | '\r')
>
> The construct is accepted. So to me it looks like a bug. Is this a 
> known problem?

If this is in the lexer, you cannot invert "rules" such as LINE_FEED.  
Done on purpose, I'm afraid. ;)

> Btw.: It would be very helpful if we could do some "token set maths" 
> like
>
>  DIGIT:            '0'..'9';
>  OCTAL_DIGIT:     DIGIT - ['8', '9'];
>
> In this simple example it would be easy to replace the octal digit 
> rule however for large sets like Unicode it is necessary to 
> selectively take out arbitrary ranges of code points as they are not 
> defined yet.

Ah.  Like a set intersection operator and such?

Ter
>
> Mike
> --
> www.soft-gems.net
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list