> -----Original Message-----
> From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
> boun...@antlr.org] On Behalf Of Ruslan Zasukhin
> Sent: Saturday, October 15, 2011 7:54 AM
> To: antlr-interest@antlr.org
> Subject: [antlr-interest] [Q] how rewrite tree for this simple rule
> with alternatives?
>
> Hi All,
> Hi Terrence,
>
>
> What still wonders me a lot in ANTLR v3  is that fact that we must
> quite often to use helper rules_leafs to build trees.
>


> ============================================
> Because attempts to make it in SINGLE rule way  -- not works:
>
> alter_trigger_statement
>     :    T_ALTER T_TRIGGER trigger_name ( T_ENABLE | T_DISABLE )
>             -> ^( ALTER_TRIGGER trigger_name (T_ENABLE | T_DISABLE) )
>     ;
>
>
> PROBLEM comes from this alternative (T_ENABLE | T_DISABLE ) ...
> We cannot label it right?
>
> And it is wrong make both tokens optional
>
> alter_trigger_statement
>     :    T_ALTER T_TRIGGER trigger_name ( T_ENABLE | T_DISABLE )
>             -> ^( ALTER_TRIGGER trigger_name T_ENABLE? T_DISABLE? )
>     ;
>


-> ^( ALTER_TRIGGER trigger_name T_ENABLE? T_DISABLE? )

You just have to think about the rewrite ordinality indicators, not the
rule syntax.


Jim

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

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to