summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-10 00:50:35 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-10 00:50:35 +0100
commit498632ab5e03f6cafa68fbd6f967e00024e8a0ad (patch)
tree41983db0d044651c6c0b387f34cf38f5993b6ada
parentMisc: Support evaluating sequentially in REPL (diff)
downloadinterpreter-498632ab5e03f6cafa68fbd6f967e00024e8a0ad.tar.gz
interpreter-498632ab5e03f6cafa68fbd6f967e00024e8a0ad.tar.bz2
interpreter-498632ab5e03f6cafa68fbd6f967e00024e8a0ad.zip
Tokenizer: Fix parsing end-of-buf strings
-rw-r--r--src/tokenizer.zig2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/tokenizer.zig b/src/tokenizer.zig
index 688a32f..35da280 100644
--- a/src/tokenizer.zig
+++ b/src/tokenizer.zig
@@ -44,6 +44,8 @@ pub const Tokenizer = struct {
     fn consume_string(self: *Tokenizer) []u8 {
         const start = self.offset;
         while (true) {
+            if (self.offset >= self.buf.len) return self.buf[start..self.offset];
+
             const c = self.buf[self.offset];
 
             if (!std.ascii.isAlphanumeric(c)) return self.buf[start..self.offset];