diff options
| author | Baitinq <[email protected]> | 2025-01-08 21:32:26 +0100 |
|---|---|---|
| committer | Baitinq <[email protected]> | 2025-01-08 21:32:26 +0100 |
| commit | 26c258b0157e4e4e0b3005496828a406f49f609d (patch) | |
| tree | 7a8b144b44e9968930bf9ae40f751ec541805541 /src/parser.zig | |
| parent | Parser: Prepare for variable statement parsing (diff) | |
| download | pry-lang-26c258b0157e4e4e0b3005496828a406f49f609d.tar.gz pry-lang-26c258b0157e4e4e0b3005496828a406f49f609d.tar.bz2 pry-lang-26c258b0157e4e4e0b3005496828a406f49f609d.zip | |
Parser: Use arena allocator
Diffstat (limited to 'src/parser.zig')
| -rw-r--r-- | src/parser.zig | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/parser.zig b/src/parser.zig index 7fb6372..e855cbd 100644 --- a/src/parser.zig +++ b/src/parser.zig @@ -49,31 +49,6 @@ pub const Parser = struct { return parser; } - //TODO: We maybe should use an arena alocator or smth - pub fn deinit(self: *Parser, ast: ?*Node) void { - if (ast != null) { - std.debug.assert(ast.?.* == .PROGRAM); - for (ast.?.PROGRAM.statements) |statement| { - switch (statement.*) { - .STATEMENT => |x| { - switch (x.statement.*) { - .PRINT_STATEMENT => |p| { - self.allocator.destroy(p.expression); - }, - else => @panic("NOT IMPLEMENTED"), - } - self.allocator.destroy(x.statement); - }, - else => @panic("NOT IMPLEMENTED"), - } - self.allocator.destroy(statement); - } - self.allocator.free(ast.?.PROGRAM.statements); - self.allocator.destroy(ast.?); - } - self.allocator.destroy(self); - } - pub fn parse(self: *Parser) !*Node { return self.parse_program(); } |