feat: parsing a decent chunk of the ink grammar

This commit is contained in:
Brett Broadhurst 2026-02-26 19:11:12 -07:00
parent 5268a53148
commit 4ebdd3c66e
Failed to generate hash of commit
3 changed files with 988 additions and 7 deletions

View file

@ -13,7 +13,11 @@ pub const Story = struct {
source_bytes: [:0]const u8,
options: LoadOptions,
) !Story {
var ast = try Ast.parse(gpa, source_bytes, "<STDIN>", 0);
var arena_allocator = std.heap.ArenaAllocator.init(gpa);
defer arena_allocator.deinit();
const arena = arena_allocator.allocator();
var ast = try Ast.parse(gpa, arena, source_bytes, "<STDIN>", 0);
defer ast.deinit(gpa);
try ast.render(gpa, options.stream_writer, .{
@ -27,6 +31,7 @@ pub const Story = struct {
}
return .{};
}
pub fn deinit(_: *Story) void {}
};