diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2025-01-08 23:09:07 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2025-01-08 23:09:07 +0100 |
commit | 8e6a49f377fc8a74c76f49e0cad4c6eeccc279b7 (patch) | |
tree | ae26978b3e2be9750df25d8bb3325367720f1413 /src | |
parent | Parser: general cleanup (diff) | |
download | interpreter-8e6a49f377fc8a74c76f49e0cad4c6eeccc279b7.tar.gz interpreter-8e6a49f377fc8a74c76f49e0cad4c6eeccc279b7.tar.bz2 interpreter-8e6a49f377fc8a74c76f49e0cad4c6eeccc279b7.zip |
Misc: Dont crash REPL if parsing fails
Diffstat (limited to 'src')
-rw-r--r-- | src/main.zig | 4 |
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}); |