feature. See also
. The project being documented here (as the example) is the Zig library itself.
Parse.warnMsg
fn warnMsg(p: *Parse, msg: Ast.Error) Error!void
File
Code
fn warnMsg(p: *Parse, msg: Ast.Error) Error!void {
@branchHint(.cold);
switch (msg.tag) {
.expected_semi_after_decl,
.expected_semi_after_stmt,
.expected_comma_after_field,
.expected_comma_after_arg,
.expected_comma_after_param,
.expected_comma_after_initializer,
.expected_comma_after_switch_prong,
.expected_comma_after_for_operand,
.expected_comma_after_capture,
.expected_semi_or_else,
.expected_semi_or_lbrace,
.expected_token,
.expected_block,
.expected_block_or_assignment,
.expected_block_or_expr,
.expected_block_or_field,
.expected_expr,
.expected_expr_or_assignment,
.expected_fn,
.expected_inlinable,
.expected_labelable,
.expected_param_list,
.expected_prefix_expr,
.expected_primary_type_expr,
.expected_pub_item,
.expected_return_type,
.expected_suffix_op,
.expected_type_expr,
.expected_var_decl,
.expected_var_decl_or_fn,
.expected_loop_payload,
.expected_container,
=> if (msg.token != 0 and !p.tokensOnSameLine(msg.token - 1, msg.token)) {
var copy = msg;
copy.token_is_prev = true;
copy.token -= 1;
try p.errors.append(p.gpa, copy);
} else {
try p.errors.append(p.gpa, msg);
},
else => try p.errors.append(p.gpa, msg),
}
if (!p.recover) return error.ParseError;
}