It's been awhile since I've written grammars, but what about: code: (proc | func)* -> ^(CODE ^(PROCS proc*) ^(FUNCS func*))
I seem to recall that this works fairly well... ------Original Message------ From: J. Stephen Riley Silber Sender: [email protected] To: Damien Cassou Cc: [email protected] Subject: Re: [antlr-interest] Collecting disparate subtrees into one tree? Sent: Jul 1, 2009 7:00 AM Hi Damien, > doesn't something like this work? > > code: procs* funcs* > -> ^(CODE ^(PROCS procs*) ^(FUNCS funcs*)) > I don't think it would, because it still requires that procs be grouped together in the source code, as well as funcs. Something like code: (proc | func)* would be more accurate, but then I still have my same tree problem. Though your idea did trigger some vague notion in my brain meaties that maybe I can do a combo top-down and bottom-up visitor to bubble procs and funcs apart... I'll have to think about this. Other ideas? --S List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address Sent via BlackBerry by AT&T 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 -~----------~----~----~----~------~----~------~--~---
