Pass in the type as a parameter and use conditional rewrites or use the parameter as the node type in the rewrite.
Jim On Sep 4, 2009, at 12:09 AM, Elnur Cabarov <[email protected]> wrote: > Hi, > > I've got a rule that is called from multiple other rules. I want > dynamically modify AST node for every invocation. > > For example: > > variable > : type ID -> ^(VARIABLE type ID); > > I want VARIABLE node be dynamic, that is it can also be PARAMETER > when called from somewhere else. > My case is not as simple as this, so duplicating rules is not > acceptable. > Also I'd prefer use dynamic attribute scopes, because rules are > nested into many levels and rule attributes are not desirable too :) > > Thanks > > -- > Elnur Cabarov > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address 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 -~----------~----~----~----~------~----~------~--~---
