format
Function parameters
Parameters
- self:*const @This()
- w:*std.Io.Writer
Configuration for the runtime parser.
Types
- Options
- Configuration for the runtime parser.
- Diagnostics
- Information about the success or failure of a parse.
Parses the given slice as ZON.
Functions
- fromSlice
- Parses the given slice as ZON.
- fromZoir
- Like `fromSlice`, but operates on `Zoir` instead of ZON source.
- fromZoirNode
- Like `fromZoir`, but the parse starts on `node` instead of root.
- free
- Frees ZON values.
Source
Implementation
pub fn format(self: *const @This(), w: *std.Io.Writer) std.Io.Writer.Error!void {
var errors = self.iterateErrors();
while (errors.next()) |err| {
const loc = err.getLocation(self);
const msg = err.fmtMessage(self);
try w.print("{d}:{d}: error: {f}\n", .{ loc.line + 1, loc.column + 1, msg });
var notes = err.iterateNotes(self);
while (notes.next()) |note| {
const note_loc = note.getLocation(self);
const note_msg = note.fmtMessage(self);
try w.print("{d}:{d}: note: {f}\n", .{
note_loc.line + 1,
note_loc.column + 1,
note_msg,
});
}
}
}