mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 13:30:45 +00:00
parser: give better errors for misplaced .{
This commit is contained in:
parent
8a432436ae
commit
0699b29ce0
@ -66,7 +66,7 @@ pub fn renderToArrayList(tree: Ast, buffer: *std.ArrayList(u8)) RenderError!void
|
||||
|
||||
/// Returns an extra offset for column and byte offset of errors that
|
||||
/// should point after the token in the error message.
|
||||
pub fn errorOffset(tree:Ast, error_tag: Error.Tag, token: TokenIndex) u32 {
|
||||
pub fn errorOffset(tree: Ast, error_tag: Error.Tag, token: TokenIndex) u32 {
|
||||
return switch (error_tag) {
|
||||
.expected_semi_after_decl,
|
||||
.expected_semi_after_stmt,
|
||||
|
||||
@ -3229,6 +3229,10 @@ const Parser = struct {
|
||||
.rhs = p.nextToken(),
|
||||
},
|
||||
}),
|
||||
.l_brace => {
|
||||
// this a misplaced `.{`, handle the error somewhere else
|
||||
return null_node;
|
||||
},
|
||||
else => {
|
||||
p.tok_i += 1;
|
||||
try p.warn(.expected_suffix_op);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user