On Wed, Apr 21, 2010 at 01:27:02PM +0200, Giampaolo Tomassoni wrote:
> > The solution seems simple: the actions should be called before the
> > tree rewrites, like:
> > 
> > condExpr
> >     :    QMARK c=orExpression t=condExpr f=condExpr
> >                 {shc=true;}
> >             -> {($c.tree.getType()==TRUE)}?   $t
> >             -> {($c.tree.getType()==FALSE)}?  $f
> >             ->
> >     ;
> > 
> > Regards, Mark
> 
> Well, I attempted that, but then the shc var is set true even when there are
> no rewrites (the empty rewrite case in your example). This is probably
> because the disambiguating predicates are on the right side of the rewrite
> operator, while the {shc=true;} seems an action to me. So, it is of course
> to its left.
> 
> I don't see a way to put an action to the right side of the rewrite
> operator, since a {...} notation would be interpreted like a tree reference,
> if I understand it right.
> 
> Maybe all this means there is space for an enhancement in ANTLR? ;)
> 
> Giampaolo

I guess then it is necessary to repeat the predicate test in the action
code then conditionally set shc, or to call a method from the action code with
whatever parameters are necessary for it to compute whether it should set shc 
or not.

Regards, Mark

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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to