Skip to content

Commit

Permalink
feat(repl): Highlight and format dumped value
Browse files Browse the repository at this point in the history
  • Loading branch information
giann committed Oct 20, 2023
1 parent 37d4e61 commit 8d04463
Show file tree
Hide file tree
Showing 5 changed files with 539 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/buzz_api.zig
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ fn valueDump(value: Value, vm: *VM, seen: *std.AutoHashMap(*_obj.Obj, void), dep
.Pattern => {
const pattern = ObjPattern.cast(value.obj()).?;

std.debug.print("_{s}_", .{pattern.source});
std.debug.print("$\"{s}\"", .{pattern.source});
},

.List => {
Expand Down
6 changes: 5 additions & 1 deletion src/parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4866,9 +4866,13 @@ pub const Parser = struct {
}
}

if (self.parser.previous_token.?.token_type != .RightBracket) {
self.reportErrorAtCurrent(.syntax, "Expected `]`");
}

item_type = item_type orelse common_type;
} else {
try self.consume(.RightBracket, "Expected `}`");
try self.consume(.RightBracket, "Expected `]`");
}

// Either item type was specified with `<type>` or the list is not empty and we could infer it
Expand Down
Loading

0 comments on commit 8d04463

Please sign in to comment.