authorgravatar for jhc@dismail.deJimmi Holst Christensen <jhc@dismail.de> 2018-04-11 15:26:00+02:00
committergravatar for jhc@dismail.deJimmi Holst Christensen <jhc@dismail.de> 2018-04-11 15:26:00+02:00
loga7f77d7c6a4326de4c4cd356cd88e48854817e6f
treed7c5e6df669bdb271524bb88725c53005cfd88ba
parentdf4c575525a8ab3d190b46af724a718c77e607e3

std.zig.parser: requireSemiColon now matches the C++ behavior

Related #909 Allowes parsing of `std/os/child_process.zig`

1 files changed, 7 insertions(+), 7 deletions(-)

std/zig/parser.zig+7-7
......@@ -2722,7 +2722,7 @@ pub const Parser = struct {
27222722 continue;
27232723 }
27242724
2725 n = while_node.body;
2725 return while_node.body.id != ast.Node.Id.Block;
27262726 },
27272727 ast.Node.Id.For => {
27282728 const for_node = @fieldParentPtr(ast.NodeFor, "base", n);
......@@ -2731,7 +2731,7 @@ pub const Parser = struct {
27312731 continue;
27322732 }
27332733
2734 n = for_node.body;
2734 return for_node.body.id != ast.Node.Id.Block;
27352735 },
27362736 ast.Node.Id.If => {
27372737 const if_node = @fieldParentPtr(ast.NodeIf, "base", n);
......@@ -2740,25 +2740,25 @@ pub const Parser = struct {
27402740 continue;
27412741 }
27422742
2743 n = if_node.body;
2743 return if_node.body.id != ast.Node.Id.Block;
27442744 },
27452745 ast.Node.Id.Else => {
27462746 const else_node = @fieldParentPtr(ast.NodeElse, "base", n);
27472747 n = else_node.body;
2748 continue;
27482749 },
27492750 ast.Node.Id.Defer => {
27502751 const defer_node = @fieldParentPtr(ast.NodeDefer, "base", n);
2751 n = defer_node.expr;
2752 return defer_node.expr.id != ast.Node.Id.Block;
27522753 },
27532754 ast.Node.Id.Comptime => {
27542755 const comptime_node = @fieldParentPtr(ast.NodeComptime, "base", n);
2755 n = comptime_node.expr;
2756 return comptime_node.expr.id != ast.Node.Id.Block;
27562757 },
27572758 ast.Node.Id.Suspend => {
27582759 const suspend_node = @fieldParentPtr(ast.NodeSuspend, "base", n);
27592760 if (suspend_node.body) |body| {
2760 n = body;
2761 continue;
2761 return body.id != ast.Node.Id.Block;
27622762 }
27632763
27642764 return true;