Skip to content

Commit

Permalink
handle empty map
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenzek committed Sep 3, 2024
1 parent 67b5974 commit 83d5fdf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/parse.zig
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,11 @@ const Parser = struct {
self.token_it.seekBy(-1);
break;
},
.flow_map_end => {
break;
},
else => {
log.err("Unhandled token in map: {}", .{key});
// TODO key not being a literal
return error.Unhandled;
},
Expand Down
8 changes: 8 additions & 0 deletions src/parse/test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,14 @@ test "empty list" {
);
}

test "empty map" {
try parseSuccess(
\\a:
\\ b: {}
\\ c: { }
);
}

test "comment within a bracketed list is an error" {
try parseError(
\\[ # something
Expand Down

0 comments on commit 83d5fdf

Please sign in to comment.