summaryrefslogtreecommitdiff
path: root/tokenizer.c
diff options
context:
space:
mode:
Diffstat (limited to 'tokenizer.c')
-rw-r--r--tokenizer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tokenizer.c b/tokenizer.c
index 17fbde4..f155b9f 100644
--- a/tokenizer.c
+++ b/tokenizer.c
@@ -162,8 +162,8 @@ static int tokr_esc_seq(Tokenizer *t) {
static Location token_location(File *file, Token *t) {
Location loc;
- loc.start = t;
- loc.end = t + 1;
+ loc.start = (U32)(t - file->tokens);
+ loc.end = loc.start + 1;
loc.file = file;
return loc;
}
@@ -568,6 +568,7 @@ static Status tokenize_file(Tokenizer *t, File *file) {
token->kind = TOKEN_EOF;
t->token = t->tokens;
+ file->tokens = t->tokens;
return !has_err;
}