[antlr-interest] Tree Rewrite Issue with Negation (~)

Gavin Lambert antlr at mirality.co.nz
Wed Jul 30 14:08:03 PDT 2008


At 05:44 31/07/2008, Foust wrote:
>Although this works (nonsense):
>x :           ':' ( v+=(';'|'}') )* ';'  -> ^(':' $v) ;

Last time I checked, that wouldn't have worked either (= and += 
didn't work against blocks; you had to use an extra rule).  When 
did that get changed?

Or possibly it still hasn't been fixed -- depends what definition 
of "works" you're using.  Certainly in older versions of ANTLR, 
the above would compile perfectly fine but would lead to null 
references or empty lists at runtime instead of providing the 
content you're expecting.

(And incidentally, that should have been $v* in the rewrite.)



More information about the antlr-interest mailing list