Re: Re: The Array type

Stefan Seefeld <[email protected]>
Newsgroups gmane.comp.documentation.synopsis
Message-ID <[email protected]>
Luke Petre wrote:

> I was able to implement a fix without getting into the decoder, although 
> I'm still a bit unsure if this is the correct approach.  Basically I 
> started by finding all the places in the code where we could encode type 
> Array.  I found two places, both in Parser.cc, lines 1784 and 3648.  
> Directly below the calls to encode the array type the parser makes new 
> Ptree nodes, inserting them into the current parse tree.  What I did was 
> to change the types of nodes it was creating so that it would create 
> PtreeArrayExpr nodes instead.  changing lines like this:
> 
>  decl = Ptree::Nconc(decl, Ptree::List(new Leaf(ob), exp, new Leaf(cb)));
> 
> to this:
> 
>  decl = Ptree::Nconc(decl, new PtreeArrayExpr(Ptree::List(new Leaf(ob), 
> exp, new Leaf(cb)), 0));
> 
> 
> and then in swalker.cc, around line 1135 I was able to search for the 
> PtreeArrayExpr types in the parse tree.

right, that's about the best you can do in the current design. Depending
on how adventurous you feel you may want to get involved in the refactoring
I'm doing right now, so may be we can come up with a more clean solution.
One of the goals is to somehow make the ptree API more typed, so downcasts
and the like are not necessary. (Not to speak of a real AST API that would
make these things even more concise and straight forward.)

Regards,
		Stefan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.