| ... | @@ -1093,6 +1093,23 @@ pub const Parser = struct { | ... | @@ -1093,6 +1093,23 @@ pub const Parser = struct { |
| 1093 | }) catch unreachable; | 1093 | }) catch unreachable; |
| 1094 | continue; | 1094 | continue; |
| 1095 | }, | 1095 | }, |
| | 1096 | Token.Id.Keyword_suspend => { |
| | 1097 | const node = try arena.construct(ast.Node.Suspend { |
| | 1098 | .base = ast.Node { |
| | 1099 | .id = ast.Node.Id.Suspend, |
| | 1100 | .doc_comments = null, |
| | 1101 | .same_line_comment = null, |
| | 1102 | }, |
| | 1103 | .label = ctx.label, |
| | 1104 | .suspend_token = token, |
| | 1105 | .payload = null, |
| | 1106 | .body = null, |
| | 1107 | }); |
| | 1108 | ctx.opt_ctx.store(&node.base); |
| | 1109 | stack.append(State { .SuspendBody = node }) catch unreachable; |
| | 1110 | try stack.append(State { .Payload = OptionalCtx { .Optional = &node.payload } }); |
| | 1111 | continue; |
| | 1112 | }, |
| 1096 | Token.Id.Keyword_inline => { | 1113 | Token.Id.Keyword_inline => { |
| 1097 | stack.append(State { | 1114 | stack.append(State { |
| 1098 | .Inline = InlineCtx { | 1115 | .Inline = InlineCtx { |
| ... | @@ -3046,6 +3063,7 @@ pub const Parser = struct { | ... | @@ -3046,6 +3063,7 @@ pub const Parser = struct { |
| 3046 | const node = try self.createToCtxNode(arena, ctx, ast.Node.Suspend, | 3063 | const node = try self.createToCtxNode(arena, ctx, ast.Node.Suspend, |
| 3047 | ast.Node.Suspend { | 3064 | ast.Node.Suspend { |
| 3048 | .base = undefined, | 3065 | .base = undefined, |
| | 3066 | .label = null, |
| 3049 | .suspend_token = *token, | 3067 | .suspend_token = *token, |
| 3050 | .payload = null, | 3068 | .payload = null, |
| 3051 | .body = null, | 3069 | .body = null, |
| ... | @@ -3655,6 +3673,9 @@ pub const Parser = struct { | ... | @@ -3655,6 +3673,9 @@ pub const Parser = struct { |
| 3655 | }, | 3673 | }, |
| 3656 | ast.Node.Id.Suspend => { | 3674 | ast.Node.Id.Suspend => { |
| 3657 | const suspend_node = @fieldParentPtr(ast.Node.Suspend, "base", base); | 3675 | const suspend_node = @fieldParentPtr(ast.Node.Suspend, "base", base); |
| | 3676 | if (suspend_node.label) |label| { |
| | 3677 | try stream.print("{}: ", self.tokenizer.getTokenSlice(label)); |
| | 3678 | } |
| 3658 | try stream.print("{}", self.tokenizer.getTokenSlice(suspend_node.suspend_token)); | 3679 | try stream.print("{}", self.tokenizer.getTokenSlice(suspend_node.suspend_token)); |
| 3659 | | 3680 | |
| 3660 | if (suspend_node.body) |body| { | 3681 | if (suspend_node.body) |body| { |