33 #include "lib/charbuf.h" 35 #if defined(DEBUGTREE) 37 Viewer::Viewer(SyntaxNode* root)
40 output =
new CharBuffer();
48 char* Viewer::GetTree()
const 50 output->ClearBuffer();
52 output->EnsureGrowth(42);
54 output->Append(
'-', 40);
57 return output->GetString();
60 void Viewer::Structure(SyntaxNode* node,
int level)
const 64 output->EnsureGrowth(1);
69 node->ResetIterator();
70 Structure(node->GetNext(), level + 1);
71 output->EnsureGrowth(level + StrLen(node->GetTextCode() + 1));
72 output->Append(
'\t', level);
73 output->Append(node->GetTextCode());
75 Structure(node->GetNext(), level + 1);