2008/12/2 Terence Parr <[EMAIL PROTECTED]>: > > On Dec 2, 2008, at 2:58 AM, Oliver Zeigermann wrote: >> >> Here is what I want to do: >> >>>> Traverse a *full tree* (i.e. from tree root down to each and every >>>> leaf), having access to each and every single node and handle certain nodes >>>> differently.<< >> >> How would you do that? My grammar above would do the job (I know as it >> used to work in ANTLR 2). > > You are looking at the tree as a node stream, which is fine. A simple tree > visitor does that. A grammar specify structure; don't use a grammar to > serialize a tree. The new tree pattern matching is what you want. Just list > all of the special nodes and given action or a rewrite. Will that work for > you?
It will work and it does work with the new tree pattern matching. My problem is already solved. But more generally: Why not using a grammar to serialize a tree (given there are some structure sensitive exceptions?). Is it really that hard to implement that root wildcard? Maybe just for the sake of completeness? Anyway, I won't bother any more. Oliver List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org:8080/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 -~----------~----~----~----~------~----~------~--~---
