Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions parser/c2_tokenizer.c2
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,7 @@ fn void Tokenizer.num_error(Tokenizer* t, Token* result, const char* p, const ch
vsnprintf(t.error_msg, sizeof(t.error_msg), format, args);
va_end(args);

// XXX: error position should be passed separately from token start
result.loc = t.loc_start + (SrcLoc)(p - t.input_start);
SrcLoc err_loc = t.loc_start + (SrcLoc)(p - t.input_start);
// read the rest of the pp-number token
for (;;) {
if ((*p == 'e' || *p == 'E' || *p == 'p' || *p == 'P') && (p[1] == '+' || p[1] == '-')) {
Expand All @@ -712,7 +711,7 @@ fn void Tokenizer.num_error(Tokenizer* t, Token* result, const char* p, const ch
}
t.cur = p;
result.len = (u16)((p - t.input_start) - (result.loc - t.loc_start));
if (t.on_warning) t.on_warning(t.fn_arg, result.loc);
if (t.on_warning) t.on_warning(t.fn_arg, err_loc);
}

fn void Tokenizer.lex_identifier(Tokenizer* t, Token* result) {
Expand Down
Loading