[antlr-interest] Changes in ASTFactory breaks custom AST classes

Ric Klaren klaren at cs.utwente.nl
Tue Dec 10 03:12:19 PST 2002


On Mon, Dec 09, 2002 at 12:14:26PM -0800, Terence Parr wrote:
> On Monday, December 9, 2002, at 02:16  AM, Ric Klaren wrote:
> >> The problem (at least for me) lies in the fact that the duplicated
> >> node gets only initialized with the type and text! All other
> >> information stored in the original node is lost. I now simply
> >> override dup(AST) too, changing it back to the old behavior (I only
> >> use homogenous trees) but I'd rather expect dup(AST) to initialize the
> >> duplicated node via dup_t.initialize(t) or am I missing something
> >> here?
> >
> > Hmmm I really think that should not be an initialize in there.

Forget silly me I should read then reply ;)

> The only problem is that in java, clone will dup the thing bit-by-bit
> and then I'll have to wack the pointers to null and also it won't go
> thru the create() method of the factory.

Yeah, that's why the copy constructor in C++ does not copy the left/right

> Gotta be consistent I'd say. Make sense?

Hmmm C++ mode does not go through create for the dups but does straight
clones. Consistency is a point yes. Then again I don't really like the dups
in the factory. I'll have a look one of these days.


    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
  Before they invented drawing boards, what did they go back to?


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

More information about the antlr-interest mailing list