Use more space in _debug
This commit is contained in:
parent
6e1e6e2838
commit
df22a7f065
@ -9,14 +9,15 @@ EvalResult execute(vector<string> input, Memory& memory, int initial_line, ExecA
|
||||
vector<Token> tokens = tokenize(input, initial_line);
|
||||
|
||||
if (args.print_tokens) {
|
||||
cout << BOLD YELLOW " === TOKENS ===" RESET << endl;
|
||||
cout << BOLD YELLOW " ======= TOKENS =======" RESET << endl;
|
||||
|
||||
_debug_print_tokens(tokens);
|
||||
}
|
||||
|
||||
Node ast = parse(tokens);
|
||||
|
||||
if (args.print_ast) {
|
||||
cout << BOLD YELLOW " === AST ===" RESET << endl;
|
||||
cout << BOLD YELLOW " ======= AST =======" RESET << endl;
|
||||
_debug_print_tree(ast, 0, "");
|
||||
}
|
||||
|
||||
@ -24,14 +25,14 @@ EvalResult execute(vector<string> input, Memory& memory, int initial_line, ExecA
|
||||
analyze(ast, type_mem);
|
||||
|
||||
if (args.dump_type_mem) {
|
||||
cout << BOLD YELLOW " === TYPE MEMORY ===" RESET << endl;
|
||||
cout << BOLD YELLOW " ======= TYPE MEMORY =======" RESET << endl;
|
||||
type_mem._debug_print();
|
||||
}
|
||||
|
||||
EvalResult res = eval(ast, memory, input);
|
||||
|
||||
if (args.dump_mem) {
|
||||
cout << BOLD YELLOW " === MEMORY ===" RESET << endl;
|
||||
cout << BOLD YELLOW " ======= MEMORY =======" RESET << endl;
|
||||
memory._debug_print();
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
if ((print_tokens || print_ast || dump_type_mem || dump_mem) &&
|
||||
(holds_alternative<int>(res) || holds_alternative<double>(res))) {
|
||||
cout << BOLD BLUE " === RESULT ===" RESET << endl;
|
||||
cout << BOLD BLUE " ======= RESULT =======" RESET << endl;
|
||||
}
|
||||
|
||||
if (holds_alternative<int>(res)) {
|
||||
|
@ -181,13 +181,13 @@ void _debug_print_memory_var(MemoryVar var) {
|
||||
|
||||
void _debug_print_scope(Scope scope) {
|
||||
for (auto it : scope.vars) {
|
||||
if (it.first.length() > 6) {
|
||||
cout << it.first.substr(0, 6) << "..";
|
||||
if (it.first.length() > 14) {
|
||||
cout << it.first.substr(0, 14) << "..";
|
||||
} else {
|
||||
cout << setw (6) << it.first << " ";
|
||||
cout << setw (14) << it.first << " ";
|
||||
}
|
||||
cout << "|";
|
||||
cout << setw (7) << _debug_get_type_type_name(it.second.type.type) << " |";
|
||||
cout << setw (9) << _debug_get_type_type_name(it.second.type.type) << " |";
|
||||
|
||||
_debug_print_memory_var(it.second);
|
||||
cout << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user