Compare commits
2 commits
126bd476d6
...
d69365ba92
Author | SHA1 | Date | |
---|---|---|---|
d69365ba92 | |||
79107f876b |
2 changed files with 6 additions and 4 deletions
|
@ -48,9 +48,9 @@ pub fn printNode(node: *const Node, ident: usize) void {
|
||||||
const typ = method.typ.lexeme;
|
const typ = method.typ.lexeme;
|
||||||
|
|
||||||
if (method.mutable) {
|
if (method.mutable) {
|
||||||
warn("(method mut {} {} {} {} ", vari, typ, name, ret_type);
|
warn("(method mut {} {} {} {} (", vari, typ, name, ret_type);
|
||||||
} else {
|
} else {
|
||||||
warn("(method {} {} {} {} ", vari, typ, name, ret_type);
|
warn("(method {} {} {} {} (", vari, typ, name, ret_type);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warn("(fn {} {} (", name, ret_type);
|
warn("(fn {} {} (", name, ret_type);
|
||||||
|
@ -59,9 +59,10 @@ pub fn printNode(node: *const Node, ident: usize) void {
|
||||||
for (decl.params.toSlice()) |param| {
|
for (decl.params.toSlice()) |param| {
|
||||||
warn(" ({} {})", param.name.lexeme, param.typ.lexeme);
|
warn(" ({} {})", param.name.lexeme, param.typ.lexeme);
|
||||||
}
|
}
|
||||||
|
warn(") ");
|
||||||
|
|
||||||
printBlock(ident + 1, decl.body, false);
|
printBlock(ident + 1, decl.body, false);
|
||||||
warn(")\n");
|
warn("\n");
|
||||||
},
|
},
|
||||||
|
|
||||||
.ConstDecl => |consts| {
|
.ConstDecl => |consts| {
|
||||||
|
|
|
@ -679,6 +679,7 @@ pub const Parser = struct {
|
||||||
while (self.peek().typ != .RightBrace) {
|
while (self.peek().typ != .RightBrace) {
|
||||||
var stmt = try self.parseStmt();
|
var stmt = try self.parseStmt();
|
||||||
printer.printNode(try self.mkStmt(stmt), 0);
|
printer.printNode(try self.mkStmt(stmt), 0);
|
||||||
|
_ = try self.consumeSingle(.Semicolon);
|
||||||
try stmts.append(stmt.*);
|
try stmts.append(stmt.*);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue