| ... | ... | @@ -137,6 +137,10 @@ const Parser = struct { |
| 137 | 137 | std.debug.assert(std.mem.eql(u8, self.eat(.symbol), needle)); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | pub fn eatWord(comptime self: *Parser, comptime needle: string) void { |
| 141 | std.debug.assert(std.mem.eql(u8, needle, self.eat(.word))); |
| 142 | } |
| 143 | |
| 140 | 144 | pub fn doChildren(comptime self: *Parser) []const Value { |
| 141 | 145 | var ret: []const Value = &[_]Value{}; |
| 142 | 146 | |
| ... | ... | @@ -168,7 +172,7 @@ const Parser = struct { |
| 168 | 172 | var top = true; |
| 169 | 173 | while (!self.tryEatSymbol("/")) { |
| 170 | 174 | if (self.tryEatSymbol("<")) { |
| 171 | | std.debug.assert(std.mem.eql(u8, "else", self.eat(.word))); |
| 175 | self.eatWord("else"); |
| 172 | 176 | self.eatSymbol(">"); |
| 173 | 177 | top = false; |
| 174 | 178 | } |
| ... | ... | @@ -178,7 +182,7 @@ const Parser = struct { |
| 178 | 182 | bottom = bottom ++ &[_]Value{self.doValue()}; |
| 179 | 183 | } |
| 180 | 184 | } |
| 181 | | std.debug.assert(std.mem.eql(u8, @tagName(name), self.eat(.word))); |
| 185 | self.eatWord(@tagName(name)); |
| 182 | 186 | self.eatSymbol("/"); |
| 183 | 187 | return Value{ .block = Block{ |
| 184 | 188 | .name = name, |