Do you have some pointers to classes and methods. I have trouble finding a visitor that does this on a bigger structure.
RBProgramNodeVisitor>>#visitNode:, RBProgramNode>>#acceptVisitor: and its subclass implementors. The only part of the code that is using the return value of #visitNode: is RBParseTreeSearcher and RBParseTreeRewriter. Maybe they are a bit complicated examples, because the new tree nodes are not built/modified in the visitor itself but in the matching rules triggered in #performSearches:on:. The matching rules then start new visitors for the child nodes, if necessary. A more strait-forward implementation of what you are looking for can be found in PPNodeFormatter of the package 'PrettyPetit' in the PetitParser repository. PPNodeFormatter is a subclass of RBProgramNodeVisitor and it converts the standard RB AST to a layout box model AST for formatting. There you see that for each RB AST node one or more document nodes are composed and returned. The parent-child relationship is setup automatically when composing the objects (in this example only one way, but you could change that to also include the link from the child to the parent). Lukas -- Lukas Renggli www.lukas-renggli.ch