summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-08 23:09:07 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-08 23:09:07 +0100
commit8e6a49f377fc8a74c76f49e0cad4c6eeccc279b7 (patch)
treeae26978b3e2be9750df25d8bb3325367720f1413
parentParser: general cleanup (diff)
downloadinterpreter-8e6a49f377fc8a74c76f49e0cad4c6eeccc279b7.tar.gz
interpreter-8e6a49f377fc8a74c76f49e0cad4c6eeccc279b7.tar.bz2
interpreter-8e6a49f377fc8a74c76f49e0cad4c6eeccc279b7.zip
Misc: Dont crash REPL if parsing fails
-rw-r--r--src/main.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig
index e6de7f9..c8ebcfe 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -23,7 +23,9 @@ pub fn main() !void {
             const buf = try stdin.readUntilDelimiterAlloc(allocator, '\n', 1024);
             defer allocator.free(buf);
 
-            try process_buf(buf, allocator);
+            process_buf(buf, allocator) catch |err| {
+                try stdout.print("Error parsing line: {any}\n", .{err});
+            };
         }
     } else {
         std.debug.print("Tokenizing! {s}\n", .{path});