authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2026-07-03 13:49:02+02:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2026-07-08 11:49:00+02:00
log775dac91494ed602061ce4a28e7da8d64a0bd18a
tree9997465b0970532376e6aad38856f7fd28faa342
parent3681c7c506829322a2980d5bd98e493968fdea68
signaturelock-open Commit is signed but in an unrecognized format.

tools: add max depth to parser oracle

This is useful to avoid unbounded recursion/iteration while fuzzing. It's not interesting to learn that the parser hits a stack overflow when fed a million open parens for example.

3 files changed, 1269 insertions(+), 1008 deletions(-)

lib/std/zig/parser_fuzz.zig+15-2
......@@ -14,7 +14,18 @@ fn fuzzAgainstOracle(_: void, smith: *Smith) !void {
1414 buffer[len] = 0;
1515 const source = buffer[0..len :0];
1616
17 try checkAgainstOracle(source);
17 checkAgainstOracle(source) catch |err| switch (err) {
18 error.MaxDepth => return error.SkipZigTest,
19 else => |e| return e,
20 };
21}
22
23test "max depth" {
24 try std.testing.expectError(error.MaxDepth, checkAgainstOracle("((((("));
25 _ = checkAgainstOracle("((((") catch |err| switch (err) {
26 error.MaxDepth => try std.testing.expect(false),
27 else => |e| return e,
28 };
1829}
1930
2031// Found using AFL++
......@@ -109,8 +120,10 @@ fn checkAgainstOracle(source: [:0]const u8) !void {
109120
110121 const ast = try std.zig.Ast.parse(fba.allocator(), source, .zig);
111122
123 const expected = try oracle.parse(source);
124
112125 errdefer logBadSource(source, ast);
113 try std.testing.expectEqual(oracle.parse(source), ast.errors.len == 0);
126 try std.testing.expectEqual(expected, ast.errors.len == 0);
114127}
115128
116129fn logBadSource(source: []const u8, ast: std.zig.Ast) void {
lib/std/zig/parser_generated_oracle.zig+1222-996
......@@ -3,59 +3,76 @@
33
44const std = @import("std");
55
6const Error = error{MaxDepth};
7const max_depth = 5;
8
69/// Returns true if the input source is in the language defined by
710/// the grammar.
8pub fn parse(source: []const u8) bool {
9 var p: Parser = .{ .source = source, .i = 0 };
11/// Returns error.MaxDepth if more than `max_depth` levels of recursion/iteration are reached.
12pub fn parse(source: []const u8) Error!bool {
13 var p: Parser = .{ .source = source, .i = 0, .expr_depth = 1 };
1014 return p.parseRoot();
1115}
1216
1317const Parser = struct {
1418 source: []const u8,
1519 i: usize,
16 pub fn parseRoot(p: *Parser) bool {
20 expr_depth: usize,
21 pub fn parseRoot(p: *Parser) Error!bool {
1722 return blk_0: {
1823 const pos_0 = p.i;
19 if (p.parseContainerMembers() and p.parseskip() and p.parseeof()) break :blk_0 true;
24 if (try p.parseContainerMembers() and try p.parseskip() and try p.parseeof()) break :blk_0 true;
2025 p.i = pos_0;
2126 break :blk_0 false;
2227 };
2328 }
24 pub fn parseContainerMembers(p: *Parser) bool {
29 pub fn parseContainerMembers(p: *Parser) Error!bool {
2530 return blk_0: {
2631 const pos_0 = p.i;
27 if ((p.parsecontainer_doc_comment() or true) and blk_1: {
28 while (p.parseContainerDecl()) {}
32 if ((try p.parsecontainer_doc_comment() or true) and blk_1: {
33 var i_1: usize = 0;
34 while (try p.parseContainerDecl()) {
35 if (i_1 > max_depth) return error.MaxDepth;
36 i_1 += 1;
37 }
2938 break :blk_1 true;
3039 } and blk_1: {
3140 const pos_1 = p.i;
32 const match_1 = p.parseContainerDeclPrefix();
41 const match_1 = try p.parseContainerDeclPrefix();
3342 p.i = pos_1;
3443 break :blk_1 !match_1;
3544 } and blk_1: {
45 var i_1: usize = 0;
3646 while (blk_3: {
3747 const pos_3 = p.i;
3848 if (blk_4: {
3949 const pos_4 = p.i;
40 const match_4 = p.parseContainerDeclPrefix();
50 const match_4 = try p.parseContainerDeclPrefix();
4151 p.i = pos_4;
4252 break :blk_4 !match_4;
43 } and p.parseContainerField() and p.parseCOMMA()) break :blk_3 true;
53 } and try p.parseContainerField() and try p.parseCOMMA()) break :blk_3 true;
4454 p.i = pos_3;
4555 break :blk_3 false;
46 }) {}
56 }) {
57 if (i_1 > max_depth) return error.MaxDepth;
58 i_1 += 1;
59 }
4760 break :blk_1 true;
4861 } and blk_2: {
4962 const pos_2 = p.i;
5063 if (blk_3: {
5164 const pos_3 = p.i;
52 const match_3 = p.parseContainerDeclPrefix();
65 const match_3 = try p.parseContainerDeclPrefix();
5366 p.i = pos_3;
5467 break :blk_3 !match_3;
55 } and p.parseContainerField()) break :blk_2 true;
68 } and try p.parseContainerField()) break :blk_2 true;
5669 p.i = pos_2;
5770 if (blk_3: {
58 while (p.parseContainerDecl()) {}
71 var i_3: usize = 0;
72 while (try p.parseContainerDecl()) {
73 if (i_3 > max_depth) return error.MaxDepth;
74 i_3 += 1;
75 }
5976 break :blk_3 true;
6077 }) break :blk_2 true;
6178 p.i = pos_2;
......@@ -65,116 +82,116 @@ const Parser = struct {
6582 break :blk_0 false;
6683 };
6784 }
68 pub fn parseContainerDecl(p: *Parser) bool {
85 pub fn parseContainerDecl(p: *Parser) Error!bool {
6986 return blk_0: {
7087 const pos_0 = p.i;
71 if (p.parseTestDecl()) break :blk_0 true;
88 if (try p.parseTestDecl()) break :blk_0 true;
7289 p.i = pos_0;
73 if (p.parseComptimeDecl()) break :blk_0 true;
90 if (try p.parseComptimeDecl()) break :blk_0 true;
7491 p.i = pos_0;
75 if ((p.parsedoc_comment() or true) and (p.parseKEYWORD_pub() or true) and p.parseDecl()) break :blk_0 true;
92 if ((try p.parsedoc_comment() or true) and (try p.parseKEYWORD_pub() or true) and try p.parseDecl()) break :blk_0 true;
7693 p.i = pos_0;
7794 break :blk_0 false;
7895 };
7996 }
80 pub fn parseContainerDeclPrefix(p: *Parser) bool {
97 pub fn parseContainerDeclPrefix(p: *Parser) Error!bool {
8198 return blk_0: {
8299 const pos_0 = p.i;
83 if (p.parseKEYWORD_test()) break :blk_0 true;
100 if (try p.parseKEYWORD_test()) break :blk_0 true;
84101 p.i = pos_0;
85 if (p.parseKEYWORD_comptime() and p.parseLBRACE()) break :blk_0 true;
102 if (try p.parseKEYWORD_comptime() and try p.parseLBRACE()) break :blk_0 true;
86103 p.i = pos_0;
87 if ((p.parsedoc_comment() or true) and (p.parseKEYWORD_pub() or true) and p.parseDeclPrefix()) break :blk_0 true;
104 if ((try p.parsedoc_comment() or true) and (try p.parseKEYWORD_pub() or true) and try p.parseDeclPrefix()) break :blk_0 true;
88105 p.i = pos_0;
89106 break :blk_0 false;
90107 };
91108 }
92 pub fn parseTestDecl(p: *Parser) bool {
109 pub fn parseTestDecl(p: *Parser) Error!bool {
93110 return blk_0: {
94111 const pos_0 = p.i;
95 if (p.parseKEYWORD_test() and (blk_3: {
112 if (try p.parseKEYWORD_test() and (blk_3: {
96113 const pos_3 = p.i;
97 if (p.parseSTRINGLITERALSINGLE()) break :blk_3 true;
114 if (try p.parseSTRINGLITERALSINGLE()) break :blk_3 true;
98115 p.i = pos_3;
99 if (p.parseIDENTIFIER()) break :blk_3 true;
116 if (try p.parseIDENTIFIER()) break :blk_3 true;
100117 p.i = pos_3;
101118 break :blk_3 false;
102 } or true) and p.parseBlock()) break :blk_0 true;
119 } or true) and try p.parseBlock()) break :blk_0 true;
103120 p.i = pos_0;
104121 break :blk_0 false;
105122 };
106123 }
107 pub fn parseComptimeDecl(p: *Parser) bool {
124 pub fn parseComptimeDecl(p: *Parser) Error!bool {
108125 return blk_0: {
109126 const pos_0 = p.i;
110 if (p.parseKEYWORD_comptime() and p.parseBlock()) break :blk_0 true;
127 if (try p.parseKEYWORD_comptime() and try p.parseBlock()) break :blk_0 true;
111128 p.i = pos_0;
112129 break :blk_0 false;
113130 };
114131 }
115 pub fn parseDecl(p: *Parser) bool {
132 pub fn parseDecl(p: *Parser) Error!bool {
116133 return blk_0: {
117134 const pos_0 = p.i;
118135 if ((blk_3: {
119136 const pos_3 = p.i;
120 if (p.parseKEYWORD_export()) break :blk_3 true;
137 if (try p.parseKEYWORD_export()) break :blk_3 true;
121138 p.i = pos_3;
122 if (p.parseKEYWORD_inline()) break :blk_3 true;
139 if (try p.parseKEYWORD_inline()) break :blk_3 true;
123140 p.i = pos_3;
124 if (p.parseKEYWORD_noinline()) break :blk_3 true;
141 if (try p.parseKEYWORD_noinline()) break :blk_3 true;
125142 p.i = pos_3;
126143 break :blk_3 false;
127 } or true) and p.parseFnProto() and blk_2: {
144 } or true) and try p.parseFnProto() and blk_2: {
128145 const pos_2 = p.i;
129 if (p.parseSEMICOLON()) break :blk_2 true;
146 if (try p.parseSEMICOLON()) break :blk_2 true;
130147 p.i = pos_2;
131 if (p.parseBlock()) break :blk_2 true;
148 if (try p.parseBlock()) break :blk_2 true;
132149 p.i = pos_2;
133150 break :blk_2 false;
134151 }) break :blk_0 true;
135152 p.i = pos_0;
136 if (p.parseKEYWORD_extern() and (p.parseSTRINGLITERALSINGLE() or true) and p.parseFnProto() and p.parseSEMICOLON()) break :blk_0 true;
153 if (try p.parseKEYWORD_extern() and (try p.parseSTRINGLITERALSINGLE() or true) and try p.parseFnProto() and try p.parseSEMICOLON()) break :blk_0 true;
137154 p.i = pos_0;
138155 if ((blk_3: {
139156 const pos_3 = p.i;
140 if (p.parseKEYWORD_export()) break :blk_3 true;
157 if (try p.parseKEYWORD_export()) break :blk_3 true;
141158 p.i = pos_3;
142 if (p.parseKEYWORD_extern() and (p.parseSTRINGLITERALSINGLE() or true)) break :blk_3 true;
159 if (try p.parseKEYWORD_extern() and (try p.parseSTRINGLITERALSINGLE() or true)) break :blk_3 true;
143160 p.i = pos_3;
144161 break :blk_3 false;
145 } or true) and (p.parseKEYWORD_threadlocal() or true) and p.parseGlobalVarDecl()) break :blk_0 true;
162 } or true) and (try p.parseKEYWORD_threadlocal() or true) and try p.parseGlobalVarDecl()) break :blk_0 true;
146163 p.i = pos_0;
147164 break :blk_0 false;
148165 };
149166 }
150 pub fn parseDeclPrefix(p: *Parser) bool {
167 pub fn parseDeclPrefix(p: *Parser) Error!bool {
151168 return blk_0: {
152169 const pos_0 = p.i;
153170 if ((blk_3: {
154171 const pos_3 = p.i;
155 if (p.parseKEYWORD_export()) break :blk_3 true;
172 if (try p.parseKEYWORD_export()) break :blk_3 true;
156173 p.i = pos_3;
157 if (p.parseKEYWORD_inline()) break :blk_3 true;
174 if (try p.parseKEYWORD_inline()) break :blk_3 true;
158175 p.i = pos_3;
159 if (p.parseKEYWORD_noinline()) break :blk_3 true;
176 if (try p.parseKEYWORD_noinline()) break :blk_3 true;
160177 p.i = pos_3;
161178 break :blk_3 false;
162 } or true) and p.parseKEYWORD_fn()) break :blk_0 true;
179 } or true) and try p.parseKEYWORD_fn()) break :blk_0 true;
163180 p.i = pos_0;
164 if (p.parseKEYWORD_extern() and (p.parseSTRINGLITERALSINGLE() or true) and p.parseKEYWORD_fn()) break :blk_0 true;
181 if (try p.parseKEYWORD_extern() and (try p.parseSTRINGLITERALSINGLE() or true) and try p.parseKEYWORD_fn()) break :blk_0 true;
165182 p.i = pos_0;
166183 if ((blk_3: {
167184 const pos_3 = p.i;
168 if (p.parseKEYWORD_export()) break :blk_3 true;
185 if (try p.parseKEYWORD_export()) break :blk_3 true;
169186 p.i = pos_3;
170 if (p.parseKEYWORD_extern() and (p.parseSTRINGLITERALSINGLE() or true)) break :blk_3 true;
187 if (try p.parseKEYWORD_extern() and (try p.parseSTRINGLITERALSINGLE() or true)) break :blk_3 true;
171188 p.i = pos_3;
172189 break :blk_3 false;
173 } or true) and (p.parseKEYWORD_threadlocal() or true) and blk_2: {
190 } or true) and (try p.parseKEYWORD_threadlocal() or true) and blk_2: {
174191 const pos_2 = p.i;
175 if (p.parseKEYWORD_const()) break :blk_2 true;
192 if (try p.parseKEYWORD_const()) break :blk_2 true;
176193 p.i = pos_2;
177 if (p.parseKEYWORD_var()) break :blk_2 true;
194 if (try p.parseKEYWORD_var()) break :blk_2 true;
178195 p.i = pos_2;
179196 break :blk_2 false;
180197 }) break :blk_0 true;
......@@ -182,58 +199,58 @@ const Parser = struct {
182199 break :blk_0 false;
183200 };
184201 }
185 pub fn parseFnProto(p: *Parser) bool {
202 pub fn parseFnProto(p: *Parser) Error!bool {
186203 return blk_0: {
187204 const pos_0 = p.i;
188 if (p.parseKEYWORD_fn() and (p.parseIDENTIFIER() or true) and p.parseLPAREN() and p.parseParamDeclList() and p.parseRPAREN() and (p.parseByteAlign() or true) and (p.parseAddrSpace() or true) and (p.parseLinkSection() or true) and (p.parseCallConv() or true) and (p.parseEXCLAMATIONMARK() or true) and p.parseTypeExpr()) break :blk_0 true;
205 if (try p.parseKEYWORD_fn() and (try p.parseIDENTIFIER() or true) and try p.parseLPAREN() and try p.parseParamDeclList() and try p.parseRPAREN() and (try p.parseByteAlign() or true) and (try p.parseAddrSpace() or true) and (try p.parseLinkSection() or true) and (try p.parseCallConv() or true) and (try p.parseEXCLAMATIONMARK() or true) and try p.parseTypeExpr()) break :blk_0 true;
189206 p.i = pos_0;
190207 break :blk_0 false;
191208 };
192209 }
193 pub fn parseVarDeclProto(p: *Parser) bool {
210 pub fn parseVarDeclProto(p: *Parser) Error!bool {
194211 return blk_0: {
195212 const pos_0 = p.i;
196213 if (blk_2: {
197214 const pos_2 = p.i;
198 if (p.parseKEYWORD_const()) break :blk_2 true;
215 if (try p.parseKEYWORD_const()) break :blk_2 true;
199216 p.i = pos_2;
200 if (p.parseKEYWORD_var()) break :blk_2 true;
217 if (try p.parseKEYWORD_var()) break :blk_2 true;
201218 p.i = pos_2;
202219 break :blk_2 false;
203 } and p.parseIDENTIFIER() and (blk_3: {
220 } and try p.parseIDENTIFIER() and (blk_3: {
204221 const pos_3 = p.i;
205 if (p.parseCOLON() and p.parseTypeExpr()) break :blk_3 true;
222 if (try p.parseCOLON() and try p.parseTypeExpr()) break :blk_3 true;
206223 p.i = pos_3;
207224 break :blk_3 false;
208 } or true) and (p.parseByteAlign() or true) and (p.parseAddrSpace() or true) and (p.parseLinkSection() or true)) break :blk_0 true;
225 } or true) and (try p.parseByteAlign() or true) and (try p.parseAddrSpace() or true) and (try p.parseLinkSection() or true)) break :blk_0 true;
209226 p.i = pos_0;
210227 break :blk_0 false;
211228 };
212229 }
213 pub fn parseGlobalVarDecl(p: *Parser) bool {
230 pub fn parseGlobalVarDecl(p: *Parser) Error!bool {
214231 return blk_0: {
215232 const pos_0 = p.i;
216 if (p.parseVarDeclProto() and (blk_3: {
233 if (try p.parseVarDeclProto() and (blk_3: {
217234 const pos_3 = p.i;
218 if (p.parseEQUAL() and p.parseExpr()) break :blk_3 true;
235 if (try p.parseEQUAL() and try p.parseExpr()) break :blk_3 true;
219236 p.i = pos_3;
220237 break :blk_3 false;
221 } or true) and p.parseSEMICOLON()) break :blk_0 true;
238 } or true) and try p.parseSEMICOLON()) break :blk_0 true;
222239 p.i = pos_0;
223240 break :blk_0 false;
224241 };
225242 }
226 pub fn parseContainerField(p: *Parser) bool {
243 pub fn parseContainerField(p: *Parser) Error!bool {
227244 return blk_0: {
228245 const pos_0 = p.i;
229 if ((p.parsedoc_comment() or true) and (p.parseKEYWORD_comptime() or true) and (blk_3: {
246 if ((try p.parsedoc_comment() or true) and (try p.parseKEYWORD_comptime() or true) and (blk_3: {
230247 const pos_3 = p.i;
231 if (p.parseIDENTIFIER() and p.parseCOLON()) break :blk_3 true;
248 if (try p.parseIDENTIFIER() and try p.parseCOLON()) break :blk_3 true;
232249 p.i = pos_3;
233250 break :blk_3 false;
234 } or true) and p.parseTypeExpr() and (p.parseByteAlign() or true) and (blk_3: {
251 } or true) and try p.parseTypeExpr() and (try p.parseByteAlign() or true) and (blk_3: {
235252 const pos_3 = p.i;
236 if (p.parseEQUAL() and p.parseExpr()) break :blk_3 true;
253 if (try p.parseEQUAL() and try p.parseExpr()) break :blk_3 true;
237254 p.i = pos_3;
238255 break :blk_3 false;
239256 } or true)) break :blk_0 true;
......@@ -241,68 +258,68 @@ const Parser = struct {
241258 break :blk_0 false;
242259 };
243260 }
244 pub fn parseBlockStatement(p: *Parser) bool {
261 pub fn parseBlockStatement(p: *Parser) Error!bool {
245262 return blk_0: {
246263 const pos_0 = p.i;
247 if (p.parseStatement()) break :blk_0 true;
264 if (try p.parseStatement()) break :blk_0 true;
248265 p.i = pos_0;
249 if (p.parseKEYWORD_defer() and p.parseBlockExprStatement()) break :blk_0 true;
266 if (try p.parseKEYWORD_defer() and try p.parseBlockExprStatement()) break :blk_0 true;
250267 p.i = pos_0;
251 if (p.parseKEYWORD_errdefer() and p.parseBlockExprStatement()) break :blk_0 true;
268 if (try p.parseKEYWORD_errdefer() and try p.parseBlockExprStatement()) break :blk_0 true;
252269 p.i = pos_0;
253270 if ((blk_3: {
254271 const pos_3 = p.i;
255 if (p.parseKEYWORD_comptime() and blk_4: {
272 if (try p.parseKEYWORD_comptime() and blk_4: {
256273 const pos_4 = p.i;
257 const match_4 = p.parseBlockExprPrefix();
274 const match_4 = try p.parseBlockExprPrefix();
258275 p.i = pos_4;
259276 break :blk_4 !match_4;
260277 }) break :blk_3 true;
261278 p.i = pos_3;
262279 break :blk_3 false;
263 } or true) and p.parseVarAssignStatement()) break :blk_0 true;
280 } or true) and try p.parseVarAssignStatement()) break :blk_0 true;
264281 p.i = pos_0;
265282 break :blk_0 false;
266283 };
267284 }
268 pub fn parseStatement(p: *Parser) bool {
285 pub fn parseStatement(p: *Parser) Error!bool {
269286 return blk_0: {
270287 const pos_0 = p.i;
271 if (p.parseIfStatement()) break :blk_0 true;
288 if (try p.parseIfStatement()) break :blk_0 true;
272289 p.i = pos_0;
273 if (p.parseLabeledStatement()) break :blk_0 true;
290 if (try p.parseLabeledStatement()) break :blk_0 true;
274291 p.i = pos_0;
275 if (p.parseKEYWORD_nosuspend() and p.parseBlockExprStatement()) break :blk_0 true;
292 if (try p.parseKEYWORD_nosuspend() and try p.parseBlockExprStatement()) break :blk_0 true;
276293 p.i = pos_0;
277 if (p.parseKEYWORD_comptime() and p.parseBlockExpr()) break :blk_0 true;
294 if (try p.parseKEYWORD_comptime() and try p.parseBlockExpr()) break :blk_0 true;
278295 p.i = pos_0;
279 if (p.parseKEYWORD_suspend() and p.parseBlockExprStatement()) break :blk_0 true;
296 if (try p.parseKEYWORD_suspend() and try p.parseBlockExprStatement()) break :blk_0 true;
280297 p.i = pos_0;
281298 if ((blk_3: {
282299 const pos_3 = p.i;
283 if (p.parseKEYWORD_comptime() and blk_4: {
300 if (try p.parseKEYWORD_comptime() and blk_4: {
284301 const pos_4 = p.i;
285 const match_4 = p.parseBlockExprPrefix();
302 const match_4 = try p.parseBlockExprPrefix();
286303 p.i = pos_4;
287304 break :blk_4 !match_4;
288305 }) break :blk_3 true;
289306 p.i = pos_3;
290307 break :blk_3 false;
291 } or true) and p.parseAssignExpr() and p.parseSEMICOLON()) break :blk_0 true;
308 } or true) and try p.parseAssignExpr() and try p.parseSEMICOLON()) break :blk_0 true;
292309 p.i = pos_0;
293310 break :blk_0 false;
294311 };
295312 }
296 pub fn parseIfStatement(p: *Parser) bool {
313 pub fn parseIfStatement(p: *Parser) Error!bool {
297314 return blk_0: {
298315 const pos_0 = p.i;
299 if (p.parseIfPrefix() and p.parseBlockExpr() and blk_2: {
316 if (try p.parseIfPrefix() and try p.parseBlockExpr() and blk_2: {
300317 const pos_2 = p.i;
301 if (p.parseKEYWORD_else() and (p.parsePayload() or true) and p.parseStatement()) break :blk_2 true;
318 if (try p.parseKEYWORD_else() and (try p.parsePayload() or true) and try p.parseStatement()) break :blk_2 true;
302319 p.i = pos_2;
303320 if (blk_3: {
304321 const pos_3 = p.i;
305 const match_3 = p.parseKEYWORD_else();
322 const match_3 = try p.parseKEYWORD_else();
306323 p.i = pos_3;
307324 break :blk_3 !match_3;
308325 }) break :blk_2 true;
......@@ -310,16 +327,16 @@ const Parser = struct {
310327 break :blk_2 false;
311328 }) break :blk_0 true;
312329 p.i = pos_0;
313 if (p.parseIfPrefix() and blk_1: {
330 if (try p.parseIfPrefix() and blk_1: {
314331 const pos_1 = p.i;
315 const match_1 = p.parseBlockExprPrefix();
332 const match_1 = try p.parseBlockExprPrefix();
316333 p.i = pos_1;
317334 break :blk_1 !match_1;
318 } and p.parseAssignExpr() and blk_2: {
335 } and try p.parseAssignExpr() and blk_2: {
319336 const pos_2 = p.i;
320 if (p.parseSEMICOLON()) break :blk_2 true;
337 if (try p.parseSEMICOLON()) break :blk_2 true;
321338 p.i = pos_2;
322 if (p.parseKEYWORD_else() and (p.parsePayload() or true) and p.parseStatement()) break :blk_2 true;
339 if (try p.parseKEYWORD_else() and (try p.parsePayload() or true) and try p.parseStatement()) break :blk_2 true;
323340 p.i = pos_2;
324341 break :blk_2 false;
325342 }) break :blk_0 true;
......@@ -327,16 +344,16 @@ const Parser = struct {
327344 break :blk_0 false;
328345 };
329346 }
330 pub fn parseLabeledStatement(p: *Parser) bool {
347 pub fn parseLabeledStatement(p: *Parser) Error!bool {
331348 return blk_0: {
332349 const pos_0 = p.i;
333 if ((p.parseBlockLabel() or true) and blk_2: {
350 if ((try p.parseBlockLabel() or true) and blk_2: {
334351 const pos_2 = p.i;
335 if (p.parseBlock()) break :blk_2 true;
352 if (try p.parseBlock()) break :blk_2 true;
336353 p.i = pos_2;
337 if (p.parseLoopStatement()) break :blk_2 true;
354 if (try p.parseLoopStatement()) break :blk_2 true;
338355 p.i = pos_2;
339 if (p.parseSwitchExpr()) break :blk_2 true;
356 if (try p.parseSwitchExpr()) break :blk_2 true;
340357 p.i = pos_2;
341358 break :blk_2 false;
342359 }) break :blk_0 true;
......@@ -344,14 +361,14 @@ const Parser = struct {
344361 break :blk_0 false;
345362 };
346363 }
347 pub fn parseLoopStatement(p: *Parser) bool {
364 pub fn parseLoopStatement(p: *Parser) Error!bool {
348365 return blk_0: {
349366 const pos_0 = p.i;
350 if ((p.parseKEYWORD_inline() or true) and blk_2: {
367 if ((try p.parseKEYWORD_inline() or true) and blk_2: {
351368 const pos_2 = p.i;
352 if (p.parseForStatement()) break :blk_2 true;
369 if (try p.parseForStatement()) break :blk_2 true;
353370 p.i = pos_2;
354 if (p.parseWhileStatement()) break :blk_2 true;
371 if (try p.parseWhileStatement()) break :blk_2 true;
355372 p.i = pos_2;
356373 break :blk_2 false;
357374 }) break :blk_0 true;
......@@ -359,16 +376,16 @@ const Parser = struct {
359376 break :blk_0 false;
360377 };
361378 }
362 pub fn parseForStatement(p: *Parser) bool {
379 pub fn parseForStatement(p: *Parser) Error!bool {
363380 return blk_0: {
364381 const pos_0 = p.i;
365 if (p.parseForPrefix() and p.parseBlockExpr() and blk_2: {
382 if (try p.parseForPrefix() and try p.parseBlockExpr() and blk_2: {
366383 const pos_2 = p.i;
367 if (p.parseKEYWORD_else() and p.parseStatement()) break :blk_2 true;
384 if (try p.parseKEYWORD_else() and try p.parseStatement()) break :blk_2 true;
368385 p.i = pos_2;
369386 if (blk_3: {
370387 const pos_3 = p.i;
371 const match_3 = p.parseKEYWORD_else();
388 const match_3 = try p.parseKEYWORD_else();
372389 p.i = pos_3;
373390 break :blk_3 !match_3;
374391 }) break :blk_2 true;
......@@ -376,16 +393,16 @@ const Parser = struct {
376393 break :blk_2 false;
377394 }) break :blk_0 true;
378395 p.i = pos_0;
379 if (p.parseForPrefix() and blk_1: {
396 if (try p.parseForPrefix() and blk_1: {
380397 const pos_1 = p.i;
381 const match_1 = p.parseBlockExprPrefix();
398 const match_1 = try p.parseBlockExprPrefix();
382399 p.i = pos_1;
383400 break :blk_1 !match_1;
384 } and p.parseAssignExpr() and blk_2: {
401 } and try p.parseAssignExpr() and blk_2: {
385402 const pos_2 = p.i;
386 if (p.parseSEMICOLON()) break :blk_2 true;
403 if (try p.parseSEMICOLON()) break :blk_2 true;
387404 p.i = pos_2;
388 if (p.parseKEYWORD_else() and p.parseStatement()) break :blk_2 true;
405 if (try p.parseKEYWORD_else() and try p.parseStatement()) break :blk_2 true;
389406 p.i = pos_2;
390407 break :blk_2 false;
391408 }) break :blk_0 true;
......@@ -393,16 +410,16 @@ const Parser = struct {
393410 break :blk_0 false;
394411 };
395412 }
396 pub fn parseWhileStatement(p: *Parser) bool {
413 pub fn parseWhileStatement(p: *Parser) Error!bool {
397414 return blk_0: {
398415 const pos_0 = p.i;
399 if (p.parseWhilePrefix() and p.parseBlockExpr() and blk_2: {
416 if (try p.parseWhilePrefix() and try p.parseBlockExpr() and blk_2: {
400417 const pos_2 = p.i;
401 if (p.parseKEYWORD_else() and (p.parsePayload() or true) and p.parseStatement()) break :blk_2 true;
418 if (try p.parseKEYWORD_else() and (try p.parsePayload() or true) and try p.parseStatement()) break :blk_2 true;
402419 p.i = pos_2;
403420 if (blk_3: {
404421 const pos_3 = p.i;
405 const match_3 = p.parseKEYWORD_else();
422 const match_3 = try p.parseKEYWORD_else();
406423 p.i = pos_3;
407424 break :blk_3 !match_3;
408425 }) break :blk_2 true;
......@@ -410,16 +427,16 @@ const Parser = struct {
410427 break :blk_2 false;
411428 }) break :blk_0 true;
412429 p.i = pos_0;
413 if (p.parseWhilePrefix() and blk_1: {
430 if (try p.parseWhilePrefix() and blk_1: {
414431 const pos_1 = p.i;
415 const match_1 = p.parseBlockExprPrefix();
432 const match_1 = try p.parseBlockExprPrefix();
416433 p.i = pos_1;
417434 break :blk_1 !match_1;
418 } and p.parseAssignExpr() and blk_2: {
435 } and try p.parseAssignExpr() and blk_2: {
419436 const pos_2 = p.i;
420 if (p.parseSEMICOLON()) break :blk_2 true;
437 if (try p.parseSEMICOLON()) break :blk_2 true;
421438 p.i = pos_2;
422 if (p.parseKEYWORD_else() and (p.parsePayload() or true) and p.parseStatement()) break :blk_2 true;
439 if (try p.parseKEYWORD_else() and (try p.parsePayload() or true) and try p.parseStatement()) break :blk_2 true;
423440 p.i = pos_2;
424441 break :blk_2 false;
425442 }) break :blk_0 true;
......@@ -427,95 +444,102 @@ const Parser = struct {
427444 break :blk_0 false;
428445 };
429446 }
430 pub fn parseBlockExprStatement(p: *Parser) bool {
447 pub fn parseBlockExprStatement(p: *Parser) Error!bool {
431448 return blk_0: {
432449 const pos_0 = p.i;
433 if (p.parseBlockExpr()) break :blk_0 true;
450 if (try p.parseBlockExpr()) break :blk_0 true;
434451 p.i = pos_0;
435452 if (blk_1: {
436453 const pos_1 = p.i;
437 const match_1 = p.parseBlockExprPrefix();
454 const match_1 = try p.parseBlockExprPrefix();
438455 p.i = pos_1;
439456 break :blk_1 !match_1;
440 } and p.parseAssignExpr() and p.parseSEMICOLON()) break :blk_0 true;
457 } and try p.parseAssignExpr() and try p.parseSEMICOLON()) break :blk_0 true;
441458 p.i = pos_0;
442459 break :blk_0 false;
443460 };
444461 }
445 pub fn parseBlockExprPrefix(p: *Parser) bool {
462 pub fn parseBlockExprPrefix(p: *Parser) Error!bool {
446463 return blk_0: {
447464 const pos_0 = p.i;
448 if ((p.parseBlockLabel() or true) and p.parseLBRACE()) break :blk_0 true;
465 if ((try p.parseBlockLabel() or true) and try p.parseLBRACE()) break :blk_0 true;
449466 p.i = pos_0;
450467 break :blk_0 false;
451468 };
452469 }
453 pub fn parseBlockExpr(p: *Parser) bool {
470 pub fn parseBlockExpr(p: *Parser) Error!bool {
454471 return blk_0: {
455472 const pos_0 = p.i;
456 if ((p.parseBlockLabel() or true) and p.parseBlock()) break :blk_0 true;
473 if ((try p.parseBlockLabel() or true) and try p.parseBlock()) break :blk_0 true;
457474 p.i = pos_0;
458475 break :blk_0 false;
459476 };
460477 }
461 pub fn parseVarAssignStatement(p: *Parser) bool {
478 pub fn parseVarAssignStatement(p: *Parser) Error!bool {
462479 return blk_0: {
463480 const pos_0 = p.i;
464481 if (blk_2: {
465482 const pos_2 = p.i;
466 if (p.parseVarDeclProto()) break :blk_2 true;
483 if (try p.parseVarDeclProto()) break :blk_2 true;
467484 p.i = pos_2;
468 if (p.parseExpr()) break :blk_2 true;
485 if (try p.parseExpr()) break :blk_2 true;
469486 p.i = pos_2;
470487 break :blk_2 false;
471488 } and blk_1: {
489 var i_1: usize = 0;
472490 while (blk_3: {
473491 const pos_3 = p.i;
474 if (p.parseCOMMA() and blk_5: {
492 if (try p.parseCOMMA() and blk_5: {
475493 const pos_5 = p.i;
476 if (p.parseVarDeclProto()) break :blk_5 true;
494 if (try p.parseVarDeclProto()) break :blk_5 true;
477495 p.i = pos_5;
478 if (p.parseExpr()) break :blk_5 true;
496 if (try p.parseExpr()) break :blk_5 true;
479497 p.i = pos_5;
480498 break :blk_5 false;
481499 }) break :blk_3 true;
482500 p.i = pos_3;
483501 break :blk_3 false;
484 }) {}
502 }) {
503 if (i_1 > max_depth) return error.MaxDepth;
504 i_1 += 1;
505 }
485506 break :blk_1 true;
486 } and p.parseEQUAL() and p.parseExpr() and p.parseSEMICOLON()) break :blk_0 true;
507 } and try p.parseEQUAL() and try p.parseExpr() and try p.parseSEMICOLON()) break :blk_0 true;
487508 p.i = pos_0;
488509 break :blk_0 false;
489510 };
490511 }
491 pub fn parseAssignExpr(p: *Parser) bool {
512 pub fn parseAssignExpr(p: *Parser) Error!bool {
492513 return blk_0: {
493514 const pos_0 = p.i;
494 if (p.parseExpr() and blk_2: {
515 if (try p.parseExpr() and blk_2: {
495516 const pos_2 = p.i;
496 if (p.parseAssignOp() and p.parseExpr()) break :blk_2 true;
517 if (try p.parseAssignOp() and try p.parseExpr()) break :blk_2 true;
497518 p.i = pos_2;
498519 if (blk_3: {
499520 var match_3 = false;
521 var i_3: usize = 0;
500522 while (blk_5: {
501523 const pos_5 = p.i;
502 if (p.parseCOMMA() and p.parseExpr()) break :blk_5 true;
524 if (try p.parseCOMMA() and try p.parseExpr()) break :blk_5 true;
503525 p.i = pos_5;
504526 break :blk_5 false;
505527 }) {
506528 match_3 = true;
529 if (i_3 > max_depth) return error.MaxDepth;
530 i_3 += 1;
507531 }
508532 break :blk_3 match_3;
509 } and p.parseEQUAL() and p.parseExpr()) break :blk_2 true;
533 } and try p.parseEQUAL() and try p.parseExpr()) break :blk_2 true;
510534 p.i = pos_2;
511535 if (blk_3: {
512536 const pos_3 = p.i;
513 const match_3 = p.parseAssignOp();
537 const match_3 = try p.parseAssignOp();
514538 p.i = pos_3;
515539 break :blk_3 !match_3;
516540 } and blk_3: {
517541 const pos_3 = p.i;
518 const match_3 = p.parseCOMMA();
542 const match_3 = try p.parseCOMMA();
519543 p.i = pos_3;
520544 break :blk_3 !match_3;
521545 }) break :blk_2 true;
......@@ -526,16 +550,16 @@ const Parser = struct {
526550 break :blk_0 false;
527551 };
528552 }
529 pub fn parseSingleAssignExpr(p: *Parser) bool {
553 pub fn parseSingleAssignExpr(p: *Parser) Error!bool {
530554 return blk_0: {
531555 const pos_0 = p.i;
532 if (p.parseExpr() and blk_2: {
556 if (try p.parseExpr() and blk_2: {
533557 const pos_2 = p.i;
534 if (p.parseAssignOp() and p.parseExpr()) break :blk_2 true;
558 if (try p.parseAssignOp() and try p.parseExpr()) break :blk_2 true;
535559 p.i = pos_2;
536560 if (blk_3: {
537561 const pos_3 = p.i;
538 const match_3 = p.parseAssignOp();
562 const match_3 = try p.parseAssignOp();
539563 p.i = pos_3;
540564 break :blk_3 !match_3;
541565 }) break :blk_2 true;
......@@ -546,28 +570,35 @@ const Parser = struct {
546570 break :blk_0 false;
547571 };
548572 }
549 pub fn parseExpr(p: *Parser) bool {
573 pub fn parseExpr(p: *Parser) Error!bool {
574 if (p.expr_depth >= max_depth) return error.MaxDepth;
575 p.expr_depth += 1;
576 defer p.expr_depth -= 1;
550577 return blk_0: {
551578 const pos_0 = p.i;
552 if (p.parseBoolOrExpr()) break :blk_0 true;
579 if (try p.parseBoolOrExpr()) break :blk_0 true;
553580 p.i = pos_0;
554581 break :blk_0 false;
555582 };
556583 }
557 pub fn parseBoolOrExpr(p: *Parser) bool {
584 pub fn parseBoolOrExpr(p: *Parser) Error!bool {
558585 return blk_0: {
559586 const pos_0 = p.i;
560 if (p.parseBoolAndExpr() and blk_1: {
587 if (try p.parseBoolAndExpr() and blk_1: {
588 var i_1: usize = 0;
561589 while (blk_3: {
562590 const pos_3 = p.i;
563 if (p.parseOrOp() and p.parseBoolAndExpr()) break :blk_3 true;
591 if (try p.parseOrOp() and try p.parseBoolAndExpr()) break :blk_3 true;
564592 p.i = pos_3;
565593 break :blk_3 false;
566 }) {}
594 }) {
595 if (i_1 > max_depth) return error.MaxDepth;
596 i_1 += 1;
597 }
567598 break :blk_1 true;
568599 } and blk_1: {
569600 const pos_1 = p.i;
570 const match_1 = p.parseOrOp();
601 const match_1 = try p.parseOrOp();
571602 p.i = pos_1;
572603 break :blk_1 !match_1;
573604 }) break :blk_0 true;
......@@ -575,20 +606,24 @@ const Parser = struct {
575606 break :blk_0 false;
576607 };
577608 }
578 pub fn parseBoolAndExpr(p: *Parser) bool {
609 pub fn parseBoolAndExpr(p: *Parser) Error!bool {
579610 return blk_0: {
580611 const pos_0 = p.i;
581 if (p.parseCompareExpr() and blk_1: {
612 if (try p.parseCompareExpr() and blk_1: {
613 var i_1: usize = 0;
582614 while (blk_3: {
583615 const pos_3 = p.i;
584 if (p.parseAndOp() and p.parseCompareExpr()) break :blk_3 true;
616 if (try p.parseAndOp() and try p.parseCompareExpr()) break :blk_3 true;
585617 p.i = pos_3;
586618 break :blk_3 false;
587 }) {}
619 }) {
620 if (i_1 > max_depth) return error.MaxDepth;
621 i_1 += 1;
622 }
588623 break :blk_1 true;
589624 } and blk_1: {
590625 const pos_1 = p.i;
591 const match_1 = p.parseAndOp();
626 const match_1 = try p.parseAndOp();
592627 p.i = pos_1;
593628 break :blk_1 !match_1;
594629 }) break :blk_0 true;
......@@ -596,16 +631,16 @@ const Parser = struct {
596631 break :blk_0 false;
597632 };
598633 }
599 pub fn parseCompareExpr(p: *Parser) bool {
634 pub fn parseCompareExpr(p: *Parser) Error!bool {
600635 return blk_0: {
601636 const pos_0 = p.i;
602 if (p.parseBitwiseExpr() and blk_2: {
637 if (try p.parseBitwiseExpr() and blk_2: {
603638 const pos_2 = p.i;
604 if (p.parseCompareOp() and p.parseBitwiseExpr()) break :blk_2 true;
639 if (try p.parseCompareOp() and try p.parseBitwiseExpr()) break :blk_2 true;
605640 p.i = pos_2;
606641 if (blk_3: {
607642 const pos_3 = p.i;
608 const match_3 = p.parseCompareOp();
643 const match_3 = try p.parseCompareOp();
609644 p.i = pos_3;
610645 break :blk_3 !match_3;
611646 }) break :blk_2 true;
......@@ -616,20 +651,24 @@ const Parser = struct {
616651 break :blk_0 false;
617652 };
618653 }
619 pub fn parseBitwiseExpr(p: *Parser) bool {
654 pub fn parseBitwiseExpr(p: *Parser) Error!bool {
620655 return blk_0: {
621656 const pos_0 = p.i;
622 if (p.parseBitShiftExpr() and blk_1: {
657 if (try p.parseBitShiftExpr() and blk_1: {
658 var i_1: usize = 0;
623659 while (blk_3: {
624660 const pos_3 = p.i;
625 if (p.parseBitwiseOp() and p.parseBitShiftExpr()) break :blk_3 true;
661 if (try p.parseBitwiseOp() and try p.parseBitShiftExpr()) break :blk_3 true;
626662 p.i = pos_3;
627663 break :blk_3 false;
628 }) {}
664 }) {
665 if (i_1 > max_depth) return error.MaxDepth;
666 i_1 += 1;
667 }
629668 break :blk_1 true;
630669 } and blk_1: {
631670 const pos_1 = p.i;
632 const match_1 = p.parseBitwiseOp();
671 const match_1 = try p.parseBitwiseOp();
633672 p.i = pos_1;
634673 break :blk_1 !match_1;
635674 }) break :blk_0 true;
......@@ -637,20 +676,24 @@ const Parser = struct {
637676 break :blk_0 false;
638677 };
639678 }
640 pub fn parseBitShiftExpr(p: *Parser) bool {
679 pub fn parseBitShiftExpr(p: *Parser) Error!bool {
641680 return blk_0: {
642681 const pos_0 = p.i;
643 if (p.parseAdditionExpr() and blk_1: {
682 if (try p.parseAdditionExpr() and blk_1: {
683 var i_1: usize = 0;
644684 while (blk_3: {
645685 const pos_3 = p.i;
646 if (p.parseBitShiftOp() and p.parseAdditionExpr()) break :blk_3 true;
686 if (try p.parseBitShiftOp() and try p.parseAdditionExpr()) break :blk_3 true;
647687 p.i = pos_3;
648688 break :blk_3 false;
649 }) {}
689 }) {
690 if (i_1 > max_depth) return error.MaxDepth;
691 i_1 += 1;
692 }
650693 break :blk_1 true;
651694 } and blk_1: {
652695 const pos_1 = p.i;
653 const match_1 = p.parseBitShiftOp();
696 const match_1 = try p.parseBitShiftOp();
654697 p.i = pos_1;
655698 break :blk_1 !match_1;
656699 }) break :blk_0 true;
......@@ -658,20 +701,24 @@ const Parser = struct {
658701 break :blk_0 false;
659702 };
660703 }
661 pub fn parseAdditionExpr(p: *Parser) bool {
704 pub fn parseAdditionExpr(p: *Parser) Error!bool {
662705 return blk_0: {
663706 const pos_0 = p.i;
664 if (p.parseMultiplyExpr() and blk_1: {
707 if (try p.parseMultiplyExpr() and blk_1: {
708 var i_1: usize = 0;
665709 while (blk_3: {
666710 const pos_3 = p.i;
667 if (p.parseAdditionOp() and p.parseMultiplyExpr()) break :blk_3 true;
711 if (try p.parseAdditionOp() and try p.parseMultiplyExpr()) break :blk_3 true;
668712 p.i = pos_3;
669713 break :blk_3 false;
670 }) {}
714 }) {
715 if (i_1 > max_depth) return error.MaxDepth;
716 i_1 += 1;
717 }
671718 break :blk_1 true;
672719 } and blk_1: {
673720 const pos_1 = p.i;
674 const match_1 = p.parseAdditionOp();
721 const match_1 = try p.parseAdditionOp();
675722 p.i = pos_1;
676723 break :blk_1 !match_1;
677724 }) break :blk_0 true;
......@@ -679,20 +726,24 @@ const Parser = struct {
679726 break :blk_0 false;
680727 };
681728 }
682 pub fn parseMultiplyExpr(p: *Parser) bool {
729 pub fn parseMultiplyExpr(p: *Parser) Error!bool {
683730 return blk_0: {
684731 const pos_0 = p.i;
685 if (p.parsePrefixExpr() and blk_1: {
732 if (try p.parsePrefixExpr() and blk_1: {
733 var i_1: usize = 0;
686734 while (blk_3: {
687735 const pos_3 = p.i;
688 if (p.parseMultiplyOp() and p.parsePrefixExpr()) break :blk_3 true;
736 if (try p.parseMultiplyOp() and try p.parsePrefixExpr()) break :blk_3 true;
689737 p.i = pos_3;
690738 break :blk_3 false;
691 }) {}
739 }) {
740 if (i_1 > max_depth) return error.MaxDepth;
741 i_1 += 1;
742 }
692743 break :blk_1 true;
693744 } and blk_1: {
694745 const pos_1 = p.i;
695 const match_1 = p.parseMultiplyOp();
746 const match_1 = try p.parseMultiplyOp();
696747 p.i = pos_1;
697748 break :blk_1 !match_1;
698749 }) break :blk_0 true;
......@@ -700,36 +751,40 @@ const Parser = struct {
700751 break :blk_0 false;
701752 };
702753 }
703 pub fn parsePrefixExpr(p: *Parser) bool {
754 pub fn parsePrefixExpr(p: *Parser) Error!bool {
704755 return blk_0: {
705756 const pos_0 = p.i;
706757 if (blk_1: {
707 while (p.parsePrefixOp()) {}
758 var i_1: usize = 0;
759 while (try p.parsePrefixOp()) {
760 if (i_1 > max_depth) return error.MaxDepth;
761 i_1 += 1;
762 }
708763 break :blk_1 true;
709764 } and blk_1: {
710765 const pos_1 = p.i;
711 const match_1 = p.parsePrefixOp();
766 const match_1 = try p.parsePrefixOp();
712767 p.i = pos_1;
713768 break :blk_1 !match_1;
714 } and p.parsePrimaryExpr()) break :blk_0 true;
769 } and try p.parsePrimaryExpr()) break :blk_0 true;
715770 p.i = pos_0;
716771 break :blk_0 false;
717772 };
718773 }
719 pub fn parsePrimaryExpr(p: *Parser) bool {
774 pub fn parsePrimaryExpr(p: *Parser) Error!bool {
720775 return blk_0: {
721776 const pos_0 = p.i;
722 if (p.parseAsmExpr()) break :blk_0 true;
777 if (try p.parseAsmExpr()) break :blk_0 true;
723778 p.i = pos_0;
724 if (p.parseIfExpr()) break :blk_0 true;
779 if (try p.parseIfExpr()) break :blk_0 true;
725780 p.i = pos_0;
726 if (p.parseKEYWORD_break() and (p.parseBreakLabel() or true) and blk_2: {
781 if (try p.parseKEYWORD_break() and (try p.parseBreakLabel() or true) and blk_2: {
727782 const pos_2 = p.i;
728 if (p.parseExpr()) break :blk_2 true;
783 if (try p.parseExpr()) break :blk_2 true;
729784 p.i = pos_2;
730785 if (blk_3: {
731786 const pos_3 = p.i;
732 const match_3 = p.parseExprPrefix();
787 const match_3 = try p.parseExprPrefix();
733788 p.i = pos_3;
734789 break :blk_3 !match_3;
735790 }) break :blk_2 true;
......@@ -737,17 +792,17 @@ const Parser = struct {
737792 break :blk_2 false;
738793 }) break :blk_0 true;
739794 p.i = pos_0;
740 if (p.parseKEYWORD_comptime() and p.parseExpr()) break :blk_0 true;
795 if (try p.parseKEYWORD_comptime() and try p.parseExpr()) break :blk_0 true;
741796 p.i = pos_0;
742 if (p.parseKEYWORD_nosuspend() and p.parseExpr()) break :blk_0 true;
797 if (try p.parseKEYWORD_nosuspend() and try p.parseExpr()) break :blk_0 true;
743798 p.i = pos_0;
744 if (p.parseKEYWORD_continue() and (p.parseBreakLabel() or true) and blk_2: {
799 if (try p.parseKEYWORD_continue() and (try p.parseBreakLabel() or true) and blk_2: {
745800 const pos_2 = p.i;
746 if (p.parseExpr()) break :blk_2 true;
801 if (try p.parseExpr()) break :blk_2 true;
747802 p.i = pos_2;
748803 if (blk_3: {
749804 const pos_3 = p.i;
750 const match_3 = p.parseExprPrefix();
805 const match_3 = try p.parseExprPrefix();
751806 p.i = pos_3;
752807 break :blk_3 !match_3;
753808 }) break :blk_2 true;
......@@ -755,15 +810,15 @@ const Parser = struct {
755810 break :blk_2 false;
756811 }) break :blk_0 true;
757812 p.i = pos_0;
758 if (p.parseKEYWORD_resume() and p.parseExpr()) break :blk_0 true;
813 if (try p.parseKEYWORD_resume() and try p.parseExpr()) break :blk_0 true;
759814 p.i = pos_0;
760 if (p.parseKEYWORD_return() and blk_2: {
815 if (try p.parseKEYWORD_return() and blk_2: {
761816 const pos_2 = p.i;
762 if (p.parseExpr()) break :blk_2 true;
817 if (try p.parseExpr()) break :blk_2 true;
763818 p.i = pos_2;
764819 if (blk_3: {
765820 const pos_3 = p.i;
766 const match_3 = p.parseExprPrefix();
821 const match_3 = try p.parseExprPrefix();
767822 p.i = pos_3;
768823 break :blk_3 !match_3;
769824 }) break :blk_2 true;
......@@ -771,25 +826,25 @@ const Parser = struct {
771826 break :blk_2 false;
772827 }) break :blk_0 true;
773828 p.i = pos_0;
774 if ((p.parseBlockLabel() or true) and p.parseLoopExpr()) break :blk_0 true;
829 if ((try p.parseBlockLabel() or true) and try p.parseLoopExpr()) break :blk_0 true;
775830 p.i = pos_0;
776 if (p.parseBlock()) break :blk_0 true;
831 if (try p.parseBlock()) break :blk_0 true;
777832 p.i = pos_0;
778 if (p.parseCurlySuffixExpr()) break :blk_0 true;
833 if (try p.parseCurlySuffixExpr()) break :blk_0 true;
779834 p.i = pos_0;
780835 break :blk_0 false;
781836 };
782837 }
783 pub fn parseIfExpr(p: *Parser) bool {
838 pub fn parseIfExpr(p: *Parser) Error!bool {
784839 return blk_0: {
785840 const pos_0 = p.i;
786 if (p.parseIfPrefix() and p.parseExpr() and blk_2: {
841 if (try p.parseIfPrefix() and try p.parseExpr() and blk_2: {
787842 const pos_2 = p.i;
788 if (p.parseKEYWORD_else() and (p.parsePayload() or true) and p.parseExpr()) break :blk_2 true;
843 if (try p.parseKEYWORD_else() and (try p.parsePayload() or true) and try p.parseExpr()) break :blk_2 true;
789844 p.i = pos_2;
790845 if (blk_3: {
791846 const pos_3 = p.i;
792 const match_3 = p.parseKEYWORD_else();
847 const match_3 = try p.parseKEYWORD_else();
793848 p.i = pos_3;
794849 break :blk_3 !match_3;
795850 }) break :blk_2 true;
......@@ -800,25 +855,29 @@ const Parser = struct {
800855 break :blk_0 false;
801856 };
802857 }
803 pub fn parseBlock(p: *Parser) bool {
858 pub fn parseBlock(p: *Parser) Error!bool {
804859 return blk_0: {
805860 const pos_0 = p.i;
806 if (p.parseLBRACE() and blk_1: {
807 while (p.parseBlockStatement()) {}
861 if (try p.parseLBRACE() and blk_1: {
862 var i_1: usize = 0;
863 while (try p.parseBlockStatement()) {
864 if (i_1 > max_depth) return error.MaxDepth;
865 i_1 += 1;
866 }
808867 break :blk_1 true;
809 } and p.parseRBRACE()) break :blk_0 true;
868 } and try p.parseRBRACE()) break :blk_0 true;
810869 p.i = pos_0;
811870 break :blk_0 false;
812871 };
813872 }
814 pub fn parseLoopExpr(p: *Parser) bool {
873 pub fn parseLoopExpr(p: *Parser) Error!bool {
815874 return blk_0: {
816875 const pos_0 = p.i;
817 if ((p.parseKEYWORD_inline() or true) and blk_2: {
876 if ((try p.parseKEYWORD_inline() or true) and blk_2: {
818877 const pos_2 = p.i;
819 if (p.parseForExpr()) break :blk_2 true;
878 if (try p.parseForExpr()) break :blk_2 true;
820879 p.i = pos_2;
821 if (p.parseWhileExpr()) break :blk_2 true;
880 if (try p.parseWhileExpr()) break :blk_2 true;
822881 p.i = pos_2;
823882 break :blk_2 false;
824883 }) break :blk_0 true;
......@@ -826,16 +885,16 @@ const Parser = struct {
826885 break :blk_0 false;
827886 };
828887 }
829 pub fn parseForExpr(p: *Parser) bool {
888 pub fn parseForExpr(p: *Parser) Error!bool {
830889 return blk_0: {
831890 const pos_0 = p.i;
832 if (p.parseForPrefix() and p.parseExpr() and blk_2: {
891 if (try p.parseForPrefix() and try p.parseExpr() and blk_2: {
833892 const pos_2 = p.i;
834 if (p.parseKEYWORD_else() and p.parseExpr()) break :blk_2 true;
893 if (try p.parseKEYWORD_else() and try p.parseExpr()) break :blk_2 true;
835894 p.i = pos_2;
836895 if (blk_3: {
837896 const pos_3 = p.i;
838 const match_3 = p.parseKEYWORD_else();
897 const match_3 = try p.parseKEYWORD_else();
839898 p.i = pos_3;
840899 break :blk_3 !match_3;
841900 }) break :blk_2 true;
......@@ -846,12 +905,12 @@ const Parser = struct {
846905 break :blk_0 false;
847906 };
848907 }
849 pub fn parseWhileExpr(p: *Parser) bool {
908 pub fn parseWhileExpr(p: *Parser) Error!bool {
850909 return blk_0: {
851910 const pos_0 = p.i;
852 if (p.parseWhilePrefix() and p.parseExpr() and (blk_3: {
911 if (try p.parseWhilePrefix() and try p.parseExpr() and (blk_3: {
853912 const pos_3 = p.i;
854 if (p.parseKEYWORD_else() and (p.parsePayload() or true) and p.parseExpr()) break :blk_3 true;
913 if (try p.parseKEYWORD_else() and (try p.parsePayload() or true) and try p.parseExpr()) break :blk_3 true;
855914 p.i = pos_3;
856915 break :blk_3 false;
857916 } or true)) break :blk_0 true;
......@@ -859,16 +918,16 @@ const Parser = struct {
859918 break :blk_0 false;
860919 };
861920 }
862 pub fn parseCurlySuffixExpr(p: *Parser) bool {
921 pub fn parseCurlySuffixExpr(p: *Parser) Error!bool {
863922 return blk_0: {
864923 const pos_0 = p.i;
865 if (p.parseTypeExpr() and blk_2: {
924 if (try p.parseTypeExpr() and blk_2: {
866925 const pos_2 = p.i;
867 if (p.parseInitList()) break :blk_2 true;
926 if (try p.parseInitList()) break :blk_2 true;
868927 p.i = pos_2;
869928 if (blk_3: {
870929 const pos_3 = p.i;
871 const match_3 = p.parseLBRACE();
930 const match_3 = try p.parseLBRACE();
872931 p.i = pos_3;
873932 break :blk_3 !match_3;
874933 }) break :blk_2 true;
......@@ -879,60 +938,72 @@ const Parser = struct {
879938 break :blk_0 false;
880939 };
881940 }
882 pub fn parseInitList(p: *Parser) bool {
941 pub fn parseInitList(p: *Parser) Error!bool {
883942 return blk_0: {
884943 const pos_0 = p.i;
885 if (p.parseLBRACE() and p.parseFieldInit() and blk_1: {
944 if (try p.parseLBRACE() and try p.parseFieldInit() and blk_1: {
945 var i_1: usize = 0;
886946 while (blk_3: {
887947 const pos_3 = p.i;
888 if (p.parseCOMMA() and p.parseFieldInit()) break :blk_3 true;
948 if (try p.parseCOMMA() and try p.parseFieldInit()) break :blk_3 true;
889949 p.i = pos_3;
890950 break :blk_3 false;
891 }) {}
951 }) {
952 if (i_1 > max_depth) return error.MaxDepth;
953 i_1 += 1;
954 }
892955 break :blk_1 true;
893 } and (p.parseCOMMA() or true) and p.parseRBRACE()) break :blk_0 true;
956 } and (try p.parseCOMMA() or true) and try p.parseRBRACE()) break :blk_0 true;
894957 p.i = pos_0;
895 if (p.parseLBRACE() and p.parseExpr() and blk_1: {
958 if (try p.parseLBRACE() and try p.parseExpr() and blk_1: {
959 var i_1: usize = 0;
896960 while (blk_3: {
897961 const pos_3 = p.i;
898 if (p.parseCOMMA() and p.parseExpr()) break :blk_3 true;
962 if (try p.parseCOMMA() and try p.parseExpr()) break :blk_3 true;
899963 p.i = pos_3;
900964 break :blk_3 false;
901 }) {}
965 }) {
966 if (i_1 > max_depth) return error.MaxDepth;
967 i_1 += 1;
968 }
902969 break :blk_1 true;
903 } and (p.parseCOMMA() or true) and p.parseRBRACE()) break :blk_0 true;
970 } and (try p.parseCOMMA() or true) and try p.parseRBRACE()) break :blk_0 true;
904971 p.i = pos_0;
905 if (p.parseLBRACE() and p.parseRBRACE()) break :blk_0 true;
972 if (try p.parseLBRACE() and try p.parseRBRACE()) break :blk_0 true;
906973 p.i = pos_0;
907974 break :blk_0 false;
908975 };
909976 }
910 pub fn parseTypeExpr(p: *Parser) bool {
977 pub fn parseTypeExpr(p: *Parser) Error!bool {
911978 return blk_0: {
912979 const pos_0 = p.i;
913980 if (blk_1: {
914 while (p.parsePrefixTypeOp()) {}
981 var i_1: usize = 0;
982 while (try p.parsePrefixTypeOp()) {
983 if (i_1 > max_depth) return error.MaxDepth;
984 i_1 += 1;
985 }
915986 break :blk_1 true;
916987 } and blk_1: {
917988 const pos_1 = p.i;
918 const match_1 = p.parsePrefixTypeOpPrefix();
989 const match_1 = try p.parsePrefixTypeOpPrefix();
919990 p.i = pos_1;
920991 break :blk_1 !match_1;
921 } and p.parseErrorUnionExpr()) break :blk_0 true;
992 } and try p.parseErrorUnionExpr()) break :blk_0 true;
922993 p.i = pos_0;
923994 break :blk_0 false;
924995 };
925996 }
926 pub fn parseErrorUnionExpr(p: *Parser) bool {
997 pub fn parseErrorUnionExpr(p: *Parser) Error!bool {
927998 return blk_0: {
928999 const pos_0 = p.i;
929 if (p.parseSuffixExpr() and blk_2: {
1000 if (try p.parseSuffixExpr() and blk_2: {
9301001 const pos_2 = p.i;
931 if (p.parseEXCLAMATIONMARK() and p.parseTypeExpr()) break :blk_2 true;
1002 if (try p.parseEXCLAMATIONMARK() and try p.parseTypeExpr()) break :blk_2 true;
9321003 p.i = pos_2;
9331004 if (blk_3: {
9341005 const pos_3 = p.i;
935 const match_3 = p.parseEXCLAMATIONMARK();
1006 const match_3 = try p.parseEXCLAMATIONMARK();
9361007 p.i = pos_3;
9371008 break :blk_3 !match_3;
9381009 }) break :blk_2 true;
......@@ -943,15 +1014,19 @@ const Parser = struct {
9431014 break :blk_0 false;
9441015 };
9451016 }
946 pub fn parseSuffixExpr(p: *Parser) bool {
1017 pub fn parseSuffixExpr(p: *Parser) Error!bool {
9471018 return blk_0: {
9481019 const pos_0 = p.i;
949 if (p.parsePrimaryTypeExpr() and blk_1: {
950 while (p.parseSuffixOp()) {}
1020 if (try p.parsePrimaryTypeExpr() and blk_1: {
1021 var i_1: usize = 0;
1022 while (try p.parseSuffixOp()) {
1023 if (i_1 > max_depth) return error.MaxDepth;
1024 i_1 += 1;
1025 }
9511026 break :blk_1 true;
9521027 } and blk_1: {
9531028 const pos_1 = p.i;
954 const match_1 = p.parseSuffixOpPrefix();
1029 const match_1 = try p.parseSuffixOpPrefix();
9551030 p.i = pos_1;
9561031 break :blk_1 !match_1;
9571032 }) break :blk_0 true;
......@@ -959,87 +1034,87 @@ const Parser = struct {
9591034 break :blk_0 false;
9601035 };
9611036 }
962 pub fn parsePrimaryTypeExpr(p: *Parser) bool {
1037 pub fn parsePrimaryTypeExpr(p: *Parser) Error!bool {
9631038 return blk_0: {
9641039 const pos_0 = p.i;
965 if (p.parseBUILTINIDENTIFIER() and p.parseFnCallArguments()) break :blk_0 true;
1040 if (try p.parseBUILTINIDENTIFIER() and try p.parseFnCallArguments()) break :blk_0 true;
9661041 p.i = pos_0;
967 if (p.parseCHAR_LITERAL()) break :blk_0 true;
1042 if (try p.parseCHAR_LITERAL()) break :blk_0 true;
9681043 p.i = pos_0;
969 if (p.parseContainerType()) break :blk_0 true;
1044 if (try p.parseContainerType()) break :blk_0 true;
9701045 p.i = pos_0;
971 if (p.parseDOT() and p.parseIDENTIFIER()) break :blk_0 true;
1046 if (try p.parseDOT() and try p.parseIDENTIFIER()) break :blk_0 true;
9721047 p.i = pos_0;
973 if (p.parseDOT() and p.parseInitList()) break :blk_0 true;
1048 if (try p.parseDOT() and try p.parseInitList()) break :blk_0 true;
9741049 p.i = pos_0;
975 if (p.parseErrorSetDecl()) break :blk_0 true;
1050 if (try p.parseErrorSetDecl()) break :blk_0 true;
9761051 p.i = pos_0;
977 if (p.parseFnProto()) break :blk_0 true;
1052 if (try p.parseFnProto()) break :blk_0 true;
9781053 p.i = pos_0;
979 if (p.parseGroupedExpr()) break :blk_0 true;
1054 if (try p.parseGroupedExpr()) break :blk_0 true;
9801055 p.i = pos_0;
981 if (p.parseLabeledTypeExpr()) break :blk_0 true;
1056 if (try p.parseLabeledTypeExpr()) break :blk_0 true;
9821057 p.i = pos_0;
983 if (p.parseIDENTIFIER()) break :blk_0 true;
1058 if (try p.parseIDENTIFIER()) break :blk_0 true;
9841059 p.i = pos_0;
985 if (p.parseIfTypeExpr()) break :blk_0 true;
1060 if (try p.parseIfTypeExpr()) break :blk_0 true;
9861061 p.i = pos_0;
987 if (p.parseKEYWORD_comptime() and p.parseTypeExpr()) break :blk_0 true;
1062 if (try p.parseKEYWORD_comptime() and try p.parseTypeExpr()) break :blk_0 true;
9881063 p.i = pos_0;
989 if (p.parseKEYWORD_error() and p.parseDOT() and p.parseIDENTIFIER()) break :blk_0 true;
1064 if (try p.parseKEYWORD_error() and try p.parseDOT() and try p.parseIDENTIFIER()) break :blk_0 true;
9901065 p.i = pos_0;
991 if (p.parseKEYWORD_anyframe()) break :blk_0 true;
1066 if (try p.parseKEYWORD_anyframe()) break :blk_0 true;
9921067 p.i = pos_0;
993 if (p.parseKEYWORD_unreachable()) break :blk_0 true;
1068 if (try p.parseKEYWORD_unreachable()) break :blk_0 true;
9941069 p.i = pos_0;
995 if (p.parseNUMBERLITERAL()) break :blk_0 true;
1070 if (try p.parseNUMBERLITERAL()) break :blk_0 true;
9961071 p.i = pos_0;
997 if (p.parseSTRINGLITERAL()) break :blk_0 true;
1072 if (try p.parseSTRINGLITERAL()) break :blk_0 true;
9981073 p.i = pos_0;
9991074 break :blk_0 false;
10001075 };
10011076 }
1002 pub fn parseContainerType(p: *Parser) bool {
1077 pub fn parseContainerType(p: *Parser) Error!bool {
10031078 return blk_0: {
10041079 const pos_0 = p.i;
10051080 if ((blk_3: {
10061081 const pos_3 = p.i;
1007 if (p.parseKEYWORD_extern()) break :blk_3 true;
1082 if (try p.parseKEYWORD_extern()) break :blk_3 true;
10081083 p.i = pos_3;
1009 if (p.parseKEYWORD_packed()) break :blk_3 true;
1084 if (try p.parseKEYWORD_packed()) break :blk_3 true;
10101085 p.i = pos_3;
10111086 break :blk_3 false;
1012 } or true) and p.parseContainerTypeAuto()) break :blk_0 true;
1087 } or true) and try p.parseContainerTypeAuto()) break :blk_0 true;
10131088 p.i = pos_0;
10141089 break :blk_0 false;
10151090 };
10161091 }
1017 pub fn parseErrorSetDecl(p: *Parser) bool {
1092 pub fn parseErrorSetDecl(p: *Parser) Error!bool {
10181093 return blk_0: {
10191094 const pos_0 = p.i;
1020 if (p.parseKEYWORD_error() and p.parseLBRACE() and p.parseIdentifierList() and p.parseRBRACE()) break :blk_0 true;
1095 if (try p.parseKEYWORD_error() and try p.parseLBRACE() and try p.parseIdentifierList() and try p.parseRBRACE()) break :blk_0 true;
10211096 p.i = pos_0;
10221097 break :blk_0 false;
10231098 };
10241099 }
1025 pub fn parseGroupedExpr(p: *Parser) bool {
1100 pub fn parseGroupedExpr(p: *Parser) Error!bool {
10261101 return blk_0: {
10271102 const pos_0 = p.i;
1028 if (p.parseLPAREN() and p.parseExpr() and p.parseRPAREN()) break :blk_0 true;
1103 if (try p.parseLPAREN() and try p.parseExpr() and try p.parseRPAREN()) break :blk_0 true;
10291104 p.i = pos_0;
10301105 break :blk_0 false;
10311106 };
10321107 }
1033 pub fn parseIfTypeExpr(p: *Parser) bool {
1108 pub fn parseIfTypeExpr(p: *Parser) Error!bool {
10341109 return blk_0: {
10351110 const pos_0 = p.i;
1036 if (p.parseIfPrefix() and p.parseTypeExpr() and blk_2: {
1111 if (try p.parseIfPrefix() and try p.parseTypeExpr() and blk_2: {
10371112 const pos_2 = p.i;
1038 if (p.parseKEYWORD_else() and (p.parsePayload() or true) and p.parseTypeExpr()) break :blk_2 true;
1113 if (try p.parseKEYWORD_else() and (try p.parsePayload() or true) and try p.parseTypeExpr()) break :blk_2 true;
10391114 p.i = pos_2;
10401115 if (blk_3: {
10411116 const pos_3 = p.i;
1042 const match_3 = p.parseKEYWORD_else();
1117 const match_3 = try p.parseKEYWORD_else();
10431118 p.i = pos_3;
10441119 break :blk_3 !match_3;
10451120 }) break :blk_2 true;
......@@ -1050,26 +1125,26 @@ const Parser = struct {
10501125 break :blk_0 false;
10511126 };
10521127 }
1053 pub fn parseLabeledTypeExpr(p: *Parser) bool {
1128 pub fn parseLabeledTypeExpr(p: *Parser) Error!bool {
10541129 return blk_0: {
10551130 const pos_0 = p.i;
1056 if (p.parseBlockLabel() and p.parseBlock()) break :blk_0 true;
1131 if (try p.parseBlockLabel() and try p.parseBlock()) break :blk_0 true;
10571132 p.i = pos_0;
1058 if ((p.parseBlockLabel() or true) and p.parseLoopTypeExpr()) break :blk_0 true;
1133 if ((try p.parseBlockLabel() or true) and try p.parseLoopTypeExpr()) break :blk_0 true;
10591134 p.i = pos_0;
1060 if ((p.parseBlockLabel() or true) and p.parseSwitchExpr()) break :blk_0 true;
1135 if ((try p.parseBlockLabel() or true) and try p.parseSwitchExpr()) break :blk_0 true;
10611136 p.i = pos_0;
10621137 break :blk_0 false;
10631138 };
10641139 }
1065 pub fn parseLoopTypeExpr(p: *Parser) bool {
1140 pub fn parseLoopTypeExpr(p: *Parser) Error!bool {
10661141 return blk_0: {
10671142 const pos_0 = p.i;
1068 if ((p.parseKEYWORD_inline() or true) and blk_2: {
1143 if ((try p.parseKEYWORD_inline() or true) and blk_2: {
10691144 const pos_2 = p.i;
1070 if (p.parseForTypeExpr()) break :blk_2 true;
1145 if (try p.parseForTypeExpr()) break :blk_2 true;
10711146 p.i = pos_2;
1072 if (p.parseWhileTypeExpr()) break :blk_2 true;
1147 if (try p.parseWhileTypeExpr()) break :blk_2 true;
10731148 p.i = pos_2;
10741149 break :blk_2 false;
10751150 }) break :blk_0 true;
......@@ -1077,16 +1152,16 @@ const Parser = struct {
10771152 break :blk_0 false;
10781153 };
10791154 }
1080 pub fn parseForTypeExpr(p: *Parser) bool {
1155 pub fn parseForTypeExpr(p: *Parser) Error!bool {
10811156 return blk_0: {
10821157 const pos_0 = p.i;
1083 if (p.parseForPrefix() and p.parseTypeExpr() and blk_2: {
1158 if (try p.parseForPrefix() and try p.parseTypeExpr() and blk_2: {
10841159 const pos_2 = p.i;
1085 if (p.parseKEYWORD_else() and p.parseTypeExpr()) break :blk_2 true;
1160 if (try p.parseKEYWORD_else() and try p.parseTypeExpr()) break :blk_2 true;
10861161 p.i = pos_2;
10871162 if (blk_3: {
10881163 const pos_3 = p.i;
1089 const match_3 = p.parseKEYWORD_else();
1164 const match_3 = try p.parseKEYWORD_else();
10901165 p.i = pos_3;
10911166 break :blk_3 !match_3;
10921167 }) break :blk_2 true;
......@@ -1097,16 +1172,16 @@ const Parser = struct {
10971172 break :blk_0 false;
10981173 };
10991174 }
1100 pub fn parseWhileTypeExpr(p: *Parser) bool {
1175 pub fn parseWhileTypeExpr(p: *Parser) Error!bool {
11011176 return blk_0: {
11021177 const pos_0 = p.i;
1103 if (p.parseWhilePrefix() and p.parseTypeExpr() and blk_2: {
1178 if (try p.parseWhilePrefix() and try p.parseTypeExpr() and blk_2: {
11041179 const pos_2 = p.i;
1105 if (p.parseKEYWORD_else() and (p.parsePayload() or true) and p.parseTypeExpr()) break :blk_2 true;
1180 if (try p.parseKEYWORD_else() and (try p.parsePayload() or true) and try p.parseTypeExpr()) break :blk_2 true;
11061181 p.i = pos_2;
11071182 if (blk_3: {
11081183 const pos_3 = p.i;
1109 const match_3 = p.parseKEYWORD_else();
1184 const match_3 = try p.parseKEYWORD_else();
11101185 p.i = pos_3;
11111186 break :blk_3 !match_3;
11121187 }) break :blk_2 true;
......@@ -1117,137 +1192,137 @@ const Parser = struct {
11171192 break :blk_0 false;
11181193 };
11191194 }
1120 pub fn parseSwitchExpr(p: *Parser) bool {
1195 pub fn parseSwitchExpr(p: *Parser) Error!bool {
11211196 return blk_0: {
11221197 const pos_0 = p.i;
1123 if (p.parseKEYWORD_switch() and p.parseLPAREN() and p.parseExpr() and p.parseRPAREN() and p.parseLBRACE() and p.parseSwitchProngList() and p.parseRBRACE()) break :blk_0 true;
1198 if (try p.parseKEYWORD_switch() and try p.parseLPAREN() and try p.parseExpr() and try p.parseRPAREN() and try p.parseLBRACE() and try p.parseSwitchProngList() and try p.parseRBRACE()) break :blk_0 true;
11241199 p.i = pos_0;
11251200 break :blk_0 false;
11261201 };
11271202 }
1128 pub fn parseAsmExpr(p: *Parser) bool {
1203 pub fn parseAsmExpr(p: *Parser) Error!bool {
11291204 return blk_0: {
11301205 const pos_0 = p.i;
1131 if (p.parseKEYWORD_asm() and (p.parseKEYWORD_volatile() or true) and p.parseLPAREN() and p.parseExpr() and (p.parseAsmOutput() or true) and p.parseRPAREN()) break :blk_0 true;
1206 if (try p.parseKEYWORD_asm() and (try p.parseKEYWORD_volatile() or true) and try p.parseLPAREN() and try p.parseExpr() and (try p.parseAsmOutput() or true) and try p.parseRPAREN()) break :blk_0 true;
11321207 p.i = pos_0;
11331208 break :blk_0 false;
11341209 };
11351210 }
1136 pub fn parseAsmOutput(p: *Parser) bool {
1211 pub fn parseAsmOutput(p: *Parser) Error!bool {
11371212 return blk_0: {
11381213 const pos_0 = p.i;
1139 if (p.parseCOLON() and p.parseAsmOutputList() and (p.parseAsmInput() or true)) break :blk_0 true;
1214 if (try p.parseCOLON() and try p.parseAsmOutputList() and (try p.parseAsmInput() or true)) break :blk_0 true;
11401215 p.i = pos_0;
11411216 break :blk_0 false;
11421217 };
11431218 }
1144 pub fn parseAsmOutputItem(p: *Parser) bool {
1219 pub fn parseAsmOutputItem(p: *Parser) Error!bool {
11451220 return blk_0: {
11461221 const pos_0 = p.i;
1147 if (p.parseLBRACKET() and p.parseIDENTIFIER() and p.parseRBRACKET() and p.parseSTRINGLITERALSINGLE() and p.parseLPAREN() and blk_2: {
1222 if (try p.parseLBRACKET() and try p.parseIDENTIFIER() and try p.parseRBRACKET() and try p.parseSTRINGLITERALSINGLE() and try p.parseLPAREN() and blk_2: {
11481223 const pos_2 = p.i;
1149 if (p.parseMINUSRARROW() and p.parseTypeExpr()) break :blk_2 true;
1224 if (try p.parseMINUSRARROW() and try p.parseTypeExpr()) break :blk_2 true;
11501225 p.i = pos_2;
1151 if (p.parseIDENTIFIER()) break :blk_2 true;
1226 if (try p.parseIDENTIFIER()) break :blk_2 true;
11521227 p.i = pos_2;
11531228 break :blk_2 false;
1154 } and p.parseRPAREN()) break :blk_0 true;
1229 } and try p.parseRPAREN()) break :blk_0 true;
11551230 p.i = pos_0;
11561231 break :blk_0 false;
11571232 };
11581233 }
1159 pub fn parseAsmInput(p: *Parser) bool {
1234 pub fn parseAsmInput(p: *Parser) Error!bool {
11601235 return blk_0: {
11611236 const pos_0 = p.i;
1162 if (p.parseCOLON() and p.parseAsmInputList() and (p.parseAsmClobbers() or true)) break :blk_0 true;
1237 if (try p.parseCOLON() and try p.parseAsmInputList() and (try p.parseAsmClobbers() or true)) break :blk_0 true;
11631238 p.i = pos_0;
11641239 break :blk_0 false;
11651240 };
11661241 }
1167 pub fn parseAsmInputItem(p: *Parser) bool {
1242 pub fn parseAsmInputItem(p: *Parser) Error!bool {
11681243 return blk_0: {
11691244 const pos_0 = p.i;
1170 if (p.parseLBRACKET() and p.parseIDENTIFIER() and p.parseRBRACKET() and p.parseSTRINGLITERALSINGLE() and p.parseLPAREN() and p.parseExpr() and p.parseRPAREN()) break :blk_0 true;
1245 if (try p.parseLBRACKET() and try p.parseIDENTIFIER() and try p.parseRBRACKET() and try p.parseSTRINGLITERALSINGLE() and try p.parseLPAREN() and try p.parseExpr() and try p.parseRPAREN()) break :blk_0 true;
11711246 p.i = pos_0;
11721247 break :blk_0 false;
11731248 };
11741249 }
1175 pub fn parseAsmClobbers(p: *Parser) bool {
1250 pub fn parseAsmClobbers(p: *Parser) Error!bool {
11761251 return blk_0: {
11771252 const pos_0 = p.i;
1178 if (p.parseCOLON() and p.parseExpr()) break :blk_0 true;
1253 if (try p.parseCOLON() and try p.parseExpr()) break :blk_0 true;
11791254 p.i = pos_0;
11801255 break :blk_0 false;
11811256 };
11821257 }
1183 pub fn parseBreakLabel(p: *Parser) bool {
1258 pub fn parseBreakLabel(p: *Parser) Error!bool {
11841259 return blk_0: {
11851260 const pos_0 = p.i;
1186 if (p.parseCOLON() and p.parseIDENTIFIER()) break :blk_0 true;
1261 if (try p.parseCOLON() and try p.parseIDENTIFIER()) break :blk_0 true;
11871262 p.i = pos_0;
11881263 break :blk_0 false;
11891264 };
11901265 }
1191 pub fn parseBlockLabel(p: *Parser) bool {
1266 pub fn parseBlockLabel(p: *Parser) Error!bool {
11921267 return blk_0: {
11931268 const pos_0 = p.i;
1194 if (p.parseIDENTIFIER() and p.parseCOLON()) break :blk_0 true;
1269 if (try p.parseIDENTIFIER() and try p.parseCOLON()) break :blk_0 true;
11951270 p.i = pos_0;
11961271 break :blk_0 false;
11971272 };
11981273 }
1199 pub fn parseFieldInit(p: *Parser) bool {
1274 pub fn parseFieldInit(p: *Parser) Error!bool {
12001275 return blk_0: {
12011276 const pos_0 = p.i;
1202 if (p.parseDOT() and p.parseIDENTIFIER() and p.parseEQUAL() and p.parseExpr()) break :blk_0 true;
1277 if (try p.parseDOT() and try p.parseIDENTIFIER() and try p.parseEQUAL() and try p.parseExpr()) break :blk_0 true;
12031278 p.i = pos_0;
12041279 break :blk_0 false;
12051280 };
12061281 }
1207 pub fn parseWhileContinueExpr(p: *Parser) bool {
1282 pub fn parseWhileContinueExpr(p: *Parser) Error!bool {
12081283 return blk_0: {
12091284 const pos_0 = p.i;
1210 if (p.parseCOLON() and p.parseLPAREN() and p.parseAssignExpr() and p.parseRPAREN()) break :blk_0 true;
1285 if (try p.parseCOLON() and try p.parseLPAREN() and try p.parseAssignExpr() and try p.parseRPAREN()) break :blk_0 true;
12111286 p.i = pos_0;
12121287 break :blk_0 false;
12131288 };
12141289 }
1215 pub fn parseLinkSection(p: *Parser) bool {
1290 pub fn parseLinkSection(p: *Parser) Error!bool {
12161291 return blk_0: {
12171292 const pos_0 = p.i;
1218 if (p.parseKEYWORD_linksection() and p.parseLPAREN() and p.parseExpr() and p.parseRPAREN()) break :blk_0 true;
1293 if (try p.parseKEYWORD_linksection() and try p.parseLPAREN() and try p.parseExpr() and try p.parseRPAREN()) break :blk_0 true;
12191294 p.i = pos_0;
12201295 break :blk_0 false;
12211296 };
12221297 }
1223 pub fn parseAddrSpace(p: *Parser) bool {
1298 pub fn parseAddrSpace(p: *Parser) Error!bool {
12241299 return blk_0: {
12251300 const pos_0 = p.i;
1226 if (p.parseKEYWORD_addrspace() and p.parseLPAREN() and p.parseExpr() and p.parseRPAREN()) break :blk_0 true;
1301 if (try p.parseKEYWORD_addrspace() and try p.parseLPAREN() and try p.parseExpr() and try p.parseRPAREN()) break :blk_0 true;
12271302 p.i = pos_0;
12281303 break :blk_0 false;
12291304 };
12301305 }
1231 pub fn parseCallConv(p: *Parser) bool {
1306 pub fn parseCallConv(p: *Parser) Error!bool {
12321307 return blk_0: {
12331308 const pos_0 = p.i;
1234 if (p.parseKEYWORD_callconv() and p.parseLPAREN() and p.parseExpr() and p.parseRPAREN()) break :blk_0 true;
1309 if (try p.parseKEYWORD_callconv() and try p.parseLPAREN() and try p.parseExpr() and try p.parseRPAREN()) break :blk_0 true;
12351310 p.i = pos_0;
12361311 break :blk_0 false;
12371312 };
12381313 }
1239 pub fn parseParamDecl(p: *Parser) bool {
1314 pub fn parseParamDecl(p: *Parser) Error!bool {
12401315 return blk_0: {
12411316 const pos_0 = p.i;
1242 if ((p.parsedoc_comment() or true) and blk_2: {
1317 if ((try p.parsedoc_comment() or true) and blk_2: {
12431318 const pos_2 = p.i;
1244 if (p.parseKEYWORD_noalias()) break :blk_2 true;
1319 if (try p.parseKEYWORD_noalias()) break :blk_2 true;
12451320 p.i = pos_2;
1246 if (p.parseKEYWORD_comptime()) break :blk_2 true;
1321 if (try p.parseKEYWORD_comptime()) break :blk_2 true;
12471322 p.i = pos_2;
12481323 if (blk_3: {
12491324 const pos_3 = p.i;
1250 const match_3 = p.parseKEYWORD_comptime();
1325 const match_3 = try p.parseKEYWORD_comptime();
12511326 p.i = pos_3;
12521327 break :blk_3 !match_3;
12531328 }) break :blk_2 true;
......@@ -1255,13 +1330,13 @@ const Parser = struct {
12551330 break :blk_2 false;
12561331 } and blk_2: {
12571332 const pos_2 = p.i;
1258 if (p.parseIDENTIFIER() and p.parseCOLON()) break :blk_2 true;
1333 if (try p.parseIDENTIFIER() and try p.parseCOLON()) break :blk_2 true;
12591334 p.i = pos_2;
12601335 if (blk_3: {
12611336 const pos_3 = p.i;
12621337 const match_3 = blk_5: {
12631338 const pos_5 = p.i;
1264 if (p.parseIDENTIFIER() and p.parseCOLON()) break :blk_5 true;
1339 if (try p.parseIDENTIFIER() and try p.parseCOLON()) break :blk_5 true;
12651340 p.i = pos_5;
12661341 break :blk_5 false;
12671342 };
......@@ -1270,122 +1345,130 @@ const Parser = struct {
12701345 }) break :blk_2 true;
12711346 p.i = pos_2;
12721347 break :blk_2 false;
1273 } and p.parseParamType()) break :blk_0 true;
1348 } and try p.parseParamType()) break :blk_0 true;
12741349 p.i = pos_0;
12751350 break :blk_0 false;
12761351 };
12771352 }
1278 pub fn parseParamType(p: *Parser) bool {
1353 pub fn parseParamType(p: *Parser) Error!bool {
12791354 return blk_0: {
12801355 const pos_0 = p.i;
1281 if (p.parseKEYWORD_anytype()) break :blk_0 true;
1356 if (try p.parseKEYWORD_anytype()) break :blk_0 true;
12821357 p.i = pos_0;
1283 if (p.parseTypeExpr()) break :blk_0 true;
1358 if (try p.parseTypeExpr()) break :blk_0 true;
12841359 p.i = pos_0;
12851360 break :blk_0 false;
12861361 };
12871362 }
1288 pub fn parseIfPrefix(p: *Parser) bool {
1363 pub fn parseIfPrefix(p: *Parser) Error!bool {
12891364 return blk_0: {
12901365 const pos_0 = p.i;
1291 if (p.parseKEYWORD_if() and p.parseLPAREN() and p.parseExpr() and p.parseRPAREN() and (p.parsePtrPayload() or true)) break :blk_0 true;
1366 if (try p.parseKEYWORD_if() and try p.parseLPAREN() and try p.parseExpr() and try p.parseRPAREN() and (try p.parsePtrPayload() or true)) break :blk_0 true;
12921367 p.i = pos_0;
12931368 break :blk_0 false;
12941369 };
12951370 }
1296 pub fn parseWhilePrefix(p: *Parser) bool {
1371 pub fn parseWhilePrefix(p: *Parser) Error!bool {
12971372 return blk_0: {
12981373 const pos_0 = p.i;
1299 if (p.parseKEYWORD_while() and p.parseLPAREN() and p.parseExpr() and p.parseRPAREN() and (p.parsePtrPayload() or true) and (p.parseWhileContinueExpr() or true)) break :blk_0 true;
1374 if (try p.parseKEYWORD_while() and try p.parseLPAREN() and try p.parseExpr() and try p.parseRPAREN() and (try p.parsePtrPayload() or true) and (try p.parseWhileContinueExpr() or true)) break :blk_0 true;
13001375 p.i = pos_0;
13011376 break :blk_0 false;
13021377 };
13031378 }
1304 pub fn parseForPrefix(p: *Parser) bool {
1379 pub fn parseForPrefix(p: *Parser) Error!bool {
13051380 return blk_0: {
13061381 const pos_0 = p.i;
1307 if (p.parseKEYWORD_for() and p.parseLPAREN() and p.parseForArgumentsList() and p.parseRPAREN() and p.parsePtrListPayload()) break :blk_0 true;
1382 if (try p.parseKEYWORD_for() and try p.parseLPAREN() and try p.parseForArgumentsList() and try p.parseRPAREN() and try p.parsePtrListPayload()) break :blk_0 true;
13081383 p.i = pos_0;
13091384 break :blk_0 false;
13101385 };
13111386 }
1312 pub fn parsePayload(p: *Parser) bool {
1387 pub fn parsePayload(p: *Parser) Error!bool {
13131388 return blk_0: {
13141389 const pos_0 = p.i;
1315 if (p.parsePIPE() and p.parseIDENTIFIER() and p.parsePIPE()) break :blk_0 true;
1390 if (try p.parsePIPE() and try p.parseIDENTIFIER() and try p.parsePIPE()) break :blk_0 true;
13161391 p.i = pos_0;
13171392 break :blk_0 false;
13181393 };
13191394 }
1320 pub fn parsePtrPayload(p: *Parser) bool {
1395 pub fn parsePtrPayload(p: *Parser) Error!bool {
13211396 return blk_0: {
13221397 const pos_0 = p.i;
1323 if (p.parsePIPE() and (p.parseASTERISK() or true) and p.parseIDENTIFIER() and p.parsePIPE()) break :blk_0 true;
1398 if (try p.parsePIPE() and (try p.parseASTERISK() or true) and try p.parseIDENTIFIER() and try p.parsePIPE()) break :blk_0 true;
13241399 p.i = pos_0;
13251400 break :blk_0 false;
13261401 };
13271402 }
1328 pub fn parsePtrIndexPayload(p: *Parser) bool {
1403 pub fn parsePtrIndexPayload(p: *Parser) Error!bool {
13291404 return blk_0: {
13301405 const pos_0 = p.i;
1331 if (p.parsePIPE() and (p.parseASTERISK() or true) and p.parseIDENTIFIER() and (blk_3: {
1406 if (try p.parsePIPE() and (try p.parseASTERISK() or true) and try p.parseIDENTIFIER() and (blk_3: {
13321407 const pos_3 = p.i;
1333 if (p.parseCOMMA() and p.parseIDENTIFIER()) break :blk_3 true;
1408 if (try p.parseCOMMA() and try p.parseIDENTIFIER()) break :blk_3 true;
13341409 p.i = pos_3;
13351410 break :blk_3 false;
1336 } or true) and p.parsePIPE()) break :blk_0 true;
1411 } or true) and try p.parsePIPE()) break :blk_0 true;
13371412 p.i = pos_0;
13381413 break :blk_0 false;
13391414 };
13401415 }
1341 pub fn parsePtrListPayload(p: *Parser) bool {
1416 pub fn parsePtrListPayload(p: *Parser) Error!bool {
13421417 return blk_0: {
13431418 const pos_0 = p.i;
1344 if (p.parsePIPE() and (p.parseASTERISK() or true) and p.parseIDENTIFIER() and blk_1: {
1419 if (try p.parsePIPE() and (try p.parseASTERISK() or true) and try p.parseIDENTIFIER() and blk_1: {
1420 var i_1: usize = 0;
13451421 while (blk_3: {
13461422 const pos_3 = p.i;
1347 if (p.parseCOMMA() and (p.parseASTERISK() or true) and p.parseIDENTIFIER()) break :blk_3 true;
1423 if (try p.parseCOMMA() and (try p.parseASTERISK() or true) and try p.parseIDENTIFIER()) break :blk_3 true;
13481424 p.i = pos_3;
13491425 break :blk_3 false;
1350 }) {}
1426 }) {
1427 if (i_1 > max_depth) return error.MaxDepth;
1428 i_1 += 1;
1429 }
13511430 break :blk_1 true;
1352 } and (p.parseCOMMA() or true) and p.parsePIPE()) break :blk_0 true;
1431 } and (try p.parseCOMMA() or true) and try p.parsePIPE()) break :blk_0 true;
13531432 p.i = pos_0;
13541433 break :blk_0 false;
13551434 };
13561435 }
1357 pub fn parseSwitchProng(p: *Parser) bool {
1436 pub fn parseSwitchProng(p: *Parser) Error!bool {
13581437 return blk_0: {
13591438 const pos_0 = p.i;
1360 if ((p.parseKEYWORD_inline() or true) and p.parseSwitchCase() and p.parseEQUALRARROW() and (p.parsePtrIndexPayload() or true) and p.parseSingleAssignExpr()) break :blk_0 true;
1439 if ((try p.parseKEYWORD_inline() or true) and try p.parseSwitchCase() and try p.parseEQUALRARROW() and (try p.parsePtrIndexPayload() or true) and try p.parseSingleAssignExpr()) break :blk_0 true;
13611440 p.i = pos_0;
13621441 break :blk_0 false;
13631442 };
13641443 }
1365 pub fn parseSwitchCase(p: *Parser) bool {
1444 pub fn parseSwitchCase(p: *Parser) Error!bool {
13661445 return blk_0: {
13671446 const pos_0 = p.i;
1368 if (p.parseSwitchItem() and blk_1: {
1447 if (try p.parseSwitchItem() and blk_1: {
1448 var i_1: usize = 0;
13691449 while (blk_3: {
13701450 const pos_3 = p.i;
1371 if (p.parseCOMMA() and p.parseSwitchItem()) break :blk_3 true;
1451 if (try p.parseCOMMA() and try p.parseSwitchItem()) break :blk_3 true;
13721452 p.i = pos_3;
13731453 break :blk_3 false;
1374 }) {}
1454 }) {
1455 if (i_1 > max_depth) return error.MaxDepth;
1456 i_1 += 1;
1457 }
13751458 break :blk_1 true;
1376 } and (p.parseCOMMA() or true)) break :blk_0 true;
1459 } and (try p.parseCOMMA() or true)) break :blk_0 true;
13771460 p.i = pos_0;
1378 if (p.parseKEYWORD_else()) break :blk_0 true;
1461 if (try p.parseKEYWORD_else()) break :blk_0 true;
13791462 p.i = pos_0;
13801463 break :blk_0 false;
13811464 };
13821465 }
1383 pub fn parseSwitchItem(p: *Parser) bool {
1466 pub fn parseSwitchItem(p: *Parser) Error!bool {
13841467 return blk_0: {
13851468 const pos_0 = p.i;
1386 if (p.parseExpr() and (blk_3: {
1469 if (try p.parseExpr() and (blk_3: {
13871470 const pos_3 = p.i;
1388 if (p.parseDOT3() and p.parseExpr()) break :blk_3 true;
1471 if (try p.parseDOT3() and try p.parseExpr()) break :blk_3 true;
13891472 p.i = pos_3;
13901473 break :blk_3 false;
13911474 } or true)) break :blk_0 true;
......@@ -1393,34 +1476,38 @@ const Parser = struct {
13931476 break :blk_0 false;
13941477 };
13951478 }
1396 pub fn parseForArgumentsList(p: *Parser) bool {
1479 pub fn parseForArgumentsList(p: *Parser) Error!bool {
13971480 return blk_0: {
13981481 const pos_0 = p.i;
1399 if (p.parseForItem() and blk_1: {
1482 if (try p.parseForItem() and blk_1: {
1483 var i_1: usize = 0;
14001484 while (blk_3: {
14011485 const pos_3 = p.i;
1402 if (p.parseCOMMA() and p.parseForItem()) break :blk_3 true;
1486 if (try p.parseCOMMA() and try p.parseForItem()) break :blk_3 true;
14031487 p.i = pos_3;
14041488 break :blk_3 false;
1405 }) {}
1489 }) {
1490 if (i_1 > max_depth) return error.MaxDepth;
1491 i_1 += 1;
1492 }
14061493 break :blk_1 true;
1407 } and (p.parseCOMMA() or true)) break :blk_0 true;
1494 } and (try p.parseCOMMA() or true)) break :blk_0 true;
14081495 p.i = pos_0;
14091496 break :blk_0 false;
14101497 };
14111498 }
1412 pub fn parseForItem(p: *Parser) bool {
1499 pub fn parseForItem(p: *Parser) Error!bool {
14131500 return blk_0: {
14141501 const pos_0 = p.i;
1415 if (p.parseExpr() and blk_2: {
1502 if (try p.parseExpr() and blk_2: {
14161503 const pos_2 = p.i;
1417 if (p.parseDOT2() and blk_4: {
1504 if (try p.parseDOT2() and blk_4: {
14181505 const pos_4 = p.i;
1419 if (p.parseExpr()) break :blk_4 true;
1506 if (try p.parseExpr()) break :blk_4 true;
14201507 p.i = pos_4;
14211508 if (blk_5: {
14221509 const pos_5 = p.i;
1423 const match_5 = p.parseExprPrefix();
1510 const match_5 = try p.parseExprPrefix();
14241511 p.i = pos_5;
14251512 break :blk_5 !match_5;
14261513 }) break :blk_4 true;
......@@ -1430,7 +1517,7 @@ const Parser = struct {
14301517 p.i = pos_2;
14311518 if (blk_3: {
14321519 const pos_3 = p.i;
1433 const match_3 = p.parseDOT2();
1520 const match_3 = try p.parseDOT2();
14341521 p.i = pos_3;
14351522 break :blk_3 !match_3;
14361523 }) break :blk_2 true;
......@@ -1441,61 +1528,61 @@ const Parser = struct {
14411528 break :blk_0 false;
14421529 };
14431530 }
1444 pub fn parseAssignOp(p: *Parser) bool {
1531 pub fn parseAssignOp(p: *Parser) Error!bool {
14451532 return blk_0: {
14461533 const pos_0 = p.i;
1447 if (p.parseASTERISKEQUAL()) break :blk_0 true;
1534 if (try p.parseASTERISKEQUAL()) break :blk_0 true;
14481535 p.i = pos_0;
1449 if (p.parseASTERISKPIPEEQUAL()) break :blk_0 true;
1536 if (try p.parseASTERISKPIPEEQUAL()) break :blk_0 true;
14501537 p.i = pos_0;
1451 if (p.parseSLASHEQUAL()) break :blk_0 true;
1538 if (try p.parseSLASHEQUAL()) break :blk_0 true;
14521539 p.i = pos_0;
1453 if (p.parsePERCENTEQUAL()) break :blk_0 true;
1540 if (try p.parsePERCENTEQUAL()) break :blk_0 true;
14541541 p.i = pos_0;
1455 if (p.parsePLUSEQUAL()) break :blk_0 true;
1542 if (try p.parsePLUSEQUAL()) break :blk_0 true;
14561543 p.i = pos_0;
1457 if (p.parsePLUSPIPEEQUAL()) break :blk_0 true;
1544 if (try p.parsePLUSPIPEEQUAL()) break :blk_0 true;
14581545 p.i = pos_0;
1459 if (p.parseMINUSEQUAL()) break :blk_0 true;
1546 if (try p.parseMINUSEQUAL()) break :blk_0 true;
14601547 p.i = pos_0;
1461 if (p.parseMINUSPIPEEQUAL()) break :blk_0 true;
1548 if (try p.parseMINUSPIPEEQUAL()) break :blk_0 true;
14621549 p.i = pos_0;
1463 if (p.parseLARROW2EQUAL()) break :blk_0 true;
1550 if (try p.parseLARROW2EQUAL()) break :blk_0 true;
14641551 p.i = pos_0;
1465 if (p.parseLARROW2PIPEEQUAL()) break :blk_0 true;
1552 if (try p.parseLARROW2PIPEEQUAL()) break :blk_0 true;
14661553 p.i = pos_0;
1467 if (p.parseRARROW2EQUAL()) break :blk_0 true;
1554 if (try p.parseRARROW2EQUAL()) break :blk_0 true;
14681555 p.i = pos_0;
1469 if (p.parseAMPERSANDEQUAL()) break :blk_0 true;
1556 if (try p.parseAMPERSANDEQUAL()) break :blk_0 true;
14701557 p.i = pos_0;
1471 if (p.parseCARETEQUAL()) break :blk_0 true;
1558 if (try p.parseCARETEQUAL()) break :blk_0 true;
14721559 p.i = pos_0;
1473 if (p.parsePIPEEQUAL()) break :blk_0 true;
1560 if (try p.parsePIPEEQUAL()) break :blk_0 true;
14741561 p.i = pos_0;
1475 if (p.parseASTERISKPERCENTEQUAL()) break :blk_0 true;
1562 if (try p.parseASTERISKPERCENTEQUAL()) break :blk_0 true;
14761563 p.i = pos_0;
1477 if (p.parsePLUSPERCENTEQUAL()) break :blk_0 true;
1564 if (try p.parsePLUSPERCENTEQUAL()) break :blk_0 true;
14781565 p.i = pos_0;
1479 if (p.parseMINUSPERCENTEQUAL()) break :blk_0 true;
1566 if (try p.parseMINUSPERCENTEQUAL()) break :blk_0 true;
14801567 p.i = pos_0;
1481 if (p.parseEQUAL()) break :blk_0 true;
1568 if (try p.parseEQUAL()) break :blk_0 true;
14821569 p.i = pos_0;
14831570 break :blk_0 false;
14841571 };
14851572 }
1486 pub fn parseOrOp(p: *Parser) bool {
1573 pub fn parseOrOp(p: *Parser) Error!bool {
14871574 return blk_0: {
14881575 const pos_0 = p.i;
1489 if (p.parsepre_op_white() and p.parseKEYWORD_or() and p.parsepost_op_white()) break :blk_0 true;
1576 if (try p.parsepre_op_white() and try p.parseKEYWORD_or() and try p.parsepost_op_white()) break :blk_0 true;
14901577 p.i = pos_0;
14911578 if (blk_1: {
14921579 const pos_1 = p.i;
1493 const match_1 = p.parsepre_op_white();
1580 const match_1 = try p.parsepre_op_white();
14941581 p.i = pos_1;
14951582 break :blk_1 !match_1;
1496 } and p.parseKEYWORD_or() and blk_1: {
1583 } and try p.parseKEYWORD_or() and blk_1: {
14971584 const pos_1 = p.i;
1498 const match_1 = p.parsepost_op_white();
1585 const match_1 = try p.parsepost_op_white();
14991586 p.i = pos_1;
15001587 break :blk_1 !match_1;
15011588 }) break :blk_0 true;
......@@ -1503,19 +1590,19 @@ const Parser = struct {
15031590 break :blk_0 false;
15041591 };
15051592 }
1506 pub fn parseAndOp(p: *Parser) bool {
1593 pub fn parseAndOp(p: *Parser) Error!bool {
15071594 return blk_0: {
15081595 const pos_0 = p.i;
1509 if (p.parsepre_op_white() and p.parseKEYWORD_and() and p.parsepost_op_white()) break :blk_0 true;
1596 if (try p.parsepre_op_white() and try p.parseKEYWORD_and() and try p.parsepost_op_white()) break :blk_0 true;
15101597 p.i = pos_0;
15111598 if (blk_1: {
15121599 const pos_1 = p.i;
1513 const match_1 = p.parsepre_op_white();
1600 const match_1 = try p.parsepre_op_white();
15141601 p.i = pos_1;
15151602 break :blk_1 !match_1;
1516 } and p.parseKEYWORD_and() and blk_1: {
1603 } and try p.parseKEYWORD_and() and blk_1: {
15171604 const pos_1 = p.i;
1518 const match_1 = p.parsepost_op_white();
1605 const match_1 = try p.parsepost_op_white();
15191606 p.i = pos_1;
15201607 break :blk_1 !match_1;
15211608 }) break :blk_0 true;
......@@ -1523,19 +1610,19 @@ const Parser = struct {
15231610 break :blk_0 false;
15241611 };
15251612 }
1526 pub fn parseCompareOp(p: *Parser) bool {
1613 pub fn parseCompareOp(p: *Parser) Error!bool {
15271614 return blk_0: {
15281615 const pos_0 = p.i;
1529 if (p.parsepre_op_white() and p.parseCompareOpTok() and p.parsepost_op_white()) break :blk_0 true;
1616 if (try p.parsepre_op_white() and try p.parseCompareOpTok() and try p.parsepost_op_white()) break :blk_0 true;
15301617 p.i = pos_0;
15311618 if (blk_1: {
15321619 const pos_1 = p.i;
1533 const match_1 = p.parsepre_op_white();
1620 const match_1 = try p.parsepre_op_white();
15341621 p.i = pos_1;
15351622 break :blk_1 !match_1;
1536 } and p.parseCompareOpTok() and blk_1: {
1623 } and try p.parseCompareOpTok() and blk_1: {
15371624 const pos_1 = p.i;
1538 const match_1 = p.parsepost_op_white();
1625 const match_1 = try p.parsepost_op_white();
15391626 p.i = pos_1;
15401627 break :blk_1 !match_1;
15411628 }) break :blk_0 true;
......@@ -1543,37 +1630,37 @@ const Parser = struct {
15431630 break :blk_0 false;
15441631 };
15451632 }
1546 pub fn parseCompareOpTok(p: *Parser) bool {
1633 pub fn parseCompareOpTok(p: *Parser) Error!bool {
15471634 return blk_0: {
15481635 const pos_0 = p.i;
1549 if (p.parseEQUALEQUAL()) break :blk_0 true;
1636 if (try p.parseEQUALEQUAL()) break :blk_0 true;
15501637 p.i = pos_0;
1551 if (p.parseEXCLAMATIONMARKEQUAL()) break :blk_0 true;
1638 if (try p.parseEXCLAMATIONMARKEQUAL()) break :blk_0 true;
15521639 p.i = pos_0;
1553 if (p.parseLARROW()) break :blk_0 true;
1640 if (try p.parseLARROW()) break :blk_0 true;
15541641 p.i = pos_0;
1555 if (p.parseRARROW()) break :blk_0 true;
1642 if (try p.parseRARROW()) break :blk_0 true;
15561643 p.i = pos_0;
1557 if (p.parseLARROWEQUAL()) break :blk_0 true;
1644 if (try p.parseLARROWEQUAL()) break :blk_0 true;
15581645 p.i = pos_0;
1559 if (p.parseRARROWEQUAL()) break :blk_0 true;
1646 if (try p.parseRARROWEQUAL()) break :blk_0 true;
15601647 p.i = pos_0;
15611648 break :blk_0 false;
15621649 };
15631650 }
1564 pub fn parseBitwiseOp(p: *Parser) bool {
1651 pub fn parseBitwiseOp(p: *Parser) Error!bool {
15651652 return blk_0: {
15661653 const pos_0 = p.i;
1567 if (p.parsepre_op_white() and p.parseBitwiseOpTok() and p.parsepost_op_white()) break :blk_0 true;
1654 if (try p.parsepre_op_white() and try p.parseBitwiseOpTok() and try p.parsepost_op_white()) break :blk_0 true;
15681655 p.i = pos_0;
15691656 if (blk_1: {
15701657 const pos_1 = p.i;
1571 const match_1 = p.parsepre_op_white();
1658 const match_1 = try p.parsepre_op_white();
15721659 p.i = pos_1;
15731660 break :blk_1 !match_1;
1574 } and p.parseBitwiseOpTok() and blk_1: {
1661 } and try p.parseBitwiseOpTok() and blk_1: {
15751662 const pos_1 = p.i;
1576 const match_1 = p.parsepost_op_white();
1663 const match_1 = try p.parsepost_op_white();
15771664 p.i = pos_1;
15781665 break :blk_1 !match_1;
15791666 }) break :blk_0 true;
......@@ -1581,10 +1668,10 @@ const Parser = struct {
15811668 break :blk_0 false;
15821669 };
15831670 }
1584 pub fn parseBitwiseOpTok(p: *Parser) bool {
1671 pub fn parseBitwiseOpTok(p: *Parser) Error!bool {
15851672 return blk_0: {
15861673 const pos_0 = p.i;
1587 if (p.parseAMPERSAND() and blk_1: {
1674 if (try p.parseAMPERSAND() and blk_1: {
15881675 const pos_1 = p.i;
15891676 const match_1 = (p.i < p.source.len and switch (p.source[p.i]) {
15901677 '&'...'&',
......@@ -1598,30 +1685,30 @@ const Parser = struct {
15981685 break :blk_1 !match_1;
15991686 }) break :blk_0 true;
16001687 p.i = pos_0;
1601 if (p.parseCARET()) break :blk_0 true;
1688 if (try p.parseCARET()) break :blk_0 true;
16021689 p.i = pos_0;
1603 if (p.parsePIPE()) break :blk_0 true;
1690 if (try p.parsePIPE()) break :blk_0 true;
16041691 p.i = pos_0;
1605 if (p.parseKEYWORD_orelse()) break :blk_0 true;
1692 if (try p.parseKEYWORD_orelse()) break :blk_0 true;
16061693 p.i = pos_0;
1607 if (p.parseKEYWORD_catch() and (p.parsePayload() or true)) break :blk_0 true;
1694 if (try p.parseKEYWORD_catch() and (try p.parsePayload() or true)) break :blk_0 true;
16081695 p.i = pos_0;
16091696 break :blk_0 false;
16101697 };
16111698 }
1612 pub fn parseBitShiftOp(p: *Parser) bool {
1699 pub fn parseBitShiftOp(p: *Parser) Error!bool {
16131700 return blk_0: {
16141701 const pos_0 = p.i;
1615 if (p.parsepre_op_white() and p.parseBitShiftOpTok() and p.parsepost_op_white()) break :blk_0 true;
1702 if (try p.parsepre_op_white() and try p.parseBitShiftOpTok() and try p.parsepost_op_white()) break :blk_0 true;
16161703 p.i = pos_0;
16171704 if (blk_1: {
16181705 const pos_1 = p.i;
1619 const match_1 = p.parsepre_op_white();
1706 const match_1 = try p.parsepre_op_white();
16201707 p.i = pos_1;
16211708 break :blk_1 !match_1;
1622 } and p.parseBitShiftOpTok() and blk_1: {
1709 } and try p.parseBitShiftOpTok() and blk_1: {
16231710 const pos_1 = p.i;
1624 const match_1 = p.parsepost_op_white();
1711 const match_1 = try p.parsepost_op_white();
16251712 p.i = pos_1;
16261713 break :blk_1 !match_1;
16271714 }) break :blk_0 true;
......@@ -1629,31 +1716,31 @@ const Parser = struct {
16291716 break :blk_0 false;
16301717 };
16311718 }
1632 pub fn parseBitShiftOpTok(p: *Parser) bool {
1719 pub fn parseBitShiftOpTok(p: *Parser) Error!bool {
16331720 return blk_0: {
16341721 const pos_0 = p.i;
1635 if (p.parseLARROW2()) break :blk_0 true;
1722 if (try p.parseLARROW2()) break :blk_0 true;
16361723 p.i = pos_0;
1637 if (p.parseRARROW2()) break :blk_0 true;
1724 if (try p.parseRARROW2()) break :blk_0 true;
16381725 p.i = pos_0;
1639 if (p.parseLARROW2PIPE()) break :blk_0 true;
1726 if (try p.parseLARROW2PIPE()) break :blk_0 true;
16401727 p.i = pos_0;
16411728 break :blk_0 false;
16421729 };
16431730 }
1644 pub fn parseAdditionOp(p: *Parser) bool {
1731 pub fn parseAdditionOp(p: *Parser) Error!bool {
16451732 return blk_0: {
16461733 const pos_0 = p.i;
1647 if (p.parsepre_op_white() and p.parseAdditionOpTok() and p.parsepost_op_white()) break :blk_0 true;
1734 if (try p.parsepre_op_white() and try p.parseAdditionOpTok() and try p.parsepost_op_white()) break :blk_0 true;
16481735 p.i = pos_0;
16491736 if (blk_1: {
16501737 const pos_1 = p.i;
1651 const match_1 = p.parsepre_op_white();
1738 const match_1 = try p.parsepre_op_white();
16521739 p.i = pos_1;
16531740 break :blk_1 !match_1;
1654 } and p.parseAdditionOpTok() and blk_1: {
1741 } and try p.parseAdditionOpTok() and blk_1: {
16551742 const pos_1 = p.i;
1656 const match_1 = p.parsepost_op_white();
1743 const match_1 = try p.parsepost_op_white();
16571744 p.i = pos_1;
16581745 break :blk_1 !match_1;
16591746 }) break :blk_0 true;
......@@ -1661,39 +1748,39 @@ const Parser = struct {
16611748 break :blk_0 false;
16621749 };
16631750 }
1664 pub fn parseAdditionOpTok(p: *Parser) bool {
1751 pub fn parseAdditionOpTok(p: *Parser) Error!bool {
16651752 return blk_0: {
16661753 const pos_0 = p.i;
1667 if (p.parsePLUS()) break :blk_0 true;
1754 if (try p.parsePLUS()) break :blk_0 true;
16681755 p.i = pos_0;
1669 if (p.parseMINUS()) break :blk_0 true;
1756 if (try p.parseMINUS()) break :blk_0 true;
16701757 p.i = pos_0;
1671 if (p.parsePLUS2()) break :blk_0 true;
1758 if (try p.parsePLUS2()) break :blk_0 true;
16721759 p.i = pos_0;
1673 if (p.parsePLUSPERCENT()) break :blk_0 true;
1760 if (try p.parsePLUSPERCENT()) break :blk_0 true;
16741761 p.i = pos_0;
1675 if (p.parseMINUSPERCENT()) break :blk_0 true;
1762 if (try p.parseMINUSPERCENT()) break :blk_0 true;
16761763 p.i = pos_0;
1677 if (p.parsePLUSPIPE()) break :blk_0 true;
1764 if (try p.parsePLUSPIPE()) break :blk_0 true;
16781765 p.i = pos_0;
1679 if (p.parseMINUSPIPE()) break :blk_0 true;
1766 if (try p.parseMINUSPIPE()) break :blk_0 true;
16801767 p.i = pos_0;
16811768 break :blk_0 false;
16821769 };
16831770 }
1684 pub fn parseMultiplyOp(p: *Parser) bool {
1771 pub fn parseMultiplyOp(p: *Parser) Error!bool {
16851772 return blk_0: {
16861773 const pos_0 = p.i;
1687 if (p.parsepre_op_white() and p.parseMultiplyOpTok() and p.parsepost_op_white()) break :blk_0 true;
1774 if (try p.parsepre_op_white() and try p.parseMultiplyOpTok() and try p.parsepost_op_white()) break :blk_0 true;
16881775 p.i = pos_0;
16891776 if (blk_1: {
16901777 const pos_1 = p.i;
1691 const match_1 = p.parsepre_op_white();
1778 const match_1 = try p.parsepre_op_white();
16921779 p.i = pos_1;
16931780 break :blk_1 !match_1;
1694 } and p.parseMultiplyOpTok() and blk_1: {
1781 } and try p.parseMultiplyOpTok() and blk_1: {
16951782 const pos_1 = p.i;
1696 const match_1 = p.parsepost_op_white();
1783 const match_1 = try p.parsepost_op_white();
16971784 p.i = pos_1;
16981785 break :blk_1 !match_1;
16991786 }) break :blk_0 true;
......@@ -1701,159 +1788,207 @@ const Parser = struct {
17011788 break :blk_0 false;
17021789 };
17031790 }
1704 pub fn parseMultiplyOpTok(p: *Parser) bool {
1791 pub fn parseMultiplyOpTok(p: *Parser) Error!bool {
17051792 return blk_0: {
17061793 const pos_0 = p.i;
1707 if (p.parsePIPE2()) break :blk_0 true;
1794 if (try p.parsePIPE2()) break :blk_0 true;
17081795 p.i = pos_0;
1709 if (p.parseASTERISK()) break :blk_0 true;
1796 if (try p.parseASTERISK()) break :blk_0 true;
17101797 p.i = pos_0;
1711 if (p.parseSLASH()) break :blk_0 true;
1798 if (try p.parseSLASH()) break :blk_0 true;
17121799 p.i = pos_0;
1713 if (p.parsePERCENT()) break :blk_0 true;
1800 if (try p.parsePERCENT()) break :blk_0 true;
17141801 p.i = pos_0;
1715 if (p.parseASTERISKPERCENT()) break :blk_0 true;
1802 if (try p.parseASTERISKPERCENT()) break :blk_0 true;
17161803 p.i = pos_0;
1717 if (p.parseASTERISKPIPE()) break :blk_0 true;
1804 if (try p.parseASTERISKPIPE()) break :blk_0 true;
17181805 p.i = pos_0;
17191806 break :blk_0 false;
17201807 };
17211808 }
1722 pub fn parsePrefixOp(p: *Parser) bool {
1809 pub fn parsePrefixOp(p: *Parser) Error!bool {
17231810 return blk_0: {
17241811 const pos_0 = p.i;
1725 if (p.parseEXCLAMATIONMARK()) break :blk_0 true;
1812 if (try p.parseEXCLAMATIONMARK()) break :blk_0 true;
17261813 p.i = pos_0;
1727 if (p.parseMINUS()) break :blk_0 true;
1814 if (try p.parseMINUS()) break :blk_0 true;
17281815 p.i = pos_0;
1729 if (p.parseTILDE()) break :blk_0 true;
1816 if (try p.parseTILDE()) break :blk_0 true;
17301817 p.i = pos_0;
1731 if (p.parseMINUSPERCENT()) break :blk_0 true;
1818 if (try p.parseMINUSPERCENT()) break :blk_0 true;
17321819 p.i = pos_0;
1733 if (p.parseAMPERSAND()) break :blk_0 true;
1820 if (try p.parseAMPERSAND()) break :blk_0 true;
17341821 p.i = pos_0;
1735 if (p.parseKEYWORD_try()) break :blk_0 true;
1822 if (try p.parseKEYWORD_try()) break :blk_0 true;
17361823 p.i = pos_0;
17371824 break :blk_0 false;
17381825 };
17391826 }
1740 pub fn parsePrefixTypeOp(p: *Parser) bool {
1827 pub fn parsePrefixTypeOp(p: *Parser) Error!bool {
17411828 return blk_0: {
17421829 const pos_0 = p.i;
1743 if (p.parseQUESTIONMARK()) break :blk_0 true;
1830 if (try p.parseQUESTIONMARK()) break :blk_0 true;
17441831 p.i = pos_0;
1745 if (p.parseKEYWORD_anyframe() and p.parseMINUSRARROW()) break :blk_0 true;
1832 if (try p.parseKEYWORD_anyframe() and try p.parseMINUSRARROW()) break :blk_0 true;
17461833 p.i = pos_0;
17471834 if (blk_2: {
17481835 const pos_2 = p.i;
1749 if (p.parseManyPtrTypeStart()) break :blk_2 true;
1836 if (try p.parseManyPtrTypeStart()) break :blk_2 true;
17501837 p.i = pos_2;
1751 if (p.parseSliceTypeStart()) break :blk_2 true;
1838 if (try p.parseSliceTypeStart()) break :blk_2 true;
17521839 p.i = pos_2;
17531840 break :blk_2 false;
1754 } and p.parsePtrMods()) break :blk_0 true;
1841 } and try p.parsePtrMods()) break :blk_0 true;
17551842 p.i = pos_0;
1756 if (p.parseSinglePtrTypeStart() and p.parseSinglePtrMods()) break :blk_0 true;
1843 if (try p.parseSinglePtrTypeStart() and try p.parseSinglePtrMods()) break :blk_0 true;
17571844 p.i = pos_0;
1758 if (p.parseArrayTypeStart()) break :blk_0 true;
1845 if (try p.parseArrayTypeStart()) break :blk_0 true;
17591846 p.i = pos_0;
17601847 break :blk_0 false;
17611848 };
17621849 }
1763 pub fn parsePtrMods(p: *Parser) bool {
1850 pub fn parsePtrMods(p: *Parser) Error!bool {
17641851 return blk_0: {
17651852 const pos_0 = p.i;
17661853 if (blk_1: {
1767 while (p.parsePtrMod()) {}
1854 var i_1: usize = 0;
1855 while (try p.parsePtrMod()) {
1856 if (i_1 > max_depth) return error.MaxDepth;
1857 i_1 += 1;
1858 }
17681859 break :blk_1 true;
1769 } and (p.parseByteAlign() or true) and blk_1: {
1770 while (p.parsePtrMod()) {}
1860 } and (try p.parseByteAlign() or true) and blk_1: {
1861 var i_1: usize = 0;
1862 while (try p.parsePtrMod()) {
1863 if (i_1 > max_depth) return error.MaxDepth;
1864 i_1 += 1;
1865 }
17711866 break :blk_1 true;
1772 } and (p.parseAddrSpace() or true) and blk_1: {
1773 while (p.parsePtrMod()) {}
1867 } and (try p.parseAddrSpace() or true) and blk_1: {
1868 var i_1: usize = 0;
1869 while (try p.parsePtrMod()) {
1870 if (i_1 > max_depth) return error.MaxDepth;
1871 i_1 += 1;
1872 }
17741873 break :blk_1 true;
17751874 }) break :blk_0 true;
17761875 p.i = pos_0;
17771876 if (blk_1: {
1778 while (p.parsePtrMod()) {}
1877 var i_1: usize = 0;
1878 while (try p.parsePtrMod()) {
1879 if (i_1 > max_depth) return error.MaxDepth;
1880 i_1 += 1;
1881 }
17791882 break :blk_1 true;
1780 } and (p.parseAddrSpace() or true) and blk_1: {
1781 while (p.parsePtrMod()) {}
1883 } and (try p.parseAddrSpace() or true) and blk_1: {
1884 var i_1: usize = 0;
1885 while (try p.parsePtrMod()) {
1886 if (i_1 > max_depth) return error.MaxDepth;
1887 i_1 += 1;
1888 }
17821889 break :blk_1 true;
1783 } and (p.parseByteAlign() or true) and blk_1: {
1784 while (p.parsePtrMod()) {}
1890 } and (try p.parseByteAlign() or true) and blk_1: {
1891 var i_1: usize = 0;
1892 while (try p.parsePtrMod()) {
1893 if (i_1 > max_depth) return error.MaxDepth;
1894 i_1 += 1;
1895 }
17851896 break :blk_1 true;
17861897 }) break :blk_0 true;
17871898 p.i = pos_0;
17881899 break :blk_0 false;
17891900 };
17901901 }
1791 pub fn parseSinglePtrMods(p: *Parser) bool {
1902 pub fn parseSinglePtrMods(p: *Parser) Error!bool {
17921903 return blk_0: {
17931904 const pos_0 = p.i;
17941905 if (blk_1: {
1795 while (p.parsePtrMod()) {}
1906 var i_1: usize = 0;
1907 while (try p.parsePtrMod()) {
1908 if (i_1 > max_depth) return error.MaxDepth;
1909 i_1 += 1;
1910 }
17961911 break :blk_1 true;
1797 } and (p.parseBitAlign() or true) and blk_1: {
1798 while (p.parsePtrMod()) {}
1912 } and (try p.parseBitAlign() or true) and blk_1: {
1913 var i_1: usize = 0;
1914 while (try p.parsePtrMod()) {
1915 if (i_1 > max_depth) return error.MaxDepth;
1916 i_1 += 1;
1917 }
17991918 break :blk_1 true;
1800 } and (p.parseAddrSpace() or true) and blk_1: {
1801 while (p.parsePtrMod()) {}
1919 } and (try p.parseAddrSpace() or true) and blk_1: {
1920 var i_1: usize = 0;
1921 while (try p.parsePtrMod()) {
1922 if (i_1 > max_depth) return error.MaxDepth;
1923 i_1 += 1;
1924 }
18021925 break :blk_1 true;
18031926 }) break :blk_0 true;
18041927 p.i = pos_0;
18051928 if (blk_1: {
1806 while (p.parsePtrMod()) {}
1929 var i_1: usize = 0;
1930 while (try p.parsePtrMod()) {
1931 if (i_1 > max_depth) return error.MaxDepth;
1932 i_1 += 1;
1933 }
18071934 break :blk_1 true;
1808 } and (p.parseAddrSpace() or true) and blk_1: {
1809 while (p.parsePtrMod()) {}
1935 } and (try p.parseAddrSpace() or true) and blk_1: {
1936 var i_1: usize = 0;
1937 while (try p.parsePtrMod()) {
1938 if (i_1 > max_depth) return error.MaxDepth;
1939 i_1 += 1;
1940 }
18101941 break :blk_1 true;
1811 } and (p.parseBitAlign() or true) and blk_1: {
1812 while (p.parsePtrMod()) {}
1942 } and (try p.parseBitAlign() or true) and blk_1: {
1943 var i_1: usize = 0;
1944 while (try p.parsePtrMod()) {
1945 if (i_1 > max_depth) return error.MaxDepth;
1946 i_1 += 1;
1947 }
18131948 break :blk_1 true;
18141949 }) break :blk_0 true;
18151950 p.i = pos_0;
18161951 break :blk_0 false;
18171952 };
18181953 }
1819 pub fn parsePtrMod(p: *Parser) bool {
1954 pub fn parsePtrMod(p: *Parser) Error!bool {
18201955 return blk_0: {
18211956 const pos_0 = p.i;
1822 if (p.parseKEYWORD_allowzero()) break :blk_0 true;
1957 if (try p.parseKEYWORD_allowzero()) break :blk_0 true;
18231958 p.i = pos_0;
1824 if (p.parseKEYWORD_const()) break :blk_0 true;
1959 if (try p.parseKEYWORD_const()) break :blk_0 true;
18251960 p.i = pos_0;
1826 if (p.parseKEYWORD_volatile()) break :blk_0 true;
1961 if (try p.parseKEYWORD_volatile()) break :blk_0 true;
18271962 p.i = pos_0;
18281963 break :blk_0 false;
18291964 };
18301965 }
1831 pub fn parsePrefixTypeOpPrefix(p: *Parser) bool {
1966 pub fn parsePrefixTypeOpPrefix(p: *Parser) Error!bool {
18321967 return blk_0: {
18331968 const pos_0 = p.i;
1834 if (p.parseQUESTIONMARK()) break :blk_0 true;
1969 if (try p.parseQUESTIONMARK()) break :blk_0 true;
18351970 p.i = pos_0;
1836 if (p.parseKEYWORD_anyframe() and p.parseMINUSRARROW()) break :blk_0 true;
1971 if (try p.parseKEYWORD_anyframe() and try p.parseMINUSRARROW()) break :blk_0 true;
18371972 p.i = pos_0;
1838 if (p.parseLBRACKET()) break :blk_0 true;
1973 if (try p.parseLBRACKET()) break :blk_0 true;
18391974 p.i = pos_0;
1840 if (p.parseASTERISK()) break :blk_0 true;
1975 if (try p.parseASTERISK()) break :blk_0 true;
18411976 p.i = pos_0;
18421977 break :blk_0 false;
18431978 };
18441979 }
1845 pub fn parseSuffixOp(p: *Parser) bool {
1980 pub fn parseSuffixOp(p: *Parser) Error!bool {
18461981 return blk_0: {
18471982 const pos_0 = p.i;
1848 if (p.parseLBRACKET() and p.parseExpr() and (blk_3: {
1983 if (try p.parseLBRACKET() and try p.parseExpr() and (blk_3: {
18491984 const pos_3 = p.i;
1850 if (p.parseDOT2() and blk_5: {
1985 if (try p.parseDOT2() and blk_5: {
18511986 const pos_5 = p.i;
1852 if (p.parseExpr()) break :blk_5 true;
1987 if (try p.parseExpr()) break :blk_5 true;
18531988 p.i = pos_5;
18541989 if (blk_6: {
18551990 const pos_6 = p.i;
1856 const match_6 = p.parseExprPrefix();
1991 const match_6 = try p.parseExprPrefix();
18571992 p.i = pos_6;
18581993 break :blk_6 !match_6;
18591994 }) break :blk_5 true;
......@@ -1861,145 +1996,145 @@ const Parser = struct {
18611996 break :blk_5 false;
18621997 } and (blk_6: {
18631998 const pos_6 = p.i;
1864 if (p.parseCOLON() and p.parseExpr()) break :blk_6 true;
1999 if (try p.parseCOLON() and try p.parseExpr()) break :blk_6 true;
18652000 p.i = pos_6;
18662001 break :blk_6 false;
18672002 } or true)) break :blk_3 true;
18682003 p.i = pos_3;
18692004 break :blk_3 false;
1870 } or true) and p.parseRBRACKET()) break :blk_0 true;
2005 } or true) and try p.parseRBRACKET()) break :blk_0 true;
18712006 p.i = pos_0;
1872 if (p.parseDOT() and p.parseIDENTIFIER()) break :blk_0 true;
2007 if (try p.parseDOT() and try p.parseIDENTIFIER()) break :blk_0 true;
18732008 p.i = pos_0;
1874 if (p.parseDOTASTERISK()) break :blk_0 true;
2009 if (try p.parseDOTASTERISK()) break :blk_0 true;
18752010 p.i = pos_0;
1876 if (p.parseDOT() and p.parseQUESTIONMARK()) break :blk_0 true;
2011 if (try p.parseDOT() and try p.parseQUESTIONMARK()) break :blk_0 true;
18772012 p.i = pos_0;
1878 if (p.parseFnCallArguments()) break :blk_0 true;
2013 if (try p.parseFnCallArguments()) break :blk_0 true;
18792014 p.i = pos_0;
18802015 break :blk_0 false;
18812016 };
18822017 }
1883 pub fn parseSuffixOpPrefix(p: *Parser) bool {
2018 pub fn parseSuffixOpPrefix(p: *Parser) Error!bool {
18842019 return blk_0: {
18852020 const pos_0 = p.i;
1886 if (p.parseLBRACKET()) break :blk_0 true;
2021 if (try p.parseLBRACKET()) break :blk_0 true;
18872022 p.i = pos_0;
1888 if (p.parseDOT() and p.parseIDENTIFIER()) break :blk_0 true;
2023 if (try p.parseDOT() and try p.parseIDENTIFIER()) break :blk_0 true;
18892024 p.i = pos_0;
1890 if (p.parseDOTASTERISK()) break :blk_0 true;
2025 if (try p.parseDOTASTERISK()) break :blk_0 true;
18912026 p.i = pos_0;
1892 if (p.parseDOT() and p.parseQUESTIONMARK()) break :blk_0 true;
2027 if (try p.parseDOT() and try p.parseQUESTIONMARK()) break :blk_0 true;
18932028 p.i = pos_0;
1894 if (p.parseLPAREN()) break :blk_0 true;
2029 if (try p.parseLPAREN()) break :blk_0 true;
18952030 p.i = pos_0;
18962031 break :blk_0 false;
18972032 };
18982033 }
1899 pub fn parseFnCallArguments(p: *Parser) bool {
2034 pub fn parseFnCallArguments(p: *Parser) Error!bool {
19002035 return blk_0: {
19012036 const pos_0 = p.i;
1902 if (p.parseLPAREN() and p.parseExprList() and p.parseRPAREN()) break :blk_0 true;
2037 if (try p.parseLPAREN() and try p.parseExprList() and try p.parseRPAREN()) break :blk_0 true;
19032038 p.i = pos_0;
19042039 break :blk_0 false;
19052040 };
19062041 }
1907 pub fn parseSliceTypeStart(p: *Parser) bool {
2042 pub fn parseSliceTypeStart(p: *Parser) Error!bool {
19082043 return blk_0: {
19092044 const pos_0 = p.i;
1910 if (p.parseLBRACKET() and (blk_3: {
2045 if (try p.parseLBRACKET() and (blk_3: {
19112046 const pos_3 = p.i;
1912 if (p.parseCOLON() and p.parseExpr()) break :blk_3 true;
2047 if (try p.parseCOLON() and try p.parseExpr()) break :blk_3 true;
19132048 p.i = pos_3;
19142049 break :blk_3 false;
1915 } or true) and p.parseRBRACKET()) break :blk_0 true;
2050 } or true) and try p.parseRBRACKET()) break :blk_0 true;
19162051 p.i = pos_0;
19172052 break :blk_0 false;
19182053 };
19192054 }
1920 pub fn parseSinglePtrTypeStart(p: *Parser) bool {
2055 pub fn parseSinglePtrTypeStart(p: *Parser) Error!bool {
19212056 return blk_0: {
19222057 const pos_0 = p.i;
1923 if (p.parseASTERISK()) break :blk_0 true;
2058 if (try p.parseASTERISK()) break :blk_0 true;
19242059 p.i = pos_0;
19252060 break :blk_0 false;
19262061 };
19272062 }
1928 pub fn parseManyPtrTypeStart(p: *Parser) bool {
2063 pub fn parseManyPtrTypeStart(p: *Parser) Error!bool {
19292064 return blk_0: {
19302065 const pos_0 = p.i;
1931 if (p.parseLBRACKET() and p.parseASTERISK() and (blk_3: {
2066 if (try p.parseLBRACKET() and try p.parseASTERISK() and (blk_3: {
19322067 const pos_3 = p.i;
1933 if (p.parseLETTERC()) break :blk_3 true;
2068 if (try p.parseLETTERC()) break :blk_3 true;
19342069 p.i = pos_3;
1935 if (p.parseCOLON() and p.parseExpr()) break :blk_3 true;
2070 if (try p.parseCOLON() and try p.parseExpr()) break :blk_3 true;
19362071 p.i = pos_3;
19372072 break :blk_3 false;
1938 } or true) and p.parseRBRACKET()) break :blk_0 true;
2073 } or true) and try p.parseRBRACKET()) break :blk_0 true;
19392074 p.i = pos_0;
19402075 break :blk_0 false;
19412076 };
19422077 }
1943 pub fn parseArrayTypeStart(p: *Parser) bool {
2078 pub fn parseArrayTypeStart(p: *Parser) Error!bool {
19442079 return blk_0: {
19452080 const pos_0 = p.i;
1946 if (p.parseLBRACKET() and blk_1: {
2081 if (try p.parseLBRACKET() and blk_1: {
19472082 const pos_1 = p.i;
1948 const match_1 = p.parseASTERISK();
2083 const match_1 = try p.parseASTERISK();
19492084 p.i = pos_1;
19502085 break :blk_1 !match_1;
1951 } and p.parseExpr() and (blk_3: {
2086 } and try p.parseExpr() and (blk_3: {
19522087 const pos_3 = p.i;
1953 if (p.parseCOLON() and p.parseExpr()) break :blk_3 true;
2088 if (try p.parseCOLON() and try p.parseExpr()) break :blk_3 true;
19542089 p.i = pos_3;
19552090 break :blk_3 false;
1956 } or true) and p.parseRBRACKET()) break :blk_0 true;
2091 } or true) and try p.parseRBRACKET()) break :blk_0 true;
19572092 p.i = pos_0;
19582093 break :blk_0 false;
19592094 };
19602095 }
1961 pub fn parseContainerTypeAuto(p: *Parser) bool {
2096 pub fn parseContainerTypeAuto(p: *Parser) Error!bool {
19622097 return blk_0: {
19632098 const pos_0 = p.i;
1964 if (p.parseContainerTypeKind() and p.parseLBRACE() and p.parseContainerMembers() and p.parseRBRACE()) break :blk_0 true;
2099 if (try p.parseContainerTypeKind() and try p.parseLBRACE() and try p.parseContainerMembers() and try p.parseRBRACE()) break :blk_0 true;
19652100 p.i = pos_0;
19662101 break :blk_0 false;
19672102 };
19682103 }
1969 pub fn parseContainerTypeKind(p: *Parser) bool {
2104 pub fn parseContainerTypeKind(p: *Parser) Error!bool {
19702105 return blk_0: {
19712106 const pos_0 = p.i;
1972 if (p.parseKEYWORD_struct() and (blk_3: {
2107 if (try p.parseKEYWORD_struct() and (blk_3: {
19732108 const pos_3 = p.i;
1974 if (p.parseLPAREN() and p.parseExpr() and p.parseRPAREN()) break :blk_3 true;
2109 if (try p.parseLPAREN() and try p.parseExpr() and try p.parseRPAREN()) break :blk_3 true;
19752110 p.i = pos_3;
19762111 break :blk_3 false;
19772112 } or true)) break :blk_0 true;
19782113 p.i = pos_0;
1979 if (p.parseKEYWORD_opaque()) break :blk_0 true;
2114 if (try p.parseKEYWORD_opaque()) break :blk_0 true;
19802115 p.i = pos_0;
1981 if (p.parseKEYWORD_enum() and (blk_3: {
2116 if (try p.parseKEYWORD_enum() and (blk_3: {
19822117 const pos_3 = p.i;
1983 if (p.parseLPAREN() and p.parseExpr() and p.parseRPAREN()) break :blk_3 true;
2118 if (try p.parseLPAREN() and try p.parseExpr() and try p.parseRPAREN()) break :blk_3 true;
19842119 p.i = pos_3;
19852120 break :blk_3 false;
19862121 } or true)) break :blk_0 true;
19872122 p.i = pos_0;
1988 if (p.parseKEYWORD_union() and (blk_3: {
2123 if (try p.parseKEYWORD_union() and (blk_3: {
19892124 const pos_3 = p.i;
1990 if (p.parseLPAREN() and blk_5: {
2125 if (try p.parseLPAREN() and blk_5: {
19912126 const pos_5 = p.i;
1992 if (p.parseKEYWORD_enum() and (blk_8: {
2127 if (try p.parseKEYWORD_enum() and (blk_8: {
19932128 const pos_8 = p.i;
1994 if (p.parseLPAREN() and p.parseExpr() and p.parseRPAREN()) break :blk_8 true;
2129 if (try p.parseLPAREN() and try p.parseExpr() and try p.parseRPAREN()) break :blk_8 true;
19952130 p.i = pos_8;
19962131 break :blk_8 false;
19972132 } or true)) break :blk_5 true;
19982133 p.i = pos_5;
1999 if (p.parseExpr()) break :blk_5 true;
2134 if (try p.parseExpr()) break :blk_5 true;
20002135 p.i = pos_5;
20012136 break :blk_5 false;
2002 } and p.parseRPAREN()) break :blk_3 true;
2137 } and try p.parseRPAREN()) break :blk_3 true;
20032138 p.i = pos_3;
20042139 break :blk_3 false;
20052140 } or true)) break :blk_0 true;
......@@ -2007,41 +2142,45 @@ const Parser = struct {
20072142 break :blk_0 false;
20082143 };
20092144 }
2010 pub fn parseByteAlign(p: *Parser) bool {
2145 pub fn parseByteAlign(p: *Parser) Error!bool {
20112146 return blk_0: {
20122147 const pos_0 = p.i;
2013 if (p.parseKEYWORD_align() and p.parseLPAREN() and p.parseExpr() and p.parseRPAREN()) break :blk_0 true;
2148 if (try p.parseKEYWORD_align() and try p.parseLPAREN() and try p.parseExpr() and try p.parseRPAREN()) break :blk_0 true;
20142149 p.i = pos_0;
20152150 break :blk_0 false;
20162151 };
20172152 }
2018 pub fn parseBitAlign(p: *Parser) bool {
2153 pub fn parseBitAlign(p: *Parser) Error!bool {
20192154 return blk_0: {
20202155 const pos_0 = p.i;
2021 if (p.parseKEYWORD_align() and p.parseLPAREN() and p.parseExpr() and (blk_3: {
2156 if (try p.parseKEYWORD_align() and try p.parseLPAREN() and try p.parseExpr() and (blk_3: {
20222157 const pos_3 = p.i;
2023 if (p.parseCOLON() and p.parseExpr() and p.parseCOLON() and p.parseExpr()) break :blk_3 true;
2158 if (try p.parseCOLON() and try p.parseExpr() and try p.parseCOLON() and try p.parseExpr()) break :blk_3 true;
20242159 p.i = pos_3;
20252160 break :blk_3 false;
2026 } or true) and p.parseRPAREN()) break :blk_0 true;
2161 } or true) and try p.parseRPAREN()) break :blk_0 true;
20272162 p.i = pos_0;
20282163 break :blk_0 false;
20292164 };
20302165 }
2031 pub fn parseIdentifierList(p: *Parser) bool {
2166 pub fn parseIdentifierList(p: *Parser) Error!bool {
20322167 return blk_0: {
20332168 const pos_0 = p.i;
20342169 if (blk_1: {
2170 var i_1: usize = 0;
20352171 while (blk_3: {
20362172 const pos_3 = p.i;
2037 if ((p.parsedoc_comment() or true) and p.parseIDENTIFIER() and p.parseCOMMA()) break :blk_3 true;
2173 if ((try p.parsedoc_comment() or true) and try p.parseIDENTIFIER() and try p.parseCOMMA()) break :blk_3 true;
20382174 p.i = pos_3;
20392175 break :blk_3 false;
2040 }) {}
2176 }) {
2177 if (i_1 > max_depth) return error.MaxDepth;
2178 i_1 += 1;
2179 }
20412180 break :blk_1 true;
20422181 } and (blk_3: {
20432182 const pos_3 = p.i;
2044 if ((p.parsedoc_comment() or true) and p.parseIDENTIFIER()) break :blk_3 true;
2183 if ((try p.parsedoc_comment() or true) and try p.parseIDENTIFIER()) break :blk_3 true;
20452184 p.i = pos_3;
20462185 break :blk_3 false;
20472186 } or true)) break :blk_0 true;
......@@ -2049,70 +2188,86 @@ const Parser = struct {
20492188 break :blk_0 false;
20502189 };
20512190 }
2052 pub fn parseSwitchProngList(p: *Parser) bool {
2191 pub fn parseSwitchProngList(p: *Parser) Error!bool {
20532192 return blk_0: {
20542193 const pos_0 = p.i;
20552194 if (blk_1: {
2195 var i_1: usize = 0;
20562196 while (blk_3: {
20572197 const pos_3 = p.i;
2058 if (p.parseSwitchProng() and p.parseCOMMA()) break :blk_3 true;
2198 if (try p.parseSwitchProng() and try p.parseCOMMA()) break :blk_3 true;
20592199 p.i = pos_3;
20602200 break :blk_3 false;
2061 }) {}
2201 }) {
2202 if (i_1 > max_depth) return error.MaxDepth;
2203 i_1 += 1;
2204 }
20622205 break :blk_1 true;
2063 } and (p.parseSwitchProng() or true)) break :blk_0 true;
2206 } and (try p.parseSwitchProng() or true)) break :blk_0 true;
20642207 p.i = pos_0;
20652208 break :blk_0 false;
20662209 };
20672210 }
2068 pub fn parseAsmOutputList(p: *Parser) bool {
2211 pub fn parseAsmOutputList(p: *Parser) Error!bool {
20692212 return blk_0: {
20702213 const pos_0 = p.i;
20712214 if (blk_1: {
2215 var i_1: usize = 0;
20722216 while (blk_3: {
20732217 const pos_3 = p.i;
2074 if (p.parseAsmOutputItem() and p.parseCOMMA()) break :blk_3 true;
2218 if (try p.parseAsmOutputItem() and try p.parseCOMMA()) break :blk_3 true;
20752219 p.i = pos_3;
20762220 break :blk_3 false;
2077 }) {}
2221 }) {
2222 if (i_1 > max_depth) return error.MaxDepth;
2223 i_1 += 1;
2224 }
20782225 break :blk_1 true;
2079 } and (p.parseAsmOutputItem() or true)) break :blk_0 true;
2226 } and (try p.parseAsmOutputItem() or true)) break :blk_0 true;
20802227 p.i = pos_0;
20812228 break :blk_0 false;
20822229 };
20832230 }
2084 pub fn parseAsmInputList(p: *Parser) bool {
2231 pub fn parseAsmInputList(p: *Parser) Error!bool {
20852232 return blk_0: {
20862233 const pos_0 = p.i;
20872234 if (blk_1: {
2235 var i_1: usize = 0;
20882236 while (blk_3: {
20892237 const pos_3 = p.i;
2090 if (p.parseAsmInputItem() and p.parseCOMMA()) break :blk_3 true;
2238 if (try p.parseAsmInputItem() and try p.parseCOMMA()) break :blk_3 true;
20912239 p.i = pos_3;
20922240 break :blk_3 false;
2093 }) {}
2241 }) {
2242 if (i_1 > max_depth) return error.MaxDepth;
2243 i_1 += 1;
2244 }
20942245 break :blk_1 true;
2095 } and (p.parseAsmInputItem() or true)) break :blk_0 true;
2246 } and (try p.parseAsmInputItem() or true)) break :blk_0 true;
20962247 p.i = pos_0;
20972248 break :blk_0 false;
20982249 };
20992250 }
2100 pub fn parseParamDeclList(p: *Parser) bool {
2251 pub fn parseParamDeclList(p: *Parser) Error!bool {
21012252 return blk_0: {
21022253 const pos_0 = p.i;
21032254 if (blk_1: {
2255 var i_1: usize = 0;
21042256 while (blk_3: {
21052257 const pos_3 = p.i;
2106 if (p.parseParamDecl() and p.parseCOMMA()) break :blk_3 true;
2258 if (try p.parseParamDecl() and try p.parseCOMMA()) break :blk_3 true;
21072259 p.i = pos_3;
21082260 break :blk_3 false;
2109 }) {}
2261 }) {
2262 if (i_1 > max_depth) return error.MaxDepth;
2263 i_1 += 1;
2264 }
21102265 break :blk_1 true;
21112266 } and (blk_3: {
21122267 const pos_3 = p.i;
2113 if (p.parseParamDecl()) break :blk_3 true;
2268 if (try p.parseParamDecl()) break :blk_3 true;
21142269 p.i = pos_3;
2115 if (p.parseDOT3() and (p.parseCOMMA() or true)) break :blk_3 true;
2270 if (try p.parseDOT3() and (try p.parseCOMMA() or true)) break :blk_3 true;
21162271 p.i = pos_3;
21172272 break :blk_3 false;
21182273 } or true)) break :blk_0 true;
......@@ -2120,24 +2275,28 @@ const Parser = struct {
21202275 break :blk_0 false;
21212276 };
21222277 }
2123 pub fn parseExprList(p: *Parser) bool {
2278 pub fn parseExprList(p: *Parser) Error!bool {
21242279 return blk_0: {
21252280 const pos_0 = p.i;
21262281 if (blk_1: {
2282 var i_1: usize = 0;
21272283 while (blk_3: {
21282284 const pos_3 = p.i;
2129 if (p.parseExpr() and p.parseCOMMA()) break :blk_3 true;
2285 if (try p.parseExpr() and try p.parseCOMMA()) break :blk_3 true;
21302286 p.i = pos_3;
21312287 break :blk_3 false;
2132 }) {}
2288 }) {
2289 if (i_1 > max_depth) return error.MaxDepth;
2290 i_1 += 1;
2291 }
21332292 break :blk_1 true;
21342293 } and blk_2: {
21352294 const pos_2 = p.i;
2136 if (p.parseExpr()) break :blk_2 true;
2295 if (try p.parseExpr()) break :blk_2 true;
21372296 p.i = pos_2;
21382297 if (blk_3: {
21392298 const pos_3 = p.i;
2140 const match_3 = p.parseExprPrefix();
2299 const match_3 = try p.parseExprPrefix();
21412300 p.i = pos_3;
21422301 break :blk_3 !match_3;
21432302 }) break :blk_2 true;
......@@ -2148,15 +2307,15 @@ const Parser = struct {
21482307 break :blk_0 false;
21492308 };
21502309 }
2151 pub fn parseExprPrefix(p: *Parser) bool {
2310 pub fn parseExprPrefix(p: *Parser) Error!bool {
21522311 return blk_0: {
21532312 const pos_0 = p.i;
2154 if (p.parseASTERISK()) break :blk_0 true;
2313 if (try p.parseASTERISK()) break :blk_0 true;
21552314 p.i = pos_0;
21562315 break :blk_0 false;
21572316 };
21582317 }
2159 pub fn parsesof(p: *Parser) bool {
2318 pub fn parsesof(p: *Parser) Error!bool {
21602319 return blk_0: {
21612320 const pos_0 = p.i;
21622321 if ((p.i == 0)) break :blk_0 true;
......@@ -2164,7 +2323,7 @@ const Parser = struct {
21642323 break :blk_0 false;
21652324 };
21662325 }
2167 pub fn parseeof(p: *Parser) bool {
2326 pub fn parseeof(p: *Parser) Error!bool {
21682327 return blk_0: {
21692328 const pos_0 = p.i;
21702329 if (blk_1: {
......@@ -2183,7 +2342,7 @@ const Parser = struct {
21832342 break :blk_0 false;
21842343 };
21852344 }
2186 pub fn parseox80_oxBF(p: *Parser) bool {
2345 pub fn parseox80_oxBF(p: *Parser) Error!bool {
21872346 return blk_0: {
21882347 const pos_0 = p.i;
21892348 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2198,7 +2357,7 @@ const Parser = struct {
21982357 break :blk_0 false;
21992358 };
22002359 }
2201 pub fn parseoxF4(p: *Parser) bool {
2360 pub fn parseoxF4(p: *Parser) Error!bool {
22022361 return blk_0: {
22032362 const pos_0 = p.i;
22042363 if (blk_1: {
......@@ -2212,7 +2371,7 @@ const Parser = struct {
22122371 break :blk_0 false;
22132372 };
22142373 }
2215 pub fn parseox80_ox8F(p: *Parser) bool {
2374 pub fn parseox80_ox8F(p: *Parser) Error!bool {
22162375 return blk_0: {
22172376 const pos_0 = p.i;
22182377 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2227,7 +2386,7 @@ const Parser = struct {
22272386 break :blk_0 false;
22282387 };
22292388 }
2230 pub fn parseoxF1_oxF3(p: *Parser) bool {
2389 pub fn parseoxF1_oxF3(p: *Parser) Error!bool {
22312390 return blk_0: {
22322391 const pos_0 = p.i;
22332392 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2242,7 +2401,7 @@ const Parser = struct {
22422401 break :blk_0 false;
22432402 };
22442403 }
2245 pub fn parseoxF0(p: *Parser) bool {
2404 pub fn parseoxF0(p: *Parser) Error!bool {
22462405 return blk_0: {
22472406 const pos_0 = p.i;
22482407 if (blk_1: {
......@@ -2256,7 +2415,7 @@ const Parser = struct {
22562415 break :blk_0 false;
22572416 };
22582417 }
2259 pub fn parseox90_0xBF(p: *Parser) bool {
2418 pub fn parseox90_0xBF(p: *Parser) Error!bool {
22602419 return blk_0: {
22612420 const pos_0 = p.i;
22622421 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2271,7 +2430,7 @@ const Parser = struct {
22712430 break :blk_0 false;
22722431 };
22732432 }
2274 pub fn parseoxEE_oxEF(p: *Parser) bool {
2433 pub fn parseoxEE_oxEF(p: *Parser) Error!bool {
22752434 return blk_0: {
22762435 const pos_0 = p.i;
22772436 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2286,7 +2445,7 @@ const Parser = struct {
22862445 break :blk_0 false;
22872446 };
22882447 }
2289 pub fn parseoxED(p: *Parser) bool {
2448 pub fn parseoxED(p: *Parser) Error!bool {
22902449 return blk_0: {
22912450 const pos_0 = p.i;
22922451 if (blk_1: {
......@@ -2300,7 +2459,7 @@ const Parser = struct {
23002459 break :blk_0 false;
23012460 };
23022461 }
2303 pub fn parseox80_ox9F(p: *Parser) bool {
2462 pub fn parseox80_ox9F(p: *Parser) Error!bool {
23042463 return blk_0: {
23052464 const pos_0 = p.i;
23062465 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2315,7 +2474,7 @@ const Parser = struct {
23152474 break :blk_0 false;
23162475 };
23172476 }
2318 pub fn parseoxE1_oxEC(p: *Parser) bool {
2477 pub fn parseoxE1_oxEC(p: *Parser) Error!bool {
23192478 return blk_0: {
23202479 const pos_0 = p.i;
23212480 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2330,7 +2489,7 @@ const Parser = struct {
23302489 break :blk_0 false;
23312490 };
23322491 }
2333 pub fn parseoxE0(p: *Parser) bool {
2492 pub fn parseoxE0(p: *Parser) Error!bool {
23342493 return blk_0: {
23352494 const pos_0 = p.i;
23362495 if (blk_1: {
......@@ -2344,7 +2503,7 @@ const Parser = struct {
23442503 break :blk_0 false;
23452504 };
23462505 }
2347 pub fn parseoxA0_oxBF(p: *Parser) bool {
2506 pub fn parseoxA0_oxBF(p: *Parser) Error!bool {
23482507 return blk_0: {
23492508 const pos_0 = p.i;
23502509 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2359,7 +2518,7 @@ const Parser = struct {
23592518 break :blk_0 false;
23602519 };
23612520 }
2362 pub fn parseoxC2_oxDF(p: *Parser) bool {
2521 pub fn parseoxC2_oxDF(p: *Parser) Error!bool {
23632522 return blk_0: {
23642523 const pos_0 = p.i;
23652524 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2374,29 +2533,29 @@ const Parser = struct {
23742533 break :blk_0 false;
23752534 };
23762535 }
2377 pub fn parsemultibyte_utf8(p: *Parser) bool {
2536 pub fn parsemultibyte_utf8(p: *Parser) Error!bool {
23782537 return blk_0: {
23792538 const pos_0 = p.i;
2380 if (p.parseoxF4() and p.parseox80_ox8F() and p.parseox80_oxBF() and p.parseox80_oxBF()) break :blk_0 true;
2539 if (try p.parseoxF4() and try p.parseox80_ox8F() and try p.parseox80_oxBF() and try p.parseox80_oxBF()) break :blk_0 true;
23812540 p.i = pos_0;
2382 if (p.parseoxF1_oxF3() and p.parseox80_oxBF() and p.parseox80_oxBF() and p.parseox80_oxBF()) break :blk_0 true;
2541 if (try p.parseoxF1_oxF3() and try p.parseox80_oxBF() and try p.parseox80_oxBF() and try p.parseox80_oxBF()) break :blk_0 true;
23832542 p.i = pos_0;
2384 if (p.parseoxF0() and p.parseox90_0xBF() and p.parseox80_oxBF() and p.parseox80_oxBF()) break :blk_0 true;
2543 if (try p.parseoxF0() and try p.parseox90_0xBF() and try p.parseox80_oxBF() and try p.parseox80_oxBF()) break :blk_0 true;
23852544 p.i = pos_0;
2386 if (p.parseoxEE_oxEF() and p.parseox80_oxBF() and p.parseox80_oxBF()) break :blk_0 true;
2545 if (try p.parseoxEE_oxEF() and try p.parseox80_oxBF() and try p.parseox80_oxBF()) break :blk_0 true;
23872546 p.i = pos_0;
2388 if (p.parseoxED() and p.parseox80_ox9F() and p.parseox80_oxBF()) break :blk_0 true;
2547 if (try p.parseoxED() and try p.parseox80_ox9F() and try p.parseox80_oxBF()) break :blk_0 true;
23892548 p.i = pos_0;
2390 if (p.parseoxE1_oxEC() and p.parseox80_oxBF() and p.parseox80_oxBF()) break :blk_0 true;
2549 if (try p.parseoxE1_oxEC() and try p.parseox80_oxBF() and try p.parseox80_oxBF()) break :blk_0 true;
23912550 p.i = pos_0;
2392 if (p.parseoxE0() and p.parseoxA0_oxBF() and p.parseox80_oxBF()) break :blk_0 true;
2551 if (try p.parseoxE0() and try p.parseoxA0_oxBF() and try p.parseox80_oxBF()) break :blk_0 true;
23932552 p.i = pos_0;
2394 if (p.parseoxC2_oxDF() and p.parseox80_oxBF()) break :blk_0 true;
2553 if (try p.parseoxC2_oxDF() and try p.parseox80_oxBF()) break :blk_0 true;
23952554 p.i = pos_0;
23962555 break :blk_0 false;
23972556 };
23982557 }
2399 pub fn parsenon_control_ascii(p: *Parser) bool {
2558 pub fn parsenon_control_ascii(p: *Parser) Error!bool {
24002559 return blk_0: {
24012560 const pos_0 = p.i;
24022561 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2411,7 +2570,7 @@ const Parser = struct {
24112570 break :blk_0 false;
24122571 };
24132572 }
2414 pub fn parsenon_control_utf8(p: *Parser) bool {
2573 pub fn parsenon_control_utf8(p: *Parser) Error!bool {
24152574 return blk_0: {
24162575 const pos_0 = p.i;
24172576 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2427,7 +2586,7 @@ const Parser = struct {
24272586 break :blk_0 false;
24282587 };
24292588 }
2430 pub fn parsechar_char(p: *Parser) bool {
2589 pub fn parsechar_char(p: *Parser) Error!bool {
24312590 return blk_0: {
24322591 const pos_0 = p.i;
24332592 if (blk_1: {
......@@ -2458,12 +2617,12 @@ const Parser = struct {
24582617 });
24592618 p.i = pos_1;
24602619 break :blk_1 !match_1;
2461 } and p.parsenon_control_utf8()) break :blk_0 true;
2620 } and try p.parsenon_control_utf8()) break :blk_0 true;
24622621 p.i = pos_0;
24632622 break :blk_0 false;
24642623 };
24652624 }
2466 pub fn parsestring_char(p: *Parser) bool {
2625 pub fn parsestring_char(p: *Parser) Error!bool {
24672626 return blk_0: {
24682627 const pos_0 = p.i;
24692628 if (blk_1: {
......@@ -2494,32 +2653,39 @@ const Parser = struct {
24942653 });
24952654 p.i = pos_1;
24962655 break :blk_1 !match_1;
2497 } and p.parsenon_control_utf8()) break :blk_0 true;
2656 } and try p.parsenon_control_utf8()) break :blk_0 true;
24982657 p.i = pos_0;
24992658 break :blk_0 false;
25002659 };
25012660 }
2502 pub fn parsecontainer_doc_comment(p: *Parser) bool {
2661 pub fn parsecontainer_doc_comment(p: *Parser) Error!bool {
25032662 return blk_0: {
25042663 const pos_0 = p.i;
25052664 if (blk_1: {
25062665 var match_1 = false;
2666 var i_1: usize = 0;
25072667 while (blk_3: {
25082668 const pos_3 = p.i;
2509 if (p.parseskip() and blk_4: {
2669 if (try p.parseskip() and blk_4: {
25102670 if (std.mem.startsWith(u8, p.source[p.i..], "//!")) {
25112671 p.i += 3;
25122672 break :blk_4 true;
25132673 }
25142674 break :blk_4 false;
25152675 } and blk_4: {
2516 while (p.parsenon_control_utf8()) {}
2676 var i_4: usize = 0;
2677 while (try p.parsenon_control_utf8()) {
2678 if (i_4 > max_depth) return error.MaxDepth;
2679 i_4 += 1;
2680 }
25172681 break :blk_4 true;
2518 } and p.parsenewline()) break :blk_3 true;
2682 } and try p.parsenewline()) break :blk_3 true;
25192683 p.i = pos_3;
25202684 break :blk_3 false;
25212685 }) {
25222686 match_1 = true;
2687 if (i_1 > max_depth) return error.MaxDepth;
2688 i_1 += 1;
25232689 }
25242690 break :blk_1 match_1;
25252691 }) break :blk_0 true;
......@@ -2527,34 +2693,41 @@ const Parser = struct {
25272693 break :blk_0 false;
25282694 };
25292695 }
2530 pub fn parsedoc_comment(p: *Parser) bool {
2696 pub fn parsedoc_comment(p: *Parser) Error!bool {
25312697 return blk_0: {
25322698 const pos_0 = p.i;
25332699 if (blk_2: {
25342700 const pos_2 = p.i;
2535 if (p.parsesof()) break :blk_2 true;
2701 if (try p.parsesof()) break :blk_2 true;
25362702 p.i = pos_2;
2537 if (p.parseskip_require_newline()) break :blk_2 true;
2703 if (try p.parseskip_require_newline()) break :blk_2 true;
25382704 p.i = pos_2;
25392705 break :blk_2 false;
25402706 } and blk_1: {
25412707 var match_1 = false;
2708 var i_1: usize = 0;
25422709 while (blk_3: {
25432710 const pos_3 = p.i;
2544 if (p.parseskip() and blk_4: {
2711 if (try p.parseskip() and blk_4: {
25452712 if (std.mem.startsWith(u8, p.source[p.i..], "///")) {
25462713 p.i += 3;
25472714 break :blk_4 true;
25482715 }
25492716 break :blk_4 false;
25502717 } and blk_4: {
2551 while (p.parsenon_control_utf8()) {}
2718 var i_4: usize = 0;
2719 while (try p.parsenon_control_utf8()) {
2720 if (i_4 > max_depth) return error.MaxDepth;
2721 i_4 += 1;
2722 }
25522723 break :blk_4 true;
2553 } and p.parsenewline()) break :blk_3 true;
2724 } and try p.parsenewline()) break :blk_3 true;
25542725 p.i = pos_3;
25552726 break :blk_3 false;
25562727 }) {
25572728 match_1 = true;
2729 if (i_1 > max_depth) return error.MaxDepth;
2730 i_1 += 1;
25582731 }
25592732 break :blk_1 match_1;
25602733 }) break :blk_0 true;
......@@ -2562,7 +2735,7 @@ const Parser = struct {
25622735 break :blk_0 false;
25632736 };
25642737 }
2565 pub fn parseline_comment(p: *Parser) bool {
2738 pub fn parseline_comment(p: *Parser) Error!bool {
25662739 return blk_0: {
25672740 const pos_0 = p.i;
25682741 if (blk_1: {
......@@ -2585,9 +2758,13 @@ const Parser = struct {
25852758 p.i = pos_1;
25862759 break :blk_1 !match_1;
25872760 } and blk_1: {
2588 while (p.parsenon_control_utf8()) {}
2761 var i_1: usize = 0;
2762 while (try p.parsenon_control_utf8()) {
2763 if (i_1 > max_depth) return error.MaxDepth;
2764 i_1 += 1;
2765 }
25892766 break :blk_1 true;
2590 } and p.parsenewline()) break :blk_0 true;
2767 } and try p.parsenewline()) break :blk_0 true;
25912768 p.i = pos_0;
25922769 if (blk_1: {
25932770 if (std.mem.startsWith(u8, p.source[p.i..], "////")) {
......@@ -2596,14 +2773,18 @@ const Parser = struct {
25962773 }
25972774 break :blk_1 false;
25982775 } and blk_1: {
2599 while (p.parsenon_control_utf8()) {}
2776 var i_1: usize = 0;
2777 while (try p.parsenon_control_utf8()) {
2778 if (i_1 > max_depth) return error.MaxDepth;
2779 i_1 += 1;
2780 }
26002781 break :blk_1 true;
2601 } and p.parsenewline()) break :blk_0 true;
2782 } and try p.parsenewline()) break :blk_0 true;
26022783 p.i = pos_0;
26032784 break :blk_0 false;
26042785 };
26052786 }
2606 pub fn parseline_string(p: *Parser) bool {
2787 pub fn parseline_string(p: *Parser) Error!bool {
26072788 return blk_0: {
26082789 const pos_0 = p.i;
26092790 if (blk_1: {
......@@ -2613,14 +2794,18 @@ const Parser = struct {
26132794 }
26142795 break :blk_1 false;
26152796 } and blk_1: {
2616 while (p.parsenon_control_utf8()) {}
2797 var i_1: usize = 0;
2798 while (try p.parsenon_control_utf8()) {
2799 if (i_1 > max_depth) return error.MaxDepth;
2800 i_1 += 1;
2801 }
26172802 break :blk_1 true;
2618 } and p.parsenewline()) break :blk_0 true;
2803 } and try p.parsenewline()) break :blk_0 true;
26192804 p.i = pos_0;
26202805 break :blk_0 false;
26212806 };
26222807 }
2623 pub fn parsenewline(p: *Parser) bool {
2808 pub fn parsenewline(p: *Parser) Error!bool {
26242809 return blk_0: {
26252810 const pos_0 = p.i;
26262811 if (blk_1: {
......@@ -2643,7 +2828,7 @@ const Parser = struct {
26432828 break :blk_4 false;
26442829 }) break :blk_3 true;
26452830 p.i = pos_3;
2646 if (p.parseeof()) break :blk_3 true;
2831 if (try p.parseeof()) break :blk_3 true;
26472832 p.i = pos_3;
26482833 break :blk_3 false;
26492834 };
......@@ -2654,10 +2839,11 @@ const Parser = struct {
26542839 break :blk_0 false;
26552840 };
26562841 }
2657 pub fn parseskip(p: *Parser) bool {
2842 pub fn parseskip(p: *Parser) Error!bool {
26582843 return blk_0: {
26592844 const pos_0 = p.i;
26602845 if (blk_1: {
2846 var i_1: usize = 0;
26612847 while (blk_3: {
26622848 const pos_3 = p.i;
26632849 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2672,20 +2858,24 @@ const Parser = struct {
26722858 else => false,
26732859 })) break :blk_3 true;
26742860 p.i = pos_3;
2675 if (p.parseline_comment()) break :blk_3 true;
2861 if (try p.parseline_comment()) break :blk_3 true;
26762862 p.i = pos_3;
26772863 break :blk_3 false;
2678 }) {}
2864 }) {
2865 if (i_1 > max_depth) return error.MaxDepth;
2866 i_1 += 1;
2867 }
26792868 break :blk_1 true;
26802869 }) break :blk_0 true;
26812870 p.i = pos_0;
26822871 break :blk_0 false;
26832872 };
26842873 }
2685 pub fn parseskip_require_newline(p: *Parser) bool {
2874 pub fn parseskip_require_newline(p: *Parser) Error!bool {
26862875 return blk_0: {
26872876 const pos_0 = p.i;
26882877 if (blk_1: {
2878 var i_1: usize = 0;
26892879 while ((p.i < p.source.len and switch (p.source[p.i]) {
26902880 ' '...' ',
26912881 '\t'...'\t',
......@@ -2695,7 +2885,10 @@ const Parser = struct {
26952885 break :blk_2 true;
26962886 },
26972887 else => false,
2698 })) {}
2888 })) {
2889 if (i_1 > max_depth) return error.MaxDepth;
2890 i_1 += 1;
2891 }
26992892 break :blk_1 true;
27002893 } and blk_2: {
27012894 const pos_2 = p.i;
......@@ -2708,19 +2901,20 @@ const Parser = struct {
27082901 else => false,
27092902 })) break :blk_2 true;
27102903 p.i = pos_2;
2711 if (p.parseline_comment()) break :blk_2 true;
2904 if (try p.parseline_comment()) break :blk_2 true;
27122905 p.i = pos_2;
27132906 break :blk_2 false;
2714 } and p.parseskip()) break :blk_0 true;
2907 } and try p.parseskip()) break :blk_0 true;
27152908 p.i = pos_0;
27162909 break :blk_0 false;
27172910 };
27182911 }
2719 pub fn parsepre_op_white(p: *Parser) bool {
2912 pub fn parsepre_op_white(p: *Parser) Error!bool {
27202913 return blk_0: {
27212914 const pos_0 = p.i;
27222915 if (blk_1: {
27232916 var match_1 = false;
2917 var i_1: usize = 0;
27242918 while (blk_3: {
27252919 const pos_3 = p.i;
27262920 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2735,11 +2929,13 @@ const Parser = struct {
27352929 else => false,
27362930 })) break :blk_3 true;
27372931 p.i = pos_3;
2738 if (p.parseline_comment()) break :blk_3 true;
2932 if (try p.parseline_comment()) break :blk_3 true;
27392933 p.i = pos_3;
27402934 break :blk_3 false;
27412935 }) {
27422936 match_1 = true;
2937 if (i_1 > max_depth) return error.MaxDepth;
2938 i_1 += 1;
27432939 }
27442940 break :blk_1 match_1;
27452941 }) break :blk_0 true;
......@@ -2747,7 +2943,7 @@ const Parser = struct {
27472943 break :blk_0 false;
27482944 };
27492945 }
2750 pub fn parsepost_op_white(p: *Parser) bool {
2946 pub fn parsepost_op_white(p: *Parser) Error!bool {
27512947 return blk_0: {
27522948 const pos_0 = p.i;
27532949 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2760,15 +2956,15 @@ const Parser = struct {
27602956 break :blk_1 true;
27612957 },
27622958 else => false,
2763 }) and p.parseskip()) break :blk_0 true;
2959 }) and try p.parseskip()) break :blk_0 true;
27642960 p.i = pos_0;
27652961 break :blk_0 false;
27662962 };
27672963 }
2768 pub fn parseCHAR_LITERAL(p: *Parser) bool {
2964 pub fn parseCHAR_LITERAL(p: *Parser) Error!bool {
27692965 return blk_0: {
27702966 const pos_0 = p.i;
2771 if (p.parseskip() and (p.i < p.source.len and switch (p.source[p.i]) {
2967 if (try p.parseskip() and (p.i < p.source.len and switch (p.source[p.i]) {
27722968 '\''...'\'',
27732969 => blk_1: {
27742970 p.i += 1;
......@@ -2776,7 +2972,11 @@ const Parser = struct {
27762972 },
27772973 else => false,
27782974 }) and blk_1: {
2779 while (p.parsechar_char()) {}
2975 var i_1: usize = 0;
2976 while (try p.parsechar_char()) {
2977 if (i_1 > max_depth) return error.MaxDepth;
2978 i_1 += 1;
2979 }
27802980 break :blk_1 true;
27812981 } and (p.i < p.source.len and switch (p.source[p.i]) {
27822982 '\''...'\'',
......@@ -2790,7 +2990,7 @@ const Parser = struct {
27902990 break :blk_0 false;
27912991 };
27922992 }
2793 pub fn parsedigit(p: *Parser) bool {
2993 pub fn parsedigit(p: *Parser) Error!bool {
27942994 return blk_0: {
27952995 const pos_0 = p.i;
27962996 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2812,10 +3012,10 @@ const Parser = struct {
28123012 break :blk_0 false;
28133013 };
28143014 }
2815 pub fn parsedigit_int(p: *Parser) bool {
3015 pub fn parsedigit_int(p: *Parser) Error!bool {
28163016 return blk_0: {
28173017 const pos_0 = p.i;
2818 if (p.parsedigit()) break :blk_0 true;
3018 if (try p.parsedigit()) break :blk_0 true;
28193019 p.i = pos_0;
28203020 if ((p.i < p.source.len and switch (p.source[p.i]) {
28213021 'e'...'e',
......@@ -2832,10 +3032,10 @@ const Parser = struct {
28323032 break :blk_0 false;
28333033 };
28343034 }
2835 pub fn parsedigit_float(p: *Parser) bool {
3035 pub fn parsedigit_float(p: *Parser) Error!bool {
28363036 return blk_0: {
28373037 const pos_0 = p.i;
2838 if (p.parsedigit()) break :blk_0 true;
3038 if (try p.parsedigit()) break :blk_0 true;
28393039 p.i = pos_0;
28403040 if ((p.i < p.source.len and switch (p.source[p.i]) {
28413041 'e'...'e',
......@@ -2860,10 +3060,10 @@ const Parser = struct {
28603060 break :blk_0 false;
28613061 };
28623062 }
2863 pub fn parseNUMBERLITERAL(p: *Parser) bool {
3063 pub fn parseNUMBERLITERAL(p: *Parser) Error!bool {
28643064 return blk_0: {
28653065 const pos_0 = p.i;
2866 if (p.parseskip() and (p.i < p.source.len and switch (p.source[p.i]) {
3066 if (try p.parseskip() and (p.i < p.source.len and switch (p.source[p.i]) {
28673067 '0'...'9',
28683068 => blk_1: {
28693069 p.i += 1;
......@@ -2871,7 +3071,11 @@ const Parser = struct {
28713071 },
28723072 else => false,
28733073 }) and blk_1: {
2874 while (p.parsedigit_int()) {}
3074 var i_1: usize = 0;
3075 while (try p.parsedigit_int()) {
3076 if (i_1 > max_depth) return error.MaxDepth;
3077 i_1 += 1;
3078 }
28753079 break :blk_1 true;
28763080 } and blk_1: {
28773081 if (std.mem.startsWith(u8, p.source[p.i..], ".")) {
......@@ -2881,13 +3085,16 @@ const Parser = struct {
28813085 break :blk_1 false;
28823086 } and blk_1: {
28833087 var match_1 = false;
2884 while (p.parsedigit_float()) {
3088 var i_1: usize = 0;
3089 while (try p.parsedigit_float()) {
28853090 match_1 = true;
3091 if (i_1 > max_depth) return error.MaxDepth;
3092 i_1 += 1;
28863093 }
28873094 break :blk_1 match_1;
28883095 }) break :blk_0 true;
28893096 p.i = pos_0;
2890 if (p.parseskip() and (p.i < p.source.len and switch (p.source[p.i]) {
3097 if (try p.parseskip() and (p.i < p.source.len and switch (p.source[p.i]) {
28913098 '0'...'9',
28923099 => blk_1: {
28933100 p.i += 1;
......@@ -2895,14 +3102,18 @@ const Parser = struct {
28953102 },
28963103 else => false,
28973104 }) and blk_1: {
2898 while (p.parsedigit_float()) {}
3105 var i_1: usize = 0;
3106 while (try p.parsedigit_float()) {
3107 if (i_1 > max_depth) return error.MaxDepth;
3108 i_1 += 1;
3109 }
28993110 break :blk_1 true;
29003111 }) break :blk_0 true;
29013112 p.i = pos_0;
29023113 break :blk_0 false;
29033114 };
29043115 }
2905 pub fn parsestring(p: *Parser) bool {
3116 pub fn parsestring(p: *Parser) Error!bool {
29063117 return blk_0: {
29073118 const pos_0 = p.i;
29083119 if ((p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2913,7 +3124,11 @@ const Parser = struct {
29133124 },
29143125 else => false,
29153126 }) and blk_1: {
2916 while (p.parsestring_char()) {}
3127 var i_1: usize = 0;
3128 while (try p.parsestring_char()) {
3129 if (i_1 > max_depth) return error.MaxDepth;
3130 i_1 += 1;
3131 }
29173132 break :blk_1 true;
29183133 } and (p.i < p.source.len and switch (p.source[p.i]) {
29193134 '"'...'"',
......@@ -2927,28 +3142,31 @@ const Parser = struct {
29273142 break :blk_0 false;
29283143 };
29293144 }
2930 pub fn parseSTRINGLITERALSINGLE(p: *Parser) bool {
3145 pub fn parseSTRINGLITERALSINGLE(p: *Parser) Error!bool {
29313146 return blk_0: {
29323147 const pos_0 = p.i;
2933 if (p.parseskip() and p.parsestring()) break :blk_0 true;
3148 if (try p.parseskip() and try p.parsestring()) break :blk_0 true;
29343149 p.i = pos_0;
29353150 break :blk_0 false;
29363151 };
29373152 }
2938 pub fn parseSTRINGLITERAL(p: *Parser) bool {
3153 pub fn parseSTRINGLITERAL(p: *Parser) Error!bool {
29393154 return blk_0: {
29403155 const pos_0 = p.i;
2941 if (p.parseskip() and p.parsestring()) break :blk_0 true;
3156 if (try p.parseskip() and try p.parsestring()) break :blk_0 true;
29423157 p.i = pos_0;
29433158 if (blk_1: {
29443159 var match_1 = false;
3160 var i_1: usize = 0;
29453161 while (blk_3: {
29463162 const pos_3 = p.i;
2947 if (p.parseskip() and p.parseline_string()) break :blk_3 true;
3163 if (try p.parseskip() and try p.parseline_string()) break :blk_3 true;
29483164 p.i = pos_3;
29493165 break :blk_3 false;
29503166 }) {
29513167 match_1 = true;
3168 if (i_1 > max_depth) return error.MaxDepth;
3169 i_1 += 1;
29523170 }
29533171 break :blk_1 match_1;
29543172 }) break :blk_0 true;
......@@ -2956,12 +3174,12 @@ const Parser = struct {
29563174 break :blk_0 false;
29573175 };
29583176 }
2959 pub fn parseIDENTIFIER(p: *Parser) bool {
3177 pub fn parseIDENTIFIER(p: *Parser) Error!bool {
29603178 return blk_0: {
29613179 const pos_0 = p.i;
2962 if (p.parseskip() and blk_1: {
3180 if (try p.parseskip() and blk_1: {
29633181 const pos_1 = p.i;
2964 const match_1 = p.parsekeyword();
3182 const match_1 = try p.parsekeyword();
29653183 p.i = pos_1;
29663184 break :blk_1 !match_1;
29673185 } and (p.i < p.source.len and switch (p.source[p.i]) {
......@@ -2974,6 +3192,7 @@ const Parser = struct {
29743192 },
29753193 else => false,
29763194 }) and blk_1: {
3195 var i_1: usize = 0;
29773196 while ((p.i < p.source.len and switch (p.source[p.i]) {
29783197 'A'...'Z',
29793198 'a'...'z',
......@@ -2984,25 +3203,28 @@ const Parser = struct {
29843203 break :blk_2 true;
29853204 },
29863205 else => false,
2987 })) {}
3206 })) {
3207 if (i_1 > max_depth) return error.MaxDepth;
3208 i_1 += 1;
3209 }
29883210 break :blk_1 true;
29893211 }) break :blk_0 true;
29903212 p.i = pos_0;
2991 if (p.parseskip() and blk_1: {
3213 if (try p.parseskip() and blk_1: {
29923214 if (std.mem.startsWith(u8, p.source[p.i..], "@")) {
29933215 p.i += 1;
29943216 break :blk_1 true;
29953217 }
29963218 break :blk_1 false;
2997 } and p.parsestring()) break :blk_0 true;
3219 } and try p.parsestring()) break :blk_0 true;
29983220 p.i = pos_0;
29993221 break :blk_0 false;
30003222 };
30013223 }
3002 pub fn parseBUILTINIDENTIFIER(p: *Parser) bool {
3224 pub fn parseBUILTINIDENTIFIER(p: *Parser) Error!bool {
30033225 return blk_0: {
30043226 const pos_0 = p.i;
3005 if (p.parseskip() and blk_1: {
3227 if (try p.parseskip() and blk_1: {
30063228 if (std.mem.startsWith(u8, p.source[p.i..], "@")) {
30073229 p.i += 1;
30083230 break :blk_1 true;
......@@ -3018,6 +3240,7 @@ const Parser = struct {
30183240 },
30193241 else => false,
30203242 }) and blk_1: {
3243 var i_1: usize = 0;
30213244 while ((p.i < p.source.len and switch (p.source[p.i]) {
30223245 'A'...'Z',
30233246 'a'...'z',
......@@ -3028,17 +3251,20 @@ const Parser = struct {
30283251 break :blk_2 true;
30293252 },
30303253 else => false,
3031 })) {}
3254 })) {
3255 if (i_1 > max_depth) return error.MaxDepth;
3256 i_1 += 1;
3257 }
30323258 break :blk_1 true;
30333259 }) break :blk_0 true;
30343260 p.i = pos_0;
30353261 break :blk_0 false;
30363262 };
30373263 }
3038 pub fn parseAMPERSAND(p: *Parser) bool {
3264 pub fn parseAMPERSAND(p: *Parser) Error!bool {
30393265 return blk_0: {
30403266 const pos_0 = p.i;
3041 if (p.parseskip() and blk_1: {
3267 if (try p.parseskip() and blk_1: {
30423268 if (std.mem.startsWith(u8, p.source[p.i..], "&")) {
30433269 p.i += 1;
30443270 break :blk_1 true;
......@@ -3061,10 +3287,10 @@ const Parser = struct {
30613287 break :blk_0 false;
30623288 };
30633289 }
3064 pub fn parseAMPERSANDEQUAL(p: *Parser) bool {
3290 pub fn parseAMPERSANDEQUAL(p: *Parser) Error!bool {
30653291 return blk_0: {
30663292 const pos_0 = p.i;
3067 if (p.parseskip() and blk_1: {
3293 if (try p.parseskip() and blk_1: {
30683294 if (std.mem.startsWith(u8, p.source[p.i..], "&=")) {
30693295 p.i += 2;
30703296 break :blk_1 true;
......@@ -3075,10 +3301,10 @@ const Parser = struct {
30753301 break :blk_0 false;
30763302 };
30773303 }
3078 pub fn parseASTERISK(p: *Parser) bool {
3304 pub fn parseASTERISK(p: *Parser) Error!bool {
30793305 return blk_0: {
30803306 const pos_0 = p.i;
3081 if (p.parseskip() and blk_1: {
3307 if (try p.parseskip() and blk_1: {
30823308 if (std.mem.startsWith(u8, p.source[p.i..], "*")) {
30833309 p.i += 1;
30843310 break :blk_1 true;
......@@ -3103,10 +3329,10 @@ const Parser = struct {
31033329 break :blk_0 false;
31043330 };
31053331 }
3106 pub fn parseASTERISKEQUAL(p: *Parser) bool {
3332 pub fn parseASTERISKEQUAL(p: *Parser) Error!bool {
31073333 return blk_0: {
31083334 const pos_0 = p.i;
3109 if (p.parseskip() and blk_1: {
3335 if (try p.parseskip() and blk_1: {
31103336 if (std.mem.startsWith(u8, p.source[p.i..], "*=")) {
31113337 p.i += 2;
31123338 break :blk_1 true;
......@@ -3117,10 +3343,10 @@ const Parser = struct {
31173343 break :blk_0 false;
31183344 };
31193345 }
3120 pub fn parseASTERISKPERCENT(p: *Parser) bool {
3346 pub fn parseASTERISKPERCENT(p: *Parser) Error!bool {
31213347 return blk_0: {
31223348 const pos_0 = p.i;
3123 if (p.parseskip() and blk_1: {
3349 if (try p.parseskip() and blk_1: {
31243350 if (std.mem.startsWith(u8, p.source[p.i..], "*%")) {
31253351 p.i += 2;
31263352 break :blk_1 true;
......@@ -3143,10 +3369,10 @@ const Parser = struct {
31433369 break :blk_0 false;
31443370 };
31453371 }
3146 pub fn parseASTERISKPERCENTEQUAL(p: *Parser) bool {
3372 pub fn parseASTERISKPERCENTEQUAL(p: *Parser) Error!bool {
31473373 return blk_0: {
31483374 const pos_0 = p.i;
3149 if (p.parseskip() and blk_1: {
3375 if (try p.parseskip() and blk_1: {
31503376 if (std.mem.startsWith(u8, p.source[p.i..], "*%=")) {
31513377 p.i += 3;
31523378 break :blk_1 true;
......@@ -3157,10 +3383,10 @@ const Parser = struct {
31573383 break :blk_0 false;
31583384 };
31593385 }
3160 pub fn parseASTERISKPIPE(p: *Parser) bool {
3386 pub fn parseASTERISKPIPE(p: *Parser) Error!bool {
31613387 return blk_0: {
31623388 const pos_0 = p.i;
3163 if (p.parseskip() and blk_1: {
3389 if (try p.parseskip() and blk_1: {
31643390 if (std.mem.startsWith(u8, p.source[p.i..], "*|")) {
31653391 p.i += 2;
31663392 break :blk_1 true;
......@@ -3183,10 +3409,10 @@ const Parser = struct {
31833409 break :blk_0 false;
31843410 };
31853411 }
3186 pub fn parseASTERISKPIPEEQUAL(p: *Parser) bool {
3412 pub fn parseASTERISKPIPEEQUAL(p: *Parser) Error!bool {
31873413 return blk_0: {
31883414 const pos_0 = p.i;
3189 if (p.parseskip() and blk_1: {
3415 if (try p.parseskip() and blk_1: {
31903416 if (std.mem.startsWith(u8, p.source[p.i..], "*|=")) {
31913417 p.i += 3;
31923418 break :blk_1 true;
......@@ -3197,10 +3423,10 @@ const Parser = struct {
31973423 break :blk_0 false;
31983424 };
31993425 }
3200 pub fn parseCARET(p: *Parser) bool {
3426 pub fn parseCARET(p: *Parser) Error!bool {
32013427 return blk_0: {
32023428 const pos_0 = p.i;
3203 if (p.parseskip() and blk_1: {
3429 if (try p.parseskip() and blk_1: {
32043430 if (std.mem.startsWith(u8, p.source[p.i..], "^")) {
32053431 p.i += 1;
32063432 break :blk_1 true;
......@@ -3223,10 +3449,10 @@ const Parser = struct {
32233449 break :blk_0 false;
32243450 };
32253451 }
3226 pub fn parseCARETEQUAL(p: *Parser) bool {
3452 pub fn parseCARETEQUAL(p: *Parser) Error!bool {
32273453 return blk_0: {
32283454 const pos_0 = p.i;
3229 if (p.parseskip() and blk_1: {
3455 if (try p.parseskip() and blk_1: {
32303456 if (std.mem.startsWith(u8, p.source[p.i..], "^=")) {
32313457 p.i += 2;
32323458 break :blk_1 true;
......@@ -3237,10 +3463,10 @@ const Parser = struct {
32373463 break :blk_0 false;
32383464 };
32393465 }
3240 pub fn parseCOLON(p: *Parser) bool {
3466 pub fn parseCOLON(p: *Parser) Error!bool {
32413467 return blk_0: {
32423468 const pos_0 = p.i;
3243 if (p.parseskip() and blk_1: {
3469 if (try p.parseskip() and blk_1: {
32443470 if (std.mem.startsWith(u8, p.source[p.i..], ":")) {
32453471 p.i += 1;
32463472 break :blk_1 true;
......@@ -3251,10 +3477,10 @@ const Parser = struct {
32513477 break :blk_0 false;
32523478 };
32533479 }
3254 pub fn parseCOMMA(p: *Parser) bool {
3480 pub fn parseCOMMA(p: *Parser) Error!bool {
32553481 return blk_0: {
32563482 const pos_0 = p.i;
3257 if (p.parseskip() and blk_1: {
3483 if (try p.parseskip() and blk_1: {
32583484 if (std.mem.startsWith(u8, p.source[p.i..], ",")) {
32593485 p.i += 1;
32603486 break :blk_1 true;
......@@ -3265,10 +3491,10 @@ const Parser = struct {
32653491 break :blk_0 false;
32663492 };
32673493 }
3268 pub fn parseDOT(p: *Parser) bool {
3494 pub fn parseDOT(p: *Parser) Error!bool {
32693495 return blk_0: {
32703496 const pos_0 = p.i;
3271 if (p.parseskip() and blk_1: {
3497 if (try p.parseskip() and blk_1: {
32723498 if (std.mem.startsWith(u8, p.source[p.i..], ".")) {
32733499 p.i += 1;
32743500 break :blk_1 true;
......@@ -3292,10 +3518,10 @@ const Parser = struct {
32923518 break :blk_0 false;
32933519 };
32943520 }
3295 pub fn parseDOT2(p: *Parser) bool {
3521 pub fn parseDOT2(p: *Parser) Error!bool {
32963522 return blk_0: {
32973523 const pos_0 = p.i;
3298 if (p.parseskip() and blk_1: {
3524 if (try p.parseskip() and blk_1: {
32993525 if (std.mem.startsWith(u8, p.source[p.i..], "..")) {
33003526 p.i += 2;
33013527 break :blk_1 true;
......@@ -3318,10 +3544,10 @@ const Parser = struct {
33183544 break :blk_0 false;
33193545 };
33203546 }
3321 pub fn parseDOT3(p: *Parser) bool {
3547 pub fn parseDOT3(p: *Parser) Error!bool {
33223548 return blk_0: {
33233549 const pos_0 = p.i;
3324 if (p.parseskip() and blk_1: {
3550 if (try p.parseskip() and blk_1: {
33253551 if (std.mem.startsWith(u8, p.source[p.i..], "...")) {
33263552 p.i += 3;
33273553 break :blk_1 true;
......@@ -3332,10 +3558,10 @@ const Parser = struct {
33323558 break :blk_0 false;
33333559 };
33343560 }
3335 pub fn parseDOTASTERISK(p: *Parser) bool {
3561 pub fn parseDOTASTERISK(p: *Parser) Error!bool {
33363562 return blk_0: {
33373563 const pos_0 = p.i;
3338 if (p.parseskip() and blk_1: {
3564 if (try p.parseskip() and blk_1: {
33393565 if (std.mem.startsWith(u8, p.source[p.i..], ".*")) {
33403566 p.i += 2;
33413567 break :blk_1 true;
......@@ -3346,10 +3572,10 @@ const Parser = struct {
33463572 break :blk_0 false;
33473573 };
33483574 }
3349 pub fn parseEQUAL(p: *Parser) bool {
3575 pub fn parseEQUAL(p: *Parser) Error!bool {
33503576 return blk_0: {
33513577 const pos_0 = p.i;
3352 if (p.parseskip() and blk_1: {
3578 if (try p.parseskip() and blk_1: {
33533579 if (std.mem.startsWith(u8, p.source[p.i..], "=")) {
33543580 p.i += 1;
33553581 break :blk_1 true;
......@@ -3373,10 +3599,10 @@ const Parser = struct {
33733599 break :blk_0 false;
33743600 };
33753601 }
3376 pub fn parseEQUALEQUAL(p: *Parser) bool {
3602 pub fn parseEQUALEQUAL(p: *Parser) Error!bool {
33773603 return blk_0: {
33783604 const pos_0 = p.i;
3379 if (p.parseskip() and blk_1: {
3605 if (try p.parseskip() and blk_1: {
33803606 if (std.mem.startsWith(u8, p.source[p.i..], "==")) {
33813607 p.i += 2;
33823608 break :blk_1 true;
......@@ -3387,10 +3613,10 @@ const Parser = struct {
33873613 break :blk_0 false;
33883614 };
33893615 }
3390 pub fn parseEQUALRARROW(p: *Parser) bool {
3616 pub fn parseEQUALRARROW(p: *Parser) Error!bool {
33913617 return blk_0: {
33923618 const pos_0 = p.i;
3393 if (p.parseskip() and blk_1: {
3619 if (try p.parseskip() and blk_1: {
33943620 if (std.mem.startsWith(u8, p.source[p.i..], "=>")) {
33953621 p.i += 2;
33963622 break :blk_1 true;
......@@ -3401,10 +3627,10 @@ const Parser = struct {
34013627 break :blk_0 false;
34023628 };
34033629 }
3404 pub fn parseEXCLAMATIONMARK(p: *Parser) bool {
3630 pub fn parseEXCLAMATIONMARK(p: *Parser) Error!bool {
34053631 return blk_0: {
34063632 const pos_0 = p.i;
3407 if (p.parseskip() and blk_1: {
3633 if (try p.parseskip() and blk_1: {
34083634 if (std.mem.startsWith(u8, p.source[p.i..], "!")) {
34093635 p.i += 1;
34103636 break :blk_1 true;
......@@ -3427,10 +3653,10 @@ const Parser = struct {
34273653 break :blk_0 false;
34283654 };
34293655 }
3430 pub fn parseEXCLAMATIONMARKEQUAL(p: *Parser) bool {
3656 pub fn parseEXCLAMATIONMARKEQUAL(p: *Parser) Error!bool {
34313657 return blk_0: {
34323658 const pos_0 = p.i;
3433 if (p.parseskip() and blk_1: {
3659 if (try p.parseskip() and blk_1: {
34343660 if (std.mem.startsWith(u8, p.source[p.i..], "!=")) {
34353661 p.i += 2;
34363662 break :blk_1 true;
......@@ -3441,10 +3667,10 @@ const Parser = struct {
34413667 break :blk_0 false;
34423668 };
34433669 }
3444 pub fn parseLARROW(p: *Parser) bool {
3670 pub fn parseLARROW(p: *Parser) Error!bool {
34453671 return blk_0: {
34463672 const pos_0 = p.i;
3447 if (p.parseskip() and blk_1: {
3673 if (try p.parseskip() and blk_1: {
34483674 if (std.mem.startsWith(u8, p.source[p.i..], "<")) {
34493675 p.i += 1;
34503676 break :blk_1 true;
......@@ -3468,10 +3694,10 @@ const Parser = struct {
34683694 break :blk_0 false;
34693695 };
34703696 }
3471 pub fn parseLARROW2(p: *Parser) bool {
3697 pub fn parseLARROW2(p: *Parser) Error!bool {
34723698 return blk_0: {
34733699 const pos_0 = p.i;
3474 if (p.parseskip() and blk_1: {
3700 if (try p.parseskip() and blk_1: {
34753701 if (std.mem.startsWith(u8, p.source[p.i..], "<<")) {
34763702 p.i += 2;
34773703 break :blk_1 true;
......@@ -3495,10 +3721,10 @@ const Parser = struct {
34953721 break :blk_0 false;
34963722 };
34973723 }
3498 pub fn parseLARROW2EQUAL(p: *Parser) bool {
3724 pub fn parseLARROW2EQUAL(p: *Parser) Error!bool {
34993725 return blk_0: {
35003726 const pos_0 = p.i;
3501 if (p.parseskip() and blk_1: {
3727 if (try p.parseskip() and blk_1: {
35023728 if (std.mem.startsWith(u8, p.source[p.i..], "<<=")) {
35033729 p.i += 3;
35043730 break :blk_1 true;
......@@ -3509,10 +3735,10 @@ const Parser = struct {
35093735 break :blk_0 false;
35103736 };
35113737 }
3512 pub fn parseLARROW2PIPE(p: *Parser) bool {
3738 pub fn parseLARROW2PIPE(p: *Parser) Error!bool {
35133739 return blk_0: {
35143740 const pos_0 = p.i;
3515 if (p.parseskip() and blk_1: {
3741 if (try p.parseskip() and blk_1: {
35163742 if (std.mem.startsWith(u8, p.source[p.i..], "<<|")) {
35173743 p.i += 3;
35183744 break :blk_1 true;
......@@ -3535,10 +3761,10 @@ const Parser = struct {
35353761 break :blk_0 false;
35363762 };
35373763 }
3538 pub fn parseLARROW2PIPEEQUAL(p: *Parser) bool {
3764 pub fn parseLARROW2PIPEEQUAL(p: *Parser) Error!bool {
35393765 return blk_0: {
35403766 const pos_0 = p.i;
3541 if (p.parseskip() and blk_1: {
3767 if (try p.parseskip() and blk_1: {
35423768 if (std.mem.startsWith(u8, p.source[p.i..], "<<|=")) {
35433769 p.i += 4;
35443770 break :blk_1 true;
......@@ -3549,10 +3775,10 @@ const Parser = struct {
35493775 break :blk_0 false;
35503776 };
35513777 }
3552 pub fn parseLARROWEQUAL(p: *Parser) bool {
3778 pub fn parseLARROWEQUAL(p: *Parser) Error!bool {
35533779 return blk_0: {
35543780 const pos_0 = p.i;
3555 if (p.parseskip() and blk_1: {
3781 if (try p.parseskip() and blk_1: {
35563782 if (std.mem.startsWith(u8, p.source[p.i..], "<=")) {
35573783 p.i += 2;
35583784 break :blk_1 true;
......@@ -3563,10 +3789,10 @@ const Parser = struct {
35633789 break :blk_0 false;
35643790 };
35653791 }
3566 pub fn parseLBRACE(p: *Parser) bool {
3792 pub fn parseLBRACE(p: *Parser) Error!bool {
35673793 return blk_0: {
35683794 const pos_0 = p.i;
3569 if (p.parseskip() and blk_1: {
3795 if (try p.parseskip() and blk_1: {
35703796 if (std.mem.startsWith(u8, p.source[p.i..], "{")) {
35713797 p.i += 1;
35723798 break :blk_1 true;
......@@ -3577,10 +3803,10 @@ const Parser = struct {
35773803 break :blk_0 false;
35783804 };
35793805 }
3580 pub fn parseLBRACKET(p: *Parser) bool {
3806 pub fn parseLBRACKET(p: *Parser) Error!bool {
35813807 return blk_0: {
35823808 const pos_0 = p.i;
3583 if (p.parseskip() and blk_1: {
3809 if (try p.parseskip() and blk_1: {
35843810 if (std.mem.startsWith(u8, p.source[p.i..], "[")) {
35853811 p.i += 1;
35863812 break :blk_1 true;
......@@ -3591,10 +3817,10 @@ const Parser = struct {
35913817 break :blk_0 false;
35923818 };
35933819 }
3594 pub fn parseLPAREN(p: *Parser) bool {
3820 pub fn parseLPAREN(p: *Parser) Error!bool {
35953821 return blk_0: {
35963822 const pos_0 = p.i;
3597 if (p.parseskip() and blk_1: {
3823 if (try p.parseskip() and blk_1: {
35983824 if (std.mem.startsWith(u8, p.source[p.i..], "(")) {
35993825 p.i += 1;
36003826 break :blk_1 true;
......@@ -3605,10 +3831,10 @@ const Parser = struct {
36053831 break :blk_0 false;
36063832 };
36073833 }
3608 pub fn parseMINUS(p: *Parser) bool {
3834 pub fn parseMINUS(p: *Parser) Error!bool {
36093835 return blk_0: {
36103836 const pos_0 = p.i;
3611 if (p.parseskip() and blk_1: {
3837 if (try p.parseskip() and blk_1: {
36123838 if (std.mem.startsWith(u8, p.source[p.i..], "-")) {
36133839 p.i += 1;
36143840 break :blk_1 true;
......@@ -3634,10 +3860,10 @@ const Parser = struct {
36343860 break :blk_0 false;
36353861 };
36363862 }
3637 pub fn parseMINUSEQUAL(p: *Parser) bool {
3863 pub fn parseMINUSEQUAL(p: *Parser) Error!bool {
36383864 return blk_0: {
36393865 const pos_0 = p.i;
3640 if (p.parseskip() and blk_1: {
3866 if (try p.parseskip() and blk_1: {
36413867 if (std.mem.startsWith(u8, p.source[p.i..], "-=")) {
36423868 p.i += 2;
36433869 break :blk_1 true;
......@@ -3648,10 +3874,10 @@ const Parser = struct {
36483874 break :blk_0 false;
36493875 };
36503876 }
3651 pub fn parseMINUSPERCENT(p: *Parser) bool {
3877 pub fn parseMINUSPERCENT(p: *Parser) Error!bool {
36523878 return blk_0: {
36533879 const pos_0 = p.i;
3654 if (p.parseskip() and blk_1: {
3880 if (try p.parseskip() and blk_1: {
36553881 if (std.mem.startsWith(u8, p.source[p.i..], "-%")) {
36563882 p.i += 2;
36573883 break :blk_1 true;
......@@ -3674,10 +3900,10 @@ const Parser = struct {
36743900 break :blk_0 false;
36753901 };
36763902 }
3677 pub fn parseMINUSPERCENTEQUAL(p: *Parser) bool {
3903 pub fn parseMINUSPERCENTEQUAL(p: *Parser) Error!bool {
36783904 return blk_0: {
36793905 const pos_0 = p.i;
3680 if (p.parseskip() and blk_1: {
3906 if (try p.parseskip() and blk_1: {
36813907 if (std.mem.startsWith(u8, p.source[p.i..], "-%=")) {
36823908 p.i += 3;
36833909 break :blk_1 true;
......@@ -3688,10 +3914,10 @@ const Parser = struct {
36883914 break :blk_0 false;
36893915 };
36903916 }
3691 pub fn parseMINUSPIPE(p: *Parser) bool {
3917 pub fn parseMINUSPIPE(p: *Parser) Error!bool {
36923918 return blk_0: {
36933919 const pos_0 = p.i;
3694 if (p.parseskip() and blk_1: {
3920 if (try p.parseskip() and blk_1: {
36953921 if (std.mem.startsWith(u8, p.source[p.i..], "-|")) {
36963922 p.i += 2;
36973923 break :blk_1 true;
......@@ -3714,10 +3940,10 @@ const Parser = struct {
37143940 break :blk_0 false;
37153941 };
37163942 }
3717 pub fn parseMINUSPIPEEQUAL(p: *Parser) bool {
3943 pub fn parseMINUSPIPEEQUAL(p: *Parser) Error!bool {
37183944 return blk_0: {
37193945 const pos_0 = p.i;
3720 if (p.parseskip() and blk_1: {
3946 if (try p.parseskip() and blk_1: {
37213947 if (std.mem.startsWith(u8, p.source[p.i..], "-|=")) {
37223948 p.i += 3;
37233949 break :blk_1 true;
......@@ -3728,10 +3954,10 @@ const Parser = struct {
37283954 break :blk_0 false;
37293955 };
37303956 }
3731 pub fn parseMINUSRARROW(p: *Parser) bool {
3957 pub fn parseMINUSRARROW(p: *Parser) Error!bool {
37323958 return blk_0: {
37333959 const pos_0 = p.i;
3734 if (p.parseskip() and blk_1: {
3960 if (try p.parseskip() and blk_1: {
37353961 if (std.mem.startsWith(u8, p.source[p.i..], "->")) {
37363962 p.i += 2;
37373963 break :blk_1 true;
......@@ -3742,10 +3968,10 @@ const Parser = struct {
37423968 break :blk_0 false;
37433969 };
37443970 }
3745 pub fn parsePERCENT(p: *Parser) bool {
3971 pub fn parsePERCENT(p: *Parser) Error!bool {
37463972 return blk_0: {
37473973 const pos_0 = p.i;
3748 if (p.parseskip() and blk_1: {
3974 if (try p.parseskip() and blk_1: {
37493975 if (std.mem.startsWith(u8, p.source[p.i..], "%")) {
37503976 p.i += 1;
37513977 break :blk_1 true;
......@@ -3768,10 +3994,10 @@ const Parser = struct {
37683994 break :blk_0 false;
37693995 };
37703996 }
3771 pub fn parsePERCENTEQUAL(p: *Parser) bool {
3997 pub fn parsePERCENTEQUAL(p: *Parser) Error!bool {
37723998 return blk_0: {
37733999 const pos_0 = p.i;
3774 if (p.parseskip() and blk_1: {
4000 if (try p.parseskip() and blk_1: {
37754001 if (std.mem.startsWith(u8, p.source[p.i..], "%=")) {
37764002 p.i += 2;
37774003 break :blk_1 true;
......@@ -3782,10 +4008,10 @@ const Parser = struct {
37824008 break :blk_0 false;
37834009 };
37844010 }
3785 pub fn parsePIPE(p: *Parser) bool {
4011 pub fn parsePIPE(p: *Parser) Error!bool {
37864012 return blk_0: {
37874013 const pos_0 = p.i;
3788 if (p.parseskip() and blk_1: {
4014 if (try p.parseskip() and blk_1: {
37894015 if (std.mem.startsWith(u8, p.source[p.i..], "|")) {
37904016 p.i += 1;
37914017 break :blk_1 true;
......@@ -3809,10 +4035,10 @@ const Parser = struct {
38094035 break :blk_0 false;
38104036 };
38114037 }
3812 pub fn parsePIPE2(p: *Parser) bool {
4038 pub fn parsePIPE2(p: *Parser) Error!bool {
38134039 return blk_0: {
38144040 const pos_0 = p.i;
3815 if (p.parseskip() and blk_1: {
4041 if (try p.parseskip() and blk_1: {
38164042 if (std.mem.startsWith(u8, p.source[p.i..], "||")) {
38174043 p.i += 2;
38184044 break :blk_1 true;
......@@ -3823,10 +4049,10 @@ const Parser = struct {
38234049 break :blk_0 false;
38244050 };
38254051 }
3826 pub fn parsePIPEEQUAL(p: *Parser) bool {
4052 pub fn parsePIPEEQUAL(p: *Parser) Error!bool {
38274053 return blk_0: {
38284054 const pos_0 = p.i;
3829 if (p.parseskip() and blk_1: {
4055 if (try p.parseskip() and blk_1: {
38304056 if (std.mem.startsWith(u8, p.source[p.i..], "|=")) {
38314057 p.i += 2;
38324058 break :blk_1 true;
......@@ -3837,10 +4063,10 @@ const Parser = struct {
38374063 break :blk_0 false;
38384064 };
38394065 }
3840 pub fn parsePLUS(p: *Parser) bool {
4066 pub fn parsePLUS(p: *Parser) Error!bool {
38414067 return blk_0: {
38424068 const pos_0 = p.i;
3843 if (p.parseskip() and blk_1: {
4069 if (try p.parseskip() and blk_1: {
38444070 if (std.mem.startsWith(u8, p.source[p.i..], "+")) {
38454071 p.i += 1;
38464072 break :blk_1 true;
......@@ -3866,10 +4092,10 @@ const Parser = struct {
38664092 break :blk_0 false;
38674093 };
38684094 }
3869 pub fn parsePLUS2(p: *Parser) bool {
4095 pub fn parsePLUS2(p: *Parser) Error!bool {
38704096 return blk_0: {
38714097 const pos_0 = p.i;
3872 if (p.parseskip() and blk_1: {
4098 if (try p.parseskip() and blk_1: {
38734099 if (std.mem.startsWith(u8, p.source[p.i..], "++")) {
38744100 p.i += 2;
38754101 break :blk_1 true;
......@@ -3880,10 +4106,10 @@ const Parser = struct {
38804106 break :blk_0 false;
38814107 };
38824108 }
3883 pub fn parsePLUSEQUAL(p: *Parser) bool {
4109 pub fn parsePLUSEQUAL(p: *Parser) Error!bool {
38844110 return blk_0: {
38854111 const pos_0 = p.i;
3886 if (p.parseskip() and blk_1: {
4112 if (try p.parseskip() and blk_1: {
38874113 if (std.mem.startsWith(u8, p.source[p.i..], "+=")) {
38884114 p.i += 2;
38894115 break :blk_1 true;
......@@ -3894,10 +4120,10 @@ const Parser = struct {
38944120 break :blk_0 false;
38954121 };
38964122 }
3897 pub fn parsePLUSPERCENT(p: *Parser) bool {
4123 pub fn parsePLUSPERCENT(p: *Parser) Error!bool {
38984124 return blk_0: {
38994125 const pos_0 = p.i;
3900 if (p.parseskip() and blk_1: {
4126 if (try p.parseskip() and blk_1: {
39014127 if (std.mem.startsWith(u8, p.source[p.i..], "+%")) {
39024128 p.i += 2;
39034129 break :blk_1 true;
......@@ -3920,10 +4146,10 @@ const Parser = struct {
39204146 break :blk_0 false;
39214147 };
39224148 }
3923 pub fn parsePLUSPERCENTEQUAL(p: *Parser) bool {
4149 pub fn parsePLUSPERCENTEQUAL(p: *Parser) Error!bool {
39244150 return blk_0: {
39254151 const pos_0 = p.i;
3926 if (p.parseskip() and blk_1: {
4152 if (try p.parseskip() and blk_1: {
39274153 if (std.mem.startsWith(u8, p.source[p.i..], "+%=")) {
39284154 p.i += 3;
39294155 break :blk_1 true;
......@@ -3934,10 +4160,10 @@ const Parser = struct {
39344160 break :blk_0 false;
39354161 };
39364162 }
3937 pub fn parsePLUSPIPE(p: *Parser) bool {
4163 pub fn parsePLUSPIPE(p: *Parser) Error!bool {
39384164 return blk_0: {
39394165 const pos_0 = p.i;
3940 if (p.parseskip() and blk_1: {
4166 if (try p.parseskip() and blk_1: {
39414167 if (std.mem.startsWith(u8, p.source[p.i..], "+|")) {
39424168 p.i += 2;
39434169 break :blk_1 true;
......@@ -3960,10 +4186,10 @@ const Parser = struct {
39604186 break :blk_0 false;
39614187 };
39624188 }
3963 pub fn parsePLUSPIPEEQUAL(p: *Parser) bool {
4189 pub fn parsePLUSPIPEEQUAL(p: *Parser) Error!bool {
39644190 return blk_0: {
39654191 const pos_0 = p.i;
3966 if (p.parseskip() and blk_1: {
4192 if (try p.parseskip() and blk_1: {
39674193 if (std.mem.startsWith(u8, p.source[p.i..], "+|=")) {
39684194 p.i += 3;
39694195 break :blk_1 true;
......@@ -3974,10 +4200,10 @@ const Parser = struct {
39744200 break :blk_0 false;
39754201 };
39764202 }
3977 pub fn parseLETTERC(p: *Parser) bool {
4203 pub fn parseLETTERC(p: *Parser) Error!bool {
39784204 return blk_0: {
39794205 const pos_0 = p.i;
3980 if (p.parseskip() and blk_1: {
4206 if (try p.parseskip() and blk_1: {
39814207 if (std.mem.startsWith(u8, p.source[p.i..], "c")) {
39824208 p.i += 1;
39834209 break :blk_1 true;
......@@ -3988,10 +4214,10 @@ const Parser = struct {
39884214 break :blk_0 false;
39894215 };
39904216 }
3991 pub fn parseQUESTIONMARK(p: *Parser) bool {
4217 pub fn parseQUESTIONMARK(p: *Parser) Error!bool {
39924218 return blk_0: {
39934219 const pos_0 = p.i;
3994 if (p.parseskip() and blk_1: {
4220 if (try p.parseskip() and blk_1: {
39954221 if (std.mem.startsWith(u8, p.source[p.i..], "?")) {
39964222 p.i += 1;
39974223 break :blk_1 true;
......@@ -4002,10 +4228,10 @@ const Parser = struct {
40024228 break :blk_0 false;
40034229 };
40044230 }
4005 pub fn parseRARROW(p: *Parser) bool {
4231 pub fn parseRARROW(p: *Parser) Error!bool {
40064232 return blk_0: {
40074233 const pos_0 = p.i;
4008 if (p.parseskip() and blk_1: {
4234 if (try p.parseskip() and blk_1: {
40094235 if (std.mem.startsWith(u8, p.source[p.i..], ">")) {
40104236 p.i += 1;
40114237 break :blk_1 true;
......@@ -4029,10 +4255,10 @@ const Parser = struct {
40294255 break :blk_0 false;
40304256 };
40314257 }
4032 pub fn parseRARROW2(p: *Parser) bool {
4258 pub fn parseRARROW2(p: *Parser) Error!bool {
40334259 return blk_0: {
40344260 const pos_0 = p.i;
4035 if (p.parseskip() and blk_1: {
4261 if (try p.parseskip() and blk_1: {
40364262 if (std.mem.startsWith(u8, p.source[p.i..], ">>")) {
40374263 p.i += 2;
40384264 break :blk_1 true;
......@@ -4055,10 +4281,10 @@ const Parser = struct {
40554281 break :blk_0 false;
40564282 };
40574283 }
4058 pub fn parseRARROW2EQUAL(p: *Parser) bool {
4284 pub fn parseRARROW2EQUAL(p: *Parser) Error!bool {
40594285 return blk_0: {
40604286 const pos_0 = p.i;
4061 if (p.parseskip() and blk_1: {
4287 if (try p.parseskip() and blk_1: {
40624288 if (std.mem.startsWith(u8, p.source[p.i..], ">>=")) {
40634289 p.i += 3;
40644290 break :blk_1 true;
......@@ -4069,10 +4295,10 @@ const Parser = struct {
40694295 break :blk_0 false;
40704296 };
40714297 }
4072 pub fn parseRARROWEQUAL(p: *Parser) bool {
4298 pub fn parseRARROWEQUAL(p: *Parser) Error!bool {
40734299 return blk_0: {
40744300 const pos_0 = p.i;
4075 if (p.parseskip() and blk_1: {
4301 if (try p.parseskip() and blk_1: {
40764302 if (std.mem.startsWith(u8, p.source[p.i..], ">=")) {
40774303 p.i += 2;
40784304 break :blk_1 true;
......@@ -4083,10 +4309,10 @@ const Parser = struct {
40834309 break :blk_0 false;
40844310 };
40854311 }
4086 pub fn parseRBRACE(p: *Parser) bool {
4312 pub fn parseRBRACE(p: *Parser) Error!bool {
40874313 return blk_0: {
40884314 const pos_0 = p.i;
4089 if (p.parseskip() and blk_1: {
4315 if (try p.parseskip() and blk_1: {
40904316 if (std.mem.startsWith(u8, p.source[p.i..], "}")) {
40914317 p.i += 1;
40924318 break :blk_1 true;
......@@ -4097,10 +4323,10 @@ const Parser = struct {
40974323 break :blk_0 false;
40984324 };
40994325 }
4100 pub fn parseRBRACKET(p: *Parser) bool {
4326 pub fn parseRBRACKET(p: *Parser) Error!bool {
41014327 return blk_0: {
41024328 const pos_0 = p.i;
4103 if (p.parseskip() and blk_1: {
4329 if (try p.parseskip() and blk_1: {
41044330 if (std.mem.startsWith(u8, p.source[p.i..], "]")) {
41054331 p.i += 1;
41064332 break :blk_1 true;
......@@ -4111,10 +4337,10 @@ const Parser = struct {
41114337 break :blk_0 false;
41124338 };
41134339 }
4114 pub fn parseRPAREN(p: *Parser) bool {
4340 pub fn parseRPAREN(p: *Parser) Error!bool {
41154341 return blk_0: {
41164342 const pos_0 = p.i;
4117 if (p.parseskip() and blk_1: {
4343 if (try p.parseskip() and blk_1: {
41184344 if (std.mem.startsWith(u8, p.source[p.i..], ")")) {
41194345 p.i += 1;
41204346 break :blk_1 true;
......@@ -4125,10 +4351,10 @@ const Parser = struct {
41254351 break :blk_0 false;
41264352 };
41274353 }
4128 pub fn parseSEMICOLON(p: *Parser) bool {
4354 pub fn parseSEMICOLON(p: *Parser) Error!bool {
41294355 return blk_0: {
41304356 const pos_0 = p.i;
4131 if (p.parseskip() and blk_1: {
4357 if (try p.parseskip() and blk_1: {
41324358 if (std.mem.startsWith(u8, p.source[p.i..], ";")) {
41334359 p.i += 1;
41344360 break :blk_1 true;
......@@ -4139,10 +4365,10 @@ const Parser = struct {
41394365 break :blk_0 false;
41404366 };
41414367 }
4142 pub fn parseSLASH(p: *Parser) bool {
4368 pub fn parseSLASH(p: *Parser) Error!bool {
41434369 return blk_0: {
41444370 const pos_0 = p.i;
4145 if (p.parseskip() and blk_1: {
4371 if (try p.parseskip() and blk_1: {
41464372 if (std.mem.startsWith(u8, p.source[p.i..], "/")) {
41474373 p.i += 1;
41484374 break :blk_1 true;
......@@ -4166,10 +4392,10 @@ const Parser = struct {
41664392 break :blk_0 false;
41674393 };
41684394 }
4169 pub fn parseSLASHEQUAL(p: *Parser) bool {
4395 pub fn parseSLASHEQUAL(p: *Parser) Error!bool {
41704396 return blk_0: {
41714397 const pos_0 = p.i;
4172 if (p.parseskip() and blk_1: {
4398 if (try p.parseskip() and blk_1: {
41734399 if (std.mem.startsWith(u8, p.source[p.i..], "/=")) {
41744400 p.i += 2;
41754401 break :blk_1 true;
......@@ -4180,10 +4406,10 @@ const Parser = struct {
41804406 break :blk_0 false;
41814407 };
41824408 }
4183 pub fn parseTILDE(p: *Parser) bool {
4409 pub fn parseTILDE(p: *Parser) Error!bool {
41844410 return blk_0: {
41854411 const pos_0 = p.i;
4186 if (p.parseskip() and blk_1: {
4412 if (try p.parseskip() and blk_1: {
41874413 if (std.mem.startsWith(u8, p.source[p.i..], "~")) {
41884414 p.i += 1;
41894415 break :blk_1 true;
......@@ -4194,7 +4420,7 @@ const Parser = struct {
41944420 break :blk_0 false;
41954421 };
41964422 }
4197 pub fn parseend_of_word(p: *Parser) bool {
4423 pub fn parseend_of_word(p: *Parser) Error!bool {
41984424 return blk_0: {
41994425 const pos_0 = p.i;
42004426 if (blk_1: {
......@@ -4217,744 +4443,744 @@ const Parser = struct {
42174443 break :blk_0 false;
42184444 };
42194445 }
4220 pub fn parseKEYWORD_addrspace(p: *Parser) bool {
4446 pub fn parseKEYWORD_addrspace(p: *Parser) Error!bool {
42214447 return blk_0: {
42224448 const pos_0 = p.i;
4223 if (p.parseskip() and blk_1: {
4449 if (try p.parseskip() and blk_1: {
42244450 if (std.mem.startsWith(u8, p.source[p.i..], "addrspace")) {
42254451 p.i += 9;
42264452 break :blk_1 true;
42274453 }
42284454 break :blk_1 false;
4229 } and p.parseend_of_word()) break :blk_0 true;
4455 } and try p.parseend_of_word()) break :blk_0 true;
42304456 p.i = pos_0;
42314457 break :blk_0 false;
42324458 };
42334459 }
4234 pub fn parseKEYWORD_align(p: *Parser) bool {
4460 pub fn parseKEYWORD_align(p: *Parser) Error!bool {
42354461 return blk_0: {
42364462 const pos_0 = p.i;
4237 if (p.parseskip() and blk_1: {
4463 if (try p.parseskip() and blk_1: {
42384464 if (std.mem.startsWith(u8, p.source[p.i..], "align")) {
42394465 p.i += 5;
42404466 break :blk_1 true;
42414467 }
42424468 break :blk_1 false;
4243 } and p.parseend_of_word()) break :blk_0 true;
4469 } and try p.parseend_of_word()) break :blk_0 true;
42444470 p.i = pos_0;
42454471 break :blk_0 false;
42464472 };
42474473 }
4248 pub fn parseKEYWORD_allowzero(p: *Parser) bool {
4474 pub fn parseKEYWORD_allowzero(p: *Parser) Error!bool {
42494475 return blk_0: {
42504476 const pos_0 = p.i;
4251 if (p.parseskip() and blk_1: {
4477 if (try p.parseskip() and blk_1: {
42524478 if (std.mem.startsWith(u8, p.source[p.i..], "allowzero")) {
42534479 p.i += 9;
42544480 break :blk_1 true;
42554481 }
42564482 break :blk_1 false;
4257 } and p.parseend_of_word()) break :blk_0 true;
4483 } and try p.parseend_of_word()) break :blk_0 true;
42584484 p.i = pos_0;
42594485 break :blk_0 false;
42604486 };
42614487 }
4262 pub fn parseKEYWORD_and(p: *Parser) bool {
4488 pub fn parseKEYWORD_and(p: *Parser) Error!bool {
42634489 return blk_0: {
42644490 const pos_0 = p.i;
4265 if (p.parseskip() and blk_1: {
4491 if (try p.parseskip() and blk_1: {
42664492 if (std.mem.startsWith(u8, p.source[p.i..], "and")) {
42674493 p.i += 3;
42684494 break :blk_1 true;
42694495 }
42704496 break :blk_1 false;
4271 } and p.parseend_of_word()) break :blk_0 true;
4497 } and try p.parseend_of_word()) break :blk_0 true;
42724498 p.i = pos_0;
42734499 break :blk_0 false;
42744500 };
42754501 }
4276 pub fn parseKEYWORD_anyframe(p: *Parser) bool {
4502 pub fn parseKEYWORD_anyframe(p: *Parser) Error!bool {
42774503 return blk_0: {
42784504 const pos_0 = p.i;
4279 if (p.parseskip() and blk_1: {
4505 if (try p.parseskip() and blk_1: {
42804506 if (std.mem.startsWith(u8, p.source[p.i..], "anyframe")) {
42814507 p.i += 8;
42824508 break :blk_1 true;
42834509 }
42844510 break :blk_1 false;
4285 } and p.parseend_of_word()) break :blk_0 true;
4511 } and try p.parseend_of_word()) break :blk_0 true;
42864512 p.i = pos_0;
42874513 break :blk_0 false;
42884514 };
42894515 }
4290 pub fn parseKEYWORD_anytype(p: *Parser) bool {
4516 pub fn parseKEYWORD_anytype(p: *Parser) Error!bool {
42914517 return blk_0: {
42924518 const pos_0 = p.i;
4293 if (p.parseskip() and blk_1: {
4519 if (try p.parseskip() and blk_1: {
42944520 if (std.mem.startsWith(u8, p.source[p.i..], "anytype")) {
42954521 p.i += 7;
42964522 break :blk_1 true;
42974523 }
42984524 break :blk_1 false;
4299 } and p.parseend_of_word()) break :blk_0 true;
4525 } and try p.parseend_of_word()) break :blk_0 true;
43004526 p.i = pos_0;
43014527 break :blk_0 false;
43024528 };
43034529 }
4304 pub fn parseKEYWORD_asm(p: *Parser) bool {
4530 pub fn parseKEYWORD_asm(p: *Parser) Error!bool {
43054531 return blk_0: {
43064532 const pos_0 = p.i;
4307 if (p.parseskip() and blk_1: {
4533 if (try p.parseskip() and blk_1: {
43084534 if (std.mem.startsWith(u8, p.source[p.i..], "asm")) {
43094535 p.i += 3;
43104536 break :blk_1 true;
43114537 }
43124538 break :blk_1 false;
4313 } and p.parseend_of_word()) break :blk_0 true;
4539 } and try p.parseend_of_word()) break :blk_0 true;
43144540 p.i = pos_0;
43154541 break :blk_0 false;
43164542 };
43174543 }
4318 pub fn parseKEYWORD_break(p: *Parser) bool {
4544 pub fn parseKEYWORD_break(p: *Parser) Error!bool {
43194545 return blk_0: {
43204546 const pos_0 = p.i;
4321 if (p.parseskip() and blk_1: {
4547 if (try p.parseskip() and blk_1: {
43224548 if (std.mem.startsWith(u8, p.source[p.i..], "break")) {
43234549 p.i += 5;
43244550 break :blk_1 true;
43254551 }
43264552 break :blk_1 false;
4327 } and p.parseend_of_word()) break :blk_0 true;
4553 } and try p.parseend_of_word()) break :blk_0 true;
43284554 p.i = pos_0;
43294555 break :blk_0 false;
43304556 };
43314557 }
4332 pub fn parseKEYWORD_callconv(p: *Parser) bool {
4558 pub fn parseKEYWORD_callconv(p: *Parser) Error!bool {
43334559 return blk_0: {
43344560 const pos_0 = p.i;
4335 if (p.parseskip() and blk_1: {
4561 if (try p.parseskip() and blk_1: {
43364562 if (std.mem.startsWith(u8, p.source[p.i..], "callconv")) {
43374563 p.i += 8;
43384564 break :blk_1 true;
43394565 }
43404566 break :blk_1 false;
4341 } and p.parseend_of_word()) break :blk_0 true;
4567 } and try p.parseend_of_word()) break :blk_0 true;
43424568 p.i = pos_0;
43434569 break :blk_0 false;
43444570 };
43454571 }
4346 pub fn parseKEYWORD_catch(p: *Parser) bool {
4572 pub fn parseKEYWORD_catch(p: *Parser) Error!bool {
43474573 return blk_0: {
43484574 const pos_0 = p.i;
4349 if (p.parseskip() and blk_1: {
4575 if (try p.parseskip() and blk_1: {
43504576 if (std.mem.startsWith(u8, p.source[p.i..], "catch")) {
43514577 p.i += 5;
43524578 break :blk_1 true;
43534579 }
43544580 break :blk_1 false;
4355 } and p.parseend_of_word()) break :blk_0 true;
4581 } and try p.parseend_of_word()) break :blk_0 true;
43564582 p.i = pos_0;
43574583 break :blk_0 false;
43584584 };
43594585 }
4360 pub fn parseKEYWORD_comptime(p: *Parser) bool {
4586 pub fn parseKEYWORD_comptime(p: *Parser) Error!bool {
43614587 return blk_0: {
43624588 const pos_0 = p.i;
4363 if (p.parseskip() and blk_1: {
4589 if (try p.parseskip() and blk_1: {
43644590 if (std.mem.startsWith(u8, p.source[p.i..], "comptime")) {
43654591 p.i += 8;
43664592 break :blk_1 true;
43674593 }
43684594 break :blk_1 false;
4369 } and p.parseend_of_word()) break :blk_0 true;
4595 } and try p.parseend_of_word()) break :blk_0 true;
43704596 p.i = pos_0;
43714597 break :blk_0 false;
43724598 };
43734599 }
4374 pub fn parseKEYWORD_const(p: *Parser) bool {
4600 pub fn parseKEYWORD_const(p: *Parser) Error!bool {
43754601 return blk_0: {
43764602 const pos_0 = p.i;
4377 if (p.parseskip() and blk_1: {
4603 if (try p.parseskip() and blk_1: {
43784604 if (std.mem.startsWith(u8, p.source[p.i..], "const")) {
43794605 p.i += 5;
43804606 break :blk_1 true;
43814607 }
43824608 break :blk_1 false;
4383 } and p.parseend_of_word()) break :blk_0 true;
4609 } and try p.parseend_of_word()) break :blk_0 true;
43844610 p.i = pos_0;
43854611 break :blk_0 false;
43864612 };
43874613 }
4388 pub fn parseKEYWORD_continue(p: *Parser) bool {
4614 pub fn parseKEYWORD_continue(p: *Parser) Error!bool {
43894615 return blk_0: {
43904616 const pos_0 = p.i;
4391 if (p.parseskip() and blk_1: {
4617 if (try p.parseskip() and blk_1: {
43924618 if (std.mem.startsWith(u8, p.source[p.i..], "continue")) {
43934619 p.i += 8;
43944620 break :blk_1 true;
43954621 }
43964622 break :blk_1 false;
4397 } and p.parseend_of_word()) break :blk_0 true;
4623 } and try p.parseend_of_word()) break :blk_0 true;
43984624 p.i = pos_0;
43994625 break :blk_0 false;
44004626 };
44014627 }
4402 pub fn parseKEYWORD_defer(p: *Parser) bool {
4628 pub fn parseKEYWORD_defer(p: *Parser) Error!bool {
44034629 return blk_0: {
44044630 const pos_0 = p.i;
4405 if (p.parseskip() and blk_1: {
4631 if (try p.parseskip() and blk_1: {
44064632 if (std.mem.startsWith(u8, p.source[p.i..], "defer")) {
44074633 p.i += 5;
44084634 break :blk_1 true;
44094635 }
44104636 break :blk_1 false;
4411 } and p.parseend_of_word()) break :blk_0 true;
4637 } and try p.parseend_of_word()) break :blk_0 true;
44124638 p.i = pos_0;
44134639 break :blk_0 false;
44144640 };
44154641 }
4416 pub fn parseKEYWORD_else(p: *Parser) bool {
4642 pub fn parseKEYWORD_else(p: *Parser) Error!bool {
44174643 return blk_0: {
44184644 const pos_0 = p.i;
4419 if (p.parseskip() and blk_1: {
4645 if (try p.parseskip() and blk_1: {
44204646 if (std.mem.startsWith(u8, p.source[p.i..], "else")) {
44214647 p.i += 4;
44224648 break :blk_1 true;
44234649 }
44244650 break :blk_1 false;
4425 } and p.parseend_of_word()) break :blk_0 true;
4651 } and try p.parseend_of_word()) break :blk_0 true;
44264652 p.i = pos_0;
44274653 break :blk_0 false;
44284654 };
44294655 }
4430 pub fn parseKEYWORD_enum(p: *Parser) bool {
4656 pub fn parseKEYWORD_enum(p: *Parser) Error!bool {
44314657 return blk_0: {
44324658 const pos_0 = p.i;
4433 if (p.parseskip() and blk_1: {
4659 if (try p.parseskip() and blk_1: {
44344660 if (std.mem.startsWith(u8, p.source[p.i..], "enum")) {
44354661 p.i += 4;
44364662 break :blk_1 true;
44374663 }
44384664 break :blk_1 false;
4439 } and p.parseend_of_word()) break :blk_0 true;
4665 } and try p.parseend_of_word()) break :blk_0 true;
44404666 p.i = pos_0;
44414667 break :blk_0 false;
44424668 };
44434669 }
4444 pub fn parseKEYWORD_errdefer(p: *Parser) bool {
4670 pub fn parseKEYWORD_errdefer(p: *Parser) Error!bool {
44454671 return blk_0: {
44464672 const pos_0 = p.i;
4447 if (p.parseskip() and blk_1: {
4673 if (try p.parseskip() and blk_1: {
44484674 if (std.mem.startsWith(u8, p.source[p.i..], "errdefer")) {
44494675 p.i += 8;
44504676 break :blk_1 true;
44514677 }
44524678 break :blk_1 false;
4453 } and p.parseend_of_word()) break :blk_0 true;
4679 } and try p.parseend_of_word()) break :blk_0 true;
44544680 p.i = pos_0;
44554681 break :blk_0 false;
44564682 };
44574683 }
4458 pub fn parseKEYWORD_error(p: *Parser) bool {
4684 pub fn parseKEYWORD_error(p: *Parser) Error!bool {
44594685 return blk_0: {
44604686 const pos_0 = p.i;
4461 if (p.parseskip() and blk_1: {
4687 if (try p.parseskip() and blk_1: {
44624688 if (std.mem.startsWith(u8, p.source[p.i..], "error")) {
44634689 p.i += 5;
44644690 break :blk_1 true;
44654691 }
44664692 break :blk_1 false;
4467 } and p.parseend_of_word()) break :blk_0 true;
4693 } and try p.parseend_of_word()) break :blk_0 true;
44684694 p.i = pos_0;
44694695 break :blk_0 false;
44704696 };
44714697 }
4472 pub fn parseKEYWORD_export(p: *Parser) bool {
4698 pub fn parseKEYWORD_export(p: *Parser) Error!bool {
44734699 return blk_0: {
44744700 const pos_0 = p.i;
4475 if (p.parseskip() and blk_1: {
4701 if (try p.parseskip() and blk_1: {
44764702 if (std.mem.startsWith(u8, p.source[p.i..], "export")) {
44774703 p.i += 6;
44784704 break :blk_1 true;
44794705 }
44804706 break :blk_1 false;
4481 } and p.parseend_of_word()) break :blk_0 true;
4707 } and try p.parseend_of_word()) break :blk_0 true;
44824708 p.i = pos_0;
44834709 break :blk_0 false;
44844710 };
44854711 }
4486 pub fn parseKEYWORD_extern(p: *Parser) bool {
4712 pub fn parseKEYWORD_extern(p: *Parser) Error!bool {
44874713 return blk_0: {
44884714 const pos_0 = p.i;
4489 if (p.parseskip() and blk_1: {
4715 if (try p.parseskip() and blk_1: {
44904716 if (std.mem.startsWith(u8, p.source[p.i..], "extern")) {
44914717 p.i += 6;
44924718 break :blk_1 true;
44934719 }
44944720 break :blk_1 false;
4495 } and p.parseend_of_word()) break :blk_0 true;
4721 } and try p.parseend_of_word()) break :blk_0 true;
44964722 p.i = pos_0;
44974723 break :blk_0 false;
44984724 };
44994725 }
4500 pub fn parseKEYWORD_fn(p: *Parser) bool {
4726 pub fn parseKEYWORD_fn(p: *Parser) Error!bool {
45014727 return blk_0: {
45024728 const pos_0 = p.i;
4503 if (p.parseskip() and blk_1: {
4729 if (try p.parseskip() and blk_1: {
45044730 if (std.mem.startsWith(u8, p.source[p.i..], "fn")) {
45054731 p.i += 2;
45064732 break :blk_1 true;
45074733 }
45084734 break :blk_1 false;
4509 } and p.parseend_of_word()) break :blk_0 true;
4735 } and try p.parseend_of_word()) break :blk_0 true;
45104736 p.i = pos_0;
45114737 break :blk_0 false;
45124738 };
45134739 }
4514 pub fn parseKEYWORD_for(p: *Parser) bool {
4740 pub fn parseKEYWORD_for(p: *Parser) Error!bool {
45154741 return blk_0: {
45164742 const pos_0 = p.i;
4517 if (p.parseskip() and blk_1: {
4743 if (try p.parseskip() and blk_1: {
45184744 if (std.mem.startsWith(u8, p.source[p.i..], "for")) {
45194745 p.i += 3;
45204746 break :blk_1 true;
45214747 }
45224748 break :blk_1 false;
4523 } and p.parseend_of_word()) break :blk_0 true;
4749 } and try p.parseend_of_word()) break :blk_0 true;
45244750 p.i = pos_0;
45254751 break :blk_0 false;
45264752 };
45274753 }
4528 pub fn parseKEYWORD_if(p: *Parser) bool {
4754 pub fn parseKEYWORD_if(p: *Parser) Error!bool {
45294755 return blk_0: {
45304756 const pos_0 = p.i;
4531 if (p.parseskip() and blk_1: {
4757 if (try p.parseskip() and blk_1: {
45324758 if (std.mem.startsWith(u8, p.source[p.i..], "if")) {
45334759 p.i += 2;
45344760 break :blk_1 true;
45354761 }
45364762 break :blk_1 false;
4537 } and p.parseend_of_word()) break :blk_0 true;
4763 } and try p.parseend_of_word()) break :blk_0 true;
45384764 p.i = pos_0;
45394765 break :blk_0 false;
45404766 };
45414767 }
4542 pub fn parseKEYWORD_inline(p: *Parser) bool {
4768 pub fn parseKEYWORD_inline(p: *Parser) Error!bool {
45434769 return blk_0: {
45444770 const pos_0 = p.i;
4545 if (p.parseskip() and blk_1: {
4771 if (try p.parseskip() and blk_1: {
45464772 if (std.mem.startsWith(u8, p.source[p.i..], "inline")) {
45474773 p.i += 6;
45484774 break :blk_1 true;
45494775 }
45504776 break :blk_1 false;
4551 } and p.parseend_of_word()) break :blk_0 true;
4777 } and try p.parseend_of_word()) break :blk_0 true;
45524778 p.i = pos_0;
45534779 break :blk_0 false;
45544780 };
45554781 }
4556 pub fn parseKEYWORD_noalias(p: *Parser) bool {
4782 pub fn parseKEYWORD_noalias(p: *Parser) Error!bool {
45574783 return blk_0: {
45584784 const pos_0 = p.i;
4559 if (p.parseskip() and blk_1: {
4785 if (try p.parseskip() and blk_1: {
45604786 if (std.mem.startsWith(u8, p.source[p.i..], "noalias")) {
45614787 p.i += 7;
45624788 break :blk_1 true;
45634789 }
45644790 break :blk_1 false;
4565 } and p.parseend_of_word()) break :blk_0 true;
4791 } and try p.parseend_of_word()) break :blk_0 true;
45664792 p.i = pos_0;
45674793 break :blk_0 false;
45684794 };
45694795 }
4570 pub fn parseKEYWORD_nosuspend(p: *Parser) bool {
4796 pub fn parseKEYWORD_nosuspend(p: *Parser) Error!bool {
45714797 return blk_0: {
45724798 const pos_0 = p.i;
4573 if (p.parseskip() and blk_1: {
4799 if (try p.parseskip() and blk_1: {
45744800 if (std.mem.startsWith(u8, p.source[p.i..], "nosuspend")) {
45754801 p.i += 9;
45764802 break :blk_1 true;
45774803 }
45784804 break :blk_1 false;
4579 } and p.parseend_of_word()) break :blk_0 true;
4805 } and try p.parseend_of_word()) break :blk_0 true;
45804806 p.i = pos_0;
45814807 break :blk_0 false;
45824808 };
45834809 }
4584 pub fn parseKEYWORD_noinline(p: *Parser) bool {
4810 pub fn parseKEYWORD_noinline(p: *Parser) Error!bool {
45854811 return blk_0: {
45864812 const pos_0 = p.i;
4587 if (p.parseskip() and blk_1: {
4813 if (try p.parseskip() and blk_1: {
45884814 if (std.mem.startsWith(u8, p.source[p.i..], "noinline")) {
45894815 p.i += 8;
45904816 break :blk_1 true;
45914817 }
45924818 break :blk_1 false;
4593 } and p.parseend_of_word()) break :blk_0 true;
4819 } and try p.parseend_of_word()) break :blk_0 true;
45944820 p.i = pos_0;
45954821 break :blk_0 false;
45964822 };
45974823 }
4598 pub fn parseKEYWORD_opaque(p: *Parser) bool {
4824 pub fn parseKEYWORD_opaque(p: *Parser) Error!bool {
45994825 return blk_0: {
46004826 const pos_0 = p.i;
4601 if (p.parseskip() and blk_1: {
4827 if (try p.parseskip() and blk_1: {
46024828 if (std.mem.startsWith(u8, p.source[p.i..], "opaque")) {
46034829 p.i += 6;
46044830 break :blk_1 true;
46054831 }
46064832 break :blk_1 false;
4607 } and p.parseend_of_word()) break :blk_0 true;
4833 } and try p.parseend_of_word()) break :blk_0 true;
46084834 p.i = pos_0;
46094835 break :blk_0 false;
46104836 };
46114837 }
4612 pub fn parseKEYWORD_or(p: *Parser) bool {
4838 pub fn parseKEYWORD_or(p: *Parser) Error!bool {
46134839 return blk_0: {
46144840 const pos_0 = p.i;
4615 if (p.parseskip() and blk_1: {
4841 if (try p.parseskip() and blk_1: {
46164842 if (std.mem.startsWith(u8, p.source[p.i..], "or")) {
46174843 p.i += 2;
46184844 break :blk_1 true;
46194845 }
46204846 break :blk_1 false;
4621 } and p.parseend_of_word()) break :blk_0 true;
4847 } and try p.parseend_of_word()) break :blk_0 true;
46224848 p.i = pos_0;
46234849 break :blk_0 false;
46244850 };
46254851 }
4626 pub fn parseKEYWORD_orelse(p: *Parser) bool {
4852 pub fn parseKEYWORD_orelse(p: *Parser) Error!bool {
46274853 return blk_0: {
46284854 const pos_0 = p.i;
4629 if (p.parseskip() and blk_1: {
4855 if (try p.parseskip() and blk_1: {
46304856 if (std.mem.startsWith(u8, p.source[p.i..], "orelse")) {
46314857 p.i += 6;
46324858 break :blk_1 true;
46334859 }
46344860 break :blk_1 false;
4635 } and p.parseend_of_word()) break :blk_0 true;
4861 } and try p.parseend_of_word()) break :blk_0 true;
46364862 p.i = pos_0;
46374863 break :blk_0 false;
46384864 };
46394865 }
4640 pub fn parseKEYWORD_packed(p: *Parser) bool {
4866 pub fn parseKEYWORD_packed(p: *Parser) Error!bool {
46414867 return blk_0: {
46424868 const pos_0 = p.i;
4643 if (p.parseskip() and blk_1: {
4869 if (try p.parseskip() and blk_1: {
46444870 if (std.mem.startsWith(u8, p.source[p.i..], "packed")) {
46454871 p.i += 6;
46464872 break :blk_1 true;
46474873 }
46484874 break :blk_1 false;
4649 } and p.parseend_of_word()) break :blk_0 true;
4875 } and try p.parseend_of_word()) break :blk_0 true;
46504876 p.i = pos_0;
46514877 break :blk_0 false;
46524878 };
46534879 }
4654 pub fn parseKEYWORD_pub(p: *Parser) bool {
4880 pub fn parseKEYWORD_pub(p: *Parser) Error!bool {
46554881 return blk_0: {
46564882 const pos_0 = p.i;
4657 if (p.parseskip() and blk_1: {
4883 if (try p.parseskip() and blk_1: {
46584884 if (std.mem.startsWith(u8, p.source[p.i..], "pub")) {
46594885 p.i += 3;
46604886 break :blk_1 true;
46614887 }
46624888 break :blk_1 false;
4663 } and p.parseend_of_word()) break :blk_0 true;
4889 } and try p.parseend_of_word()) break :blk_0 true;
46644890 p.i = pos_0;
46654891 break :blk_0 false;
46664892 };
46674893 }
4668 pub fn parseKEYWORD_resume(p: *Parser) bool {
4894 pub fn parseKEYWORD_resume(p: *Parser) Error!bool {
46694895 return blk_0: {
46704896 const pos_0 = p.i;
4671 if (p.parseskip() and blk_1: {
4897 if (try p.parseskip() and blk_1: {
46724898 if (std.mem.startsWith(u8, p.source[p.i..], "resume")) {
46734899 p.i += 6;
46744900 break :blk_1 true;
46754901 }
46764902 break :blk_1 false;
4677 } and p.parseend_of_word()) break :blk_0 true;
4903 } and try p.parseend_of_word()) break :blk_0 true;
46784904 p.i = pos_0;
46794905 break :blk_0 false;
46804906 };
46814907 }
4682 pub fn parseKEYWORD_return(p: *Parser) bool {
4908 pub fn parseKEYWORD_return(p: *Parser) Error!bool {
46834909 return blk_0: {
46844910 const pos_0 = p.i;
4685 if (p.parseskip() and blk_1: {
4911 if (try p.parseskip() and blk_1: {
46864912 if (std.mem.startsWith(u8, p.source[p.i..], "return")) {
46874913 p.i += 6;
46884914 break :blk_1 true;
46894915 }
46904916 break :blk_1 false;
4691 } and p.parseend_of_word()) break :blk_0 true;
4917 } and try p.parseend_of_word()) break :blk_0 true;
46924918 p.i = pos_0;
46934919 break :blk_0 false;
46944920 };
46954921 }
4696 pub fn parseKEYWORD_linksection(p: *Parser) bool {
4922 pub fn parseKEYWORD_linksection(p: *Parser) Error!bool {
46974923 return blk_0: {
46984924 const pos_0 = p.i;
4699 if (p.parseskip() and blk_1: {
4925 if (try p.parseskip() and blk_1: {
47004926 if (std.mem.startsWith(u8, p.source[p.i..], "linksection")) {
47014927 p.i += 11;
47024928 break :blk_1 true;
47034929 }
47044930 break :blk_1 false;
4705 } and p.parseend_of_word()) break :blk_0 true;
4931 } and try p.parseend_of_word()) break :blk_0 true;
47064932 p.i = pos_0;
47074933 break :blk_0 false;
47084934 };
47094935 }
4710 pub fn parseKEYWORD_struct(p: *Parser) bool {
4936 pub fn parseKEYWORD_struct(p: *Parser) Error!bool {
47114937 return blk_0: {
47124938 const pos_0 = p.i;
4713 if (p.parseskip() and blk_1: {
4939 if (try p.parseskip() and blk_1: {
47144940 if (std.mem.startsWith(u8, p.source[p.i..], "struct")) {
47154941 p.i += 6;
47164942 break :blk_1 true;
47174943 }
47184944 break :blk_1 false;
4719 } and p.parseend_of_word()) break :blk_0 true;
4945 } and try p.parseend_of_word()) break :blk_0 true;
47204946 p.i = pos_0;
47214947 break :blk_0 false;
47224948 };
47234949 }
4724 pub fn parseKEYWORD_suspend(p: *Parser) bool {
4950 pub fn parseKEYWORD_suspend(p: *Parser) Error!bool {
47254951 return blk_0: {
47264952 const pos_0 = p.i;
4727 if (p.parseskip() and blk_1: {
4953 if (try p.parseskip() and blk_1: {
47284954 if (std.mem.startsWith(u8, p.source[p.i..], "suspend")) {
47294955 p.i += 7;
47304956 break :blk_1 true;
47314957 }
47324958 break :blk_1 false;
4733 } and p.parseend_of_word()) break :blk_0 true;
4959 } and try p.parseend_of_word()) break :blk_0 true;
47344960 p.i = pos_0;
47354961 break :blk_0 false;
47364962 };
47374963 }
4738 pub fn parseKEYWORD_switch(p: *Parser) bool {
4964 pub fn parseKEYWORD_switch(p: *Parser) Error!bool {
47394965 return blk_0: {
47404966 const pos_0 = p.i;
4741 if (p.parseskip() and blk_1: {
4967 if (try p.parseskip() and blk_1: {
47424968 if (std.mem.startsWith(u8, p.source[p.i..], "switch")) {
47434969 p.i += 6;
47444970 break :blk_1 true;
47454971 }
47464972 break :blk_1 false;
4747 } and p.parseend_of_word()) break :blk_0 true;
4973 } and try p.parseend_of_word()) break :blk_0 true;
47484974 p.i = pos_0;
47494975 break :blk_0 false;
47504976 };
47514977 }
4752 pub fn parseKEYWORD_test(p: *Parser) bool {
4978 pub fn parseKEYWORD_test(p: *Parser) Error!bool {
47534979 return blk_0: {
47544980 const pos_0 = p.i;
4755 if (p.parseskip() and blk_1: {
4981 if (try p.parseskip() and blk_1: {
47564982 if (std.mem.startsWith(u8, p.source[p.i..], "test")) {
47574983 p.i += 4;
47584984 break :blk_1 true;
47594985 }
47604986 break :blk_1 false;
4761 } and p.parseend_of_word()) break :blk_0 true;
4987 } and try p.parseend_of_word()) break :blk_0 true;
47624988 p.i = pos_0;
47634989 break :blk_0 false;
47644990 };
47654991 }
4766 pub fn parseKEYWORD_threadlocal(p: *Parser) bool {
4992 pub fn parseKEYWORD_threadlocal(p: *Parser) Error!bool {
47674993 return blk_0: {
47684994 const pos_0 = p.i;
4769 if (p.parseskip() and blk_1: {
4995 if (try p.parseskip() and blk_1: {
47704996 if (std.mem.startsWith(u8, p.source[p.i..], "threadlocal")) {
47714997 p.i += 11;
47724998 break :blk_1 true;
47734999 }
47745000 break :blk_1 false;
4775 } and p.parseend_of_word()) break :blk_0 true;
5001 } and try p.parseend_of_word()) break :blk_0 true;
47765002 p.i = pos_0;
47775003 break :blk_0 false;
47785004 };
47795005 }
4780 pub fn parseKEYWORD_try(p: *Parser) bool {
5006 pub fn parseKEYWORD_try(p: *Parser) Error!bool {
47815007 return blk_0: {
47825008 const pos_0 = p.i;
4783 if (p.parseskip() and blk_1: {
5009 if (try p.parseskip() and blk_1: {
47845010 if (std.mem.startsWith(u8, p.source[p.i..], "try")) {
47855011 p.i += 3;
47865012 break :blk_1 true;
47875013 }
47885014 break :blk_1 false;
4789 } and p.parseend_of_word()) break :blk_0 true;
5015 } and try p.parseend_of_word()) break :blk_0 true;
47905016 p.i = pos_0;
47915017 break :blk_0 false;
47925018 };
47935019 }
4794 pub fn parseKEYWORD_union(p: *Parser) bool {
5020 pub fn parseKEYWORD_union(p: *Parser) Error!bool {
47955021 return blk_0: {
47965022 const pos_0 = p.i;
4797 if (p.parseskip() and blk_1: {
5023 if (try p.parseskip() and blk_1: {
47985024 if (std.mem.startsWith(u8, p.source[p.i..], "union")) {
47995025 p.i += 5;
48005026 break :blk_1 true;
48015027 }
48025028 break :blk_1 false;
4803 } and p.parseend_of_word()) break :blk_0 true;
5029 } and try p.parseend_of_word()) break :blk_0 true;
48045030 p.i = pos_0;
48055031 break :blk_0 false;
48065032 };
48075033 }
4808 pub fn parseKEYWORD_unreachable(p: *Parser) bool {
5034 pub fn parseKEYWORD_unreachable(p: *Parser) Error!bool {
48095035 return blk_0: {
48105036 const pos_0 = p.i;
4811 if (p.parseskip() and blk_1: {
5037 if (try p.parseskip() and blk_1: {
48125038 if (std.mem.startsWith(u8, p.source[p.i..], "unreachable")) {
48135039 p.i += 11;
48145040 break :blk_1 true;
48155041 }
48165042 break :blk_1 false;
4817 } and p.parseend_of_word()) break :blk_0 true;
5043 } and try p.parseend_of_word()) break :blk_0 true;
48185044 p.i = pos_0;
48195045 break :blk_0 false;
48205046 };
48215047 }
4822 pub fn parseKEYWORD_var(p: *Parser) bool {
5048 pub fn parseKEYWORD_var(p: *Parser) Error!bool {
48235049 return blk_0: {
48245050 const pos_0 = p.i;
4825 if (p.parseskip() and blk_1: {
5051 if (try p.parseskip() and blk_1: {
48265052 if (std.mem.startsWith(u8, p.source[p.i..], "var")) {
48275053 p.i += 3;
48285054 break :blk_1 true;
48295055 }
48305056 break :blk_1 false;
4831 } and p.parseend_of_word()) break :blk_0 true;
5057 } and try p.parseend_of_word()) break :blk_0 true;
48325058 p.i = pos_0;
48335059 break :blk_0 false;
48345060 };
48355061 }
4836 pub fn parseKEYWORD_volatile(p: *Parser) bool {
5062 pub fn parseKEYWORD_volatile(p: *Parser) Error!bool {
48375063 return blk_0: {
48385064 const pos_0 = p.i;
4839 if (p.parseskip() and blk_1: {
5065 if (try p.parseskip() and blk_1: {
48405066 if (std.mem.startsWith(u8, p.source[p.i..], "volatile")) {
48415067 p.i += 8;
48425068 break :blk_1 true;
48435069 }
48445070 break :blk_1 false;
4845 } and p.parseend_of_word()) break :blk_0 true;
5071 } and try p.parseend_of_word()) break :blk_0 true;
48465072 p.i = pos_0;
48475073 break :blk_0 false;
48485074 };
48495075 }
4850 pub fn parseKEYWORD_while(p: *Parser) bool {
5076 pub fn parseKEYWORD_while(p: *Parser) Error!bool {
48515077 return blk_0: {
48525078 const pos_0 = p.i;
4853 if (p.parseskip() and blk_1: {
5079 if (try p.parseskip() and blk_1: {
48545080 if (std.mem.startsWith(u8, p.source[p.i..], "while")) {
48555081 p.i += 5;
48565082 break :blk_1 true;
48575083 }
48585084 break :blk_1 false;
4859 } and p.parseend_of_word()) break :blk_0 true;
5085 } and try p.parseend_of_word()) break :blk_0 true;
48605086 p.i = pos_0;
48615087 break :blk_0 false;
48625088 };
48635089 }
4864 pub fn parsekeyword(p: *Parser) bool {
5090 pub fn parsekeyword(p: *Parser) Error!bool {
48655091 return blk_0: {
48665092 const pos_0 = p.i;
4867 if (p.parseKEYWORD_addrspace()) break :blk_0 true;
5093 if (try p.parseKEYWORD_addrspace()) break :blk_0 true;
48685094 p.i = pos_0;
4869 if (p.parseKEYWORD_align()) break :blk_0 true;
5095 if (try p.parseKEYWORD_align()) break :blk_0 true;
48705096 p.i = pos_0;
4871 if (p.parseKEYWORD_allowzero()) break :blk_0 true;
5097 if (try p.parseKEYWORD_allowzero()) break :blk_0 true;
48725098 p.i = pos_0;
4873 if (p.parseKEYWORD_and()) break :blk_0 true;
5099 if (try p.parseKEYWORD_and()) break :blk_0 true;
48745100 p.i = pos_0;
4875 if (p.parseKEYWORD_anyframe()) break :blk_0 true;
5101 if (try p.parseKEYWORD_anyframe()) break :blk_0 true;
48765102 p.i = pos_0;
4877 if (p.parseKEYWORD_anytype()) break :blk_0 true;
5103 if (try p.parseKEYWORD_anytype()) break :blk_0 true;
48785104 p.i = pos_0;
4879 if (p.parseKEYWORD_asm()) break :blk_0 true;
5105 if (try p.parseKEYWORD_asm()) break :blk_0 true;
48805106 p.i = pos_0;
4881 if (p.parseKEYWORD_break()) break :blk_0 true;
5107 if (try p.parseKEYWORD_break()) break :blk_0 true;
48825108 p.i = pos_0;
4883 if (p.parseKEYWORD_callconv()) break :blk_0 true;
5109 if (try p.parseKEYWORD_callconv()) break :blk_0 true;
48845110 p.i = pos_0;
4885 if (p.parseKEYWORD_catch()) break :blk_0 true;
5111 if (try p.parseKEYWORD_catch()) break :blk_0 true;
48865112 p.i = pos_0;
4887 if (p.parseKEYWORD_comptime()) break :blk_0 true;
5113 if (try p.parseKEYWORD_comptime()) break :blk_0 true;
48885114 p.i = pos_0;
4889 if (p.parseKEYWORD_const()) break :blk_0 true;
5115 if (try p.parseKEYWORD_const()) break :blk_0 true;
48905116 p.i = pos_0;
4891 if (p.parseKEYWORD_continue()) break :blk_0 true;
5117 if (try p.parseKEYWORD_continue()) break :blk_0 true;
48925118 p.i = pos_0;
4893 if (p.parseKEYWORD_defer()) break :blk_0 true;
5119 if (try p.parseKEYWORD_defer()) break :blk_0 true;
48945120 p.i = pos_0;
4895 if (p.parseKEYWORD_else()) break :blk_0 true;
5121 if (try p.parseKEYWORD_else()) break :blk_0 true;
48965122 p.i = pos_0;
4897 if (p.parseKEYWORD_enum()) break :blk_0 true;
5123 if (try p.parseKEYWORD_enum()) break :blk_0 true;
48985124 p.i = pos_0;
4899 if (p.parseKEYWORD_errdefer()) break :blk_0 true;
5125 if (try p.parseKEYWORD_errdefer()) break :blk_0 true;
49005126 p.i = pos_0;
4901 if (p.parseKEYWORD_error()) break :blk_0 true;
5127 if (try p.parseKEYWORD_error()) break :blk_0 true;
49025128 p.i = pos_0;
4903 if (p.parseKEYWORD_export()) break :blk_0 true;
5129 if (try p.parseKEYWORD_export()) break :blk_0 true;
49045130 p.i = pos_0;
4905 if (p.parseKEYWORD_extern()) break :blk_0 true;
5131 if (try p.parseKEYWORD_extern()) break :blk_0 true;
49065132 p.i = pos_0;
4907 if (p.parseKEYWORD_fn()) break :blk_0 true;
5133 if (try p.parseKEYWORD_fn()) break :blk_0 true;
49085134 p.i = pos_0;
4909 if (p.parseKEYWORD_for()) break :blk_0 true;
5135 if (try p.parseKEYWORD_for()) break :blk_0 true;
49105136 p.i = pos_0;
4911 if (p.parseKEYWORD_if()) break :blk_0 true;
5137 if (try p.parseKEYWORD_if()) break :blk_0 true;
49125138 p.i = pos_0;
4913 if (p.parseKEYWORD_inline()) break :blk_0 true;
5139 if (try p.parseKEYWORD_inline()) break :blk_0 true;
49145140 p.i = pos_0;
4915 if (p.parseKEYWORD_noalias()) break :blk_0 true;
5141 if (try p.parseKEYWORD_noalias()) break :blk_0 true;
49165142 p.i = pos_0;
4917 if (p.parseKEYWORD_nosuspend()) break :blk_0 true;
5143 if (try p.parseKEYWORD_nosuspend()) break :blk_0 true;
49185144 p.i = pos_0;
4919 if (p.parseKEYWORD_noinline()) break :blk_0 true;
5145 if (try p.parseKEYWORD_noinline()) break :blk_0 true;
49205146 p.i = pos_0;
4921 if (p.parseKEYWORD_opaque()) break :blk_0 true;
5147 if (try p.parseKEYWORD_opaque()) break :blk_0 true;
49225148 p.i = pos_0;
4923 if (p.parseKEYWORD_or()) break :blk_0 true;
5149 if (try p.parseKEYWORD_or()) break :blk_0 true;
49245150 p.i = pos_0;
4925 if (p.parseKEYWORD_orelse()) break :blk_0 true;
5151 if (try p.parseKEYWORD_orelse()) break :blk_0 true;
49265152 p.i = pos_0;
4927 if (p.parseKEYWORD_packed()) break :blk_0 true;
5153 if (try p.parseKEYWORD_packed()) break :blk_0 true;
49285154 p.i = pos_0;
4929 if (p.parseKEYWORD_pub()) break :blk_0 true;
5155 if (try p.parseKEYWORD_pub()) break :blk_0 true;
49305156 p.i = pos_0;
4931 if (p.parseKEYWORD_resume()) break :blk_0 true;
5157 if (try p.parseKEYWORD_resume()) break :blk_0 true;
49325158 p.i = pos_0;
4933 if (p.parseKEYWORD_return()) break :blk_0 true;
5159 if (try p.parseKEYWORD_return()) break :blk_0 true;
49345160 p.i = pos_0;
4935 if (p.parseKEYWORD_linksection()) break :blk_0 true;
5161 if (try p.parseKEYWORD_linksection()) break :blk_0 true;
49365162 p.i = pos_0;
4937 if (p.parseKEYWORD_struct()) break :blk_0 true;
5163 if (try p.parseKEYWORD_struct()) break :blk_0 true;
49385164 p.i = pos_0;
4939 if (p.parseKEYWORD_suspend()) break :blk_0 true;
5165 if (try p.parseKEYWORD_suspend()) break :blk_0 true;
49405166 p.i = pos_0;
4941 if (p.parseKEYWORD_switch()) break :blk_0 true;
5167 if (try p.parseKEYWORD_switch()) break :blk_0 true;
49425168 p.i = pos_0;
4943 if (p.parseKEYWORD_test()) break :blk_0 true;
5169 if (try p.parseKEYWORD_test()) break :blk_0 true;
49445170 p.i = pos_0;
4945 if (p.parseKEYWORD_threadlocal()) break :blk_0 true;
5171 if (try p.parseKEYWORD_threadlocal()) break :blk_0 true;
49465172 p.i = pos_0;
4947 if (p.parseKEYWORD_try()) break :blk_0 true;
5173 if (try p.parseKEYWORD_try()) break :blk_0 true;
49485174 p.i = pos_0;
4949 if (p.parseKEYWORD_union()) break :blk_0 true;
5175 if (try p.parseKEYWORD_union()) break :blk_0 true;
49505176 p.i = pos_0;
4951 if (p.parseKEYWORD_unreachable()) break :blk_0 true;
5177 if (try p.parseKEYWORD_unreachable()) break :blk_0 true;
49525178 p.i = pos_0;
4953 if (p.parseKEYWORD_var()) break :blk_0 true;
5179 if (try p.parseKEYWORD_var()) break :blk_0 true;
49545180 p.i = pos_0;
4955 if (p.parseKEYWORD_volatile()) break :blk_0 true;
5181 if (try p.parseKEYWORD_volatile()) break :blk_0 true;
49565182 p.i = pos_0;
4957 if (p.parseKEYWORD_while()) break :blk_0 true;
5183 if (try p.parseKEYWORD_while()) break :blk_0 true;
49585184 p.i = pos_0;
49595185 break :blk_0 false;
49605186 };
tools/gen_parser_oracle.zig+32-10
......@@ -82,16 +82,21 @@ const Generator = struct {
8282 \\
8383 \\const std = @import("std");
8484 \\
85 \\const Error = error{MaxDepth};
86 \\const max_depth = 5;
87 \\
8588 \\/// Returns true if the input source is in the language defined by
8689 \\/// the grammar.
87 \\pub fn parse(source: []const u8) bool {
88 \\ var p: Parser = .{ .source = source, .i = 0 };
90 \\/// Returns error.MaxDepth if more than `max_depth` levels of recursion/iteration are reached.
91 \\pub fn parse(source: []const u8) Error!bool {
92 \\ var p: Parser = .{ .source = source, .i = 0, .expr_depth = 1 };
8993 \\ return p.parseRoot();
9094 \\}
9195 \\
9296 \\const Parser = struct {
9397 \\ source: []const u8,
9498 \\ i: usize,
99 \\ expr_depth: usize,
95100 \\
96101 );
97102 for (g.p.getExtra(node.get(g.p).root)) |def| {
......@@ -104,7 +109,15 @@ const Generator = struct {
104109 const def = node.get(g.p).def;
105110 const id = def.id.get(g.p).id;
106111 assert(g.suffix == 0);
107 try g.w.print("pub fn parse{s}(p: *Parser) bool {{ return ", .{id});
112 try g.w.print("pub fn parse{s}(p: *Parser) Error!bool {{", .{id});
113 if (mem.eql(u8, "Expr", id)) {
114 try g.w.print(
115 \\if (p.expr_depth >= max_depth) return error.MaxDepth;
116 \\p.expr_depth += 1;
117 \\defer p.expr_depth -= 1;
118 , .{});
119 }
120 try g.w.writeAll("return ");
108121 try g.genExpr(def.expr);
109122 try g.w.writeAll(";}");
110123 }
......@@ -139,7 +152,7 @@ const Generator = struct {
139152 g.suffix += 1;
140153 defer g.suffix -= 1;
141154 switch (node.get(g.p)) {
142 .id => |id| try g.w.print("p.parse{s}()", .{id}),
155 .id => |id| try g.w.print("try p.parse{s}()", .{id}),
143156 .expr => try g.genExpr(node),
144157 .@"&" => |child| {
145158 // XXX forbid unbounded lookahead
......@@ -179,25 +192,34 @@ const Generator = struct {
179192 .@"*" => |child| {
180193 try g.w.print(
181194 \\blk_{d}: {{
195 \\var i_{d}: usize = 0;
182196 \\while (
183 , .{suffix});
197 , .{ suffix, suffix });
184198 try g.genNode(child);
185199 try g.w.print(
186 \\) {{}}
200 \\) {{
201 \\ if (i_{d} > max_depth) return error.MaxDepth;
202 \\ i_{d} += 1;
203 \\}}
187204 \\break :blk_{d} true; }}
188 , .{suffix});
205 , .{ suffix, suffix, suffix });
189206 },
190207 .@"+" => |child| {
191208 try g.w.print(
192209 \\blk_{d}: {{
193210 \\var match_{d} = false;
211 \\var i_{d}: usize = 0;
194212 \\while (
195 , .{ suffix, suffix });
213 , .{ suffix, suffix, suffix });
196214 try g.genNode(child);
197215 try g.w.print(
198 \\) {{ match_{d} = true; }}
216 \\) {{
217 \\ match_{d} = true;
218 \\ if (i_{d} > max_depth) return error.MaxDepth;
219 \\ i_{d} += 1;
220 \\}}
199221 \\break :blk_{d} match_{d}; }}
200 , .{ suffix, suffix, suffix });
222 , .{ suffix, suffix, suffix, suffix, suffix });
201223 },
202224 .@"." => {
203225 try g.w.print(