[antlr-interest] Rewrite rule for multiple alternatives
Gavin Lambert
antlr at mirality.co.nz
Thu Aug 2 13:02:32 PDT 2007
At 07:46 3/08/2007, Andy Tripp wrote:
>I wonder if ANTLR could be enhanced to allow the sort of
>thing that Jan has above? If not, how about allowing him
>to assign a name to any arbirarily complex expression
>on the left like this:
>
>'{' mystuff=(a | b | c)* '}' -> ^(COMPOUND $mystuff )
Again, I haven't tried it, but IIRC something like this works too:
'{' (mystuff+=(a | b | c))* '}' -> ^(COMPOUND $mystuff*)
More information about the antlr-interest
mailing list