zoirErrorLocation
Function parameters
Parameters
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
fn zoirErrorLocation(ast: Ast, maybe_token: Ast.OptionalTokenIndex, node_or_offset: u32) Ast.Location {
if (maybe_token.unwrap()) |token| {
var location = ast.tokenLocation(0, token);
location.column += node_or_offset;
return location;
} else {
const ast_node: Ast.Node.Index = @enumFromInt(node_or_offset);
const token = ast.nodeMainToken(ast_node);
return ast.tokenLocation(0, token);
}
}