DoxigAlpha

getLocation

Function parameters

Parameters

#
self:@This()
diag:*const Diagnostics

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 getLocation(self: @This(), diag: *const Diagnostics) Ast.Location {
    return switch (self) {
        .zoir => |err| return zoirErrorLocation(
            diag.ast,
            err.token,
            err.node_or_offset,
        ),
        .type_check => |err| return diag.ast.tokenLocation(err.offset, err.token),
    };
}