diff --git a/src/parse.zig b/src/parse.zig index f4d6d12..92392dc 100644 --- a/src/parse.zig +++ b/src/parse.zig @@ -253,6 +253,12 @@ const Parser = struct { // TODO: class definition (inheritance). fn parseClass(p: *Parser) !void { + if (p.indent > 0) { + p.say("INNER parseClass\n", .{}); + } + else { + p.say("TOP parseClass\n", .{}); + } p.indent += 1; defer { p.indent -= 1; } @@ -280,11 +286,14 @@ const Parser = struct { // TODO: parsing class content. // TODO: loop over this. const token = p.nextToken(); + p.say("(top class reading) reading token: {}\n", .{p.giveTokenContent(token)}); switch (p.token_ids[token]) { .Identifier => { const following = p.nextToken(); switch (p.token_ids[following]) { + // Class header (with or without id). + .LParen, .LBrace => { p.putBackToken(following); p.putBackToken(token); @@ -306,6 +315,9 @@ const Parser = struct { else => { // Wasn't expected. // Couln't understand what was in this class. + p.say("did not understand {} then {}\n" + , .{ p.giveTokenContent(token) + , p.giveTokenContent(following)}); p.putBackToken(following); p.putBackToken(token); break; @@ -317,6 +329,8 @@ const Parser = struct { p.say("Reading a property\n", .{}); p.putBackToken(token); try p.parseProperty(); + p.say("Done reading a property\n", .{}); + continue; }, .LBrace => { @@ -325,7 +339,7 @@ const Parser = struct { .RBrace => { p.say("Reading a RBrace\n", .{}); - // p.putBackToken(token); + p.putBackToken(token); break; },