diff options
| author | Baitinq <[email protected]> | 2025-01-10 00:44:56 +0100 |
|---|---|---|
| committer | Baitinq <[email protected]> | 2025-01-10 00:44:56 +0100 |
| commit | 2dbd3aa2942a5b48d92500801026226c5a6ca2db (patch) | |
| tree | 8294a4dbb53d83b1fd6050f54e20feec5967afbb /src/parser.zig | |
| parent | Evaluator: Implement variable declaration and definition and variable printing (diff) | |
| download | pry-lang-2dbd3aa2942a5b48d92500801026226c5a6ca2db.tar.gz pry-lang-2dbd3aa2942a5b48d92500801026226c5a6ca2db.tar.bz2 pry-lang-2dbd3aa2942a5b48d92500801026226c5a6ca2db.zip | |
Misc: Support evaluating sequentially in REPL
Diffstat (limited to 'src/parser.zig')
| -rw-r--r-- | src/parser.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/parser.zig b/src/parser.zig index 0db089f..d564924 100644 --- a/src/parser.zig +++ b/src/parser.zig @@ -103,7 +103,7 @@ pub const Parser = struct { return self.create_node(.{ .VARIABLE_STATEMENT = .{ .is_declaration = is_declaration, - .name = identifier.IDENTIFIER, + .name = try self.allocator.dupe(u8, identifier.IDENTIFIER), .expression = @constCast(expression), }, }); @@ -141,7 +141,7 @@ pub const Parser = struct { .IDENTIFIER => |identifier_token| self.create_node(.{ .EXPRESSION = .{ .IDENTIFIER = .{ - .name = identifier_token, + .name = try self.allocator.dupe(u8, identifier_token), }, }, }), |