| ... | @@ -667,7 +667,12 @@ fn parseStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) Error!?*No | ... | @@ -667,7 +667,12 @@ fn parseStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) Error!?*No |
| 667 | if (try parseLabeledStatement(arena, it, tree)) |node| return node; | 667 | if (try parseLabeledStatement(arena, it, tree)) |node| return node; |
| 668 | if (try parseSwitchExpr(arena, it, tree)) |node| return node; | 668 | if (try parseSwitchExpr(arena, it, tree)) |node| return node; |
| 669 | if (try parseAssignExpr(arena, it, tree)) |node| { | 669 | if (try parseAssignExpr(arena, it, tree)) |node| { |
| 670 | _ = try expectToken(it, tree, .Semicolon); | 670 | _ = eatToken(it, .Semicolon) orelse { |
| | 671 | try tree.errors.push(.{ |
| | 672 | .ExpectedToken = .{ .token = it.index, .expected_id = .Semicolon }, |
| | 673 | }); |
| | 674 | // pretend we saw a semicolon and continue parsing |
| | 675 | }; |
| 671 | return node; | 676 | return node; |
| 672 | } | 677 | } |
| 673 | | 678 | |
| ... | @@ -911,7 +916,12 @@ fn parseWhileStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*No | ... | @@ -911,7 +916,12 @@ fn parseWhileStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*No |
| 911 | fn parseBlockExprStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { | 916 | fn parseBlockExprStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| 912 | if (try parseBlockExpr(arena, it, tree)) |node| return node; | 917 | if (try parseBlockExpr(arena, it, tree)) |node| return node; |
| 913 | if (try parseAssignExpr(arena, it, tree)) |node| { | 918 | if (try parseAssignExpr(arena, it, tree)) |node| { |
| 914 | _ = try expectToken(it, tree, .Semicolon); | 919 | _ = eatToken(it, .Semicolon) orelse { |
| | 920 | try tree.errors.push(.{ |
| | 921 | .ExpectedToken = .{ .token = it.index, .expected_id = .Semicolon }, |
| | 922 | }); |
| | 923 | // pretend we saw a semicolon and continue parsing |
| | 924 | }; |
| 915 | return node; | 925 | return node; |
| 916 | } | 926 | } |
| 917 | return null; | 927 | return null; |
| ... | @@ -3072,7 +3082,7 @@ fn parseDocComment(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node.D | ... | @@ -3072,7 +3082,7 @@ fn parseDocComment(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node.D |
| 3072 | } | 3082 | } |
| 3073 | | 3083 | |
| 3074 | /// Eat a single-line doc comment on the same line as another node | 3084 | /// Eat a single-line doc comment on the same line as another node |
| 3075 | fn parseAppendedDocComment(arena: *Allocator, it: *TokenIterator, tree: *Tree, after_token: TokenIndex) Allocator.Error!?*Node.DocComment { | 3085 | fn parseAppendedDocComment(arena: *Allocator, it: *TokenIterator, tree: *Tree, after_token: TokenIndex) !?*Node.DocComment { |
| 3076 | const comment_token = eatToken(it, .DocComment) orelse return null; | 3086 | const comment_token = eatToken(it, .DocComment) orelse return null; |
| 3077 | if (tree.tokensOnSameLine(after_token, comment_token)) { | 3087 | if (tree.tokensOnSameLine(after_token, comment_token)) { |
| 3078 | const node = try arena.create(Node.DocComment); | 3088 | const node = try arena.create(Node.DocComment); |