index 920b809ce28e65417ee4ffb2a56dd3e30f4ba4ac..37198f0cd803fc3545b7b1b9855b1c9587c131e8 100644 (file)
return $this->nodes_[$node_id];
}
- function getLastNode($parent_id)
- {
- $childs = $this->getChilds($parent_id);
-
- for ($i=count($childs); $i>0; --$i)
- {
- $node = $this->getNode($childs[$i-1]);
- if ($node['text'] == '{')
- {
- // return command owning the block
- return $this->getNode($parent_id);
- }
- if ($node['class'] != 'comment')
- {
- return $node;
- }
- }
-
- return $this->getNode($parent_id);
- }
-
function setDumpFunc($callback)
{
if ($callback == NULL || is_callable($callback))
if ($last)
{
$infix = '`--- ';
- $c_prefix = $prefix . ' ';
+ $child_prefix = $prefix . ' ';
}
else
{
$infix = '|--- ';
- $c_prefix = $prefix . '| ';
+ $child_prefix = $prefix . '| ';
}
$node = $this->nodes_[$node_id];
$this->dump_ .= "$prefix$infix$node\n";
}
- $childs = $this->childs_[$node_id];
- for ($i=0; $i<count($childs); ++$i)
+ if (isset($this->childs_[$node_id]))
{
- $c_last = false;
- if ($i+1 == count($childs))
+ $childs = $this->childs_[$node_id];
+ $last_child = count($childs);
+
+ for ($i=1; $i <= $last_child; ++$i)
{
- $c_last = true;
+ $this->doDump_($childs[$i-1], $child_prefix, ($i == $last_child ? true : false));
}
-
- $this->doDump_($childs[$i], $c_prefix, $c_last);
}
}
}
-?>
+?>
\ No newline at end of file