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

@@ -103,19 +103,22 @@ namespace chaiscript
/**
* Prints the parsed ast_nodes as a tree
*/
/*
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 + " ");
}
}
*/
/**
* Shows the current stack of matched ast_nodes
*/
void show_match_stack() {
for (unsigned int i = 0; i < match_stack.size(); ++i) {
debug_print(match_stack[i]);
//debug_print(match_stack[i]);
std::cout << match_stack[i]->to_string();
}
}