I suspect that you are approaching this problem incorrectly in some way. Why do you feel you need to specify a new token at the AST stage? Why don't you restate your goal, ignoring what you have done so far - I suspect that we may be trying to solve a problem that you should not have.
Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Courtney Falk > Sent: Monday, May 02, 2011 5:29 AM > To: [email protected] > Subject: Re: [antlr-interest] Rematching AST Nodes > > > > You grammar doesn't have an 'aaa' token. It does have CHARACTERS > > tokens. If 'aaa' is special, then you need to match it in your > > grammar like a keyword. Then you can reference it in your tree > grammar. > > Otherwise you will need to match any CHARACTERS token in your rematch > > rule and do what you need to when the value is 'aaa' and do something > > else when it is not. > > > > Your tree grammars can only work with the tokens your lexers produce > > (and the same set that your parsers use as well). > > That's unfortunate. I'm working on a workaround using semantic > predicates. The huge downside is that I have to implement in a > separate piece of Java code the boolean validation function for the > semantic predicate. Then in a second separate piece of Java code I > implement the string parsing function. This solution is far less > elegant than implementing everything as ANTLR logic. > > > Court > > 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.
