[antlr-interest] Re: C# CommonAST class and Clone()

Ney, Richard richard.ney at aspect.com
Tue Mar 18 22:50:07 PST 2003


Okay,

I have seen the code that uses reflection to create AST nodes and tokens.
Now that I know clone is no longer used by ANTLR directly I have implemented
it to do a complete clone of the tree. I needed this since I have two
parsers, one that handles an expression language and another that handles
SQL. When the SQL is parsed I often take pre-processed ASTs of the
expression language and create new trees. This required a way to clone the
original trees so to not corrupt them. We may want make ASTs fully clonable
in the next release.

-Richard

-----Original Message-----
From: micheal_jor [mailto:open.zone at virgin.net] 
Sent: Tuesday, March 18, 2003 9:04 PM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Re: C# CommonAST class and Clone()

> Michael,
> 
>  
> 
> Was there a reason CommonAST.Clone() wasn't implemented with calls 
that
> descend the entire AST tree and clone it?

<scratches-head>
Is Clone() still used by ANTLR C# in 2.7.2?
I'm away from the ANTLR C# code presently...
</scratches-head>

Yes. The semantics of node cloning in ANTLR excludes that feature. 
Pls see previous related discussion on the list. 

IIRC, the copy-by-Clone() mechanism has now been replaced with a copy-
via-reflection mechanism. The Clone()-related code will be deprecated 
and excised in due course unless someone *needs* it. 

Cheers,

Micheal



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list