[antlr-interest] ASTFactory.dup*

Terence Parr parrt at jguru.com
Sun Dec 23 13:52:22 PST 2001


On Sunday, December 23, 2001, at 02:07  AM, Andreas Rueckert wrote:

> Hi!
>
> I just learned yesterday, that the dup* methods don't work as expected, 
> if you
> use various types of AST nodes and cannot set the default AST type 
> therefore.
> They return a CommonAST node, instead of the typ, that is passed to 
> them. I've
> already found a workaround for me, but maybe using some clone() method 
> in the
> dup* methods would be better?

Ouch.  Good point.  dup should pay attention to types...hmmm...I wonder 
how that can be made efficient.  Oh, each heterogeneous AST node must 
define dup or clone or whatever.

Anybody remember why I used dup instead of clone?  Probably a type issue 
since I hate typecasting return types from clone() etc...

Ter
--
Chief Scientist & Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org


 

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



More information about the antlr-interest mailing list