fix body consume
This commit is contained in:
parent
11f810a5f3
commit
cf45f3f3ee
1 changed files with 7 additions and 4 deletions
|
@ -130,9 +130,10 @@ pub const Parser = struct {
|
|||
while (true) {
|
||||
var tok = self.peek();
|
||||
|
||||
if (tok.ttype == .RightParen) break;
|
||||
if (tok.ttype != .Identifier) {
|
||||
try self.doError("expected identifier, got {}", tok.ttype);
|
||||
switch (tok.ttype) {
|
||||
.RightParen => break,
|
||||
.Identifier => {},
|
||||
else => try self.doError("expected identifier, got {}", tok.ttype),
|
||||
}
|
||||
|
||||
var typetok = try self.nextToken();
|
||||
|
@ -145,9 +146,11 @@ pub const Parser = struct {
|
|||
|
||||
std.debug.warn("param! {}\n", param);
|
||||
try param_list.append(param);
|
||||
tok = try self.nextToken();
|
||||
}
|
||||
|
||||
// function body
|
||||
_ = try self.nextToken();
|
||||
_ = try self.consumeSingle(.LeftBrace);
|
||||
while (true) {
|
||||
var tok = self.peek();
|
||||
|
@ -183,7 +186,7 @@ pub const Parser = struct {
|
|||
if (token.ttype == .EOF) break;
|
||||
|
||||
var node = try self.processToken(token);
|
||||
std.debug.warn("{}\n", node.*);
|
||||
std.debug.warn("node: {}\n", node.*);
|
||||
try root.Root.append(node);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue