Java Reference
In-Depth Information
/
Assert: y
null
/
function
make
S
iblings
( y ) returns Node
/
Find the rightmost node in this list
/
xsibs this
while xsibs . rightSib null do xsibs xsibs . rightSib
/
Join the lists
/
ysibs y . le f tmostSib
xsibs . rightSib ysibs
/
Set pointers for the new siblings
/
ysibs . le f tmostSib xsibs . le f tmostSib
ysibs . parent xsibs . parent
while ysibs . rightSib
null do
ysibs ysibs . rightSib
ysibs . le f tmostSib xsibs . le f tmostSib
ysibs . parent xsibs . parent
return ysibs
end
/
Assert: y
null
/
function
( y ) returns Node
if this . le f tmostChild null
then this . le f tmostChild . makeSiblings( y )
else
ysibs y . le f tmostSib
this . le f tmostChild ysibs
while ysibs
adopt
C
hildren
null do
ysibs . parent this
ysibs ysibs . rightSib
end
Figure 7.13: Methods for building an AST.
 
Search WWH ::




Custom Search