Clean up reflection a bit, and how we do pretty printing of ast nodes. Registered new internal_to_string in reflection module so that we

can have automatic pretty printing of ast nodes during repl eval.
This commit is contained in:
Jonathan Turner
2010-08-30 13:37:50 +00:00
parent 054179ead3
commit cfa42158af
4 changed files with 24 additions and 13 deletions

View File

@@ -538,17 +538,6 @@ namespace chaiscript
return engine;
}
/**
* Prints the contents of an AST node, including its children, recursively
*/
void debug_print(AST_NodePtr t, std::string prepend = "") {
std::cout << prepend << "(" << ast_node_type_to_string(t->identifier) << ") "
<< t->text << " : " << t->start.line << ", " << t->start.column << std::endl;
for (unsigned int j = 0; j < t->children.size(); ++j) {
debug_print(t->children[j], prepend + " ");
}
}
/**
* Helper function for loading a file
*/