aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer.cpp
diff options
context:
space:
mode:
authorMatthew McAllister <matthew.mcallister.0@gmail.com>2019-01-29 16:20:38 -0800
committerAndrew Kelley <andrew@ziglang.org>2019-01-30 14:02:01 -0500
commitad8381e0d2936ffecaa0b54e51e26d6bdb98682e (patch)
treeb7a51c0044311876c296f30a2e46762f6a80e0ad /src/tokenizer.cpp
parentecb0cb661a75a130cf6978fa42d464e2d654d8df (diff)
downloadzig-ad8381e0d2936ffecaa0b54e51e26d6bdb98682e.tar.gz
zig-ad8381e0d2936ffecaa0b54e51e26d6bdb98682e.zip
Move tokenizer error location to offending char
Previously, it pointed to the start of the current token, but this made it difficult to tell where the error occurred when it was, say, in the middle of a string.
Diffstat (limited to 'src/tokenizer.cpp')
-rw-r--r--src/tokenizer.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp
index 6215541876..d43bfabf6d 100644
--- a/src/tokenizer.cpp
+++ b/src/tokenizer.cpp
@@ -248,13 +248,8 @@ ATTRIBUTE_PRINTF(2, 3)
static void tokenize_error(Tokenize *t, const char *format, ...) {
t->state = TokenizeStateError;
- if (t->cur_tok) {
- t->out->err_line = t->cur_tok->start_line;
- t->out->err_column = t->cur_tok->start_column;
- } else {
- t->out->err_line = t->line;
- t->out->err_column = t->column;
- }
+ t->out->err_line = t->line;
+ t->out->err_column = t->column;
va_list ap;
va_start(ap, format);