summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-19 16:52:49 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-19 16:52:49 +0100
commit01498853a2853cd02143391eac28bfc200734dbb (patch)
tree92c90ef0ab61a7edb9e4fdf712657054a74d18f6
parentFeature: Add basic support for equality expression (diff)
downloadinterpreter-01498853a2853cd02143391eac28bfc200734dbb.tar.gz
interpreter-01498853a2853cd02143391eac28bfc200734dbb.tar.bz2
interpreter-01498853a2853cd02143391eac28bfc200734dbb.zip
Bug: Fix bug with accept_parse
-rw-r--r--src/parser.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/parser.zig b/src/parser.zig
index 1014ba4..f87c406 100644
--- a/src/parser.zig
+++ b/src/parser.zig
@@ -377,12 +377,14 @@ pub const Parser = struct {
 
     fn accept_parse(self: *Parser, parsing_func: *const fn (_: *Parser) ParserError!*Node) ?*Node {
         const prev_offset = self.offset;
+        const prev_try_context = self.try_context;
         self.try_context = true;
         const node = parsing_func(self) catch {
             self.offset = prev_offset;
+            self.try_context = prev_try_context;
             return null;
         };
-        self.try_context = false;
+        self.try_context = prev_try_context;
         return node;
     }