[antlr-interest] Modifying AST

erandi lakshika erasuru at gmail.com
Sun May 11 21:01:39 PDT 2008


Thanks... I found another method which can be used to easily duplicate AST
objects. Here is the code snippet;
  *ASTFactory app = new ASTFactory();
  AST dupAttach  = app.dupTree(attach);
*
On Sat, May 10, 2008 at 9:36 AM, Dan Delorey <antlr at deloreyfamily.org>
wrote:

> I don't know if this is the preferred method, but I've used
> adaptor.dupTree()<http://www.antlr.org/api/Java/interfaceorg_1_1antlr_1_1runtime_1_1tree_1_1_tree_adaptor.html#ae053199c6552b68362d3a8b8d964d22>and
> adaptor.becomeRoot()<http://www.antlr.org/api/Java/interfaceorg_1_1antlr_1_1runtime_1_1tree_1_1_tree_adaptor.html#2caa60c49f05e8fb8d7541755b086ce5>to accomplish that.
>
>
> On Sat, May 10, 2008 at 2:24 AM, erandi lakshika <erasuru at gmail.com>
> wrote:
>
>> I am dealing with a AST of a language and I want to insert multiple
>> sub-trees of an AST into my original AST at multiple nodes. For that I want
>> to make copies of the subtree. How can I do this?
>>
>> --
>> Regards
>>  -Erandi-
>
>
>


-- 
Regards
-Erandi-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080511/3d84b54b/attachment.html 


More information about the antlr-interest mailing list