diff options
| author | Baitinq <[email protected]> | 2025-05-10 13:25:41 +0200 |
|---|---|---|
| committer | Baitinq <[email protected]> | 2025-05-10 13:25:50 +0200 |
| commit | 36f0b2f486fbec48972a96581576b5008062be6f (patch) | |
| tree | a3a74d72aea5df49059e7f14a63f17c62154ea42 /src/main.zig | |
| parent | Misc: Add gitattributes (diff) | |
| download | pry-lang-36f0b2f486fbec48972a96581576b5008062be6f.tar.gz pry-lang-36f0b2f486fbec48972a96581576b5008062be6f.tar.bz2 pry-lang-36f0b2f486fbec48972a96581576b5008062be6f.zip | |
Feature: Add support for imports
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/main.zig b/src/main.zig index 5ddd750..79def61 100644 --- a/src/main.zig +++ b/src/main.zig @@ -25,26 +25,19 @@ pub fn main() !void { defer source_codegen.deinit(); try process_buf( buf, - allocator, arena.allocator(), source_codegen, + path, ); source_codegen.compile(); } -fn process_buf(buf: []u8, allocator: std.mem.Allocator, arena: std.mem.Allocator, source_codegen: ?*codegen.CodeGen) !void { +fn process_buf(buf: []u8, arena: std.mem.Allocator, source_codegen: ?*codegen.CodeGen, filename: []const u8) !void { std.debug.print("Buf:\n{s}\n", .{buf}); - var token_list = std.ArrayList(tokenizer.Token).init(allocator); - defer token_list.deinit(); - var source_tokenizer = try tokenizer.Tokenizer.init(buf, arena); - while (try source_tokenizer.next()) |token| { - std.debug.print("{any}\n", .{token}); - try token_list.append(token); - } - - const source_parser = try parser.Parser.init(token_list.items, arena); + const token_list = try source_tokenizer.tokenize(); + const source_parser = try parser.Parser.init(token_list, arena, filename); const ast = try source_parser.parse(); std.debug.print("AST: {any}\n", .{ast}); |