DoxigAlpha

next

Function parameters

Parameters

#
self:*@This()

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 next(self: *@This()) ?Note {
    switch (self.err) {
        .zoir => |err| {
            if (self.index >= err.note_count) return null;
            const note = err.getNotes(self.diag.zoir)[self.index];
            self.index += 1;
            return .{ .zoir = note };
        },
        .type_check => |err| {
            if (self.index >= err.getNoteCount()) return null;
            const note = err.getNote(self.index);
            self.index += 1;
            return .{ .type_check = note };
        },
    }
}