summaryrefslogtreecommitdiff
path: root/tokenizer.c
diff options
context:
space:
mode:
Diffstat (limited to 'tokenizer.c')
-rw-r--r--tokenizer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tokenizer.c b/tokenizer.c
index d2bf87f..4c1d31a 100644
--- a/tokenizer.c
+++ b/tokenizer.c
@@ -13,7 +13,8 @@ static const char *keywords[KW_COUNT] =
"new", "del", "struct",
"int", "i8", "i16", "i32", "i64",
"u8", "u16", "u32", "u64", "float", "f32", "f64", "Type",
- "char", "bool", "true", "false"};
+ "char", "bool", "true", "false",
+ "pkg"};
static inline const char *kw_to_str(Keyword k) { return keywords[k]; }
@@ -542,6 +543,10 @@ static void tokr_skip_semicolon(Tokenizer *t) {
}
}
+static inline void tokr_skip_to_eof(Tokenizer *t) {
+ while (t->token->kind != TOKEN_EOF) ++t->token; /* move to end of file */
+}
+
/* only frees tokens, not string literals (because those are on the allocator). */
static void tokr_free(Tokenizer *t) {
arr_clear(&t->tokens);