From: Baptiste L. <gai...@fr...> - 2002-11-27 19:32:01
|
----- Original Message ----- From: "Sven Reichard" <rei...@ma...> To: "CppTool Mailing List" <Cpp...@li...> Sent: Tuesday, November 26, 2002 5:52 PM Subject: Re: [Cpptool-develop] Dealing with scope... > On Sun, 24 Nov 2002, Baptiste Lepilleur wrote: > > I think you are underestimating the complexity of matching scope to a part > > of the tree. For example, the AST structure of a for statement is: > > > > for ( int x= 1; x < 3; ++x ) > > doStuff( x ); > > > > [for-statement] > > iteration-property => [declaration-or-expression] = ( int x= > > 1; x < 3; ++x ) > > iteration-statement-property => [statement] = > > doStuff( x ); > > > > As you can see, the iterated statement is not a child of the for iteration > > declaration node. Also, there is no guaranty concerning the order properties > > are visited (at the current time they are stored in a vector, which means > > you get them in the order they were added, but it is an implementation > > detail that we should not depend uppon). > > I see. I had the idea that you could easily access the initializer > statement of a for statement. Still, I'll try out my idea. You can, but the both the initializer and the iteration statement are properties of the for statement, so you can't rely on the recursive aspect only to resolve scope. Baptiste. |