mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
std.zig.parser: requireSemiColon now matches the C++ behavior
Related #909 Allowes parsing of `std/os/child_process.zig`
This commit is contained in:
parent
df4c575525
commit
a7f77d7c6a
@ -2722,7 +2722,7 @@ pub const Parser = struct {
|
||||
continue;
|
||||
}
|
||||
|
||||
n = while_node.body;
|
||||
return while_node.body.id != ast.Node.Id.Block;
|
||||
},
|
||||
ast.Node.Id.For => {
|
||||
const for_node = @fieldParentPtr(ast.NodeFor, "base", n);
|
||||
@ -2731,7 +2731,7 @@ pub const Parser = struct {
|
||||
continue;
|
||||
}
|
||||
|
||||
n = for_node.body;
|
||||
return for_node.body.id != ast.Node.Id.Block;
|
||||
},
|
||||
ast.Node.Id.If => {
|
||||
const if_node = @fieldParentPtr(ast.NodeIf, "base", n);
|
||||
@ -2740,25 +2740,25 @@ pub const Parser = struct {
|
||||
continue;
|
||||
}
|
||||
|
||||
n = if_node.body;
|
||||
return if_node.body.id != ast.Node.Id.Block;
|
||||
},
|
||||
ast.Node.Id.Else => {
|
||||
const else_node = @fieldParentPtr(ast.NodeElse, "base", n);
|
||||
n = else_node.body;
|
||||
continue;
|
||||
},
|
||||
ast.Node.Id.Defer => {
|
||||
const defer_node = @fieldParentPtr(ast.NodeDefer, "base", n);
|
||||
n = defer_node.expr;
|
||||
return defer_node.expr.id != ast.Node.Id.Block;
|
||||
},
|
||||
ast.Node.Id.Comptime => {
|
||||
const comptime_node = @fieldParentPtr(ast.NodeComptime, "base", n);
|
||||
n = comptime_node.expr;
|
||||
return comptime_node.expr.id != ast.Node.Id.Block;
|
||||
},
|
||||
ast.Node.Id.Suspend => {
|
||||
const suspend_node = @fieldParentPtr(ast.NodeSuspend, "base", n);
|
||||
if (suspend_node.body) |body| {
|
||||
n = body;
|
||||
continue;
|
||||
return body.id != ast.Node.Id.Block;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user