ast: add stmt printing
This commit is contained in:
parent
86d8fe1a3a
commit
a4fa0e0cfc
1 changed files with 22 additions and 1 deletions
23
src/ast.zig
23
src/ast.zig
|
@ -142,7 +142,28 @@ pub fn printNode(node: *Node, ident: usize) void {
|
|||
}
|
||||
},
|
||||
|
||||
.Expr => |expr| printExpr(expr),
|
||||
.Expr => |expr| {
|
||||
printIdent(ident);
|
||||
printExpr(expr);
|
||||
std.debug.warn("\n");
|
||||
},
|
||||
|
||||
.Stmt => |stmt| blk: {
|
||||
switch (stmt.*) {
|
||||
.Println => |expr| blk2: {
|
||||
printIdent(ident);
|
||||
std.debug.warn("println(");
|
||||
printExpr(expr);
|
||||
std.debug.warn("\n");
|
||||
},
|
||||
|
||||
.Expr => |expr| {
|
||||
printIdent(ident);
|
||||
printExpr(expr);
|
||||
std.debug.warn("\n");
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
else => {
|
||||
print(ident, "unknown node: {}\n", node);
|
||||
|
|
Loading…
Reference in a new issue