[antlr-interest] Simple Tree Rewrite help

Jim Idle jimi at temporal-wave.com
Wed Jul 29 10:07:55 PDT 2009


Just change the type of the token and don't use rewrites. It is  
simpler that way (assuming you add comments! ;)


(t=OR_TOK^ { $t.type = OR; } ...


Jim

On Jul 29, 2009, at 5:25 AM, Tim Williams <williamstw at gmail.com> wrote:

> I'm trying to get a tree rewrite version of something like this:
>
> query:  LPAREN! expr (OR_TOK^ expr)+ RPAREN!;
>
> This seems to do what I want, but I need a tree rewrite version so
> that I can send something other than OR_TOK as the root, namely an
> normalized "OR" token.  I've tried:
>
> -> ^(OR expr expr)+;
>
> with no luck.
>
> Any help appreciated,
>
> Thanks,
> --tim
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list