Add column number

This commit is contained in:
augustin64 2024-01-04 19:39:31 +01:00
parent 19116dcbd0
commit ac191716d9

View File

@ -76,10 +76,11 @@ void print_error_position(vector<string> history, CodePosition pos) {
void print_error_stack_trace(vector<string> history, const RuntimeError& error) { void print_error_stack_trace(vector<string> history, const RuntimeError& error) {
cout << "\n" BOLD "Traceback" RESET " (most recent call last)" << endl; cout << "\n" BOLD "Traceback" RESET " (most recent call last)" << endl;
for (StackTraceEntry e : error.trace) { for (StackTraceEntry e : error.trace) {
cout << BOLD << setw(4) << setfill(' ') cout << BOLD << setw(8) << setfill(' ')
<< get<1>(e).line+1 << RESET BLUE << to_string(get<1>(e).line+1) + ":" + to_string(get<1>(e).column+1)
<< RESET BLUE
<< setw(16) << setfill(' ') << setw(16) << setfill(' ')
<< get<0>(e) << RESET << "\t" << get<0>(e) << RESET << " \t"
<< trim(history[get<1>(e).line]) << endl; << trim(history[get<1>(e).line]) << endl;
} }