Gary, Hope things are good and that your product is coming along nicely!
The best way to deal with this to have your main including grammar implement a superclass, then all the other grammars will inherit it. That is where all your extra code and variables go and it works better that way. If you use Maven, my archetype will create this structure for you out of the box. Don’t put anything in the .g files that you can put in the super class. Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Gary Miller > Sent: Wednesday, March 09, 2011 7:15 PM > To: [email protected] > Subject: Re: [antlr-interest] Composite Tree Grammars are things of > beauty, but ... > > Hey Terrance, > > tree grammar T; > a : some horrible mess of a RECURSIVE rule; b : B ; > > tree grammar U; > import T; > a : {pre action} T.a {post action}; // <-- wants to be able to refer to > super rule > > It wouldn't be enough to just expose the super rule T.a. > In the generated walker A_T the rule 'a' would need to call the > delegators.a(). > > > ANTLR technically doesn't expose x.y syntax to the user and so I > didn't recognize the fact that you invoked the super rule. It > extracted only those rules from your super grammar that it needed. It > does this so that you can fill up libraries of grammars with rules and > then pick out which ones you want without bloating your generated code. > > Thanks for raising the issue. > Based on my bias ("Composite Tree Grammars are things of beauty") I > would hope for more than a minor ;-) How do I get a login the JIRA so > that I can follow issues? > > > That said, I am adding an improvement request for consideration. > > > > http://www.antlr.org/jira/browse/ANTLR-452 > > Sorry, I can't parse this. Are you saying that you would like to > removed imports from ANTLR? > > > I'd like to retract or how ANTLR it handles imports anyway. > > Regards > Gary > > P.S. is there any reason for ANTLR over Antlr | AntLR | AntLr | antlr > etc. > > 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.
