Fix log header generation and EOF location reporting
This commit is contained in:
+5
-13
@@ -182,19 +182,11 @@ Token tokenstream_next(TokenStream* ts) {
|
||||
t.text.length = 0;
|
||||
t.location.filename = ts->filename;
|
||||
|
||||
if (ts->pos > 0 && ts->code[ts->pos - 1] == '\n') {
|
||||
t.location.line = ts->line;
|
||||
t.location.column_start = 1;
|
||||
t.location.column_end = 1;
|
||||
t.location.line_text.data = (char*)ts->line_start;
|
||||
t.location.line_text.length = get_line_length(ts->line_start);
|
||||
} else {
|
||||
t.location.line = ts->last_line;
|
||||
t.location.column_start = ts->last_column_end + 1;
|
||||
t.location.column_end = ts->last_column_end + 1;
|
||||
t.location.line_text.data = (char*)ts->last_line_start;
|
||||
t.location.line_text.length = get_line_length(ts->last_line_start);
|
||||
}
|
||||
t.location.line = ts->last_line;
|
||||
t.location.column_start = ts->last_column_end + 1;
|
||||
t.location.column_end = ts->last_column_end + 1;
|
||||
t.location.line_text.data = (char*)ts->last_line_start;
|
||||
t.location.line_text.length = get_line_length(ts->last_line_start);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user