feat: parse module
This commit is contained in:
parent
5337ba48a4
commit
fb30e1195e
@ -34,5 +34,6 @@ Now in Zig!
|
||||
- [x] Parse minimal expression
|
||||
- [x] Parse minimal variable binding
|
||||
- [x] Parse minimal statement
|
||||
- [x] Parse minimal module
|
||||
|
||||
|
||||
|
@ -40,6 +40,7 @@ pub fn build(b: *std.Build) void {
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
syntax_module.addImport("lexic", lexic_module);
|
||||
exe.root_module.addImport("syntax", syntax_module);
|
||||
|
||||
// This declares intent for the executable to be installed into the
|
||||
@ -92,9 +93,6 @@ pub fn build(b: *std.Build) void {
|
||||
const files = [_][]const u8{
|
||||
"src/01_lexic/root.zig",
|
||||
"src/02_syntax/root.zig",
|
||||
"src/02_syntax/variable.zig",
|
||||
"src/02_syntax/expression.zig",
|
||||
"src/02_syntax/statement.zig",
|
||||
};
|
||||
for (files) |file| {
|
||||
const file_unit_test = b.addTest(.{
|
||||
|
@ -68,6 +68,7 @@ test "should parse a variable declaration statement" {
|
||||
switch (statement.value) {
|
||||
.variableBinding => |v| {
|
||||
try std.testing.expectEqual(true, v.is_mutable);
|
||||
try std.testing.expectEqualDeep("my_variable", v.identifier.value);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -31,5 +31,8 @@ fn repl() !void {
|
||||
const tokens = try lexic.tokenize(line, alloc);
|
||||
defer tokens.deinit();
|
||||
|
||||
var module_ast: syntax.Module = undefined;
|
||||
try module_ast.init(&tokens, 0, alloc);
|
||||
|
||||
try bw.flush();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user