1 | // @generated by pegen.py from python.gram |
2 | #include "pegen.h" |
3 | |
4 | #if defined(Py_DEBUG) && defined(Py_BUILD_CORE) |
5 | # define D(x) if (Py_DebugFlag) x; |
6 | #else |
7 | # define D(x) |
8 | #endif |
9 | |
10 | # define MAXSTACK 6000 |
11 | static const int n_keyword_lists = 9; |
12 | static KeywordToken *reserved_keywords[] = { |
13 | (KeywordToken[]) {{NULL, -1}}, |
14 | (KeywordToken[]) {{NULL, -1}}, |
15 | (KeywordToken[]) { |
16 | {"if" , 510}, |
17 | {"in" , 518}, |
18 | {"as" , 520}, |
19 | {"is" , 530}, |
20 | {"or" , 531}, |
21 | {NULL, -1}, |
22 | }, |
23 | (KeywordToken[]) { |
24 | {"del" , 503}, |
25 | {"try" , 511}, |
26 | {"for" , 517}, |
27 | {"def" , 526}, |
28 | {"not" , 529}, |
29 | {"and" , 532}, |
30 | {NULL, -1}, |
31 | }, |
32 | (KeywordToken[]) { |
33 | {"pass" , 502}, |
34 | {"from" , 514}, |
35 | {"elif" , 515}, |
36 | {"else" , 516}, |
37 | {"with" , 519}, |
38 | {"None" , 523}, |
39 | {"True" , 524}, |
40 | {NULL, -1}, |
41 | }, |
42 | (KeywordToken[]) { |
43 | {"raise" , 501}, |
44 | {"yield" , 504}, |
45 | {"break" , 506}, |
46 | {"while" , 512}, |
47 | {"False" , 525}, |
48 | {"class" , 527}, |
49 | {NULL, -1}, |
50 | }, |
51 | (KeywordToken[]) { |
52 | {"return" , 500}, |
53 | {"assert" , 505}, |
54 | {"global" , 508}, |
55 | {"import" , 513}, |
56 | {"except" , 521}, |
57 | {"lambda" , 528}, |
58 | {NULL, -1}, |
59 | }, |
60 | (KeywordToken[]) { |
61 | {"finally" , 522}, |
62 | {NULL, -1}, |
63 | }, |
64 | (KeywordToken[]) { |
65 | {"continue" , 507}, |
66 | {"nonlocal" , 509}, |
67 | {NULL, -1}, |
68 | }, |
69 | }; |
70 | static char *soft_keywords[] = { |
71 | "_" , |
72 | "case" , |
73 | "match" , |
74 | NULL, |
75 | }; |
76 | #define file_type 1000 |
77 | #define interactive_type 1001 |
78 | #define eval_type 1002 |
79 | #define func_type_type 1003 |
80 | #define fstring_type 1004 |
81 | #define type_expressions_type 1005 |
82 | #define statements_type 1006 |
83 | #define statement_type 1007 |
84 | #define statement_newline_type 1008 |
85 | #define simple_stmts_type 1009 |
86 | #define simple_stmt_type 1010 |
87 | #define compound_stmt_type 1011 |
88 | #define assignment_type 1012 |
89 | #define augassign_type 1013 |
90 | #define global_stmt_type 1014 |
91 | #define nonlocal_stmt_type 1015 |
92 | #define yield_stmt_type 1016 |
93 | #define assert_stmt_type 1017 |
94 | #define del_stmt_type 1018 |
95 | #define import_stmt_type 1019 |
96 | #define import_name_type 1020 |
97 | #define import_from_type 1021 |
98 | #define import_from_targets_type 1022 |
99 | #define import_from_as_names_type 1023 |
100 | #define import_from_as_name_type 1024 |
101 | #define dotted_as_names_type 1025 |
102 | #define dotted_as_name_type 1026 |
103 | #define dotted_name_type 1027 // Left-recursive |
104 | #define if_stmt_type 1028 |
105 | #define elif_stmt_type 1029 |
106 | #define else_block_type 1030 |
107 | #define while_stmt_type 1031 |
108 | #define for_stmt_type 1032 |
109 | #define with_stmt_type 1033 |
110 | #define with_item_type 1034 |
111 | #define try_stmt_type 1035 |
112 | #define except_block_type 1036 |
113 | #define finally_block_type 1037 |
114 | #define match_stmt_type 1038 |
115 | #define subject_expr_type 1039 |
116 | #define case_block_type 1040 |
117 | #define guard_type 1041 |
118 | #define patterns_type 1042 |
119 | #define pattern_type 1043 |
120 | #define as_pattern_type 1044 |
121 | #define or_pattern_type 1045 |
122 | #define closed_pattern_type 1046 |
123 | #define literal_pattern_type 1047 |
124 | #define literal_expr_type 1048 |
125 | #define complex_number_type 1049 |
126 | #define signed_number_type 1050 |
127 | #define signed_real_number_type 1051 |
128 | #define real_number_type 1052 |
129 | #define imaginary_number_type 1053 |
130 | #define capture_pattern_type 1054 |
131 | #define pattern_capture_target_type 1055 |
132 | #define wildcard_pattern_type 1056 |
133 | #define value_pattern_type 1057 |
134 | #define attr_type 1058 // Left-recursive |
135 | #define name_or_attr_type 1059 // Left-recursive |
136 | #define group_pattern_type 1060 |
137 | #define sequence_pattern_type 1061 |
138 | #define open_sequence_pattern_type 1062 |
139 | #define maybe_sequence_pattern_type 1063 |
140 | #define maybe_star_pattern_type 1064 |
141 | #define star_pattern_type 1065 |
142 | #define mapping_pattern_type 1066 |
143 | #define items_pattern_type 1067 |
144 | #define key_value_pattern_type 1068 |
145 | #define double_star_pattern_type 1069 |
146 | #define class_pattern_type 1070 |
147 | #define positional_patterns_type 1071 |
148 | #define keyword_patterns_type 1072 |
149 | #define keyword_pattern_type 1073 |
150 | #define return_stmt_type 1074 |
151 | #define raise_stmt_type 1075 |
152 | #define function_def_type 1076 |
153 | #define function_def_raw_type 1077 |
154 | #define 1078 |
155 | #define params_type 1079 |
156 | #define parameters_type 1080 |
157 | #define slash_no_default_type 1081 |
158 | #define slash_with_default_type 1082 |
159 | #define star_etc_type 1083 |
160 | #define kwds_type 1084 |
161 | #define param_no_default_type 1085 |
162 | #define param_with_default_type 1086 |
163 | #define param_maybe_default_type 1087 |
164 | #define param_type 1088 |
165 | #define annotation_type 1089 |
166 | #define default_type 1090 |
167 | #define decorators_type 1091 |
168 | #define class_def_type 1092 |
169 | #define class_def_raw_type 1093 |
170 | #define block_type 1094 |
171 | #define star_expressions_type 1095 |
172 | #define star_expression_type 1096 |
173 | #define star_named_expressions_type 1097 |
174 | #define star_named_expression_type 1098 |
175 | #define assignment_expression_type 1099 |
176 | #define named_expression_type 1100 |
177 | #define annotated_rhs_type 1101 |
178 | #define expressions_type 1102 |
179 | #define expression_type 1103 |
180 | #define lambdef_type 1104 |
181 | #define lambda_params_type 1105 |
182 | #define lambda_parameters_type 1106 |
183 | #define lambda_slash_no_default_type 1107 |
184 | #define lambda_slash_with_default_type 1108 |
185 | #define lambda_star_etc_type 1109 |
186 | #define lambda_kwds_type 1110 |
187 | #define lambda_param_no_default_type 1111 |
188 | #define lambda_param_with_default_type 1112 |
189 | #define lambda_param_maybe_default_type 1113 |
190 | #define lambda_param_type 1114 |
191 | #define disjunction_type 1115 |
192 | #define conjunction_type 1116 |
193 | #define inversion_type 1117 |
194 | #define comparison_type 1118 |
195 | #define compare_op_bitwise_or_pair_type 1119 |
196 | #define eq_bitwise_or_type 1120 |
197 | #define noteq_bitwise_or_type 1121 |
198 | #define lte_bitwise_or_type 1122 |
199 | #define lt_bitwise_or_type 1123 |
200 | #define gte_bitwise_or_type 1124 |
201 | #define gt_bitwise_or_type 1125 |
202 | #define notin_bitwise_or_type 1126 |
203 | #define in_bitwise_or_type 1127 |
204 | #define isnot_bitwise_or_type 1128 |
205 | #define is_bitwise_or_type 1129 |
206 | #define bitwise_or_type 1130 // Left-recursive |
207 | #define bitwise_xor_type 1131 // Left-recursive |
208 | #define bitwise_and_type 1132 // Left-recursive |
209 | #define shift_expr_type 1133 // Left-recursive |
210 | #define sum_type 1134 // Left-recursive |
211 | #define term_type 1135 // Left-recursive |
212 | #define factor_type 1136 |
213 | #define power_type 1137 |
214 | #define await_primary_type 1138 |
215 | #define primary_type 1139 // Left-recursive |
216 | #define slices_type 1140 |
217 | #define slice_type 1141 |
218 | #define atom_type 1142 |
219 | #define strings_type 1143 |
220 | #define list_type 1144 |
221 | #define listcomp_type 1145 |
222 | #define tuple_type 1146 |
223 | #define group_type 1147 |
224 | #define genexp_type 1148 |
225 | #define set_type 1149 |
226 | #define setcomp_type 1150 |
227 | #define dict_type 1151 |
228 | #define dictcomp_type 1152 |
229 | #define double_starred_kvpairs_type 1153 |
230 | #define double_starred_kvpair_type 1154 |
231 | #define kvpair_type 1155 |
232 | #define for_if_clauses_type 1156 |
233 | #define for_if_clause_type 1157 |
234 | #define yield_expr_type 1158 |
235 | #define arguments_type 1159 |
236 | #define args_type 1160 |
237 | #define kwargs_type 1161 |
238 | #define starred_expression_type 1162 |
239 | #define kwarg_or_starred_type 1163 |
240 | #define kwarg_or_double_starred_type 1164 |
241 | #define star_targets_type 1165 |
242 | #define star_targets_list_seq_type 1166 |
243 | #define star_targets_tuple_seq_type 1167 |
244 | #define star_target_type 1168 |
245 | #define target_with_star_atom_type 1169 |
246 | #define star_atom_type 1170 |
247 | #define single_target_type 1171 |
248 | #define single_subscript_attribute_target_type 1172 |
249 | #define del_targets_type 1173 |
250 | #define del_target_type 1174 |
251 | #define del_t_atom_type 1175 |
252 | #define t_primary_type 1176 // Left-recursive |
253 | #define t_lookahead_type 1177 |
254 | #define invalid_arguments_type 1178 |
255 | #define invalid_kwarg_type 1179 |
256 | #define expression_without_invalid_type 1180 |
257 | #define invalid_legacy_expression_type 1181 |
258 | #define invalid_expression_type 1182 |
259 | #define invalid_named_expression_type 1183 |
260 | #define invalid_assignment_type 1184 |
261 | #define invalid_ann_assign_target_type 1185 |
262 | #define invalid_del_stmt_type 1186 |
263 | #define invalid_block_type 1187 |
264 | #define invalid_comprehension_type 1188 |
265 | #define invalid_dict_comprehension_type 1189 |
266 | #define invalid_parameters_type 1190 |
267 | #define invalid_parameters_helper_type 1191 |
268 | #define invalid_lambda_parameters_type 1192 |
269 | #define invalid_lambda_parameters_helper_type 1193 |
270 | #define invalid_star_etc_type 1194 |
271 | #define invalid_lambda_star_etc_type 1195 |
272 | #define 1196 |
273 | #define invalid_with_item_type 1197 |
274 | #define invalid_for_target_type 1198 |
275 | #define invalid_group_type 1199 |
276 | #define invalid_import_from_targets_type 1200 |
277 | #define invalid_with_stmt_type 1201 |
278 | #define invalid_with_stmt_indent_type 1202 |
279 | #define invalid_try_stmt_type 1203 |
280 | #define invalid_except_stmt_type 1204 |
281 | #define invalid_finally_stmt_type 1205 |
282 | #define invalid_except_stmt_indent_type 1206 |
283 | #define invalid_match_stmt_type 1207 |
284 | #define invalid_case_block_type 1208 |
285 | #define invalid_as_pattern_type 1209 |
286 | #define invalid_class_pattern_type 1210 |
287 | #define invalid_class_argument_pattern_type 1211 |
288 | #define invalid_if_stmt_type 1212 |
289 | #define invalid_elif_stmt_type 1213 |
290 | #define invalid_else_stmt_type 1214 |
291 | #define invalid_while_stmt_type 1215 |
292 | #define invalid_for_stmt_type 1216 |
293 | #define invalid_def_raw_type 1217 |
294 | #define invalid_class_def_raw_type 1218 |
295 | #define invalid_double_starred_kvpairs_type 1219 |
296 | #define invalid_kvpair_type 1220 |
297 | #define _loop0_1_type 1221 |
298 | #define _loop0_2_type 1222 |
299 | #define _loop0_4_type 1223 |
300 | #define _gather_3_type 1224 |
301 | #define _loop0_6_type 1225 |
302 | #define _gather_5_type 1226 |
303 | #define _loop0_8_type 1227 |
304 | #define _gather_7_type 1228 |
305 | #define _loop0_10_type 1229 |
306 | #define _gather_9_type 1230 |
307 | #define _loop1_11_type 1231 |
308 | #define _loop0_13_type 1232 |
309 | #define _gather_12_type 1233 |
310 | #define _tmp_14_type 1234 |
311 | #define _tmp_15_type 1235 |
312 | #define _tmp_16_type 1236 |
313 | #define _tmp_17_type 1237 |
314 | #define _tmp_18_type 1238 |
315 | #define _tmp_19_type 1239 |
316 | #define _tmp_20_type 1240 |
317 | #define _tmp_21_type 1241 |
318 | #define _loop1_22_type 1242 |
319 | #define _tmp_23_type 1243 |
320 | #define _tmp_24_type 1244 |
321 | #define _loop0_26_type 1245 |
322 | #define _gather_25_type 1246 |
323 | #define _loop0_28_type 1247 |
324 | #define _gather_27_type 1248 |
325 | #define _tmp_29_type 1249 |
326 | #define _tmp_30_type 1250 |
327 | #define _loop0_31_type 1251 |
328 | #define _loop1_32_type 1252 |
329 | #define _loop0_34_type 1253 |
330 | #define _gather_33_type 1254 |
331 | #define _tmp_35_type 1255 |
332 | #define _loop0_37_type 1256 |
333 | #define _gather_36_type 1257 |
334 | #define _tmp_38_type 1258 |
335 | #define _loop0_40_type 1259 |
336 | #define _gather_39_type 1260 |
337 | #define _loop0_42_type 1261 |
338 | #define _gather_41_type 1262 |
339 | #define _loop0_44_type 1263 |
340 | #define _gather_43_type 1264 |
341 | #define _loop0_46_type 1265 |
342 | #define _gather_45_type 1266 |
343 | #define _tmp_47_type 1267 |
344 | #define _loop1_48_type 1268 |
345 | #define _tmp_49_type 1269 |
346 | #define _loop1_50_type 1270 |
347 | #define _loop0_52_type 1271 |
348 | #define _gather_51_type 1272 |
349 | #define _tmp_53_type 1273 |
350 | #define _tmp_54_type 1274 |
351 | #define _tmp_55_type 1275 |
352 | #define _tmp_56_type 1276 |
353 | #define _loop0_58_type 1277 |
354 | #define _gather_57_type 1278 |
355 | #define _loop0_60_type 1279 |
356 | #define _gather_59_type 1280 |
357 | #define _tmp_61_type 1281 |
358 | #define _loop0_63_type 1282 |
359 | #define _gather_62_type 1283 |
360 | #define _loop0_65_type 1284 |
361 | #define _gather_64_type 1285 |
362 | #define _tmp_66_type 1286 |
363 | #define _tmp_67_type 1287 |
364 | #define _tmp_68_type 1288 |
365 | #define _tmp_69_type 1289 |
366 | #define _loop0_70_type 1290 |
367 | #define _loop0_71_type 1291 |
368 | #define _loop0_72_type 1292 |
369 | #define _loop1_73_type 1293 |
370 | #define _loop0_74_type 1294 |
371 | #define _loop1_75_type 1295 |
372 | #define _loop1_76_type 1296 |
373 | #define _loop1_77_type 1297 |
374 | #define _loop0_78_type 1298 |
375 | #define _loop1_79_type 1299 |
376 | #define _loop0_80_type 1300 |
377 | #define _loop1_81_type 1301 |
378 | #define _loop0_82_type 1302 |
379 | #define _loop1_83_type 1303 |
380 | #define _loop1_84_type 1304 |
381 | #define _tmp_85_type 1305 |
382 | #define _loop1_86_type 1306 |
383 | #define _loop0_88_type 1307 |
384 | #define _gather_87_type 1308 |
385 | #define _loop1_89_type 1309 |
386 | #define _loop0_90_type 1310 |
387 | #define _loop0_91_type 1311 |
388 | #define _loop0_92_type 1312 |
389 | #define _loop1_93_type 1313 |
390 | #define _loop0_94_type 1314 |
391 | #define _loop1_95_type 1315 |
392 | #define _loop1_96_type 1316 |
393 | #define _loop1_97_type 1317 |
394 | #define _loop0_98_type 1318 |
395 | #define _loop1_99_type 1319 |
396 | #define _loop0_100_type 1320 |
397 | #define _loop1_101_type 1321 |
398 | #define _loop0_102_type 1322 |
399 | #define _loop1_103_type 1323 |
400 | #define _loop1_104_type 1324 |
401 | #define _loop1_105_type 1325 |
402 | #define _loop1_106_type 1326 |
403 | #define _tmp_107_type 1327 |
404 | #define _loop0_109_type 1328 |
405 | #define _gather_108_type 1329 |
406 | #define _tmp_110_type 1330 |
407 | #define _tmp_111_type 1331 |
408 | #define _tmp_112_type 1332 |
409 | #define _tmp_113_type 1333 |
410 | #define _loop1_114_type 1334 |
411 | #define _tmp_115_type 1335 |
412 | #define _tmp_116_type 1336 |
413 | #define _tmp_117_type 1337 |
414 | #define _loop0_119_type 1338 |
415 | #define _gather_118_type 1339 |
416 | #define _loop1_120_type 1340 |
417 | #define _loop0_121_type 1341 |
418 | #define _loop0_122_type 1342 |
419 | #define _loop0_124_type 1343 |
420 | #define _gather_123_type 1344 |
421 | #define _tmp_125_type 1345 |
422 | #define _loop0_127_type 1346 |
423 | #define _gather_126_type 1347 |
424 | #define _loop0_129_type 1348 |
425 | #define _gather_128_type 1349 |
426 | #define _loop0_131_type 1350 |
427 | #define _gather_130_type 1351 |
428 | #define _loop0_133_type 1352 |
429 | #define _gather_132_type 1353 |
430 | #define _loop0_134_type 1354 |
431 | #define _loop0_136_type 1355 |
432 | #define _gather_135_type 1356 |
433 | #define _loop1_137_type 1357 |
434 | #define _tmp_138_type 1358 |
435 | #define _loop0_140_type 1359 |
436 | #define _gather_139_type 1360 |
437 | #define _tmp_141_type 1361 |
438 | #define _tmp_142_type 1362 |
439 | #define _tmp_143_type 1363 |
440 | #define _tmp_144_type 1364 |
441 | #define _tmp_145_type 1365 |
442 | #define _tmp_146_type 1366 |
443 | #define _tmp_147_type 1367 |
444 | #define _tmp_148_type 1368 |
445 | #define _loop0_149_type 1369 |
446 | #define _loop0_150_type 1370 |
447 | #define _loop0_151_type 1371 |
448 | #define _tmp_152_type 1372 |
449 | #define _tmp_153_type 1373 |
450 | #define _tmp_154_type 1374 |
451 | #define _tmp_155_type 1375 |
452 | #define _loop0_156_type 1376 |
453 | #define _loop1_157_type 1377 |
454 | #define _loop0_158_type 1378 |
455 | #define _loop1_159_type 1379 |
456 | #define _tmp_160_type 1380 |
457 | #define _tmp_161_type 1381 |
458 | #define _tmp_162_type 1382 |
459 | #define _loop0_164_type 1383 |
460 | #define _gather_163_type 1384 |
461 | #define _loop0_166_type 1385 |
462 | #define _gather_165_type 1386 |
463 | #define _loop0_168_type 1387 |
464 | #define _gather_167_type 1388 |
465 | #define _loop0_170_type 1389 |
466 | #define _gather_169_type 1390 |
467 | #define _tmp_171_type 1391 |
468 | #define _tmp_172_type 1392 |
469 | #define _tmp_173_type 1393 |
470 | #define _tmp_174_type 1394 |
471 | #define _tmp_175_type 1395 |
472 | #define _tmp_176_type 1396 |
473 | #define _tmp_177_type 1397 |
474 | #define _loop0_179_type 1398 |
475 | #define _gather_178_type 1399 |
476 | #define _tmp_180_type 1400 |
477 | #define _tmp_181_type 1401 |
478 | #define _tmp_182_type 1402 |
479 | #define _tmp_183_type 1403 |
480 | #define _tmp_184_type 1404 |
481 | #define _tmp_185_type 1405 |
482 | #define _tmp_186_type 1406 |
483 | #define _tmp_187_type 1407 |
484 | #define _tmp_188_type 1408 |
485 | #define _tmp_189_type 1409 |
486 | #define _tmp_190_type 1410 |
487 | #define _tmp_191_type 1411 |
488 | #define _tmp_192_type 1412 |
489 | #define _tmp_193_type 1413 |
490 | #define _tmp_194_type 1414 |
491 | #define _tmp_195_type 1415 |
492 | #define _tmp_196_type 1416 |
493 | #define _tmp_197_type 1417 |
494 | #define _tmp_198_type 1418 |
495 | #define _tmp_199_type 1419 |
496 | #define _tmp_200_type 1420 |
497 | #define _tmp_201_type 1421 |
498 | #define _tmp_202_type 1422 |
499 | #define _tmp_203_type 1423 |
500 | #define _tmp_204_type 1424 |
501 | #define _tmp_205_type 1425 |
502 | #define _tmp_206_type 1426 |
503 | |
504 | static mod_ty file_rule(Parser *p); |
505 | static mod_ty interactive_rule(Parser *p); |
506 | static mod_ty eval_rule(Parser *p); |
507 | static mod_ty func_type_rule(Parser *p); |
508 | static expr_ty fstring_rule(Parser *p); |
509 | static asdl_expr_seq* type_expressions_rule(Parser *p); |
510 | static asdl_stmt_seq* statements_rule(Parser *p); |
511 | static asdl_stmt_seq* statement_rule(Parser *p); |
512 | static asdl_stmt_seq* statement_newline_rule(Parser *p); |
513 | static asdl_stmt_seq* simple_stmts_rule(Parser *p); |
514 | static stmt_ty simple_stmt_rule(Parser *p); |
515 | static stmt_ty compound_stmt_rule(Parser *p); |
516 | static stmt_ty assignment_rule(Parser *p); |
517 | static AugOperator* augassign_rule(Parser *p); |
518 | static stmt_ty global_stmt_rule(Parser *p); |
519 | static stmt_ty nonlocal_stmt_rule(Parser *p); |
520 | static stmt_ty yield_stmt_rule(Parser *p); |
521 | static stmt_ty assert_stmt_rule(Parser *p); |
522 | static stmt_ty del_stmt_rule(Parser *p); |
523 | static stmt_ty import_stmt_rule(Parser *p); |
524 | static stmt_ty import_name_rule(Parser *p); |
525 | static stmt_ty import_from_rule(Parser *p); |
526 | static asdl_alias_seq* import_from_targets_rule(Parser *p); |
527 | static asdl_alias_seq* import_from_as_names_rule(Parser *p); |
528 | static alias_ty import_from_as_name_rule(Parser *p); |
529 | static asdl_alias_seq* dotted_as_names_rule(Parser *p); |
530 | static alias_ty dotted_as_name_rule(Parser *p); |
531 | static expr_ty dotted_name_rule(Parser *p); |
532 | static stmt_ty if_stmt_rule(Parser *p); |
533 | static stmt_ty elif_stmt_rule(Parser *p); |
534 | static asdl_stmt_seq* else_block_rule(Parser *p); |
535 | static stmt_ty while_stmt_rule(Parser *p); |
536 | static stmt_ty for_stmt_rule(Parser *p); |
537 | static stmt_ty with_stmt_rule(Parser *p); |
538 | static withitem_ty with_item_rule(Parser *p); |
539 | static stmt_ty try_stmt_rule(Parser *p); |
540 | static excepthandler_ty except_block_rule(Parser *p); |
541 | static asdl_stmt_seq* finally_block_rule(Parser *p); |
542 | static stmt_ty match_stmt_rule(Parser *p); |
543 | static expr_ty subject_expr_rule(Parser *p); |
544 | static match_case_ty case_block_rule(Parser *p); |
545 | static expr_ty guard_rule(Parser *p); |
546 | static pattern_ty patterns_rule(Parser *p); |
547 | static pattern_ty pattern_rule(Parser *p); |
548 | static pattern_ty as_pattern_rule(Parser *p); |
549 | static pattern_ty or_pattern_rule(Parser *p); |
550 | static pattern_ty closed_pattern_rule(Parser *p); |
551 | static pattern_ty literal_pattern_rule(Parser *p); |
552 | static expr_ty literal_expr_rule(Parser *p); |
553 | static expr_ty complex_number_rule(Parser *p); |
554 | static expr_ty signed_number_rule(Parser *p); |
555 | static expr_ty signed_real_number_rule(Parser *p); |
556 | static expr_ty real_number_rule(Parser *p); |
557 | static expr_ty imaginary_number_rule(Parser *p); |
558 | static pattern_ty capture_pattern_rule(Parser *p); |
559 | static expr_ty pattern_capture_target_rule(Parser *p); |
560 | static pattern_ty wildcard_pattern_rule(Parser *p); |
561 | static pattern_ty value_pattern_rule(Parser *p); |
562 | static expr_ty attr_rule(Parser *p); |
563 | static expr_ty name_or_attr_rule(Parser *p); |
564 | static pattern_ty group_pattern_rule(Parser *p); |
565 | static pattern_ty sequence_pattern_rule(Parser *p); |
566 | static asdl_seq* open_sequence_pattern_rule(Parser *p); |
567 | static asdl_seq* maybe_sequence_pattern_rule(Parser *p); |
568 | static pattern_ty maybe_star_pattern_rule(Parser *p); |
569 | static pattern_ty star_pattern_rule(Parser *p); |
570 | static pattern_ty mapping_pattern_rule(Parser *p); |
571 | static asdl_seq* items_pattern_rule(Parser *p); |
572 | static KeyPatternPair* key_value_pattern_rule(Parser *p); |
573 | static expr_ty double_star_pattern_rule(Parser *p); |
574 | static pattern_ty class_pattern_rule(Parser *p); |
575 | static asdl_pattern_seq* positional_patterns_rule(Parser *p); |
576 | static asdl_seq* keyword_patterns_rule(Parser *p); |
577 | static KeyPatternPair* keyword_pattern_rule(Parser *p); |
578 | static stmt_ty return_stmt_rule(Parser *p); |
579 | static stmt_ty raise_stmt_rule(Parser *p); |
580 | static stmt_ty function_def_rule(Parser *p); |
581 | static stmt_ty function_def_raw_rule(Parser *p); |
582 | static Token* func_type_comment_rule(Parser *p); |
583 | static arguments_ty params_rule(Parser *p); |
584 | static arguments_ty parameters_rule(Parser *p); |
585 | static asdl_arg_seq* slash_no_default_rule(Parser *p); |
586 | static SlashWithDefault* slash_with_default_rule(Parser *p); |
587 | static StarEtc* star_etc_rule(Parser *p); |
588 | static arg_ty kwds_rule(Parser *p); |
589 | static arg_ty param_no_default_rule(Parser *p); |
590 | static NameDefaultPair* param_with_default_rule(Parser *p); |
591 | static NameDefaultPair* param_maybe_default_rule(Parser *p); |
592 | static arg_ty param_rule(Parser *p); |
593 | static expr_ty annotation_rule(Parser *p); |
594 | static expr_ty default_rule(Parser *p); |
595 | static asdl_expr_seq* decorators_rule(Parser *p); |
596 | static stmt_ty class_def_rule(Parser *p); |
597 | static stmt_ty class_def_raw_rule(Parser *p); |
598 | static asdl_stmt_seq* block_rule(Parser *p); |
599 | static expr_ty star_expressions_rule(Parser *p); |
600 | static expr_ty star_expression_rule(Parser *p); |
601 | static asdl_expr_seq* star_named_expressions_rule(Parser *p); |
602 | static expr_ty star_named_expression_rule(Parser *p); |
603 | static expr_ty assignment_expression_rule(Parser *p); |
604 | static expr_ty named_expression_rule(Parser *p); |
605 | static expr_ty annotated_rhs_rule(Parser *p); |
606 | static expr_ty expressions_rule(Parser *p); |
607 | static expr_ty expression_rule(Parser *p); |
608 | static expr_ty lambdef_rule(Parser *p); |
609 | static arguments_ty lambda_params_rule(Parser *p); |
610 | static arguments_ty lambda_parameters_rule(Parser *p); |
611 | static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p); |
612 | static SlashWithDefault* lambda_slash_with_default_rule(Parser *p); |
613 | static StarEtc* lambda_star_etc_rule(Parser *p); |
614 | static arg_ty lambda_kwds_rule(Parser *p); |
615 | static arg_ty lambda_param_no_default_rule(Parser *p); |
616 | static NameDefaultPair* lambda_param_with_default_rule(Parser *p); |
617 | static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p); |
618 | static arg_ty lambda_param_rule(Parser *p); |
619 | static expr_ty disjunction_rule(Parser *p); |
620 | static expr_ty conjunction_rule(Parser *p); |
621 | static expr_ty inversion_rule(Parser *p); |
622 | static expr_ty comparison_rule(Parser *p); |
623 | static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p); |
624 | static CmpopExprPair* eq_bitwise_or_rule(Parser *p); |
625 | static CmpopExprPair* noteq_bitwise_or_rule(Parser *p); |
626 | static CmpopExprPair* lte_bitwise_or_rule(Parser *p); |
627 | static CmpopExprPair* lt_bitwise_or_rule(Parser *p); |
628 | static CmpopExprPair* gte_bitwise_or_rule(Parser *p); |
629 | static CmpopExprPair* gt_bitwise_or_rule(Parser *p); |
630 | static CmpopExprPair* notin_bitwise_or_rule(Parser *p); |
631 | static CmpopExprPair* in_bitwise_or_rule(Parser *p); |
632 | static CmpopExprPair* isnot_bitwise_or_rule(Parser *p); |
633 | static CmpopExprPair* is_bitwise_or_rule(Parser *p); |
634 | static expr_ty bitwise_or_rule(Parser *p); |
635 | static expr_ty bitwise_xor_rule(Parser *p); |
636 | static expr_ty bitwise_and_rule(Parser *p); |
637 | static expr_ty shift_expr_rule(Parser *p); |
638 | static expr_ty sum_rule(Parser *p); |
639 | static expr_ty term_rule(Parser *p); |
640 | static expr_ty factor_rule(Parser *p); |
641 | static expr_ty power_rule(Parser *p); |
642 | static expr_ty await_primary_rule(Parser *p); |
643 | static expr_ty primary_rule(Parser *p); |
644 | static expr_ty slices_rule(Parser *p); |
645 | static expr_ty slice_rule(Parser *p); |
646 | static expr_ty atom_rule(Parser *p); |
647 | static expr_ty strings_rule(Parser *p); |
648 | static expr_ty list_rule(Parser *p); |
649 | static expr_ty listcomp_rule(Parser *p); |
650 | static expr_ty tuple_rule(Parser *p); |
651 | static expr_ty group_rule(Parser *p); |
652 | static expr_ty genexp_rule(Parser *p); |
653 | static expr_ty set_rule(Parser *p); |
654 | static expr_ty setcomp_rule(Parser *p); |
655 | static expr_ty dict_rule(Parser *p); |
656 | static expr_ty dictcomp_rule(Parser *p); |
657 | static asdl_seq* double_starred_kvpairs_rule(Parser *p); |
658 | static KeyValuePair* double_starred_kvpair_rule(Parser *p); |
659 | static KeyValuePair* kvpair_rule(Parser *p); |
660 | static asdl_comprehension_seq* for_if_clauses_rule(Parser *p); |
661 | static comprehension_ty for_if_clause_rule(Parser *p); |
662 | static expr_ty yield_expr_rule(Parser *p); |
663 | static expr_ty arguments_rule(Parser *p); |
664 | static expr_ty args_rule(Parser *p); |
665 | static asdl_seq* kwargs_rule(Parser *p); |
666 | static expr_ty starred_expression_rule(Parser *p); |
667 | static KeywordOrStarred* kwarg_or_starred_rule(Parser *p); |
668 | static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p); |
669 | static expr_ty star_targets_rule(Parser *p); |
670 | static asdl_expr_seq* star_targets_list_seq_rule(Parser *p); |
671 | static asdl_expr_seq* star_targets_tuple_seq_rule(Parser *p); |
672 | static expr_ty star_target_rule(Parser *p); |
673 | static expr_ty target_with_star_atom_rule(Parser *p); |
674 | static expr_ty star_atom_rule(Parser *p); |
675 | static expr_ty single_target_rule(Parser *p); |
676 | static expr_ty single_subscript_attribute_target_rule(Parser *p); |
677 | static asdl_expr_seq* del_targets_rule(Parser *p); |
678 | static expr_ty del_target_rule(Parser *p); |
679 | static expr_ty del_t_atom_rule(Parser *p); |
680 | static expr_ty t_primary_rule(Parser *p); |
681 | static void *t_lookahead_rule(Parser *p); |
682 | static void *invalid_arguments_rule(Parser *p); |
683 | static void *invalid_kwarg_rule(Parser *p); |
684 | static expr_ty expression_without_invalid_rule(Parser *p); |
685 | static void *invalid_legacy_expression_rule(Parser *p); |
686 | static void *invalid_expression_rule(Parser *p); |
687 | static void *invalid_named_expression_rule(Parser *p); |
688 | static void *invalid_assignment_rule(Parser *p); |
689 | static expr_ty invalid_ann_assign_target_rule(Parser *p); |
690 | static void *invalid_del_stmt_rule(Parser *p); |
691 | static void *invalid_block_rule(Parser *p); |
692 | static void *invalid_comprehension_rule(Parser *p); |
693 | static void *invalid_dict_comprehension_rule(Parser *p); |
694 | static void *invalid_parameters_rule(Parser *p); |
695 | static void *invalid_parameters_helper_rule(Parser *p); |
696 | static void *invalid_lambda_parameters_rule(Parser *p); |
697 | static void *invalid_lambda_parameters_helper_rule(Parser *p); |
698 | static void *invalid_star_etc_rule(Parser *p); |
699 | static void *invalid_lambda_star_etc_rule(Parser *p); |
700 | static void *invalid_double_type_comments_rule(Parser *p); |
701 | static void *invalid_with_item_rule(Parser *p); |
702 | static void *invalid_for_target_rule(Parser *p); |
703 | static void *invalid_group_rule(Parser *p); |
704 | static void *invalid_import_from_targets_rule(Parser *p); |
705 | static void *invalid_with_stmt_rule(Parser *p); |
706 | static void *invalid_with_stmt_indent_rule(Parser *p); |
707 | static void *invalid_try_stmt_rule(Parser *p); |
708 | static void *invalid_except_stmt_rule(Parser *p); |
709 | static void *invalid_finally_stmt_rule(Parser *p); |
710 | static void *invalid_except_stmt_indent_rule(Parser *p); |
711 | static void *invalid_match_stmt_rule(Parser *p); |
712 | static void *invalid_case_block_rule(Parser *p); |
713 | static void *invalid_as_pattern_rule(Parser *p); |
714 | static void *invalid_class_pattern_rule(Parser *p); |
715 | static asdl_pattern_seq* invalid_class_argument_pattern_rule(Parser *p); |
716 | static void *invalid_if_stmt_rule(Parser *p); |
717 | static void *invalid_elif_stmt_rule(Parser *p); |
718 | static void *invalid_else_stmt_rule(Parser *p); |
719 | static void *invalid_while_stmt_rule(Parser *p); |
720 | static void *invalid_for_stmt_rule(Parser *p); |
721 | static void *invalid_def_raw_rule(Parser *p); |
722 | static void *invalid_class_def_raw_rule(Parser *p); |
723 | static void *invalid_double_starred_kvpairs_rule(Parser *p); |
724 | static void *invalid_kvpair_rule(Parser *p); |
725 | static asdl_seq *_loop0_1_rule(Parser *p); |
726 | static asdl_seq *_loop0_2_rule(Parser *p); |
727 | static asdl_seq *_loop0_4_rule(Parser *p); |
728 | static asdl_seq *_gather_3_rule(Parser *p); |
729 | static asdl_seq *_loop0_6_rule(Parser *p); |
730 | static asdl_seq *_gather_5_rule(Parser *p); |
731 | static asdl_seq *_loop0_8_rule(Parser *p); |
732 | static asdl_seq *_gather_7_rule(Parser *p); |
733 | static asdl_seq *_loop0_10_rule(Parser *p); |
734 | static asdl_seq *_gather_9_rule(Parser *p); |
735 | static asdl_seq *_loop1_11_rule(Parser *p); |
736 | static asdl_seq *_loop0_13_rule(Parser *p); |
737 | static asdl_seq *_gather_12_rule(Parser *p); |
738 | static void *_tmp_14_rule(Parser *p); |
739 | static void *_tmp_15_rule(Parser *p); |
740 | static void *_tmp_16_rule(Parser *p); |
741 | static void *_tmp_17_rule(Parser *p); |
742 | static void *_tmp_18_rule(Parser *p); |
743 | static void *_tmp_19_rule(Parser *p); |
744 | static void *_tmp_20_rule(Parser *p); |
745 | static void *_tmp_21_rule(Parser *p); |
746 | static asdl_seq *_loop1_22_rule(Parser *p); |
747 | static void *_tmp_23_rule(Parser *p); |
748 | static void *_tmp_24_rule(Parser *p); |
749 | static asdl_seq *_loop0_26_rule(Parser *p); |
750 | static asdl_seq *_gather_25_rule(Parser *p); |
751 | static asdl_seq *_loop0_28_rule(Parser *p); |
752 | static asdl_seq *_gather_27_rule(Parser *p); |
753 | static void *_tmp_29_rule(Parser *p); |
754 | static void *_tmp_30_rule(Parser *p); |
755 | static asdl_seq *_loop0_31_rule(Parser *p); |
756 | static asdl_seq *_loop1_32_rule(Parser *p); |
757 | static asdl_seq *_loop0_34_rule(Parser *p); |
758 | static asdl_seq *_gather_33_rule(Parser *p); |
759 | static void *_tmp_35_rule(Parser *p); |
760 | static asdl_seq *_loop0_37_rule(Parser *p); |
761 | static asdl_seq *_gather_36_rule(Parser *p); |
762 | static void *_tmp_38_rule(Parser *p); |
763 | static asdl_seq *_loop0_40_rule(Parser *p); |
764 | static asdl_seq *_gather_39_rule(Parser *p); |
765 | static asdl_seq *_loop0_42_rule(Parser *p); |
766 | static asdl_seq *_gather_41_rule(Parser *p); |
767 | static asdl_seq *_loop0_44_rule(Parser *p); |
768 | static asdl_seq *_gather_43_rule(Parser *p); |
769 | static asdl_seq *_loop0_46_rule(Parser *p); |
770 | static asdl_seq *_gather_45_rule(Parser *p); |
771 | static void *_tmp_47_rule(Parser *p); |
772 | static asdl_seq *_loop1_48_rule(Parser *p); |
773 | static void *_tmp_49_rule(Parser *p); |
774 | static asdl_seq *_loop1_50_rule(Parser *p); |
775 | static asdl_seq *_loop0_52_rule(Parser *p); |
776 | static asdl_seq *_gather_51_rule(Parser *p); |
777 | static void *_tmp_53_rule(Parser *p); |
778 | static void *_tmp_54_rule(Parser *p); |
779 | static void *_tmp_55_rule(Parser *p); |
780 | static void *_tmp_56_rule(Parser *p); |
781 | static asdl_seq *_loop0_58_rule(Parser *p); |
782 | static asdl_seq *_gather_57_rule(Parser *p); |
783 | static asdl_seq *_loop0_60_rule(Parser *p); |
784 | static asdl_seq *_gather_59_rule(Parser *p); |
785 | static void *_tmp_61_rule(Parser *p); |
786 | static asdl_seq *_loop0_63_rule(Parser *p); |
787 | static asdl_seq *_gather_62_rule(Parser *p); |
788 | static asdl_seq *_loop0_65_rule(Parser *p); |
789 | static asdl_seq *_gather_64_rule(Parser *p); |
790 | static void *_tmp_66_rule(Parser *p); |
791 | static void *_tmp_67_rule(Parser *p); |
792 | static void *_tmp_68_rule(Parser *p); |
793 | static void *_tmp_69_rule(Parser *p); |
794 | static asdl_seq *_loop0_70_rule(Parser *p); |
795 | static asdl_seq *_loop0_71_rule(Parser *p); |
796 | static asdl_seq *_loop0_72_rule(Parser *p); |
797 | static asdl_seq *_loop1_73_rule(Parser *p); |
798 | static asdl_seq *_loop0_74_rule(Parser *p); |
799 | static asdl_seq *_loop1_75_rule(Parser *p); |
800 | static asdl_seq *_loop1_76_rule(Parser *p); |
801 | static asdl_seq *_loop1_77_rule(Parser *p); |
802 | static asdl_seq *_loop0_78_rule(Parser *p); |
803 | static asdl_seq *_loop1_79_rule(Parser *p); |
804 | static asdl_seq *_loop0_80_rule(Parser *p); |
805 | static asdl_seq *_loop1_81_rule(Parser *p); |
806 | static asdl_seq *_loop0_82_rule(Parser *p); |
807 | static asdl_seq *_loop1_83_rule(Parser *p); |
808 | static asdl_seq *_loop1_84_rule(Parser *p); |
809 | static void *_tmp_85_rule(Parser *p); |
810 | static asdl_seq *_loop1_86_rule(Parser *p); |
811 | static asdl_seq *_loop0_88_rule(Parser *p); |
812 | static asdl_seq *_gather_87_rule(Parser *p); |
813 | static asdl_seq *_loop1_89_rule(Parser *p); |
814 | static asdl_seq *_loop0_90_rule(Parser *p); |
815 | static asdl_seq *_loop0_91_rule(Parser *p); |
816 | static asdl_seq *_loop0_92_rule(Parser *p); |
817 | static asdl_seq *_loop1_93_rule(Parser *p); |
818 | static asdl_seq *_loop0_94_rule(Parser *p); |
819 | static asdl_seq *_loop1_95_rule(Parser *p); |
820 | static asdl_seq *_loop1_96_rule(Parser *p); |
821 | static asdl_seq *_loop1_97_rule(Parser *p); |
822 | static asdl_seq *_loop0_98_rule(Parser *p); |
823 | static asdl_seq *_loop1_99_rule(Parser *p); |
824 | static asdl_seq *_loop0_100_rule(Parser *p); |
825 | static asdl_seq *_loop1_101_rule(Parser *p); |
826 | static asdl_seq *_loop0_102_rule(Parser *p); |
827 | static asdl_seq *_loop1_103_rule(Parser *p); |
828 | static asdl_seq *_loop1_104_rule(Parser *p); |
829 | static asdl_seq *_loop1_105_rule(Parser *p); |
830 | static asdl_seq *_loop1_106_rule(Parser *p); |
831 | static void *_tmp_107_rule(Parser *p); |
832 | static asdl_seq *_loop0_109_rule(Parser *p); |
833 | static asdl_seq *_gather_108_rule(Parser *p); |
834 | static void *_tmp_110_rule(Parser *p); |
835 | static void *_tmp_111_rule(Parser *p); |
836 | static void *_tmp_112_rule(Parser *p); |
837 | static void *_tmp_113_rule(Parser *p); |
838 | static asdl_seq *_loop1_114_rule(Parser *p); |
839 | static void *_tmp_115_rule(Parser *p); |
840 | static void *_tmp_116_rule(Parser *p); |
841 | static void *_tmp_117_rule(Parser *p); |
842 | static asdl_seq *_loop0_119_rule(Parser *p); |
843 | static asdl_seq *_gather_118_rule(Parser *p); |
844 | static asdl_seq *_loop1_120_rule(Parser *p); |
845 | static asdl_seq *_loop0_121_rule(Parser *p); |
846 | static asdl_seq *_loop0_122_rule(Parser *p); |
847 | static asdl_seq *_loop0_124_rule(Parser *p); |
848 | static asdl_seq *_gather_123_rule(Parser *p); |
849 | static void *_tmp_125_rule(Parser *p); |
850 | static asdl_seq *_loop0_127_rule(Parser *p); |
851 | static asdl_seq *_gather_126_rule(Parser *p); |
852 | static asdl_seq *_loop0_129_rule(Parser *p); |
853 | static asdl_seq *_gather_128_rule(Parser *p); |
854 | static asdl_seq *_loop0_131_rule(Parser *p); |
855 | static asdl_seq *_gather_130_rule(Parser *p); |
856 | static asdl_seq *_loop0_133_rule(Parser *p); |
857 | static asdl_seq *_gather_132_rule(Parser *p); |
858 | static asdl_seq *_loop0_134_rule(Parser *p); |
859 | static asdl_seq *_loop0_136_rule(Parser *p); |
860 | static asdl_seq *_gather_135_rule(Parser *p); |
861 | static asdl_seq *_loop1_137_rule(Parser *p); |
862 | static void *_tmp_138_rule(Parser *p); |
863 | static asdl_seq *_loop0_140_rule(Parser *p); |
864 | static asdl_seq *_gather_139_rule(Parser *p); |
865 | static void *_tmp_141_rule(Parser *p); |
866 | static void *_tmp_142_rule(Parser *p); |
867 | static void *_tmp_143_rule(Parser *p); |
868 | static void *_tmp_144_rule(Parser *p); |
869 | static void *_tmp_145_rule(Parser *p); |
870 | static void *_tmp_146_rule(Parser *p); |
871 | static void *_tmp_147_rule(Parser *p); |
872 | static void *_tmp_148_rule(Parser *p); |
873 | static asdl_seq *_loop0_149_rule(Parser *p); |
874 | static asdl_seq *_loop0_150_rule(Parser *p); |
875 | static asdl_seq *_loop0_151_rule(Parser *p); |
876 | static void *_tmp_152_rule(Parser *p); |
877 | static void *_tmp_153_rule(Parser *p); |
878 | static void *_tmp_154_rule(Parser *p); |
879 | static void *_tmp_155_rule(Parser *p); |
880 | static asdl_seq *_loop0_156_rule(Parser *p); |
881 | static asdl_seq *_loop1_157_rule(Parser *p); |
882 | static asdl_seq *_loop0_158_rule(Parser *p); |
883 | static asdl_seq *_loop1_159_rule(Parser *p); |
884 | static void *_tmp_160_rule(Parser *p); |
885 | static void *_tmp_161_rule(Parser *p); |
886 | static void *_tmp_162_rule(Parser *p); |
887 | static asdl_seq *_loop0_164_rule(Parser *p); |
888 | static asdl_seq *_gather_163_rule(Parser *p); |
889 | static asdl_seq *_loop0_166_rule(Parser *p); |
890 | static asdl_seq *_gather_165_rule(Parser *p); |
891 | static asdl_seq *_loop0_168_rule(Parser *p); |
892 | static asdl_seq *_gather_167_rule(Parser *p); |
893 | static asdl_seq *_loop0_170_rule(Parser *p); |
894 | static asdl_seq *_gather_169_rule(Parser *p); |
895 | static void *_tmp_171_rule(Parser *p); |
896 | static void *_tmp_172_rule(Parser *p); |
897 | static void *_tmp_173_rule(Parser *p); |
898 | static void *_tmp_174_rule(Parser *p); |
899 | static void *_tmp_175_rule(Parser *p); |
900 | static void *_tmp_176_rule(Parser *p); |
901 | static void *_tmp_177_rule(Parser *p); |
902 | static asdl_seq *_loop0_179_rule(Parser *p); |
903 | static asdl_seq *_gather_178_rule(Parser *p); |
904 | static void *_tmp_180_rule(Parser *p); |
905 | static void *_tmp_181_rule(Parser *p); |
906 | static void *_tmp_182_rule(Parser *p); |
907 | static void *_tmp_183_rule(Parser *p); |
908 | static void *_tmp_184_rule(Parser *p); |
909 | static void *_tmp_185_rule(Parser *p); |
910 | static void *_tmp_186_rule(Parser *p); |
911 | static void *_tmp_187_rule(Parser *p); |
912 | static void *_tmp_188_rule(Parser *p); |
913 | static void *_tmp_189_rule(Parser *p); |
914 | static void *_tmp_190_rule(Parser *p); |
915 | static void *_tmp_191_rule(Parser *p); |
916 | static void *_tmp_192_rule(Parser *p); |
917 | static void *_tmp_193_rule(Parser *p); |
918 | static void *_tmp_194_rule(Parser *p); |
919 | static void *_tmp_195_rule(Parser *p); |
920 | static void *_tmp_196_rule(Parser *p); |
921 | static void *_tmp_197_rule(Parser *p); |
922 | static void *_tmp_198_rule(Parser *p); |
923 | static void *_tmp_199_rule(Parser *p); |
924 | static void *_tmp_200_rule(Parser *p); |
925 | static void *_tmp_201_rule(Parser *p); |
926 | static void *_tmp_202_rule(Parser *p); |
927 | static void *_tmp_203_rule(Parser *p); |
928 | static void *_tmp_204_rule(Parser *p); |
929 | static void *_tmp_205_rule(Parser *p); |
930 | static void *_tmp_206_rule(Parser *p); |
931 | |
932 | |
933 | // file: statements? $ |
934 | static mod_ty |
935 | file_rule(Parser *p) |
936 | { |
937 | if (p->level++ == MAXSTACK) { |
938 | p->error_indicator = 1; |
939 | PyErr_NoMemory(); |
940 | } |
941 | if (p->error_indicator) { |
942 | p->level--; |
943 | return NULL; |
944 | } |
945 | mod_ty _res = NULL; |
946 | int _mark = p->mark; |
947 | { // statements? $ |
948 | if (p->error_indicator) { |
949 | p->level--; |
950 | return NULL; |
951 | } |
952 | D(fprintf(stderr, "%*c> file[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "statements? $" )); |
953 | void *a; |
954 | Token * endmarker_var; |
955 | if ( |
956 | (a = statements_rule(p), !p->error_indicator) // statements? |
957 | && |
958 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
959 | ) |
960 | { |
961 | D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "statements? $" )); |
962 | _res = _PyPegen_make_module ( p , a ); |
963 | if (_res == NULL && PyErr_Occurred()) { |
964 | p->error_indicator = 1; |
965 | p->level--; |
966 | return NULL; |
967 | } |
968 | goto done; |
969 | } |
970 | p->mark = _mark; |
971 | D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n" , p->level, ' ', |
972 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "statements? $" )); |
973 | } |
974 | _res = NULL; |
975 | done: |
976 | p->level--; |
977 | return _res; |
978 | } |
979 | |
980 | // interactive: statement_newline |
981 | static mod_ty |
982 | interactive_rule(Parser *p) |
983 | { |
984 | if (p->level++ == MAXSTACK) { |
985 | p->error_indicator = 1; |
986 | PyErr_NoMemory(); |
987 | } |
988 | if (p->error_indicator) { |
989 | p->level--; |
990 | return NULL; |
991 | } |
992 | mod_ty _res = NULL; |
993 | int _mark = p->mark; |
994 | { // statement_newline |
995 | if (p->error_indicator) { |
996 | p->level--; |
997 | return NULL; |
998 | } |
999 | D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "statement_newline" )); |
1000 | asdl_stmt_seq* a; |
1001 | if ( |
1002 | (a = statement_newline_rule(p)) // statement_newline |
1003 | ) |
1004 | { |
1005 | D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "statement_newline" )); |
1006 | _res = _PyAST_Interactive ( a , p -> arena ); |
1007 | if (_res == NULL && PyErr_Occurred()) { |
1008 | p->error_indicator = 1; |
1009 | p->level--; |
1010 | return NULL; |
1011 | } |
1012 | goto done; |
1013 | } |
1014 | p->mark = _mark; |
1015 | D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n" , p->level, ' ', |
1016 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "statement_newline" )); |
1017 | } |
1018 | _res = NULL; |
1019 | done: |
1020 | p->level--; |
1021 | return _res; |
1022 | } |
1023 | |
1024 | // eval: expressions NEWLINE* $ |
1025 | static mod_ty |
1026 | eval_rule(Parser *p) |
1027 | { |
1028 | if (p->level++ == MAXSTACK) { |
1029 | p->error_indicator = 1; |
1030 | PyErr_NoMemory(); |
1031 | } |
1032 | if (p->error_indicator) { |
1033 | p->level--; |
1034 | return NULL; |
1035 | } |
1036 | mod_ty _res = NULL; |
1037 | int _mark = p->mark; |
1038 | { // expressions NEWLINE* $ |
1039 | if (p->error_indicator) { |
1040 | p->level--; |
1041 | return NULL; |
1042 | } |
1043 | D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expressions NEWLINE* $" )); |
1044 | asdl_seq * _loop0_1_var; |
1045 | expr_ty a; |
1046 | Token * endmarker_var; |
1047 | if ( |
1048 | (a = expressions_rule(p)) // expressions |
1049 | && |
1050 | (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE* |
1051 | && |
1052 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
1053 | ) |
1054 | { |
1055 | D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expressions NEWLINE* $" )); |
1056 | _res = _PyAST_Expression ( a , p -> arena ); |
1057 | if (_res == NULL && PyErr_Occurred()) { |
1058 | p->error_indicator = 1; |
1059 | p->level--; |
1060 | return NULL; |
1061 | } |
1062 | goto done; |
1063 | } |
1064 | p->mark = _mark; |
1065 | D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n" , p->level, ' ', |
1066 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expressions NEWLINE* $" )); |
1067 | } |
1068 | _res = NULL; |
1069 | done: |
1070 | p->level--; |
1071 | return _res; |
1072 | } |
1073 | |
1074 | // func_type: '(' type_expressions? ')' '->' expression NEWLINE* $ |
1075 | static mod_ty |
1076 | func_type_rule(Parser *p) |
1077 | { |
1078 | if (p->level++ == MAXSTACK) { |
1079 | p->error_indicator = 1; |
1080 | PyErr_NoMemory(); |
1081 | } |
1082 | if (p->error_indicator) { |
1083 | p->level--; |
1084 | return NULL; |
1085 | } |
1086 | mod_ty _res = NULL; |
1087 | int _mark = p->mark; |
1088 | { // '(' type_expressions? ')' '->' expression NEWLINE* $ |
1089 | if (p->error_indicator) { |
1090 | p->level--; |
1091 | return NULL; |
1092 | } |
1093 | D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $" )); |
1094 | Token * _literal; |
1095 | Token * _literal_1; |
1096 | Token * _literal_2; |
1097 | asdl_seq * _loop0_2_var; |
1098 | void *a; |
1099 | expr_ty b; |
1100 | Token * endmarker_var; |
1101 | if ( |
1102 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
1103 | && |
1104 | (a = type_expressions_rule(p), !p->error_indicator) // type_expressions? |
1105 | && |
1106 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
1107 | && |
1108 | (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->' |
1109 | && |
1110 | (b = expression_rule(p)) // expression |
1111 | && |
1112 | (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE* |
1113 | && |
1114 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
1115 | ) |
1116 | { |
1117 | D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $" )); |
1118 | _res = _PyAST_FunctionType ( a , b , p -> arena ); |
1119 | if (_res == NULL && PyErr_Occurred()) { |
1120 | p->error_indicator = 1; |
1121 | p->level--; |
1122 | return NULL; |
1123 | } |
1124 | goto done; |
1125 | } |
1126 | p->mark = _mark; |
1127 | D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n" , p->level, ' ', |
1128 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $" )); |
1129 | } |
1130 | _res = NULL; |
1131 | done: |
1132 | p->level--; |
1133 | return _res; |
1134 | } |
1135 | |
1136 | // fstring: star_expressions |
1137 | static expr_ty |
1138 | fstring_rule(Parser *p) |
1139 | { |
1140 | if (p->level++ == MAXSTACK) { |
1141 | p->error_indicator = 1; |
1142 | PyErr_NoMemory(); |
1143 | } |
1144 | if (p->error_indicator) { |
1145 | p->level--; |
1146 | return NULL; |
1147 | } |
1148 | expr_ty _res = NULL; |
1149 | int _mark = p->mark; |
1150 | { // star_expressions |
1151 | if (p->error_indicator) { |
1152 | p->level--; |
1153 | return NULL; |
1154 | } |
1155 | D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_expressions" )); |
1156 | expr_ty star_expressions_var; |
1157 | if ( |
1158 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
1159 | ) |
1160 | { |
1161 | D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_expressions" )); |
1162 | _res = star_expressions_var; |
1163 | goto done; |
1164 | } |
1165 | p->mark = _mark; |
1166 | D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n" , p->level, ' ', |
1167 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_expressions" )); |
1168 | } |
1169 | _res = NULL; |
1170 | done: |
1171 | p->level--; |
1172 | return _res; |
1173 | } |
1174 | |
1175 | // type_expressions: |
1176 | // | ','.expression+ ',' '*' expression ',' '**' expression |
1177 | // | ','.expression+ ',' '*' expression |
1178 | // | ','.expression+ ',' '**' expression |
1179 | // | '*' expression ',' '**' expression |
1180 | // | '*' expression |
1181 | // | '**' expression |
1182 | // | ','.expression+ |
1183 | static asdl_expr_seq* |
1184 | type_expressions_rule(Parser *p) |
1185 | { |
1186 | if (p->level++ == MAXSTACK) { |
1187 | p->error_indicator = 1; |
1188 | PyErr_NoMemory(); |
1189 | } |
1190 | if (p->error_indicator) { |
1191 | p->level--; |
1192 | return NULL; |
1193 | } |
1194 | asdl_expr_seq* _res = NULL; |
1195 | int _mark = p->mark; |
1196 | { // ','.expression+ ',' '*' expression ',' '**' expression |
1197 | if (p->error_indicator) { |
1198 | p->level--; |
1199 | return NULL; |
1200 | } |
1201 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression" )); |
1202 | Token * _literal; |
1203 | Token * _literal_1; |
1204 | Token * _literal_2; |
1205 | Token * _literal_3; |
1206 | asdl_seq * a; |
1207 | expr_ty b; |
1208 | expr_ty c; |
1209 | if ( |
1210 | (a = _gather_3_rule(p)) // ','.expression+ |
1211 | && |
1212 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
1213 | && |
1214 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
1215 | && |
1216 | (b = expression_rule(p)) // expression |
1217 | && |
1218 | (_literal_2 = _PyPegen_expect_token(p, 12)) // token=',' |
1219 | && |
1220 | (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**' |
1221 | && |
1222 | (c = expression_rule(p)) // expression |
1223 | ) |
1224 | { |
1225 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression" )); |
1226 | _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _PyPegen_seq_append_to_end ( p , a , b ) ) , c ); |
1227 | if (_res == NULL && PyErr_Occurred()) { |
1228 | p->error_indicator = 1; |
1229 | p->level--; |
1230 | return NULL; |
1231 | } |
1232 | goto done; |
1233 | } |
1234 | p->mark = _mark; |
1235 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
1236 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression" )); |
1237 | } |
1238 | { // ','.expression+ ',' '*' expression |
1239 | if (p->error_indicator) { |
1240 | p->level--; |
1241 | return NULL; |
1242 | } |
1243 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression" )); |
1244 | Token * _literal; |
1245 | Token * _literal_1; |
1246 | asdl_seq * a; |
1247 | expr_ty b; |
1248 | if ( |
1249 | (a = _gather_5_rule(p)) // ','.expression+ |
1250 | && |
1251 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
1252 | && |
1253 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
1254 | && |
1255 | (b = expression_rule(p)) // expression |
1256 | ) |
1257 | { |
1258 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression" )); |
1259 | _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b ); |
1260 | if (_res == NULL && PyErr_Occurred()) { |
1261 | p->error_indicator = 1; |
1262 | p->level--; |
1263 | return NULL; |
1264 | } |
1265 | goto done; |
1266 | } |
1267 | p->mark = _mark; |
1268 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
1269 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.expression+ ',' '*' expression" )); |
1270 | } |
1271 | { // ','.expression+ ',' '**' expression |
1272 | if (p->error_indicator) { |
1273 | p->level--; |
1274 | return NULL; |
1275 | } |
1276 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression" )); |
1277 | Token * _literal; |
1278 | Token * _literal_1; |
1279 | asdl_seq * a; |
1280 | expr_ty b; |
1281 | if ( |
1282 | (a = _gather_7_rule(p)) // ','.expression+ |
1283 | && |
1284 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
1285 | && |
1286 | (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**' |
1287 | && |
1288 | (b = expression_rule(p)) // expression |
1289 | ) |
1290 | { |
1291 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression" )); |
1292 | _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b ); |
1293 | if (_res == NULL && PyErr_Occurred()) { |
1294 | p->error_indicator = 1; |
1295 | p->level--; |
1296 | return NULL; |
1297 | } |
1298 | goto done; |
1299 | } |
1300 | p->mark = _mark; |
1301 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
1302 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.expression+ ',' '**' expression" )); |
1303 | } |
1304 | { // '*' expression ',' '**' expression |
1305 | if (p->error_indicator) { |
1306 | p->level--; |
1307 | return NULL; |
1308 | } |
1309 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression" )); |
1310 | Token * _literal; |
1311 | Token * _literal_1; |
1312 | Token * _literal_2; |
1313 | expr_ty a; |
1314 | expr_ty b; |
1315 | if ( |
1316 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
1317 | && |
1318 | (a = expression_rule(p)) // expression |
1319 | && |
1320 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
1321 | && |
1322 | (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**' |
1323 | && |
1324 | (b = expression_rule(p)) // expression |
1325 | ) |
1326 | { |
1327 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression" )); |
1328 | _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _PyPegen_singleton_seq ( p , a ) ) , b ); |
1329 | if (_res == NULL && PyErr_Occurred()) { |
1330 | p->error_indicator = 1; |
1331 | p->level--; |
1332 | return NULL; |
1333 | } |
1334 | goto done; |
1335 | } |
1336 | p->mark = _mark; |
1337 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
1338 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' expression ',' '**' expression" )); |
1339 | } |
1340 | { // '*' expression |
1341 | if (p->error_indicator) { |
1342 | p->level--; |
1343 | return NULL; |
1344 | } |
1345 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' expression" )); |
1346 | Token * _literal; |
1347 | expr_ty a; |
1348 | if ( |
1349 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
1350 | && |
1351 | (a = expression_rule(p)) // expression |
1352 | ) |
1353 | { |
1354 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' expression" )); |
1355 | _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a ); |
1356 | if (_res == NULL && PyErr_Occurred()) { |
1357 | p->error_indicator = 1; |
1358 | p->level--; |
1359 | return NULL; |
1360 | } |
1361 | goto done; |
1362 | } |
1363 | p->mark = _mark; |
1364 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
1365 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' expression" )); |
1366 | } |
1367 | { // '**' expression |
1368 | if (p->error_indicator) { |
1369 | p->level--; |
1370 | return NULL; |
1371 | } |
1372 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'**' expression" )); |
1373 | Token * _literal; |
1374 | expr_ty a; |
1375 | if ( |
1376 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
1377 | && |
1378 | (a = expression_rule(p)) // expression |
1379 | ) |
1380 | { |
1381 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'**' expression" )); |
1382 | _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a ); |
1383 | if (_res == NULL && PyErr_Occurred()) { |
1384 | p->error_indicator = 1; |
1385 | p->level--; |
1386 | return NULL; |
1387 | } |
1388 | goto done; |
1389 | } |
1390 | p->mark = _mark; |
1391 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
1392 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'**' expression" )); |
1393 | } |
1394 | { // ','.expression+ |
1395 | if (p->error_indicator) { |
1396 | p->level--; |
1397 | return NULL; |
1398 | } |
1399 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.expression+" )); |
1400 | asdl_expr_seq* a; |
1401 | if ( |
1402 | (a = (asdl_expr_seq*)_gather_9_rule(p)) // ','.expression+ |
1403 | ) |
1404 | { |
1405 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.expression+" )); |
1406 | _res = a; |
1407 | if (_res == NULL && PyErr_Occurred()) { |
1408 | p->error_indicator = 1; |
1409 | p->level--; |
1410 | return NULL; |
1411 | } |
1412 | goto done; |
1413 | } |
1414 | p->mark = _mark; |
1415 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
1416 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.expression+" )); |
1417 | } |
1418 | _res = NULL; |
1419 | done: |
1420 | p->level--; |
1421 | return _res; |
1422 | } |
1423 | |
1424 | // statements: statement+ |
1425 | static asdl_stmt_seq* |
1426 | statements_rule(Parser *p) |
1427 | { |
1428 | if (p->level++ == MAXSTACK) { |
1429 | p->error_indicator = 1; |
1430 | PyErr_NoMemory(); |
1431 | } |
1432 | if (p->error_indicator) { |
1433 | p->level--; |
1434 | return NULL; |
1435 | } |
1436 | asdl_stmt_seq* _res = NULL; |
1437 | int _mark = p->mark; |
1438 | { // statement+ |
1439 | if (p->error_indicator) { |
1440 | p->level--; |
1441 | return NULL; |
1442 | } |
1443 | D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "statement+" )); |
1444 | asdl_seq * a; |
1445 | if ( |
1446 | (a = _loop1_11_rule(p)) // statement+ |
1447 | ) |
1448 | { |
1449 | D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "statement+" )); |
1450 | _res = ( asdl_stmt_seq * ) _PyPegen_seq_flatten ( p , a ); |
1451 | if (_res == NULL && PyErr_Occurred()) { |
1452 | p->error_indicator = 1; |
1453 | p->level--; |
1454 | return NULL; |
1455 | } |
1456 | goto done; |
1457 | } |
1458 | p->mark = _mark; |
1459 | D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n" , p->level, ' ', |
1460 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "statement+" )); |
1461 | } |
1462 | _res = NULL; |
1463 | done: |
1464 | p->level--; |
1465 | return _res; |
1466 | } |
1467 | |
1468 | // statement: compound_stmt | simple_stmts |
1469 | static asdl_stmt_seq* |
1470 | statement_rule(Parser *p) |
1471 | { |
1472 | if (p->level++ == MAXSTACK) { |
1473 | p->error_indicator = 1; |
1474 | PyErr_NoMemory(); |
1475 | } |
1476 | if (p->error_indicator) { |
1477 | p->level--; |
1478 | return NULL; |
1479 | } |
1480 | asdl_stmt_seq* _res = NULL; |
1481 | int _mark = p->mark; |
1482 | { // compound_stmt |
1483 | if (p->error_indicator) { |
1484 | p->level--; |
1485 | return NULL; |
1486 | } |
1487 | D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "compound_stmt" )); |
1488 | stmt_ty a; |
1489 | if ( |
1490 | (a = compound_stmt_rule(p)) // compound_stmt |
1491 | ) |
1492 | { |
1493 | D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "compound_stmt" )); |
1494 | _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a ); |
1495 | if (_res == NULL && PyErr_Occurred()) { |
1496 | p->error_indicator = 1; |
1497 | p->level--; |
1498 | return NULL; |
1499 | } |
1500 | goto done; |
1501 | } |
1502 | p->mark = _mark; |
1503 | D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n" , p->level, ' ', |
1504 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "compound_stmt" )); |
1505 | } |
1506 | { // simple_stmts |
1507 | if (p->error_indicator) { |
1508 | p->level--; |
1509 | return NULL; |
1510 | } |
1511 | D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "simple_stmts" )); |
1512 | asdl_stmt_seq* a; |
1513 | if ( |
1514 | (a = (asdl_stmt_seq*)simple_stmts_rule(p)) // simple_stmts |
1515 | ) |
1516 | { |
1517 | D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "simple_stmts" )); |
1518 | _res = a; |
1519 | if (_res == NULL && PyErr_Occurred()) { |
1520 | p->error_indicator = 1; |
1521 | p->level--; |
1522 | return NULL; |
1523 | } |
1524 | goto done; |
1525 | } |
1526 | p->mark = _mark; |
1527 | D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n" , p->level, ' ', |
1528 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "simple_stmts" )); |
1529 | } |
1530 | _res = NULL; |
1531 | done: |
1532 | p->level--; |
1533 | return _res; |
1534 | } |
1535 | |
1536 | // statement_newline: compound_stmt NEWLINE | simple_stmts | NEWLINE | $ |
1537 | static asdl_stmt_seq* |
1538 | statement_newline_rule(Parser *p) |
1539 | { |
1540 | if (p->level++ == MAXSTACK) { |
1541 | p->error_indicator = 1; |
1542 | PyErr_NoMemory(); |
1543 | } |
1544 | if (p->error_indicator) { |
1545 | p->level--; |
1546 | return NULL; |
1547 | } |
1548 | asdl_stmt_seq* _res = NULL; |
1549 | int _mark = p->mark; |
1550 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
1551 | p->error_indicator = 1; |
1552 | p->level--; |
1553 | return NULL; |
1554 | } |
1555 | int _start_lineno = p->tokens[_mark]->lineno; |
1556 | UNUSED(_start_lineno); // Only used by EXTRA macro |
1557 | int _start_col_offset = p->tokens[_mark]->col_offset; |
1558 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
1559 | { // compound_stmt NEWLINE |
1560 | if (p->error_indicator) { |
1561 | p->level--; |
1562 | return NULL; |
1563 | } |
1564 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE" )); |
1565 | stmt_ty a; |
1566 | Token * newline_var; |
1567 | if ( |
1568 | (a = compound_stmt_rule(p)) // compound_stmt |
1569 | && |
1570 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
1571 | ) |
1572 | { |
1573 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE" )); |
1574 | _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a ); |
1575 | if (_res == NULL && PyErr_Occurred()) { |
1576 | p->error_indicator = 1; |
1577 | p->level--; |
1578 | return NULL; |
1579 | } |
1580 | goto done; |
1581 | } |
1582 | p->mark = _mark; |
1583 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n" , p->level, ' ', |
1584 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "compound_stmt NEWLINE" )); |
1585 | } |
1586 | { // simple_stmts |
1587 | if (p->error_indicator) { |
1588 | p->level--; |
1589 | return NULL; |
1590 | } |
1591 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "simple_stmts" )); |
1592 | asdl_stmt_seq* simple_stmts_var; |
1593 | if ( |
1594 | (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts |
1595 | ) |
1596 | { |
1597 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "simple_stmts" )); |
1598 | _res = simple_stmts_var; |
1599 | goto done; |
1600 | } |
1601 | p->mark = _mark; |
1602 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n" , p->level, ' ', |
1603 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "simple_stmts" )); |
1604 | } |
1605 | { // NEWLINE |
1606 | if (p->error_indicator) { |
1607 | p->level--; |
1608 | return NULL; |
1609 | } |
1610 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NEWLINE" )); |
1611 | Token * newline_var; |
1612 | if ( |
1613 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
1614 | ) |
1615 | { |
1616 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NEWLINE" )); |
1617 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
1618 | if (_token == NULL) { |
1619 | p->level--; |
1620 | return NULL; |
1621 | } |
1622 | int _end_lineno = _token->end_lineno; |
1623 | UNUSED(_end_lineno); // Only used by EXTRA macro |
1624 | int _end_col_offset = _token->end_col_offset; |
1625 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
1626 | _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , CHECK ( stmt_ty , _PyAST_Pass ( EXTRA ) ) ); |
1627 | if (_res == NULL && PyErr_Occurred()) { |
1628 | p->error_indicator = 1; |
1629 | p->level--; |
1630 | return NULL; |
1631 | } |
1632 | goto done; |
1633 | } |
1634 | p->mark = _mark; |
1635 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n" , p->level, ' ', |
1636 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NEWLINE" )); |
1637 | } |
1638 | { // $ |
1639 | if (p->error_indicator) { |
1640 | p->level--; |
1641 | return NULL; |
1642 | } |
1643 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "$" )); |
1644 | Token * endmarker_var; |
1645 | if ( |
1646 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
1647 | ) |
1648 | { |
1649 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "$" )); |
1650 | _res = _PyPegen_interactive_exit ( p ); |
1651 | if (_res == NULL && PyErr_Occurred()) { |
1652 | p->error_indicator = 1; |
1653 | p->level--; |
1654 | return NULL; |
1655 | } |
1656 | goto done; |
1657 | } |
1658 | p->mark = _mark; |
1659 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n" , p->level, ' ', |
1660 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "$" )); |
1661 | } |
1662 | _res = NULL; |
1663 | done: |
1664 | p->level--; |
1665 | return _res; |
1666 | } |
1667 | |
1668 | // simple_stmts: simple_stmt !';' NEWLINE | ';'.simple_stmt+ ';'? NEWLINE |
1669 | static asdl_stmt_seq* |
1670 | simple_stmts_rule(Parser *p) |
1671 | { |
1672 | if (p->level++ == MAXSTACK) { |
1673 | p->error_indicator = 1; |
1674 | PyErr_NoMemory(); |
1675 | } |
1676 | if (p->error_indicator) { |
1677 | p->level--; |
1678 | return NULL; |
1679 | } |
1680 | asdl_stmt_seq* _res = NULL; |
1681 | int _mark = p->mark; |
1682 | { // simple_stmt !';' NEWLINE |
1683 | if (p->error_indicator) { |
1684 | p->level--; |
1685 | return NULL; |
1686 | } |
1687 | D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE" )); |
1688 | stmt_ty a; |
1689 | Token * newline_var; |
1690 | if ( |
1691 | (a = simple_stmt_rule(p)) // simple_stmt |
1692 | && |
1693 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';' |
1694 | && |
1695 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
1696 | ) |
1697 | { |
1698 | D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE" )); |
1699 | _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a ); |
1700 | if (_res == NULL && PyErr_Occurred()) { |
1701 | p->error_indicator = 1; |
1702 | p->level--; |
1703 | return NULL; |
1704 | } |
1705 | goto done; |
1706 | } |
1707 | p->mark = _mark; |
1708 | D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n" , p->level, ' ', |
1709 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "simple_stmt !';' NEWLINE" )); |
1710 | } |
1711 | { // ';'.simple_stmt+ ';'? NEWLINE |
1712 | if (p->error_indicator) { |
1713 | p->level--; |
1714 | return NULL; |
1715 | } |
1716 | D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE" )); |
1717 | void *_opt_var; |
1718 | UNUSED(_opt_var); // Silence compiler warnings |
1719 | asdl_stmt_seq* a; |
1720 | Token * newline_var; |
1721 | if ( |
1722 | (a = (asdl_stmt_seq*)_gather_12_rule(p)) // ';'.simple_stmt+ |
1723 | && |
1724 | (_opt_var = _PyPegen_expect_token(p, 13), !p->error_indicator) // ';'? |
1725 | && |
1726 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
1727 | ) |
1728 | { |
1729 | D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE" )); |
1730 | _res = a; |
1731 | if (_res == NULL && PyErr_Occurred()) { |
1732 | p->error_indicator = 1; |
1733 | p->level--; |
1734 | return NULL; |
1735 | } |
1736 | goto done; |
1737 | } |
1738 | p->mark = _mark; |
1739 | D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n" , p->level, ' ', |
1740 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE" )); |
1741 | } |
1742 | _res = NULL; |
1743 | done: |
1744 | p->level--; |
1745 | return _res; |
1746 | } |
1747 | |
1748 | // simple_stmt: |
1749 | // | assignment |
1750 | // | star_expressions |
1751 | // | &'return' return_stmt |
1752 | // | &('import' | 'from') import_stmt |
1753 | // | &'raise' raise_stmt |
1754 | // | 'pass' |
1755 | // | &'del' del_stmt |
1756 | // | &'yield' yield_stmt |
1757 | // | &'assert' assert_stmt |
1758 | // | 'break' |
1759 | // | 'continue' |
1760 | // | &'global' global_stmt |
1761 | // | &'nonlocal' nonlocal_stmt |
1762 | static stmt_ty |
1763 | simple_stmt_rule(Parser *p) |
1764 | { |
1765 | if (p->level++ == MAXSTACK) { |
1766 | p->error_indicator = 1; |
1767 | PyErr_NoMemory(); |
1768 | } |
1769 | if (p->error_indicator) { |
1770 | p->level--; |
1771 | return NULL; |
1772 | } |
1773 | stmt_ty _res = NULL; |
1774 | if (_PyPegen_is_memoized(p, simple_stmt_type, &_res)) { |
1775 | p->level--; |
1776 | return _res; |
1777 | } |
1778 | int _mark = p->mark; |
1779 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
1780 | p->error_indicator = 1; |
1781 | p->level--; |
1782 | return NULL; |
1783 | } |
1784 | int _start_lineno = p->tokens[_mark]->lineno; |
1785 | UNUSED(_start_lineno); // Only used by EXTRA macro |
1786 | int _start_col_offset = p->tokens[_mark]->col_offset; |
1787 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
1788 | { // assignment |
1789 | if (p->error_indicator) { |
1790 | p->level--; |
1791 | return NULL; |
1792 | } |
1793 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "assignment" )); |
1794 | stmt_ty assignment_var; |
1795 | if ( |
1796 | (assignment_var = assignment_rule(p)) // assignment |
1797 | ) |
1798 | { |
1799 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "assignment" )); |
1800 | _res = assignment_var; |
1801 | goto done; |
1802 | } |
1803 | p->mark = _mark; |
1804 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
1805 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "assignment" )); |
1806 | } |
1807 | { // star_expressions |
1808 | if (p->error_indicator) { |
1809 | p->level--; |
1810 | return NULL; |
1811 | } |
1812 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_expressions" )); |
1813 | expr_ty e; |
1814 | if ( |
1815 | (e = star_expressions_rule(p)) // star_expressions |
1816 | ) |
1817 | { |
1818 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_expressions" )); |
1819 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
1820 | if (_token == NULL) { |
1821 | p->level--; |
1822 | return NULL; |
1823 | } |
1824 | int _end_lineno = _token->end_lineno; |
1825 | UNUSED(_end_lineno); // Only used by EXTRA macro |
1826 | int _end_col_offset = _token->end_col_offset; |
1827 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
1828 | _res = _PyAST_Expr ( e , EXTRA ); |
1829 | if (_res == NULL && PyErr_Occurred()) { |
1830 | p->error_indicator = 1; |
1831 | p->level--; |
1832 | return NULL; |
1833 | } |
1834 | goto done; |
1835 | } |
1836 | p->mark = _mark; |
1837 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
1838 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_expressions" )); |
1839 | } |
1840 | { // &'return' return_stmt |
1841 | if (p->error_indicator) { |
1842 | p->level--; |
1843 | return NULL; |
1844 | } |
1845 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'return' return_stmt" )); |
1846 | stmt_ty return_stmt_var; |
1847 | if ( |
1848 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return' |
1849 | && |
1850 | (return_stmt_var = return_stmt_rule(p)) // return_stmt |
1851 | ) |
1852 | { |
1853 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'return' return_stmt" )); |
1854 | _res = return_stmt_var; |
1855 | goto done; |
1856 | } |
1857 | p->mark = _mark; |
1858 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
1859 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'return' return_stmt" )); |
1860 | } |
1861 | { // &('import' | 'from') import_stmt |
1862 | if (p->error_indicator) { |
1863 | p->level--; |
1864 | return NULL; |
1865 | } |
1866 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt" )); |
1867 | stmt_ty import_stmt_var; |
1868 | if ( |
1869 | _PyPegen_lookahead(1, _tmp_14_rule, p) |
1870 | && |
1871 | (import_stmt_var = import_stmt_rule(p)) // import_stmt |
1872 | ) |
1873 | { |
1874 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt" )); |
1875 | _res = import_stmt_var; |
1876 | goto done; |
1877 | } |
1878 | p->mark = _mark; |
1879 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
1880 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&('import' | 'from') import_stmt" )); |
1881 | } |
1882 | { // &'raise' raise_stmt |
1883 | if (p->error_indicator) { |
1884 | p->level--; |
1885 | return NULL; |
1886 | } |
1887 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'raise' raise_stmt" )); |
1888 | stmt_ty raise_stmt_var; |
1889 | if ( |
1890 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise' |
1891 | && |
1892 | (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt |
1893 | ) |
1894 | { |
1895 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'raise' raise_stmt" )); |
1896 | _res = raise_stmt_var; |
1897 | goto done; |
1898 | } |
1899 | p->mark = _mark; |
1900 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
1901 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'raise' raise_stmt" )); |
1902 | } |
1903 | { // 'pass' |
1904 | if (p->error_indicator) { |
1905 | p->level--; |
1906 | return NULL; |
1907 | } |
1908 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'pass'" )); |
1909 | Token * _keyword; |
1910 | if ( |
1911 | (_keyword = _PyPegen_expect_token(p, 502)) // token='pass' |
1912 | ) |
1913 | { |
1914 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'pass'" )); |
1915 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
1916 | if (_token == NULL) { |
1917 | p->level--; |
1918 | return NULL; |
1919 | } |
1920 | int _end_lineno = _token->end_lineno; |
1921 | UNUSED(_end_lineno); // Only used by EXTRA macro |
1922 | int _end_col_offset = _token->end_col_offset; |
1923 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
1924 | _res = _PyAST_Pass ( EXTRA ); |
1925 | if (_res == NULL && PyErr_Occurred()) { |
1926 | p->error_indicator = 1; |
1927 | p->level--; |
1928 | return NULL; |
1929 | } |
1930 | goto done; |
1931 | } |
1932 | p->mark = _mark; |
1933 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
1934 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'pass'" )); |
1935 | } |
1936 | { // &'del' del_stmt |
1937 | if (p->error_indicator) { |
1938 | p->level--; |
1939 | return NULL; |
1940 | } |
1941 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'del' del_stmt" )); |
1942 | stmt_ty del_stmt_var; |
1943 | if ( |
1944 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del' |
1945 | && |
1946 | (del_stmt_var = del_stmt_rule(p)) // del_stmt |
1947 | ) |
1948 | { |
1949 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'del' del_stmt" )); |
1950 | _res = del_stmt_var; |
1951 | goto done; |
1952 | } |
1953 | p->mark = _mark; |
1954 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
1955 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'del' del_stmt" )); |
1956 | } |
1957 | { // &'yield' yield_stmt |
1958 | if (p->error_indicator) { |
1959 | p->level--; |
1960 | return NULL; |
1961 | } |
1962 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'yield' yield_stmt" )); |
1963 | stmt_ty yield_stmt_var; |
1964 | if ( |
1965 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield' |
1966 | && |
1967 | (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt |
1968 | ) |
1969 | { |
1970 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'yield' yield_stmt" )); |
1971 | _res = yield_stmt_var; |
1972 | goto done; |
1973 | } |
1974 | p->mark = _mark; |
1975 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
1976 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'yield' yield_stmt" )); |
1977 | } |
1978 | { // &'assert' assert_stmt |
1979 | if (p->error_indicator) { |
1980 | p->level--; |
1981 | return NULL; |
1982 | } |
1983 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'assert' assert_stmt" )); |
1984 | stmt_ty assert_stmt_var; |
1985 | if ( |
1986 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert' |
1987 | && |
1988 | (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt |
1989 | ) |
1990 | { |
1991 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'assert' assert_stmt" )); |
1992 | _res = assert_stmt_var; |
1993 | goto done; |
1994 | } |
1995 | p->mark = _mark; |
1996 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
1997 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'assert' assert_stmt" )); |
1998 | } |
1999 | { // 'break' |
2000 | if (p->error_indicator) { |
2001 | p->level--; |
2002 | return NULL; |
2003 | } |
2004 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'break'" )); |
2005 | Token * _keyword; |
2006 | if ( |
2007 | (_keyword = _PyPegen_expect_token(p, 506)) // token='break' |
2008 | ) |
2009 | { |
2010 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'break'" )); |
2011 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2012 | if (_token == NULL) { |
2013 | p->level--; |
2014 | return NULL; |
2015 | } |
2016 | int _end_lineno = _token->end_lineno; |
2017 | UNUSED(_end_lineno); // Only used by EXTRA macro |
2018 | int _end_col_offset = _token->end_col_offset; |
2019 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2020 | _res = _PyAST_Break ( EXTRA ); |
2021 | if (_res == NULL && PyErr_Occurred()) { |
2022 | p->error_indicator = 1; |
2023 | p->level--; |
2024 | return NULL; |
2025 | } |
2026 | goto done; |
2027 | } |
2028 | p->mark = _mark; |
2029 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2030 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'break'" )); |
2031 | } |
2032 | { // 'continue' |
2033 | if (p->error_indicator) { |
2034 | p->level--; |
2035 | return NULL; |
2036 | } |
2037 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'continue'" )); |
2038 | Token * _keyword; |
2039 | if ( |
2040 | (_keyword = _PyPegen_expect_token(p, 507)) // token='continue' |
2041 | ) |
2042 | { |
2043 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'continue'" )); |
2044 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2045 | if (_token == NULL) { |
2046 | p->level--; |
2047 | return NULL; |
2048 | } |
2049 | int _end_lineno = _token->end_lineno; |
2050 | UNUSED(_end_lineno); // Only used by EXTRA macro |
2051 | int _end_col_offset = _token->end_col_offset; |
2052 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2053 | _res = _PyAST_Continue ( EXTRA ); |
2054 | if (_res == NULL && PyErr_Occurred()) { |
2055 | p->error_indicator = 1; |
2056 | p->level--; |
2057 | return NULL; |
2058 | } |
2059 | goto done; |
2060 | } |
2061 | p->mark = _mark; |
2062 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2063 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'continue'" )); |
2064 | } |
2065 | { // &'global' global_stmt |
2066 | if (p->error_indicator) { |
2067 | p->level--; |
2068 | return NULL; |
2069 | } |
2070 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'global' global_stmt" )); |
2071 | stmt_ty global_stmt_var; |
2072 | if ( |
2073 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global' |
2074 | && |
2075 | (global_stmt_var = global_stmt_rule(p)) // global_stmt |
2076 | ) |
2077 | { |
2078 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'global' global_stmt" )); |
2079 | _res = global_stmt_var; |
2080 | goto done; |
2081 | } |
2082 | p->mark = _mark; |
2083 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2084 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'global' global_stmt" )); |
2085 | } |
2086 | { // &'nonlocal' nonlocal_stmt |
2087 | if (p->error_indicator) { |
2088 | p->level--; |
2089 | return NULL; |
2090 | } |
2091 | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt" )); |
2092 | stmt_ty nonlocal_stmt_var; |
2093 | if ( |
2094 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal' |
2095 | && |
2096 | (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt |
2097 | ) |
2098 | { |
2099 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt" )); |
2100 | _res = nonlocal_stmt_var; |
2101 | goto done; |
2102 | } |
2103 | p->mark = _mark; |
2104 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2105 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'nonlocal' nonlocal_stmt" )); |
2106 | } |
2107 | _res = NULL; |
2108 | done: |
2109 | _PyPegen_insert_memo(p, _mark, simple_stmt_type, _res); |
2110 | p->level--; |
2111 | return _res; |
2112 | } |
2113 | |
2114 | // compound_stmt: |
2115 | // | &('def' | '@' | ASYNC) function_def |
2116 | // | &'if' if_stmt |
2117 | // | &('class' | '@') class_def |
2118 | // | &('with' | ASYNC) with_stmt |
2119 | // | &('for' | ASYNC) for_stmt |
2120 | // | &'try' try_stmt |
2121 | // | &'while' while_stmt |
2122 | // | match_stmt |
2123 | static stmt_ty |
2124 | compound_stmt_rule(Parser *p) |
2125 | { |
2126 | if (p->level++ == MAXSTACK) { |
2127 | p->error_indicator = 1; |
2128 | PyErr_NoMemory(); |
2129 | } |
2130 | if (p->error_indicator) { |
2131 | p->level--; |
2132 | return NULL; |
2133 | } |
2134 | stmt_ty _res = NULL; |
2135 | int _mark = p->mark; |
2136 | { // &('def' | '@' | ASYNC) function_def |
2137 | if (p->error_indicator) { |
2138 | p->level--; |
2139 | return NULL; |
2140 | } |
2141 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def" )); |
2142 | stmt_ty function_def_var; |
2143 | if ( |
2144 | _PyPegen_lookahead(1, _tmp_15_rule, p) |
2145 | && |
2146 | (function_def_var = function_def_rule(p)) // function_def |
2147 | ) |
2148 | { |
2149 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def" )); |
2150 | _res = function_def_var; |
2151 | goto done; |
2152 | } |
2153 | p->mark = _mark; |
2154 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2155 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&('def' | '@' | ASYNC) function_def" )); |
2156 | } |
2157 | { // &'if' if_stmt |
2158 | if (p->error_indicator) { |
2159 | p->level--; |
2160 | return NULL; |
2161 | } |
2162 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'if' if_stmt" )); |
2163 | stmt_ty if_stmt_var; |
2164 | if ( |
2165 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if' |
2166 | && |
2167 | (if_stmt_var = if_stmt_rule(p)) // if_stmt |
2168 | ) |
2169 | { |
2170 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'if' if_stmt" )); |
2171 | _res = if_stmt_var; |
2172 | goto done; |
2173 | } |
2174 | p->mark = _mark; |
2175 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2176 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'if' if_stmt" )); |
2177 | } |
2178 | { // &('class' | '@') class_def |
2179 | if (p->error_indicator) { |
2180 | p->level--; |
2181 | return NULL; |
2182 | } |
2183 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&('class' | '@') class_def" )); |
2184 | stmt_ty class_def_var; |
2185 | if ( |
2186 | _PyPegen_lookahead(1, _tmp_16_rule, p) |
2187 | && |
2188 | (class_def_var = class_def_rule(p)) // class_def |
2189 | ) |
2190 | { |
2191 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&('class' | '@') class_def" )); |
2192 | _res = class_def_var; |
2193 | goto done; |
2194 | } |
2195 | p->mark = _mark; |
2196 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2197 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&('class' | '@') class_def" )); |
2198 | } |
2199 | { // &('with' | ASYNC) with_stmt |
2200 | if (p->error_indicator) { |
2201 | p->level--; |
2202 | return NULL; |
2203 | } |
2204 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt" )); |
2205 | stmt_ty with_stmt_var; |
2206 | if ( |
2207 | _PyPegen_lookahead(1, _tmp_17_rule, p) |
2208 | && |
2209 | (with_stmt_var = with_stmt_rule(p)) // with_stmt |
2210 | ) |
2211 | { |
2212 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt" )); |
2213 | _res = with_stmt_var; |
2214 | goto done; |
2215 | } |
2216 | p->mark = _mark; |
2217 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2218 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&('with' | ASYNC) with_stmt" )); |
2219 | } |
2220 | { // &('for' | ASYNC) for_stmt |
2221 | if (p->error_indicator) { |
2222 | p->level--; |
2223 | return NULL; |
2224 | } |
2225 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt" )); |
2226 | stmt_ty for_stmt_var; |
2227 | if ( |
2228 | _PyPegen_lookahead(1, _tmp_18_rule, p) |
2229 | && |
2230 | (for_stmt_var = for_stmt_rule(p)) // for_stmt |
2231 | ) |
2232 | { |
2233 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt" )); |
2234 | _res = for_stmt_var; |
2235 | goto done; |
2236 | } |
2237 | p->mark = _mark; |
2238 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2239 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&('for' | ASYNC) for_stmt" )); |
2240 | } |
2241 | { // &'try' try_stmt |
2242 | if (p->error_indicator) { |
2243 | p->level--; |
2244 | return NULL; |
2245 | } |
2246 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'try' try_stmt" )); |
2247 | stmt_ty try_stmt_var; |
2248 | if ( |
2249 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try' |
2250 | && |
2251 | (try_stmt_var = try_stmt_rule(p)) // try_stmt |
2252 | ) |
2253 | { |
2254 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'try' try_stmt" )); |
2255 | _res = try_stmt_var; |
2256 | goto done; |
2257 | } |
2258 | p->mark = _mark; |
2259 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2260 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'try' try_stmt" )); |
2261 | } |
2262 | { // &'while' while_stmt |
2263 | if (p->error_indicator) { |
2264 | p->level--; |
2265 | return NULL; |
2266 | } |
2267 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'while' while_stmt" )); |
2268 | stmt_ty while_stmt_var; |
2269 | if ( |
2270 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while' |
2271 | && |
2272 | (while_stmt_var = while_stmt_rule(p)) // while_stmt |
2273 | ) |
2274 | { |
2275 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'while' while_stmt" )); |
2276 | _res = while_stmt_var; |
2277 | goto done; |
2278 | } |
2279 | p->mark = _mark; |
2280 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2281 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'while' while_stmt" )); |
2282 | } |
2283 | { // match_stmt |
2284 | if (p->error_indicator) { |
2285 | p->level--; |
2286 | return NULL; |
2287 | } |
2288 | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "match_stmt" )); |
2289 | stmt_ty match_stmt_var; |
2290 | if ( |
2291 | (match_stmt_var = match_stmt_rule(p)) // match_stmt |
2292 | ) |
2293 | { |
2294 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "match_stmt" )); |
2295 | _res = match_stmt_var; |
2296 | goto done; |
2297 | } |
2298 | p->mark = _mark; |
2299 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2300 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "match_stmt" )); |
2301 | } |
2302 | _res = NULL; |
2303 | done: |
2304 | p->level--; |
2305 | return _res; |
2306 | } |
2307 | |
2308 | // assignment: |
2309 | // | NAME ':' expression ['=' annotated_rhs] |
2310 | // | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs] |
2311 | // | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT? |
2312 | // | single_target augassign ~ (yield_expr | star_expressions) |
2313 | // | invalid_assignment |
2314 | static stmt_ty |
2315 | assignment_rule(Parser *p) |
2316 | { |
2317 | if (p->level++ == MAXSTACK) { |
2318 | p->error_indicator = 1; |
2319 | PyErr_NoMemory(); |
2320 | } |
2321 | if (p->error_indicator) { |
2322 | p->level--; |
2323 | return NULL; |
2324 | } |
2325 | stmt_ty _res = NULL; |
2326 | int _mark = p->mark; |
2327 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
2328 | p->error_indicator = 1; |
2329 | p->level--; |
2330 | return NULL; |
2331 | } |
2332 | int _start_lineno = p->tokens[_mark]->lineno; |
2333 | UNUSED(_start_lineno); // Only used by EXTRA macro |
2334 | int _start_col_offset = p->tokens[_mark]->col_offset; |
2335 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
2336 | { // NAME ':' expression ['=' annotated_rhs] |
2337 | if (p->error_indicator) { |
2338 | p->level--; |
2339 | return NULL; |
2340 | } |
2341 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]" )); |
2342 | Token * _literal; |
2343 | expr_ty a; |
2344 | expr_ty b; |
2345 | void *c; |
2346 | if ( |
2347 | (a = _PyPegen_name_token(p)) // NAME |
2348 | && |
2349 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
2350 | && |
2351 | (b = expression_rule(p)) // expression |
2352 | && |
2353 | (c = _tmp_19_rule(p), !p->error_indicator) // ['=' annotated_rhs] |
2354 | ) |
2355 | { |
2356 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]" )); |
2357 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2358 | if (_token == NULL) { |
2359 | p->level--; |
2360 | return NULL; |
2361 | } |
2362 | int _end_lineno = _token->end_lineno; |
2363 | UNUSED(_end_lineno); // Only used by EXTRA macro |
2364 | int _end_col_offset = _token->end_col_offset; |
2365 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2366 | _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotation syntax is" , _PyAST_AnnAssign ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) ); |
2367 | if (_res == NULL && PyErr_Occurred()) { |
2368 | p->error_indicator = 1; |
2369 | p->level--; |
2370 | return NULL; |
2371 | } |
2372 | goto done; |
2373 | } |
2374 | p->mark = _mark; |
2375 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n" , p->level, ' ', |
2376 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]" )); |
2377 | } |
2378 | { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs] |
2379 | if (p->error_indicator) { |
2380 | p->level--; |
2381 | return NULL; |
2382 | } |
2383 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]" )); |
2384 | Token * _literal; |
2385 | void *a; |
2386 | expr_ty b; |
2387 | void *c; |
2388 | if ( |
2389 | (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target |
2390 | && |
2391 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
2392 | && |
2393 | (b = expression_rule(p)) // expression |
2394 | && |
2395 | (c = _tmp_21_rule(p), !p->error_indicator) // ['=' annotated_rhs] |
2396 | ) |
2397 | { |
2398 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]" )); |
2399 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2400 | if (_token == NULL) { |
2401 | p->level--; |
2402 | return NULL; |
2403 | } |
2404 | int _end_lineno = _token->end_lineno; |
2405 | UNUSED(_end_lineno); // Only used by EXTRA macro |
2406 | int _end_col_offset = _token->end_col_offset; |
2407 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2408 | _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotations syntax is" , _PyAST_AnnAssign ( a , b , c , 0 , EXTRA ) ); |
2409 | if (_res == NULL && PyErr_Occurred()) { |
2410 | p->error_indicator = 1; |
2411 | p->level--; |
2412 | return NULL; |
2413 | } |
2414 | goto done; |
2415 | } |
2416 | p->mark = _mark; |
2417 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n" , p->level, ' ', |
2418 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]" )); |
2419 | } |
2420 | { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT? |
2421 | if (p->error_indicator) { |
2422 | p->level--; |
2423 | return NULL; |
2424 | } |
2425 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?" )); |
2426 | asdl_expr_seq* a; |
2427 | void *b; |
2428 | void *tc; |
2429 | if ( |
2430 | (a = (asdl_expr_seq*)_loop1_22_rule(p)) // ((star_targets '='))+ |
2431 | && |
2432 | (b = _tmp_23_rule(p)) // yield_expr | star_expressions |
2433 | && |
2434 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' |
2435 | && |
2436 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
2437 | ) |
2438 | { |
2439 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?" )); |
2440 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2441 | if (_token == NULL) { |
2442 | p->level--; |
2443 | return NULL; |
2444 | } |
2445 | int _end_lineno = _token->end_lineno; |
2446 | UNUSED(_end_lineno); // Only used by EXTRA macro |
2447 | int _end_col_offset = _token->end_col_offset; |
2448 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2449 | _res = _PyAST_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
2450 | if (_res == NULL && PyErr_Occurred()) { |
2451 | p->error_indicator = 1; |
2452 | p->level--; |
2453 | return NULL; |
2454 | } |
2455 | goto done; |
2456 | } |
2457 | p->mark = _mark; |
2458 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n" , p->level, ' ', |
2459 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?" )); |
2460 | } |
2461 | { // single_target augassign ~ (yield_expr | star_expressions) |
2462 | if (p->error_indicator) { |
2463 | p->level--; |
2464 | return NULL; |
2465 | } |
2466 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)" )); |
2467 | int _cut_var = 0; |
2468 | expr_ty a; |
2469 | AugOperator* b; |
2470 | void *c; |
2471 | if ( |
2472 | (a = single_target_rule(p)) // single_target |
2473 | && |
2474 | (b = augassign_rule(p)) // augassign |
2475 | && |
2476 | (_cut_var = 1) |
2477 | && |
2478 | (c = _tmp_24_rule(p)) // yield_expr | star_expressions |
2479 | ) |
2480 | { |
2481 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)" )); |
2482 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2483 | if (_token == NULL) { |
2484 | p->level--; |
2485 | return NULL; |
2486 | } |
2487 | int _end_lineno = _token->end_lineno; |
2488 | UNUSED(_end_lineno); // Only used by EXTRA macro |
2489 | int _end_col_offset = _token->end_col_offset; |
2490 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2491 | _res = _PyAST_AugAssign ( a , b -> kind , c , EXTRA ); |
2492 | if (_res == NULL && PyErr_Occurred()) { |
2493 | p->error_indicator = 1; |
2494 | p->level--; |
2495 | return NULL; |
2496 | } |
2497 | goto done; |
2498 | } |
2499 | p->mark = _mark; |
2500 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n" , p->level, ' ', |
2501 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)" )); |
2502 | if (_cut_var) { |
2503 | p->level--; |
2504 | return NULL; |
2505 | } |
2506 | } |
2507 | if (p->call_invalid_rules) { // invalid_assignment |
2508 | if (p->error_indicator) { |
2509 | p->level--; |
2510 | return NULL; |
2511 | } |
2512 | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_assignment" )); |
2513 | void *invalid_assignment_var; |
2514 | if ( |
2515 | (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment |
2516 | ) |
2517 | { |
2518 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_assignment" )); |
2519 | _res = invalid_assignment_var; |
2520 | goto done; |
2521 | } |
2522 | p->mark = _mark; |
2523 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n" , p->level, ' ', |
2524 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_assignment" )); |
2525 | } |
2526 | _res = NULL; |
2527 | done: |
2528 | p->level--; |
2529 | return _res; |
2530 | } |
2531 | |
2532 | // augassign: |
2533 | // | '+=' |
2534 | // | '-=' |
2535 | // | '*=' |
2536 | // | '@=' |
2537 | // | '/=' |
2538 | // | '%=' |
2539 | // | '&=' |
2540 | // | '|=' |
2541 | // | '^=' |
2542 | // | '<<=' |
2543 | // | '>>=' |
2544 | // | '**=' |
2545 | // | '//=' |
2546 | static AugOperator* |
2547 | augassign_rule(Parser *p) |
2548 | { |
2549 | if (p->level++ == MAXSTACK) { |
2550 | p->error_indicator = 1; |
2551 | PyErr_NoMemory(); |
2552 | } |
2553 | if (p->error_indicator) { |
2554 | p->level--; |
2555 | return NULL; |
2556 | } |
2557 | AugOperator* _res = NULL; |
2558 | int _mark = p->mark; |
2559 | { // '+=' |
2560 | if (p->error_indicator) { |
2561 | p->level--; |
2562 | return NULL; |
2563 | } |
2564 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'+='" )); |
2565 | Token * _literal; |
2566 | if ( |
2567 | (_literal = _PyPegen_expect_token(p, 36)) // token='+=' |
2568 | ) |
2569 | { |
2570 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'+='" )); |
2571 | _res = _PyPegen_augoperator ( p , Add ); |
2572 | if (_res == NULL && PyErr_Occurred()) { |
2573 | p->error_indicator = 1; |
2574 | p->level--; |
2575 | return NULL; |
2576 | } |
2577 | goto done; |
2578 | } |
2579 | p->mark = _mark; |
2580 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2581 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'+='" )); |
2582 | } |
2583 | { // '-=' |
2584 | if (p->error_indicator) { |
2585 | p->level--; |
2586 | return NULL; |
2587 | } |
2588 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'-='" )); |
2589 | Token * _literal; |
2590 | if ( |
2591 | (_literal = _PyPegen_expect_token(p, 37)) // token='-=' |
2592 | ) |
2593 | { |
2594 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'-='" )); |
2595 | _res = _PyPegen_augoperator ( p , Sub ); |
2596 | if (_res == NULL && PyErr_Occurred()) { |
2597 | p->error_indicator = 1; |
2598 | p->level--; |
2599 | return NULL; |
2600 | } |
2601 | goto done; |
2602 | } |
2603 | p->mark = _mark; |
2604 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2605 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'-='" )); |
2606 | } |
2607 | { // '*=' |
2608 | if (p->error_indicator) { |
2609 | p->level--; |
2610 | return NULL; |
2611 | } |
2612 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*='" )); |
2613 | Token * _literal; |
2614 | if ( |
2615 | (_literal = _PyPegen_expect_token(p, 38)) // token='*=' |
2616 | ) |
2617 | { |
2618 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*='" )); |
2619 | _res = _PyPegen_augoperator ( p , Mult ); |
2620 | if (_res == NULL && PyErr_Occurred()) { |
2621 | p->error_indicator = 1; |
2622 | p->level--; |
2623 | return NULL; |
2624 | } |
2625 | goto done; |
2626 | } |
2627 | p->mark = _mark; |
2628 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2629 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*='" )); |
2630 | } |
2631 | { // '@=' |
2632 | if (p->error_indicator) { |
2633 | p->level--; |
2634 | return NULL; |
2635 | } |
2636 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'@='" )); |
2637 | Token * _literal; |
2638 | if ( |
2639 | (_literal = _PyPegen_expect_token(p, 50)) // token='@=' |
2640 | ) |
2641 | { |
2642 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'@='" )); |
2643 | _res = CHECK_VERSION ( AugOperator * , 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) ); |
2644 | if (_res == NULL && PyErr_Occurred()) { |
2645 | p->error_indicator = 1; |
2646 | p->level--; |
2647 | return NULL; |
2648 | } |
2649 | goto done; |
2650 | } |
2651 | p->mark = _mark; |
2652 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2653 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'@='" )); |
2654 | } |
2655 | { // '/=' |
2656 | if (p->error_indicator) { |
2657 | p->level--; |
2658 | return NULL; |
2659 | } |
2660 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'/='" )); |
2661 | Token * _literal; |
2662 | if ( |
2663 | (_literal = _PyPegen_expect_token(p, 39)) // token='/=' |
2664 | ) |
2665 | { |
2666 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'/='" )); |
2667 | _res = _PyPegen_augoperator ( p , Div ); |
2668 | if (_res == NULL && PyErr_Occurred()) { |
2669 | p->error_indicator = 1; |
2670 | p->level--; |
2671 | return NULL; |
2672 | } |
2673 | goto done; |
2674 | } |
2675 | p->mark = _mark; |
2676 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2677 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'/='" )); |
2678 | } |
2679 | { // '%=' |
2680 | if (p->error_indicator) { |
2681 | p->level--; |
2682 | return NULL; |
2683 | } |
2684 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'%='" )); |
2685 | Token * _literal; |
2686 | if ( |
2687 | (_literal = _PyPegen_expect_token(p, 40)) // token='%=' |
2688 | ) |
2689 | { |
2690 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'%='" )); |
2691 | _res = _PyPegen_augoperator ( p , Mod ); |
2692 | if (_res == NULL && PyErr_Occurred()) { |
2693 | p->error_indicator = 1; |
2694 | p->level--; |
2695 | return NULL; |
2696 | } |
2697 | goto done; |
2698 | } |
2699 | p->mark = _mark; |
2700 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2701 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'%='" )); |
2702 | } |
2703 | { // '&=' |
2704 | if (p->error_indicator) { |
2705 | p->level--; |
2706 | return NULL; |
2707 | } |
2708 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'&='" )); |
2709 | Token * _literal; |
2710 | if ( |
2711 | (_literal = _PyPegen_expect_token(p, 41)) // token='&=' |
2712 | ) |
2713 | { |
2714 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'&='" )); |
2715 | _res = _PyPegen_augoperator ( p , BitAnd ); |
2716 | if (_res == NULL && PyErr_Occurred()) { |
2717 | p->error_indicator = 1; |
2718 | p->level--; |
2719 | return NULL; |
2720 | } |
2721 | goto done; |
2722 | } |
2723 | p->mark = _mark; |
2724 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2725 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'&='" )); |
2726 | } |
2727 | { // '|=' |
2728 | if (p->error_indicator) { |
2729 | p->level--; |
2730 | return NULL; |
2731 | } |
2732 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'|='" )); |
2733 | Token * _literal; |
2734 | if ( |
2735 | (_literal = _PyPegen_expect_token(p, 42)) // token='|=' |
2736 | ) |
2737 | { |
2738 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'|='" )); |
2739 | _res = _PyPegen_augoperator ( p , BitOr ); |
2740 | if (_res == NULL && PyErr_Occurred()) { |
2741 | p->error_indicator = 1; |
2742 | p->level--; |
2743 | return NULL; |
2744 | } |
2745 | goto done; |
2746 | } |
2747 | p->mark = _mark; |
2748 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2749 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'|='" )); |
2750 | } |
2751 | { // '^=' |
2752 | if (p->error_indicator) { |
2753 | p->level--; |
2754 | return NULL; |
2755 | } |
2756 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'^='" )); |
2757 | Token * _literal; |
2758 | if ( |
2759 | (_literal = _PyPegen_expect_token(p, 43)) // token='^=' |
2760 | ) |
2761 | { |
2762 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'^='" )); |
2763 | _res = _PyPegen_augoperator ( p , BitXor ); |
2764 | if (_res == NULL && PyErr_Occurred()) { |
2765 | p->error_indicator = 1; |
2766 | p->level--; |
2767 | return NULL; |
2768 | } |
2769 | goto done; |
2770 | } |
2771 | p->mark = _mark; |
2772 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2773 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'^='" )); |
2774 | } |
2775 | { // '<<=' |
2776 | if (p->error_indicator) { |
2777 | p->level--; |
2778 | return NULL; |
2779 | } |
2780 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'<<='" )); |
2781 | Token * _literal; |
2782 | if ( |
2783 | (_literal = _PyPegen_expect_token(p, 44)) // token='<<=' |
2784 | ) |
2785 | { |
2786 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'<<='" )); |
2787 | _res = _PyPegen_augoperator ( p , LShift ); |
2788 | if (_res == NULL && PyErr_Occurred()) { |
2789 | p->error_indicator = 1; |
2790 | p->level--; |
2791 | return NULL; |
2792 | } |
2793 | goto done; |
2794 | } |
2795 | p->mark = _mark; |
2796 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2797 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'<<='" )); |
2798 | } |
2799 | { // '>>=' |
2800 | if (p->error_indicator) { |
2801 | p->level--; |
2802 | return NULL; |
2803 | } |
2804 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'>>='" )); |
2805 | Token * _literal; |
2806 | if ( |
2807 | (_literal = _PyPegen_expect_token(p, 45)) // token='>>=' |
2808 | ) |
2809 | { |
2810 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'>>='" )); |
2811 | _res = _PyPegen_augoperator ( p , RShift ); |
2812 | if (_res == NULL && PyErr_Occurred()) { |
2813 | p->error_indicator = 1; |
2814 | p->level--; |
2815 | return NULL; |
2816 | } |
2817 | goto done; |
2818 | } |
2819 | p->mark = _mark; |
2820 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2821 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'>>='" )); |
2822 | } |
2823 | { // '**=' |
2824 | if (p->error_indicator) { |
2825 | p->level--; |
2826 | return NULL; |
2827 | } |
2828 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'**='" )); |
2829 | Token * _literal; |
2830 | if ( |
2831 | (_literal = _PyPegen_expect_token(p, 46)) // token='**=' |
2832 | ) |
2833 | { |
2834 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'**='" )); |
2835 | _res = _PyPegen_augoperator ( p , Pow ); |
2836 | if (_res == NULL && PyErr_Occurred()) { |
2837 | p->error_indicator = 1; |
2838 | p->level--; |
2839 | return NULL; |
2840 | } |
2841 | goto done; |
2842 | } |
2843 | p->mark = _mark; |
2844 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2845 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'**='" )); |
2846 | } |
2847 | { // '//=' |
2848 | if (p->error_indicator) { |
2849 | p->level--; |
2850 | return NULL; |
2851 | } |
2852 | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'//='" )); |
2853 | Token * _literal; |
2854 | if ( |
2855 | (_literal = _PyPegen_expect_token(p, 48)) // token='//=' |
2856 | ) |
2857 | { |
2858 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'//='" )); |
2859 | _res = _PyPegen_augoperator ( p , FloorDiv ); |
2860 | if (_res == NULL && PyErr_Occurred()) { |
2861 | p->error_indicator = 1; |
2862 | p->level--; |
2863 | return NULL; |
2864 | } |
2865 | goto done; |
2866 | } |
2867 | p->mark = _mark; |
2868 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n" , p->level, ' ', |
2869 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'//='" )); |
2870 | } |
2871 | _res = NULL; |
2872 | done: |
2873 | p->level--; |
2874 | return _res; |
2875 | } |
2876 | |
2877 | // global_stmt: 'global' ','.NAME+ |
2878 | static stmt_ty |
2879 | global_stmt_rule(Parser *p) |
2880 | { |
2881 | if (p->level++ == MAXSTACK) { |
2882 | p->error_indicator = 1; |
2883 | PyErr_NoMemory(); |
2884 | } |
2885 | if (p->error_indicator) { |
2886 | p->level--; |
2887 | return NULL; |
2888 | } |
2889 | stmt_ty _res = NULL; |
2890 | int _mark = p->mark; |
2891 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
2892 | p->error_indicator = 1; |
2893 | p->level--; |
2894 | return NULL; |
2895 | } |
2896 | int _start_lineno = p->tokens[_mark]->lineno; |
2897 | UNUSED(_start_lineno); // Only used by EXTRA macro |
2898 | int _start_col_offset = p->tokens[_mark]->col_offset; |
2899 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
2900 | { // 'global' ','.NAME+ |
2901 | if (p->error_indicator) { |
2902 | p->level--; |
2903 | return NULL; |
2904 | } |
2905 | D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'global' ','.NAME+" )); |
2906 | Token * _keyword; |
2907 | asdl_expr_seq* a; |
2908 | if ( |
2909 | (_keyword = _PyPegen_expect_token(p, 508)) // token='global' |
2910 | && |
2911 | (a = (asdl_expr_seq*)_gather_25_rule(p)) // ','.NAME+ |
2912 | ) |
2913 | { |
2914 | D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'global' ','.NAME+" )); |
2915 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2916 | if (_token == NULL) { |
2917 | p->level--; |
2918 | return NULL; |
2919 | } |
2920 | int _end_lineno = _token->end_lineno; |
2921 | UNUSED(_end_lineno); // Only used by EXTRA macro |
2922 | int _end_col_offset = _token->end_col_offset; |
2923 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2924 | _res = _PyAST_Global ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA ); |
2925 | if (_res == NULL && PyErr_Occurred()) { |
2926 | p->error_indicator = 1; |
2927 | p->level--; |
2928 | return NULL; |
2929 | } |
2930 | goto done; |
2931 | } |
2932 | p->mark = _mark; |
2933 | D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2934 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'global' ','.NAME+" )); |
2935 | } |
2936 | _res = NULL; |
2937 | done: |
2938 | p->level--; |
2939 | return _res; |
2940 | } |
2941 | |
2942 | // nonlocal_stmt: 'nonlocal' ','.NAME+ |
2943 | static stmt_ty |
2944 | nonlocal_stmt_rule(Parser *p) |
2945 | { |
2946 | if (p->level++ == MAXSTACK) { |
2947 | p->error_indicator = 1; |
2948 | PyErr_NoMemory(); |
2949 | } |
2950 | if (p->error_indicator) { |
2951 | p->level--; |
2952 | return NULL; |
2953 | } |
2954 | stmt_ty _res = NULL; |
2955 | int _mark = p->mark; |
2956 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
2957 | p->error_indicator = 1; |
2958 | p->level--; |
2959 | return NULL; |
2960 | } |
2961 | int _start_lineno = p->tokens[_mark]->lineno; |
2962 | UNUSED(_start_lineno); // Only used by EXTRA macro |
2963 | int _start_col_offset = p->tokens[_mark]->col_offset; |
2964 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
2965 | { // 'nonlocal' ','.NAME+ |
2966 | if (p->error_indicator) { |
2967 | p->level--; |
2968 | return NULL; |
2969 | } |
2970 | D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+" )); |
2971 | Token * _keyword; |
2972 | asdl_expr_seq* a; |
2973 | if ( |
2974 | (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal' |
2975 | && |
2976 | (a = (asdl_expr_seq*)_gather_27_rule(p)) // ','.NAME+ |
2977 | ) |
2978 | { |
2979 | D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+" )); |
2980 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2981 | if (_token == NULL) { |
2982 | p->level--; |
2983 | return NULL; |
2984 | } |
2985 | int _end_lineno = _token->end_lineno; |
2986 | UNUSED(_end_lineno); // Only used by EXTRA macro |
2987 | int _end_col_offset = _token->end_col_offset; |
2988 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2989 | _res = _PyAST_Nonlocal ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA ); |
2990 | if (_res == NULL && PyErr_Occurred()) { |
2991 | p->error_indicator = 1; |
2992 | p->level--; |
2993 | return NULL; |
2994 | } |
2995 | goto done; |
2996 | } |
2997 | p->mark = _mark; |
2998 | D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
2999 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'nonlocal' ','.NAME+" )); |
3000 | } |
3001 | _res = NULL; |
3002 | done: |
3003 | p->level--; |
3004 | return _res; |
3005 | } |
3006 | |
3007 | // yield_stmt: yield_expr |
3008 | static stmt_ty |
3009 | yield_stmt_rule(Parser *p) |
3010 | { |
3011 | if (p->level++ == MAXSTACK) { |
3012 | p->error_indicator = 1; |
3013 | PyErr_NoMemory(); |
3014 | } |
3015 | if (p->error_indicator) { |
3016 | p->level--; |
3017 | return NULL; |
3018 | } |
3019 | stmt_ty _res = NULL; |
3020 | int _mark = p->mark; |
3021 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3022 | p->error_indicator = 1; |
3023 | p->level--; |
3024 | return NULL; |
3025 | } |
3026 | int _start_lineno = p->tokens[_mark]->lineno; |
3027 | UNUSED(_start_lineno); // Only used by EXTRA macro |
3028 | int _start_col_offset = p->tokens[_mark]->col_offset; |
3029 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3030 | { // yield_expr |
3031 | if (p->error_indicator) { |
3032 | p->level--; |
3033 | return NULL; |
3034 | } |
3035 | D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "yield_expr" )); |
3036 | expr_ty y; |
3037 | if ( |
3038 | (y = yield_expr_rule(p)) // yield_expr |
3039 | ) |
3040 | { |
3041 | D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "yield_expr" )); |
3042 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3043 | if (_token == NULL) { |
3044 | p->level--; |
3045 | return NULL; |
3046 | } |
3047 | int _end_lineno = _token->end_lineno; |
3048 | UNUSED(_end_lineno); // Only used by EXTRA macro |
3049 | int _end_col_offset = _token->end_col_offset; |
3050 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3051 | _res = _PyAST_Expr ( y , EXTRA ); |
3052 | if (_res == NULL && PyErr_Occurred()) { |
3053 | p->error_indicator = 1; |
3054 | p->level--; |
3055 | return NULL; |
3056 | } |
3057 | goto done; |
3058 | } |
3059 | p->mark = _mark; |
3060 | D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
3061 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "yield_expr" )); |
3062 | } |
3063 | _res = NULL; |
3064 | done: |
3065 | p->level--; |
3066 | return _res; |
3067 | } |
3068 | |
3069 | // assert_stmt: 'assert' expression [',' expression] |
3070 | static stmt_ty |
3071 | assert_stmt_rule(Parser *p) |
3072 | { |
3073 | if (p->level++ == MAXSTACK) { |
3074 | p->error_indicator = 1; |
3075 | PyErr_NoMemory(); |
3076 | } |
3077 | if (p->error_indicator) { |
3078 | p->level--; |
3079 | return NULL; |
3080 | } |
3081 | stmt_ty _res = NULL; |
3082 | int _mark = p->mark; |
3083 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3084 | p->error_indicator = 1; |
3085 | p->level--; |
3086 | return NULL; |
3087 | } |
3088 | int _start_lineno = p->tokens[_mark]->lineno; |
3089 | UNUSED(_start_lineno); // Only used by EXTRA macro |
3090 | int _start_col_offset = p->tokens[_mark]->col_offset; |
3091 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3092 | { // 'assert' expression [',' expression] |
3093 | if (p->error_indicator) { |
3094 | p->level--; |
3095 | return NULL; |
3096 | } |
3097 | D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]" )); |
3098 | Token * _keyword; |
3099 | expr_ty a; |
3100 | void *b; |
3101 | if ( |
3102 | (_keyword = _PyPegen_expect_token(p, 505)) // token='assert' |
3103 | && |
3104 | (a = expression_rule(p)) // expression |
3105 | && |
3106 | (b = _tmp_29_rule(p), !p->error_indicator) // [',' expression] |
3107 | ) |
3108 | { |
3109 | D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]" )); |
3110 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3111 | if (_token == NULL) { |
3112 | p->level--; |
3113 | return NULL; |
3114 | } |
3115 | int _end_lineno = _token->end_lineno; |
3116 | UNUSED(_end_lineno); // Only used by EXTRA macro |
3117 | int _end_col_offset = _token->end_col_offset; |
3118 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3119 | _res = _PyAST_Assert ( a , b , EXTRA ); |
3120 | if (_res == NULL && PyErr_Occurred()) { |
3121 | p->error_indicator = 1; |
3122 | p->level--; |
3123 | return NULL; |
3124 | } |
3125 | goto done; |
3126 | } |
3127 | p->mark = _mark; |
3128 | D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
3129 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'assert' expression [',' expression]" )); |
3130 | } |
3131 | _res = NULL; |
3132 | done: |
3133 | p->level--; |
3134 | return _res; |
3135 | } |
3136 | |
3137 | // del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt |
3138 | static stmt_ty |
3139 | del_stmt_rule(Parser *p) |
3140 | { |
3141 | if (p->level++ == MAXSTACK) { |
3142 | p->error_indicator = 1; |
3143 | PyErr_NoMemory(); |
3144 | } |
3145 | if (p->error_indicator) { |
3146 | p->level--; |
3147 | return NULL; |
3148 | } |
3149 | stmt_ty _res = NULL; |
3150 | int _mark = p->mark; |
3151 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3152 | p->error_indicator = 1; |
3153 | p->level--; |
3154 | return NULL; |
3155 | } |
3156 | int _start_lineno = p->tokens[_mark]->lineno; |
3157 | UNUSED(_start_lineno); // Only used by EXTRA macro |
3158 | int _start_col_offset = p->tokens[_mark]->col_offset; |
3159 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3160 | { // 'del' del_targets &(';' | NEWLINE) |
3161 | if (p->error_indicator) { |
3162 | p->level--; |
3163 | return NULL; |
3164 | } |
3165 | D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)" )); |
3166 | Token * _keyword; |
3167 | asdl_expr_seq* a; |
3168 | if ( |
3169 | (_keyword = _PyPegen_expect_token(p, 503)) // token='del' |
3170 | && |
3171 | (a = del_targets_rule(p)) // del_targets |
3172 | && |
3173 | _PyPegen_lookahead(1, _tmp_30_rule, p) |
3174 | ) |
3175 | { |
3176 | D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)" )); |
3177 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3178 | if (_token == NULL) { |
3179 | p->level--; |
3180 | return NULL; |
3181 | } |
3182 | int _end_lineno = _token->end_lineno; |
3183 | UNUSED(_end_lineno); // Only used by EXTRA macro |
3184 | int _end_col_offset = _token->end_col_offset; |
3185 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3186 | _res = _PyAST_Delete ( a , EXTRA ); |
3187 | if (_res == NULL && PyErr_Occurred()) { |
3188 | p->error_indicator = 1; |
3189 | p->level--; |
3190 | return NULL; |
3191 | } |
3192 | goto done; |
3193 | } |
3194 | p->mark = _mark; |
3195 | D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
3196 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'del' del_targets &(';' | NEWLINE)" )); |
3197 | } |
3198 | if (p->call_invalid_rules) { // invalid_del_stmt |
3199 | if (p->error_indicator) { |
3200 | p->level--; |
3201 | return NULL; |
3202 | } |
3203 | D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_del_stmt" )); |
3204 | void *invalid_del_stmt_var; |
3205 | if ( |
3206 | (invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt |
3207 | ) |
3208 | { |
3209 | D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_del_stmt" )); |
3210 | _res = invalid_del_stmt_var; |
3211 | goto done; |
3212 | } |
3213 | p->mark = _mark; |
3214 | D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
3215 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_del_stmt" )); |
3216 | } |
3217 | _res = NULL; |
3218 | done: |
3219 | p->level--; |
3220 | return _res; |
3221 | } |
3222 | |
3223 | // import_stmt: import_name | import_from |
3224 | static stmt_ty |
3225 | import_stmt_rule(Parser *p) |
3226 | { |
3227 | if (p->level++ == MAXSTACK) { |
3228 | p->error_indicator = 1; |
3229 | PyErr_NoMemory(); |
3230 | } |
3231 | if (p->error_indicator) { |
3232 | p->level--; |
3233 | return NULL; |
3234 | } |
3235 | stmt_ty _res = NULL; |
3236 | int _mark = p->mark; |
3237 | { // import_name |
3238 | if (p->error_indicator) { |
3239 | p->level--; |
3240 | return NULL; |
3241 | } |
3242 | D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "import_name" )); |
3243 | stmt_ty import_name_var; |
3244 | if ( |
3245 | (import_name_var = import_name_rule(p)) // import_name |
3246 | ) |
3247 | { |
3248 | D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "import_name" )); |
3249 | _res = import_name_var; |
3250 | goto done; |
3251 | } |
3252 | p->mark = _mark; |
3253 | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
3254 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "import_name" )); |
3255 | } |
3256 | { // import_from |
3257 | if (p->error_indicator) { |
3258 | p->level--; |
3259 | return NULL; |
3260 | } |
3261 | D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "import_from" )); |
3262 | stmt_ty import_from_var; |
3263 | if ( |
3264 | (import_from_var = import_from_rule(p)) // import_from |
3265 | ) |
3266 | { |
3267 | D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "import_from" )); |
3268 | _res = import_from_var; |
3269 | goto done; |
3270 | } |
3271 | p->mark = _mark; |
3272 | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
3273 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "import_from" )); |
3274 | } |
3275 | _res = NULL; |
3276 | done: |
3277 | p->level--; |
3278 | return _res; |
3279 | } |
3280 | |
3281 | // import_name: 'import' dotted_as_names |
3282 | static stmt_ty |
3283 | import_name_rule(Parser *p) |
3284 | { |
3285 | if (p->level++ == MAXSTACK) { |
3286 | p->error_indicator = 1; |
3287 | PyErr_NoMemory(); |
3288 | } |
3289 | if (p->error_indicator) { |
3290 | p->level--; |
3291 | return NULL; |
3292 | } |
3293 | stmt_ty _res = NULL; |
3294 | int _mark = p->mark; |
3295 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3296 | p->error_indicator = 1; |
3297 | p->level--; |
3298 | return NULL; |
3299 | } |
3300 | int _start_lineno = p->tokens[_mark]->lineno; |
3301 | UNUSED(_start_lineno); // Only used by EXTRA macro |
3302 | int _start_col_offset = p->tokens[_mark]->col_offset; |
3303 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3304 | { // 'import' dotted_as_names |
3305 | if (p->error_indicator) { |
3306 | p->level--; |
3307 | return NULL; |
3308 | } |
3309 | D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'import' dotted_as_names" )); |
3310 | Token * _keyword; |
3311 | asdl_alias_seq* a; |
3312 | if ( |
3313 | (_keyword = _PyPegen_expect_token(p, 513)) // token='import' |
3314 | && |
3315 | (a = dotted_as_names_rule(p)) // dotted_as_names |
3316 | ) |
3317 | { |
3318 | D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'import' dotted_as_names" )); |
3319 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3320 | if (_token == NULL) { |
3321 | p->level--; |
3322 | return NULL; |
3323 | } |
3324 | int _end_lineno = _token->end_lineno; |
3325 | UNUSED(_end_lineno); // Only used by EXTRA macro |
3326 | int _end_col_offset = _token->end_col_offset; |
3327 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3328 | _res = _PyAST_Import ( a , EXTRA ); |
3329 | if (_res == NULL && PyErr_Occurred()) { |
3330 | p->error_indicator = 1; |
3331 | p->level--; |
3332 | return NULL; |
3333 | } |
3334 | goto done; |
3335 | } |
3336 | p->mark = _mark; |
3337 | D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n" , p->level, ' ', |
3338 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'import' dotted_as_names" )); |
3339 | } |
3340 | _res = NULL; |
3341 | done: |
3342 | p->level--; |
3343 | return _res; |
3344 | } |
3345 | |
3346 | // import_from: |
3347 | // | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets |
3348 | // | 'from' (('.' | '...'))+ 'import' import_from_targets |
3349 | static stmt_ty |
3350 | import_from_rule(Parser *p) |
3351 | { |
3352 | if (p->level++ == MAXSTACK) { |
3353 | p->error_indicator = 1; |
3354 | PyErr_NoMemory(); |
3355 | } |
3356 | if (p->error_indicator) { |
3357 | p->level--; |
3358 | return NULL; |
3359 | } |
3360 | stmt_ty _res = NULL; |
3361 | int _mark = p->mark; |
3362 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3363 | p->error_indicator = 1; |
3364 | p->level--; |
3365 | return NULL; |
3366 | } |
3367 | int _start_lineno = p->tokens[_mark]->lineno; |
3368 | UNUSED(_start_lineno); // Only used by EXTRA macro |
3369 | int _start_col_offset = p->tokens[_mark]->col_offset; |
3370 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3371 | { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets |
3372 | if (p->error_indicator) { |
3373 | p->level--; |
3374 | return NULL; |
3375 | } |
3376 | D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets" )); |
3377 | Token * _keyword; |
3378 | Token * _keyword_1; |
3379 | asdl_seq * a; |
3380 | expr_ty b; |
3381 | asdl_alias_seq* c; |
3382 | if ( |
3383 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
3384 | && |
3385 | (a = _loop0_31_rule(p)) // (('.' | '...'))* |
3386 | && |
3387 | (b = dotted_name_rule(p)) // dotted_name |
3388 | && |
3389 | (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import' |
3390 | && |
3391 | (c = import_from_targets_rule(p)) // import_from_targets |
3392 | ) |
3393 | { |
3394 | D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets" )); |
3395 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3396 | if (_token == NULL) { |
3397 | p->level--; |
3398 | return NULL; |
3399 | } |
3400 | int _end_lineno = _token->end_lineno; |
3401 | UNUSED(_end_lineno); // Only used by EXTRA macro |
3402 | int _end_col_offset = _token->end_col_offset; |
3403 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3404 | _res = _PyAST_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA ); |
3405 | if (_res == NULL && PyErr_Occurred()) { |
3406 | p->error_indicator = 1; |
3407 | p->level--; |
3408 | return NULL; |
3409 | } |
3410 | goto done; |
3411 | } |
3412 | p->mark = _mark; |
3413 | D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n" , p->level, ' ', |
3414 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets" )); |
3415 | } |
3416 | { // 'from' (('.' | '...'))+ 'import' import_from_targets |
3417 | if (p->error_indicator) { |
3418 | p->level--; |
3419 | return NULL; |
3420 | } |
3421 | D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets" )); |
3422 | Token * _keyword; |
3423 | Token * _keyword_1; |
3424 | asdl_seq * a; |
3425 | asdl_alias_seq* b; |
3426 | if ( |
3427 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
3428 | && |
3429 | (a = _loop1_32_rule(p)) // (('.' | '...'))+ |
3430 | && |
3431 | (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import' |
3432 | && |
3433 | (b = import_from_targets_rule(p)) // import_from_targets |
3434 | ) |
3435 | { |
3436 | D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets" )); |
3437 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3438 | if (_token == NULL) { |
3439 | p->level--; |
3440 | return NULL; |
3441 | } |
3442 | int _end_lineno = _token->end_lineno; |
3443 | UNUSED(_end_lineno); // Only used by EXTRA macro |
3444 | int _end_col_offset = _token->end_col_offset; |
3445 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3446 | _res = _PyAST_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA ); |
3447 | if (_res == NULL && PyErr_Occurred()) { |
3448 | p->error_indicator = 1; |
3449 | p->level--; |
3450 | return NULL; |
3451 | } |
3452 | goto done; |
3453 | } |
3454 | p->mark = _mark; |
3455 | D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n" , p->level, ' ', |
3456 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets" )); |
3457 | } |
3458 | _res = NULL; |
3459 | done: |
3460 | p->level--; |
3461 | return _res; |
3462 | } |
3463 | |
3464 | // import_from_targets: |
3465 | // | '(' import_from_as_names ','? ')' |
3466 | // | import_from_as_names !',' |
3467 | // | '*' |
3468 | // | invalid_import_from_targets |
3469 | static asdl_alias_seq* |
3470 | import_from_targets_rule(Parser *p) |
3471 | { |
3472 | if (p->level++ == MAXSTACK) { |
3473 | p->error_indicator = 1; |
3474 | PyErr_NoMemory(); |
3475 | } |
3476 | if (p->error_indicator) { |
3477 | p->level--; |
3478 | return NULL; |
3479 | } |
3480 | asdl_alias_seq* _res = NULL; |
3481 | int _mark = p->mark; |
3482 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3483 | p->error_indicator = 1; |
3484 | p->level--; |
3485 | return NULL; |
3486 | } |
3487 | int _start_lineno = p->tokens[_mark]->lineno; |
3488 | UNUSED(_start_lineno); // Only used by EXTRA macro |
3489 | int _start_col_offset = p->tokens[_mark]->col_offset; |
3490 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3491 | { // '(' import_from_as_names ','? ')' |
3492 | if (p->error_indicator) { |
3493 | p->level--; |
3494 | return NULL; |
3495 | } |
3496 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'" )); |
3497 | Token * _literal; |
3498 | Token * _literal_1; |
3499 | void *_opt_var; |
3500 | UNUSED(_opt_var); // Silence compiler warnings |
3501 | asdl_alias_seq* a; |
3502 | if ( |
3503 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
3504 | && |
3505 | (a = import_from_as_names_rule(p)) // import_from_as_names |
3506 | && |
3507 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
3508 | && |
3509 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
3510 | ) |
3511 | { |
3512 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'" )); |
3513 | _res = a; |
3514 | if (_res == NULL && PyErr_Occurred()) { |
3515 | p->error_indicator = 1; |
3516 | p->level--; |
3517 | return NULL; |
3518 | } |
3519 | goto done; |
3520 | } |
3521 | p->mark = _mark; |
3522 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n" , p->level, ' ', |
3523 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' import_from_as_names ','? ')'" )); |
3524 | } |
3525 | { // import_from_as_names !',' |
3526 | if (p->error_indicator) { |
3527 | p->level--; |
3528 | return NULL; |
3529 | } |
3530 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "import_from_as_names !','" )); |
3531 | asdl_alias_seq* import_from_as_names_var; |
3532 | if ( |
3533 | (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names |
3534 | && |
3535 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
3536 | ) |
3537 | { |
3538 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "import_from_as_names !','" )); |
3539 | _res = import_from_as_names_var; |
3540 | goto done; |
3541 | } |
3542 | p->mark = _mark; |
3543 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n" , p->level, ' ', |
3544 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "import_from_as_names !','" )); |
3545 | } |
3546 | { // '*' |
3547 | if (p->error_indicator) { |
3548 | p->level--; |
3549 | return NULL; |
3550 | } |
3551 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*'" )); |
3552 | Token * _literal; |
3553 | if ( |
3554 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
3555 | ) |
3556 | { |
3557 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*'" )); |
3558 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3559 | if (_token == NULL) { |
3560 | p->level--; |
3561 | return NULL; |
3562 | } |
3563 | int _end_lineno = _token->end_lineno; |
3564 | UNUSED(_end_lineno); // Only used by EXTRA macro |
3565 | int _end_col_offset = _token->end_col_offset; |
3566 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3567 | _res = ( asdl_alias_seq * ) _PyPegen_singleton_seq ( p , CHECK ( alias_ty , _PyPegen_alias_for_star ( p , EXTRA ) ) ); |
3568 | if (_res == NULL && PyErr_Occurred()) { |
3569 | p->error_indicator = 1; |
3570 | p->level--; |
3571 | return NULL; |
3572 | } |
3573 | goto done; |
3574 | } |
3575 | p->mark = _mark; |
3576 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n" , p->level, ' ', |
3577 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*'" )); |
3578 | } |
3579 | if (p->call_invalid_rules) { // invalid_import_from_targets |
3580 | if (p->error_indicator) { |
3581 | p->level--; |
3582 | return NULL; |
3583 | } |
3584 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_import_from_targets" )); |
3585 | void *invalid_import_from_targets_var; |
3586 | if ( |
3587 | (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets |
3588 | ) |
3589 | { |
3590 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_import_from_targets" )); |
3591 | _res = invalid_import_from_targets_var; |
3592 | goto done; |
3593 | } |
3594 | p->mark = _mark; |
3595 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n" , p->level, ' ', |
3596 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_import_from_targets" )); |
3597 | } |
3598 | _res = NULL; |
3599 | done: |
3600 | p->level--; |
3601 | return _res; |
3602 | } |
3603 | |
3604 | // import_from_as_names: ','.import_from_as_name+ |
3605 | static asdl_alias_seq* |
3606 | import_from_as_names_rule(Parser *p) |
3607 | { |
3608 | if (p->level++ == MAXSTACK) { |
3609 | p->error_indicator = 1; |
3610 | PyErr_NoMemory(); |
3611 | } |
3612 | if (p->error_indicator) { |
3613 | p->level--; |
3614 | return NULL; |
3615 | } |
3616 | asdl_alias_seq* _res = NULL; |
3617 | int _mark = p->mark; |
3618 | { // ','.import_from_as_name+ |
3619 | if (p->error_indicator) { |
3620 | p->level--; |
3621 | return NULL; |
3622 | } |
3623 | D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.import_from_as_name+" )); |
3624 | asdl_alias_seq* a; |
3625 | if ( |
3626 | (a = (asdl_alias_seq*)_gather_33_rule(p)) // ','.import_from_as_name+ |
3627 | ) |
3628 | { |
3629 | D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.import_from_as_name+" )); |
3630 | _res = a; |
3631 | if (_res == NULL && PyErr_Occurred()) { |
3632 | p->error_indicator = 1; |
3633 | p->level--; |
3634 | return NULL; |
3635 | } |
3636 | goto done; |
3637 | } |
3638 | p->mark = _mark; |
3639 | D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n" , p->level, ' ', |
3640 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.import_from_as_name+" )); |
3641 | } |
3642 | _res = NULL; |
3643 | done: |
3644 | p->level--; |
3645 | return _res; |
3646 | } |
3647 | |
3648 | // import_from_as_name: NAME ['as' NAME] |
3649 | static alias_ty |
3650 | import_from_as_name_rule(Parser *p) |
3651 | { |
3652 | if (p->level++ == MAXSTACK) { |
3653 | p->error_indicator = 1; |
3654 | PyErr_NoMemory(); |
3655 | } |
3656 | if (p->error_indicator) { |
3657 | p->level--; |
3658 | return NULL; |
3659 | } |
3660 | alias_ty _res = NULL; |
3661 | int _mark = p->mark; |
3662 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3663 | p->error_indicator = 1; |
3664 | p->level--; |
3665 | return NULL; |
3666 | } |
3667 | int _start_lineno = p->tokens[_mark]->lineno; |
3668 | UNUSED(_start_lineno); // Only used by EXTRA macro |
3669 | int _start_col_offset = p->tokens[_mark]->col_offset; |
3670 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3671 | { // NAME ['as' NAME] |
3672 | if (p->error_indicator) { |
3673 | p->level--; |
3674 | return NULL; |
3675 | } |
3676 | D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME ['as' NAME]" )); |
3677 | expr_ty a; |
3678 | void *b; |
3679 | if ( |
3680 | (a = _PyPegen_name_token(p)) // NAME |
3681 | && |
3682 | (b = _tmp_35_rule(p), !p->error_indicator) // ['as' NAME] |
3683 | ) |
3684 | { |
3685 | D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME ['as' NAME]" )); |
3686 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3687 | if (_token == NULL) { |
3688 | p->level--; |
3689 | return NULL; |
3690 | } |
3691 | int _end_lineno = _token->end_lineno; |
3692 | UNUSED(_end_lineno); // Only used by EXTRA macro |
3693 | int _end_col_offset = _token->end_col_offset; |
3694 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3695 | _res = _PyAST_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , EXTRA ); |
3696 | if (_res == NULL && PyErr_Occurred()) { |
3697 | p->error_indicator = 1; |
3698 | p->level--; |
3699 | return NULL; |
3700 | } |
3701 | goto done; |
3702 | } |
3703 | p->mark = _mark; |
3704 | D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n" , p->level, ' ', |
3705 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME ['as' NAME]" )); |
3706 | } |
3707 | _res = NULL; |
3708 | done: |
3709 | p->level--; |
3710 | return _res; |
3711 | } |
3712 | |
3713 | // dotted_as_names: ','.dotted_as_name+ |
3714 | static asdl_alias_seq* |
3715 | dotted_as_names_rule(Parser *p) |
3716 | { |
3717 | if (p->level++ == MAXSTACK) { |
3718 | p->error_indicator = 1; |
3719 | PyErr_NoMemory(); |
3720 | } |
3721 | if (p->error_indicator) { |
3722 | p->level--; |
3723 | return NULL; |
3724 | } |
3725 | asdl_alias_seq* _res = NULL; |
3726 | int _mark = p->mark; |
3727 | { // ','.dotted_as_name+ |
3728 | if (p->error_indicator) { |
3729 | p->level--; |
3730 | return NULL; |
3731 | } |
3732 | D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.dotted_as_name+" )); |
3733 | asdl_alias_seq* a; |
3734 | if ( |
3735 | (a = (asdl_alias_seq*)_gather_36_rule(p)) // ','.dotted_as_name+ |
3736 | ) |
3737 | { |
3738 | D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.dotted_as_name+" )); |
3739 | _res = a; |
3740 | if (_res == NULL && PyErr_Occurred()) { |
3741 | p->error_indicator = 1; |
3742 | p->level--; |
3743 | return NULL; |
3744 | } |
3745 | goto done; |
3746 | } |
3747 | p->mark = _mark; |
3748 | D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n" , p->level, ' ', |
3749 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.dotted_as_name+" )); |
3750 | } |
3751 | _res = NULL; |
3752 | done: |
3753 | p->level--; |
3754 | return _res; |
3755 | } |
3756 | |
3757 | // dotted_as_name: dotted_name ['as' NAME] |
3758 | static alias_ty |
3759 | dotted_as_name_rule(Parser *p) |
3760 | { |
3761 | if (p->level++ == MAXSTACK) { |
3762 | p->error_indicator = 1; |
3763 | PyErr_NoMemory(); |
3764 | } |
3765 | if (p->error_indicator) { |
3766 | p->level--; |
3767 | return NULL; |
3768 | } |
3769 | alias_ty _res = NULL; |
3770 | int _mark = p->mark; |
3771 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3772 | p->error_indicator = 1; |
3773 | p->level--; |
3774 | return NULL; |
3775 | } |
3776 | int _start_lineno = p->tokens[_mark]->lineno; |
3777 | UNUSED(_start_lineno); // Only used by EXTRA macro |
3778 | int _start_col_offset = p->tokens[_mark]->col_offset; |
3779 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3780 | { // dotted_name ['as' NAME] |
3781 | if (p->error_indicator) { |
3782 | p->level--; |
3783 | return NULL; |
3784 | } |
3785 | D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]" )); |
3786 | expr_ty a; |
3787 | void *b; |
3788 | if ( |
3789 | (a = dotted_name_rule(p)) // dotted_name |
3790 | && |
3791 | (b = _tmp_38_rule(p), !p->error_indicator) // ['as' NAME] |
3792 | ) |
3793 | { |
3794 | D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]" )); |
3795 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3796 | if (_token == NULL) { |
3797 | p->level--; |
3798 | return NULL; |
3799 | } |
3800 | int _end_lineno = _token->end_lineno; |
3801 | UNUSED(_end_lineno); // Only used by EXTRA macro |
3802 | int _end_col_offset = _token->end_col_offset; |
3803 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3804 | _res = _PyAST_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , EXTRA ); |
3805 | if (_res == NULL && PyErr_Occurred()) { |
3806 | p->error_indicator = 1; |
3807 | p->level--; |
3808 | return NULL; |
3809 | } |
3810 | goto done; |
3811 | } |
3812 | p->mark = _mark; |
3813 | D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n" , p->level, ' ', |
3814 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "dotted_name ['as' NAME]" )); |
3815 | } |
3816 | _res = NULL; |
3817 | done: |
3818 | p->level--; |
3819 | return _res; |
3820 | } |
3821 | |
3822 | // Left-recursive |
3823 | // dotted_name: dotted_name '.' NAME | NAME |
3824 | static expr_ty dotted_name_raw(Parser *); |
3825 | static expr_ty |
3826 | dotted_name_rule(Parser *p) |
3827 | { |
3828 | if (p->level++ == MAXSTACK) { |
3829 | p->error_indicator = 1; |
3830 | PyErr_NoMemory(); |
3831 | } |
3832 | expr_ty _res = NULL; |
3833 | if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) { |
3834 | p->level--; |
3835 | return _res; |
3836 | } |
3837 | int _mark = p->mark; |
3838 | int _resmark = p->mark; |
3839 | while (1) { |
3840 | int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res); |
3841 | if (tmpvar_0) { |
3842 | p->level--; |
3843 | return _res; |
3844 | } |
3845 | p->mark = _mark; |
3846 | void *_raw = dotted_name_raw(p); |
3847 | if (p->error_indicator) { |
3848 | p->level--; |
3849 | return NULL; |
3850 | } |
3851 | if (_raw == NULL || p->mark <= _resmark) |
3852 | break; |
3853 | _resmark = p->mark; |
3854 | _res = _raw; |
3855 | } |
3856 | p->mark = _resmark; |
3857 | p->level--; |
3858 | return _res; |
3859 | } |
3860 | static expr_ty |
3861 | dotted_name_raw(Parser *p) |
3862 | { |
3863 | if (p->level++ == MAXSTACK) { |
3864 | p->error_indicator = 1; |
3865 | PyErr_NoMemory(); |
3866 | } |
3867 | if (p->error_indicator) { |
3868 | p->level--; |
3869 | return NULL; |
3870 | } |
3871 | expr_ty _res = NULL; |
3872 | int _mark = p->mark; |
3873 | { // dotted_name '.' NAME |
3874 | if (p->error_indicator) { |
3875 | p->level--; |
3876 | return NULL; |
3877 | } |
3878 | D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "dotted_name '.' NAME" )); |
3879 | Token * _literal; |
3880 | expr_ty a; |
3881 | expr_ty b; |
3882 | if ( |
3883 | (a = dotted_name_rule(p)) // dotted_name |
3884 | && |
3885 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
3886 | && |
3887 | (b = _PyPegen_name_token(p)) // NAME |
3888 | ) |
3889 | { |
3890 | D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "dotted_name '.' NAME" )); |
3891 | _res = _PyPegen_join_names_with_dot ( p , a , b ); |
3892 | if (_res == NULL && PyErr_Occurred()) { |
3893 | p->error_indicator = 1; |
3894 | p->level--; |
3895 | return NULL; |
3896 | } |
3897 | goto done; |
3898 | } |
3899 | p->mark = _mark; |
3900 | D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n" , p->level, ' ', |
3901 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "dotted_name '.' NAME" )); |
3902 | } |
3903 | { // NAME |
3904 | if (p->error_indicator) { |
3905 | p->level--; |
3906 | return NULL; |
3907 | } |
3908 | D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
3909 | expr_ty name_var; |
3910 | if ( |
3911 | (name_var = _PyPegen_name_token(p)) // NAME |
3912 | ) |
3913 | { |
3914 | D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
3915 | _res = name_var; |
3916 | goto done; |
3917 | } |
3918 | p->mark = _mark; |
3919 | D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n" , p->level, ' ', |
3920 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME" )); |
3921 | } |
3922 | _res = NULL; |
3923 | done: |
3924 | p->level--; |
3925 | return _res; |
3926 | } |
3927 | |
3928 | // if_stmt: |
3929 | // | invalid_if_stmt |
3930 | // | 'if' named_expression ':' block elif_stmt |
3931 | // | 'if' named_expression ':' block else_block? |
3932 | static stmt_ty |
3933 | if_stmt_rule(Parser *p) |
3934 | { |
3935 | if (p->level++ == MAXSTACK) { |
3936 | p->error_indicator = 1; |
3937 | PyErr_NoMemory(); |
3938 | } |
3939 | if (p->error_indicator) { |
3940 | p->level--; |
3941 | return NULL; |
3942 | } |
3943 | stmt_ty _res = NULL; |
3944 | int _mark = p->mark; |
3945 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3946 | p->error_indicator = 1; |
3947 | p->level--; |
3948 | return NULL; |
3949 | } |
3950 | int _start_lineno = p->tokens[_mark]->lineno; |
3951 | UNUSED(_start_lineno); // Only used by EXTRA macro |
3952 | int _start_col_offset = p->tokens[_mark]->col_offset; |
3953 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3954 | if (p->call_invalid_rules) { // invalid_if_stmt |
3955 | if (p->error_indicator) { |
3956 | p->level--; |
3957 | return NULL; |
3958 | } |
3959 | D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_if_stmt" )); |
3960 | void *invalid_if_stmt_var; |
3961 | if ( |
3962 | (invalid_if_stmt_var = invalid_if_stmt_rule(p)) // invalid_if_stmt |
3963 | ) |
3964 | { |
3965 | D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_if_stmt" )); |
3966 | _res = invalid_if_stmt_var; |
3967 | goto done; |
3968 | } |
3969 | p->mark = _mark; |
3970 | D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
3971 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_if_stmt" )); |
3972 | } |
3973 | { // 'if' named_expression ':' block elif_stmt |
3974 | if (p->error_indicator) { |
3975 | p->level--; |
3976 | return NULL; |
3977 | } |
3978 | D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt" )); |
3979 | Token * _keyword; |
3980 | Token * _literal; |
3981 | expr_ty a; |
3982 | asdl_stmt_seq* b; |
3983 | stmt_ty c; |
3984 | if ( |
3985 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
3986 | && |
3987 | (a = named_expression_rule(p)) // named_expression |
3988 | && |
3989 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
3990 | && |
3991 | (b = block_rule(p)) // block |
3992 | && |
3993 | (c = elif_stmt_rule(p)) // elif_stmt |
3994 | ) |
3995 | { |
3996 | D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt" )); |
3997 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3998 | if (_token == NULL) { |
3999 | p->level--; |
4000 | return NULL; |
4001 | } |
4002 | int _end_lineno = _token->end_lineno; |
4003 | UNUSED(_end_lineno); // Only used by EXTRA macro |
4004 | int _end_col_offset = _token->end_col_offset; |
4005 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4006 | _res = _PyAST_If ( a , b , CHECK ( asdl_stmt_seq * , _PyPegen_singleton_seq ( p , c ) ) , EXTRA ); |
4007 | if (_res == NULL && PyErr_Occurred()) { |
4008 | p->error_indicator = 1; |
4009 | p->level--; |
4010 | return NULL; |
4011 | } |
4012 | goto done; |
4013 | } |
4014 | p->mark = _mark; |
4015 | D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4016 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'if' named_expression ':' block elif_stmt" )); |
4017 | } |
4018 | { // 'if' named_expression ':' block else_block? |
4019 | if (p->error_indicator) { |
4020 | p->level--; |
4021 | return NULL; |
4022 | } |
4023 | D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?" )); |
4024 | Token * _keyword; |
4025 | Token * _literal; |
4026 | expr_ty a; |
4027 | asdl_stmt_seq* b; |
4028 | void *c; |
4029 | if ( |
4030 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
4031 | && |
4032 | (a = named_expression_rule(p)) // named_expression |
4033 | && |
4034 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
4035 | && |
4036 | (b = block_rule(p)) // block |
4037 | && |
4038 | (c = else_block_rule(p), !p->error_indicator) // else_block? |
4039 | ) |
4040 | { |
4041 | D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?" )); |
4042 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4043 | if (_token == NULL) { |
4044 | p->level--; |
4045 | return NULL; |
4046 | } |
4047 | int _end_lineno = _token->end_lineno; |
4048 | UNUSED(_end_lineno); // Only used by EXTRA macro |
4049 | int _end_col_offset = _token->end_col_offset; |
4050 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4051 | _res = _PyAST_If ( a , b , c , EXTRA ); |
4052 | if (_res == NULL && PyErr_Occurred()) { |
4053 | p->error_indicator = 1; |
4054 | p->level--; |
4055 | return NULL; |
4056 | } |
4057 | goto done; |
4058 | } |
4059 | p->mark = _mark; |
4060 | D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4061 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'if' named_expression ':' block else_block?" )); |
4062 | } |
4063 | _res = NULL; |
4064 | done: |
4065 | p->level--; |
4066 | return _res; |
4067 | } |
4068 | |
4069 | // elif_stmt: |
4070 | // | invalid_elif_stmt |
4071 | // | 'elif' named_expression ':' block elif_stmt |
4072 | // | 'elif' named_expression ':' block else_block? |
4073 | static stmt_ty |
4074 | elif_stmt_rule(Parser *p) |
4075 | { |
4076 | if (p->level++ == MAXSTACK) { |
4077 | p->error_indicator = 1; |
4078 | PyErr_NoMemory(); |
4079 | } |
4080 | if (p->error_indicator) { |
4081 | p->level--; |
4082 | return NULL; |
4083 | } |
4084 | stmt_ty _res = NULL; |
4085 | int _mark = p->mark; |
4086 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
4087 | p->error_indicator = 1; |
4088 | p->level--; |
4089 | return NULL; |
4090 | } |
4091 | int _start_lineno = p->tokens[_mark]->lineno; |
4092 | UNUSED(_start_lineno); // Only used by EXTRA macro |
4093 | int _start_col_offset = p->tokens[_mark]->col_offset; |
4094 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
4095 | if (p->call_invalid_rules) { // invalid_elif_stmt |
4096 | if (p->error_indicator) { |
4097 | p->level--; |
4098 | return NULL; |
4099 | } |
4100 | D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_elif_stmt" )); |
4101 | void *invalid_elif_stmt_var; |
4102 | if ( |
4103 | (invalid_elif_stmt_var = invalid_elif_stmt_rule(p)) // invalid_elif_stmt |
4104 | ) |
4105 | { |
4106 | D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_elif_stmt" )); |
4107 | _res = invalid_elif_stmt_var; |
4108 | goto done; |
4109 | } |
4110 | p->mark = _mark; |
4111 | D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4112 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_elif_stmt" )); |
4113 | } |
4114 | { // 'elif' named_expression ':' block elif_stmt |
4115 | if (p->error_indicator) { |
4116 | p->level--; |
4117 | return NULL; |
4118 | } |
4119 | D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt" )); |
4120 | Token * _keyword; |
4121 | Token * _literal; |
4122 | expr_ty a; |
4123 | asdl_stmt_seq* b; |
4124 | stmt_ty c; |
4125 | if ( |
4126 | (_keyword = _PyPegen_expect_token(p, 515)) // token='elif' |
4127 | && |
4128 | (a = named_expression_rule(p)) // named_expression |
4129 | && |
4130 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
4131 | && |
4132 | (b = block_rule(p)) // block |
4133 | && |
4134 | (c = elif_stmt_rule(p)) // elif_stmt |
4135 | ) |
4136 | { |
4137 | D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt" )); |
4138 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4139 | if (_token == NULL) { |
4140 | p->level--; |
4141 | return NULL; |
4142 | } |
4143 | int _end_lineno = _token->end_lineno; |
4144 | UNUSED(_end_lineno); // Only used by EXTRA macro |
4145 | int _end_col_offset = _token->end_col_offset; |
4146 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4147 | _res = _PyAST_If ( a , b , CHECK ( asdl_stmt_seq * , _PyPegen_singleton_seq ( p , c ) ) , EXTRA ); |
4148 | if (_res == NULL && PyErr_Occurred()) { |
4149 | p->error_indicator = 1; |
4150 | p->level--; |
4151 | return NULL; |
4152 | } |
4153 | goto done; |
4154 | } |
4155 | p->mark = _mark; |
4156 | D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4157 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'elif' named_expression ':' block elif_stmt" )); |
4158 | } |
4159 | { // 'elif' named_expression ':' block else_block? |
4160 | if (p->error_indicator) { |
4161 | p->level--; |
4162 | return NULL; |
4163 | } |
4164 | D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?" )); |
4165 | Token * _keyword; |
4166 | Token * _literal; |
4167 | expr_ty a; |
4168 | asdl_stmt_seq* b; |
4169 | void *c; |
4170 | if ( |
4171 | (_keyword = _PyPegen_expect_token(p, 515)) // token='elif' |
4172 | && |
4173 | (a = named_expression_rule(p)) // named_expression |
4174 | && |
4175 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
4176 | && |
4177 | (b = block_rule(p)) // block |
4178 | && |
4179 | (c = else_block_rule(p), !p->error_indicator) // else_block? |
4180 | ) |
4181 | { |
4182 | D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?" )); |
4183 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4184 | if (_token == NULL) { |
4185 | p->level--; |
4186 | return NULL; |
4187 | } |
4188 | int _end_lineno = _token->end_lineno; |
4189 | UNUSED(_end_lineno); // Only used by EXTRA macro |
4190 | int _end_col_offset = _token->end_col_offset; |
4191 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4192 | _res = _PyAST_If ( a , b , c , EXTRA ); |
4193 | if (_res == NULL && PyErr_Occurred()) { |
4194 | p->error_indicator = 1; |
4195 | p->level--; |
4196 | return NULL; |
4197 | } |
4198 | goto done; |
4199 | } |
4200 | p->mark = _mark; |
4201 | D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4202 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'elif' named_expression ':' block else_block?" )); |
4203 | } |
4204 | _res = NULL; |
4205 | done: |
4206 | p->level--; |
4207 | return _res; |
4208 | } |
4209 | |
4210 | // else_block: invalid_else_stmt | 'else' &&':' block |
4211 | static asdl_stmt_seq* |
4212 | else_block_rule(Parser *p) |
4213 | { |
4214 | if (p->level++ == MAXSTACK) { |
4215 | p->error_indicator = 1; |
4216 | PyErr_NoMemory(); |
4217 | } |
4218 | if (p->error_indicator) { |
4219 | p->level--; |
4220 | return NULL; |
4221 | } |
4222 | asdl_stmt_seq* _res = NULL; |
4223 | int _mark = p->mark; |
4224 | if (p->call_invalid_rules) { // invalid_else_stmt |
4225 | if (p->error_indicator) { |
4226 | p->level--; |
4227 | return NULL; |
4228 | } |
4229 | D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_else_stmt" )); |
4230 | void *invalid_else_stmt_var; |
4231 | if ( |
4232 | (invalid_else_stmt_var = invalid_else_stmt_rule(p)) // invalid_else_stmt |
4233 | ) |
4234 | { |
4235 | D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_else_stmt" )); |
4236 | _res = invalid_else_stmt_var; |
4237 | goto done; |
4238 | } |
4239 | p->mark = _mark; |
4240 | D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n" , p->level, ' ', |
4241 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_else_stmt" )); |
4242 | } |
4243 | { // 'else' &&':' block |
4244 | if (p->error_indicator) { |
4245 | p->level--; |
4246 | return NULL; |
4247 | } |
4248 | D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'else' &&':' block" )); |
4249 | Token * _keyword; |
4250 | Token * _literal; |
4251 | asdl_stmt_seq* b; |
4252 | if ( |
4253 | (_keyword = _PyPegen_expect_token(p, 516)) // token='else' |
4254 | && |
4255 | (_literal = _PyPegen_expect_forced_token(p, 11, ":" )) // forced_token=':' |
4256 | && |
4257 | (b = block_rule(p)) // block |
4258 | ) |
4259 | { |
4260 | D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'else' &&':' block" )); |
4261 | _res = b; |
4262 | if (_res == NULL && PyErr_Occurred()) { |
4263 | p->error_indicator = 1; |
4264 | p->level--; |
4265 | return NULL; |
4266 | } |
4267 | goto done; |
4268 | } |
4269 | p->mark = _mark; |
4270 | D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n" , p->level, ' ', |
4271 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'else' &&':' block" )); |
4272 | } |
4273 | _res = NULL; |
4274 | done: |
4275 | p->level--; |
4276 | return _res; |
4277 | } |
4278 | |
4279 | // while_stmt: invalid_while_stmt | 'while' named_expression ':' block else_block? |
4280 | static stmt_ty |
4281 | while_stmt_rule(Parser *p) |
4282 | { |
4283 | if (p->level++ == MAXSTACK) { |
4284 | p->error_indicator = 1; |
4285 | PyErr_NoMemory(); |
4286 | } |
4287 | if (p->error_indicator) { |
4288 | p->level--; |
4289 | return NULL; |
4290 | } |
4291 | stmt_ty _res = NULL; |
4292 | int _mark = p->mark; |
4293 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
4294 | p->error_indicator = 1; |
4295 | p->level--; |
4296 | return NULL; |
4297 | } |
4298 | int _start_lineno = p->tokens[_mark]->lineno; |
4299 | UNUSED(_start_lineno); // Only used by EXTRA macro |
4300 | int _start_col_offset = p->tokens[_mark]->col_offset; |
4301 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
4302 | if (p->call_invalid_rules) { // invalid_while_stmt |
4303 | if (p->error_indicator) { |
4304 | p->level--; |
4305 | return NULL; |
4306 | } |
4307 | D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_while_stmt" )); |
4308 | void *invalid_while_stmt_var; |
4309 | if ( |
4310 | (invalid_while_stmt_var = invalid_while_stmt_rule(p)) // invalid_while_stmt |
4311 | ) |
4312 | { |
4313 | D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_while_stmt" )); |
4314 | _res = invalid_while_stmt_var; |
4315 | goto done; |
4316 | } |
4317 | p->mark = _mark; |
4318 | D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4319 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_while_stmt" )); |
4320 | } |
4321 | { // 'while' named_expression ':' block else_block? |
4322 | if (p->error_indicator) { |
4323 | p->level--; |
4324 | return NULL; |
4325 | } |
4326 | D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?" )); |
4327 | Token * _keyword; |
4328 | Token * _literal; |
4329 | expr_ty a; |
4330 | asdl_stmt_seq* b; |
4331 | void *c; |
4332 | if ( |
4333 | (_keyword = _PyPegen_expect_token(p, 512)) // token='while' |
4334 | && |
4335 | (a = named_expression_rule(p)) // named_expression |
4336 | && |
4337 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
4338 | && |
4339 | (b = block_rule(p)) // block |
4340 | && |
4341 | (c = else_block_rule(p), !p->error_indicator) // else_block? |
4342 | ) |
4343 | { |
4344 | D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?" )); |
4345 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4346 | if (_token == NULL) { |
4347 | p->level--; |
4348 | return NULL; |
4349 | } |
4350 | int _end_lineno = _token->end_lineno; |
4351 | UNUSED(_end_lineno); // Only used by EXTRA macro |
4352 | int _end_col_offset = _token->end_col_offset; |
4353 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4354 | _res = _PyAST_While ( a , b , c , EXTRA ); |
4355 | if (_res == NULL && PyErr_Occurred()) { |
4356 | p->error_indicator = 1; |
4357 | p->level--; |
4358 | return NULL; |
4359 | } |
4360 | goto done; |
4361 | } |
4362 | p->mark = _mark; |
4363 | D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4364 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'while' named_expression ':' block else_block?" )); |
4365 | } |
4366 | _res = NULL; |
4367 | done: |
4368 | p->level--; |
4369 | return _res; |
4370 | } |
4371 | |
4372 | // for_stmt: |
4373 | // | invalid_for_stmt |
4374 | // | 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block? |
4375 | // | ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block? |
4376 | // | invalid_for_target |
4377 | static stmt_ty |
4378 | for_stmt_rule(Parser *p) |
4379 | { |
4380 | if (p->level++ == MAXSTACK) { |
4381 | p->error_indicator = 1; |
4382 | PyErr_NoMemory(); |
4383 | } |
4384 | if (p->error_indicator) { |
4385 | p->level--; |
4386 | return NULL; |
4387 | } |
4388 | stmt_ty _res = NULL; |
4389 | int _mark = p->mark; |
4390 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
4391 | p->error_indicator = 1; |
4392 | p->level--; |
4393 | return NULL; |
4394 | } |
4395 | int _start_lineno = p->tokens[_mark]->lineno; |
4396 | UNUSED(_start_lineno); // Only used by EXTRA macro |
4397 | int _start_col_offset = p->tokens[_mark]->col_offset; |
4398 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
4399 | if (p->call_invalid_rules) { // invalid_for_stmt |
4400 | if (p->error_indicator) { |
4401 | p->level--; |
4402 | return NULL; |
4403 | } |
4404 | D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_for_stmt" )); |
4405 | void *invalid_for_stmt_var; |
4406 | if ( |
4407 | (invalid_for_stmt_var = invalid_for_stmt_rule(p)) // invalid_for_stmt |
4408 | ) |
4409 | { |
4410 | D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_for_stmt" )); |
4411 | _res = invalid_for_stmt_var; |
4412 | goto done; |
4413 | } |
4414 | p->mark = _mark; |
4415 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4416 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_for_stmt" )); |
4417 | } |
4418 | { // 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block? |
4419 | if (p->error_indicator) { |
4420 | p->level--; |
4421 | return NULL; |
4422 | } |
4423 | D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?" )); |
4424 | int _cut_var = 0; |
4425 | Token * _keyword; |
4426 | Token * _keyword_1; |
4427 | Token * _literal; |
4428 | asdl_stmt_seq* b; |
4429 | void *el; |
4430 | expr_ty ex; |
4431 | expr_ty t; |
4432 | void *tc; |
4433 | if ( |
4434 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
4435 | && |
4436 | (t = star_targets_rule(p)) // star_targets |
4437 | && |
4438 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
4439 | && |
4440 | (_cut_var = 1) |
4441 | && |
4442 | (ex = star_expressions_rule(p)) // star_expressions |
4443 | && |
4444 | (_literal = _PyPegen_expect_forced_token(p, 11, ":" )) // forced_token=':' |
4445 | && |
4446 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
4447 | && |
4448 | (b = block_rule(p)) // block |
4449 | && |
4450 | (el = else_block_rule(p), !p->error_indicator) // else_block? |
4451 | ) |
4452 | { |
4453 | D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?" )); |
4454 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4455 | if (_token == NULL) { |
4456 | p->level--; |
4457 | return NULL; |
4458 | } |
4459 | int _end_lineno = _token->end_lineno; |
4460 | UNUSED(_end_lineno); // Only used by EXTRA macro |
4461 | int _end_col_offset = _token->end_col_offset; |
4462 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4463 | _res = _PyAST_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
4464 | if (_res == NULL && PyErr_Occurred()) { |
4465 | p->error_indicator = 1; |
4466 | p->level--; |
4467 | return NULL; |
4468 | } |
4469 | goto done; |
4470 | } |
4471 | p->mark = _mark; |
4472 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4473 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?" )); |
4474 | if (_cut_var) { |
4475 | p->level--; |
4476 | return NULL; |
4477 | } |
4478 | } |
4479 | { // ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block? |
4480 | if (p->error_indicator) { |
4481 | p->level--; |
4482 | return NULL; |
4483 | } |
4484 | D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?" )); |
4485 | int _cut_var = 0; |
4486 | Token * _keyword; |
4487 | Token * _keyword_1; |
4488 | Token * _literal; |
4489 | Token * async_var; |
4490 | asdl_stmt_seq* b; |
4491 | void *el; |
4492 | expr_ty ex; |
4493 | expr_ty t; |
4494 | void *tc; |
4495 | if ( |
4496 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
4497 | && |
4498 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
4499 | && |
4500 | (t = star_targets_rule(p)) // star_targets |
4501 | && |
4502 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
4503 | && |
4504 | (_cut_var = 1) |
4505 | && |
4506 | (ex = star_expressions_rule(p)) // star_expressions |
4507 | && |
4508 | (_literal = _PyPegen_expect_forced_token(p, 11, ":" )) // forced_token=':' |
4509 | && |
4510 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
4511 | && |
4512 | (b = block_rule(p)) // block |
4513 | && |
4514 | (el = else_block_rule(p), !p->error_indicator) // else_block? |
4515 | ) |
4516 | { |
4517 | D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?" )); |
4518 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4519 | if (_token == NULL) { |
4520 | p->level--; |
4521 | return NULL; |
4522 | } |
4523 | int _end_lineno = _token->end_lineno; |
4524 | UNUSED(_end_lineno); // Only used by EXTRA macro |
4525 | int _end_col_offset = _token->end_col_offset; |
4526 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4527 | _res = CHECK_VERSION ( stmt_ty , 5 , "Async for loops are" , _PyAST_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
4528 | if (_res == NULL && PyErr_Occurred()) { |
4529 | p->error_indicator = 1; |
4530 | p->level--; |
4531 | return NULL; |
4532 | } |
4533 | goto done; |
4534 | } |
4535 | p->mark = _mark; |
4536 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4537 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?" )); |
4538 | if (_cut_var) { |
4539 | p->level--; |
4540 | return NULL; |
4541 | } |
4542 | } |
4543 | if (p->call_invalid_rules) { // invalid_for_target |
4544 | if (p->error_indicator) { |
4545 | p->level--; |
4546 | return NULL; |
4547 | } |
4548 | D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_for_target" )); |
4549 | void *invalid_for_target_var; |
4550 | if ( |
4551 | (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target |
4552 | ) |
4553 | { |
4554 | D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_for_target" )); |
4555 | _res = invalid_for_target_var; |
4556 | goto done; |
4557 | } |
4558 | p->mark = _mark; |
4559 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4560 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_for_target" )); |
4561 | } |
4562 | _res = NULL; |
4563 | done: |
4564 | p->level--; |
4565 | return _res; |
4566 | } |
4567 | |
4568 | // with_stmt: |
4569 | // | invalid_with_stmt_indent |
4570 | // | 'with' '(' ','.with_item+ ','? ')' ':' block |
4571 | // | 'with' ','.with_item+ ':' TYPE_COMMENT? block |
4572 | // | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block |
4573 | // | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block |
4574 | // | invalid_with_stmt |
4575 | static stmt_ty |
4576 | with_stmt_rule(Parser *p) |
4577 | { |
4578 | if (p->level++ == MAXSTACK) { |
4579 | p->error_indicator = 1; |
4580 | PyErr_NoMemory(); |
4581 | } |
4582 | if (p->error_indicator) { |
4583 | p->level--; |
4584 | return NULL; |
4585 | } |
4586 | stmt_ty _res = NULL; |
4587 | int _mark = p->mark; |
4588 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
4589 | p->error_indicator = 1; |
4590 | p->level--; |
4591 | return NULL; |
4592 | } |
4593 | int _start_lineno = p->tokens[_mark]->lineno; |
4594 | UNUSED(_start_lineno); // Only used by EXTRA macro |
4595 | int _start_col_offset = p->tokens[_mark]->col_offset; |
4596 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
4597 | if (p->call_invalid_rules) { // invalid_with_stmt_indent |
4598 | if (p->error_indicator) { |
4599 | p->level--; |
4600 | return NULL; |
4601 | } |
4602 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_with_stmt_indent" )); |
4603 | void *invalid_with_stmt_indent_var; |
4604 | if ( |
4605 | (invalid_with_stmt_indent_var = invalid_with_stmt_indent_rule(p)) // invalid_with_stmt_indent |
4606 | ) |
4607 | { |
4608 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_with_stmt_indent" )); |
4609 | _res = invalid_with_stmt_indent_var; |
4610 | goto done; |
4611 | } |
4612 | p->mark = _mark; |
4613 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4614 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_with_stmt_indent" )); |
4615 | } |
4616 | { // 'with' '(' ','.with_item+ ','? ')' ':' block |
4617 | if (p->error_indicator) { |
4618 | p->level--; |
4619 | return NULL; |
4620 | } |
4621 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block" )); |
4622 | Token * _keyword; |
4623 | Token * _literal; |
4624 | Token * _literal_1; |
4625 | Token * _literal_2; |
4626 | void *_opt_var; |
4627 | UNUSED(_opt_var); // Silence compiler warnings |
4628 | asdl_withitem_seq* a; |
4629 | asdl_stmt_seq* b; |
4630 | if ( |
4631 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
4632 | && |
4633 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
4634 | && |
4635 | (a = (asdl_withitem_seq*)_gather_39_rule(p)) // ','.with_item+ |
4636 | && |
4637 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
4638 | && |
4639 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
4640 | && |
4641 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
4642 | && |
4643 | (b = block_rule(p)) // block |
4644 | ) |
4645 | { |
4646 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block" )); |
4647 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4648 | if (_token == NULL) { |
4649 | p->level--; |
4650 | return NULL; |
4651 | } |
4652 | int _end_lineno = _token->end_lineno; |
4653 | UNUSED(_end_lineno); // Only used by EXTRA macro |
4654 | int _end_col_offset = _token->end_col_offset; |
4655 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4656 | _res = _PyAST_With ( a , b , NULL , EXTRA ); |
4657 | if (_res == NULL && PyErr_Occurred()) { |
4658 | p->error_indicator = 1; |
4659 | p->level--; |
4660 | return NULL; |
4661 | } |
4662 | goto done; |
4663 | } |
4664 | p->mark = _mark; |
4665 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4666 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block" )); |
4667 | } |
4668 | { // 'with' ','.with_item+ ':' TYPE_COMMENT? block |
4669 | if (p->error_indicator) { |
4670 | p->level--; |
4671 | return NULL; |
4672 | } |
4673 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block" )); |
4674 | Token * _keyword; |
4675 | Token * _literal; |
4676 | asdl_withitem_seq* a; |
4677 | asdl_stmt_seq* b; |
4678 | void *tc; |
4679 | if ( |
4680 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
4681 | && |
4682 | (a = (asdl_withitem_seq*)_gather_41_rule(p)) // ','.with_item+ |
4683 | && |
4684 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
4685 | && |
4686 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
4687 | && |
4688 | (b = block_rule(p)) // block |
4689 | ) |
4690 | { |
4691 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block" )); |
4692 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4693 | if (_token == NULL) { |
4694 | p->level--; |
4695 | return NULL; |
4696 | } |
4697 | int _end_lineno = _token->end_lineno; |
4698 | UNUSED(_end_lineno); // Only used by EXTRA macro |
4699 | int _end_col_offset = _token->end_col_offset; |
4700 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4701 | _res = _PyAST_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
4702 | if (_res == NULL && PyErr_Occurred()) { |
4703 | p->error_indicator = 1; |
4704 | p->level--; |
4705 | return NULL; |
4706 | } |
4707 | goto done; |
4708 | } |
4709 | p->mark = _mark; |
4710 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4711 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block" )); |
4712 | } |
4713 | { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block |
4714 | if (p->error_indicator) { |
4715 | p->level--; |
4716 | return NULL; |
4717 | } |
4718 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block" )); |
4719 | Token * _keyword; |
4720 | Token * _literal; |
4721 | Token * _literal_1; |
4722 | Token * _literal_2; |
4723 | void *_opt_var; |
4724 | UNUSED(_opt_var); // Silence compiler warnings |
4725 | asdl_withitem_seq* a; |
4726 | Token * async_var; |
4727 | asdl_stmt_seq* b; |
4728 | if ( |
4729 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
4730 | && |
4731 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
4732 | && |
4733 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
4734 | && |
4735 | (a = (asdl_withitem_seq*)_gather_43_rule(p)) // ','.with_item+ |
4736 | && |
4737 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
4738 | && |
4739 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
4740 | && |
4741 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
4742 | && |
4743 | (b = block_rule(p)) // block |
4744 | ) |
4745 | { |
4746 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block" )); |
4747 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4748 | if (_token == NULL) { |
4749 | p->level--; |
4750 | return NULL; |
4751 | } |
4752 | int _end_lineno = _token->end_lineno; |
4753 | UNUSED(_end_lineno); // Only used by EXTRA macro |
4754 | int _end_col_offset = _token->end_col_offset; |
4755 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4756 | _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _PyAST_AsyncWith ( a , b , NULL , EXTRA ) ); |
4757 | if (_res == NULL && PyErr_Occurred()) { |
4758 | p->error_indicator = 1; |
4759 | p->level--; |
4760 | return NULL; |
4761 | } |
4762 | goto done; |
4763 | } |
4764 | p->mark = _mark; |
4765 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4766 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block" )); |
4767 | } |
4768 | { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block |
4769 | if (p->error_indicator) { |
4770 | p->level--; |
4771 | return NULL; |
4772 | } |
4773 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block" )); |
4774 | Token * _keyword; |
4775 | Token * _literal; |
4776 | asdl_withitem_seq* a; |
4777 | Token * async_var; |
4778 | asdl_stmt_seq* b; |
4779 | void *tc; |
4780 | if ( |
4781 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
4782 | && |
4783 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
4784 | && |
4785 | (a = (asdl_withitem_seq*)_gather_45_rule(p)) // ','.with_item+ |
4786 | && |
4787 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
4788 | && |
4789 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
4790 | && |
4791 | (b = block_rule(p)) // block |
4792 | ) |
4793 | { |
4794 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block" )); |
4795 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4796 | if (_token == NULL) { |
4797 | p->level--; |
4798 | return NULL; |
4799 | } |
4800 | int _end_lineno = _token->end_lineno; |
4801 | UNUSED(_end_lineno); // Only used by EXTRA macro |
4802 | int _end_col_offset = _token->end_col_offset; |
4803 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4804 | _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _PyAST_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
4805 | if (_res == NULL && PyErr_Occurred()) { |
4806 | p->error_indicator = 1; |
4807 | p->level--; |
4808 | return NULL; |
4809 | } |
4810 | goto done; |
4811 | } |
4812 | p->mark = _mark; |
4813 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4814 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block" )); |
4815 | } |
4816 | if (p->call_invalid_rules) { // invalid_with_stmt |
4817 | if (p->error_indicator) { |
4818 | p->level--; |
4819 | return NULL; |
4820 | } |
4821 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_with_stmt" )); |
4822 | void *invalid_with_stmt_var; |
4823 | if ( |
4824 | (invalid_with_stmt_var = invalid_with_stmt_rule(p)) // invalid_with_stmt |
4825 | ) |
4826 | { |
4827 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_with_stmt" )); |
4828 | _res = invalid_with_stmt_var; |
4829 | goto done; |
4830 | } |
4831 | p->mark = _mark; |
4832 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4833 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_with_stmt" )); |
4834 | } |
4835 | _res = NULL; |
4836 | done: |
4837 | p->level--; |
4838 | return _res; |
4839 | } |
4840 | |
4841 | // with_item: |
4842 | // | expression 'as' star_target &(',' | ')' | ':') |
4843 | // | invalid_with_item |
4844 | // | expression |
4845 | static withitem_ty |
4846 | with_item_rule(Parser *p) |
4847 | { |
4848 | if (p->level++ == MAXSTACK) { |
4849 | p->error_indicator = 1; |
4850 | PyErr_NoMemory(); |
4851 | } |
4852 | if (p->error_indicator) { |
4853 | p->level--; |
4854 | return NULL; |
4855 | } |
4856 | withitem_ty _res = NULL; |
4857 | int _mark = p->mark; |
4858 | { // expression 'as' star_target &(',' | ')' | ':') |
4859 | if (p->error_indicator) { |
4860 | p->level--; |
4861 | return NULL; |
4862 | } |
4863 | D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')" )); |
4864 | Token * _keyword; |
4865 | expr_ty e; |
4866 | expr_ty t; |
4867 | if ( |
4868 | (e = expression_rule(p)) // expression |
4869 | && |
4870 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
4871 | && |
4872 | (t = star_target_rule(p)) // star_target |
4873 | && |
4874 | _PyPegen_lookahead(1, _tmp_47_rule, p) |
4875 | ) |
4876 | { |
4877 | D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')" )); |
4878 | _res = _PyAST_withitem ( e , t , p -> arena ); |
4879 | if (_res == NULL && PyErr_Occurred()) { |
4880 | p->error_indicator = 1; |
4881 | p->level--; |
4882 | return NULL; |
4883 | } |
4884 | goto done; |
4885 | } |
4886 | p->mark = _mark; |
4887 | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n" , p->level, ' ', |
4888 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')" )); |
4889 | } |
4890 | if (p->call_invalid_rules) { // invalid_with_item |
4891 | if (p->error_indicator) { |
4892 | p->level--; |
4893 | return NULL; |
4894 | } |
4895 | D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_with_item" )); |
4896 | void *invalid_with_item_var; |
4897 | if ( |
4898 | (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item |
4899 | ) |
4900 | { |
4901 | D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_with_item" )); |
4902 | _res = invalid_with_item_var; |
4903 | goto done; |
4904 | } |
4905 | p->mark = _mark; |
4906 | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n" , p->level, ' ', |
4907 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_with_item" )); |
4908 | } |
4909 | { // expression |
4910 | if (p->error_indicator) { |
4911 | p->level--; |
4912 | return NULL; |
4913 | } |
4914 | D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression" )); |
4915 | expr_ty e; |
4916 | if ( |
4917 | (e = expression_rule(p)) // expression |
4918 | ) |
4919 | { |
4920 | D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression" )); |
4921 | _res = _PyAST_withitem ( e , NULL , p -> arena ); |
4922 | if (_res == NULL && PyErr_Occurred()) { |
4923 | p->error_indicator = 1; |
4924 | p->level--; |
4925 | return NULL; |
4926 | } |
4927 | goto done; |
4928 | } |
4929 | p->mark = _mark; |
4930 | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n" , p->level, ' ', |
4931 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression" )); |
4932 | } |
4933 | _res = NULL; |
4934 | done: |
4935 | p->level--; |
4936 | return _res; |
4937 | } |
4938 | |
4939 | // try_stmt: |
4940 | // | invalid_try_stmt |
4941 | // | 'try' &&':' block finally_block |
4942 | // | 'try' &&':' block except_block+ else_block? finally_block? |
4943 | static stmt_ty |
4944 | try_stmt_rule(Parser *p) |
4945 | { |
4946 | if (p->level++ == MAXSTACK) { |
4947 | p->error_indicator = 1; |
4948 | PyErr_NoMemory(); |
4949 | } |
4950 | if (p->error_indicator) { |
4951 | p->level--; |
4952 | return NULL; |
4953 | } |
4954 | stmt_ty _res = NULL; |
4955 | int _mark = p->mark; |
4956 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
4957 | p->error_indicator = 1; |
4958 | p->level--; |
4959 | return NULL; |
4960 | } |
4961 | int _start_lineno = p->tokens[_mark]->lineno; |
4962 | UNUSED(_start_lineno); // Only used by EXTRA macro |
4963 | int _start_col_offset = p->tokens[_mark]->col_offset; |
4964 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
4965 | if (p->call_invalid_rules) { // invalid_try_stmt |
4966 | if (p->error_indicator) { |
4967 | p->level--; |
4968 | return NULL; |
4969 | } |
4970 | D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_try_stmt" )); |
4971 | void *invalid_try_stmt_var; |
4972 | if ( |
4973 | (invalid_try_stmt_var = invalid_try_stmt_rule(p)) // invalid_try_stmt |
4974 | ) |
4975 | { |
4976 | D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_try_stmt" )); |
4977 | _res = invalid_try_stmt_var; |
4978 | goto done; |
4979 | } |
4980 | p->mark = _mark; |
4981 | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
4982 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_try_stmt" )); |
4983 | } |
4984 | { // 'try' &&':' block finally_block |
4985 | if (p->error_indicator) { |
4986 | p->level--; |
4987 | return NULL; |
4988 | } |
4989 | D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'try' &&':' block finally_block" )); |
4990 | Token * _keyword; |
4991 | Token * _literal; |
4992 | asdl_stmt_seq* b; |
4993 | asdl_stmt_seq* f; |
4994 | if ( |
4995 | (_keyword = _PyPegen_expect_token(p, 511)) // token='try' |
4996 | && |
4997 | (_literal = _PyPegen_expect_forced_token(p, 11, ":" )) // forced_token=':' |
4998 | && |
4999 | (b = block_rule(p)) // block |
5000 | && |
5001 | (f = finally_block_rule(p)) // finally_block |
5002 | ) |
5003 | { |
5004 | D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'try' &&':' block finally_block" )); |
5005 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
5006 | if (_token == NULL) { |
5007 | p->level--; |
5008 | return NULL; |
5009 | } |
5010 | int _end_lineno = _token->end_lineno; |
5011 | UNUSED(_end_lineno); // Only used by EXTRA macro |
5012 | int _end_col_offset = _token->end_col_offset; |
5013 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
5014 | _res = _PyAST_Try ( b , NULL , NULL , f , EXTRA ); |
5015 | if (_res == NULL && PyErr_Occurred()) { |
5016 | p->error_indicator = 1; |
5017 | p->level--; |
5018 | return NULL; |
5019 | } |
5020 | goto done; |
5021 | } |
5022 | p->mark = _mark; |
5023 | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
5024 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'try' &&':' block finally_block" )); |
5025 | } |
5026 | { // 'try' &&':' block except_block+ else_block? finally_block? |
5027 | if (p->error_indicator) { |
5028 | p->level--; |
5029 | return NULL; |
5030 | } |
5031 | D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?" )); |
5032 | Token * _keyword; |
5033 | Token * _literal; |
5034 | asdl_stmt_seq* b; |
5035 | void *el; |
5036 | asdl_excepthandler_seq* ex; |
5037 | void *f; |
5038 | if ( |
5039 | (_keyword = _PyPegen_expect_token(p, 511)) // token='try' |
5040 | && |
5041 | (_literal = _PyPegen_expect_forced_token(p, 11, ":" )) // forced_token=':' |
5042 | && |
5043 | (b = block_rule(p)) // block |
5044 | && |
5045 | (ex = (asdl_excepthandler_seq*)_loop1_48_rule(p)) // except_block+ |
5046 | && |
5047 | (el = else_block_rule(p), !p->error_indicator) // else_block? |
5048 | && |
5049 | (f = finally_block_rule(p), !p->error_indicator) // finally_block? |
5050 | ) |
5051 | { |
5052 | D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?" )); |
5053 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
5054 | if (_token == NULL) { |
5055 | p->level--; |
5056 | return NULL; |
5057 | } |
5058 | int _end_lineno = _token->end_lineno; |
5059 | UNUSED(_end_lineno); // Only used by EXTRA macro |
5060 | int _end_col_offset = _token->end_col_offset; |
5061 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
5062 | _res = _PyAST_Try ( b , ex , el , f , EXTRA ); |
5063 | if (_res == NULL && PyErr_Occurred()) { |
5064 | p->error_indicator = 1; |
5065 | p->level--; |
5066 | return NULL; |
5067 | } |
5068 | goto done; |
5069 | } |
5070 | p->mark = _mark; |
5071 | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
5072 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?" )); |
5073 | } |
5074 | _res = NULL; |
5075 | done: |
5076 | p->level--; |
5077 | return _res; |
5078 | } |
5079 | |
5080 | // except_block: |
5081 | // | invalid_except_stmt_indent |
5082 | // | 'except' expression ['as' NAME] ':' block |
5083 | // | 'except' ':' block |
5084 | // | invalid_except_stmt |
5085 | static excepthandler_ty |
5086 | except_block_rule(Parser *p) |
5087 | { |
5088 | if (p->level++ == MAXSTACK) { |
5089 | p->error_indicator = 1; |
5090 | PyErr_NoMemory(); |
5091 | } |
5092 | if (p->error_indicator) { |
5093 | p->level--; |
5094 | return NULL; |
5095 | } |
5096 | excepthandler_ty _res = NULL; |
5097 | int _mark = p->mark; |
5098 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
5099 | p->error_indicator = 1; |
5100 | p->level--; |
5101 | return NULL; |
5102 | } |
5103 | int _start_lineno = p->tokens[_mark]->lineno; |
5104 | UNUSED(_start_lineno); // Only used by EXTRA macro |
5105 | int _start_col_offset = p->tokens[_mark]->col_offset; |
5106 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
5107 | if (p->call_invalid_rules) { // invalid_except_stmt_indent |
5108 | if (p->error_indicator) { |
5109 | p->level--; |
5110 | return NULL; |
5111 | } |
5112 | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_except_stmt_indent" )); |
5113 | void *invalid_except_stmt_indent_var; |
5114 | if ( |
5115 | (invalid_except_stmt_indent_var = invalid_except_stmt_indent_rule(p)) // invalid_except_stmt_indent |
5116 | ) |
5117 | { |
5118 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_except_stmt_indent" )); |
5119 | _res = invalid_except_stmt_indent_var; |
5120 | goto done; |
5121 | } |
5122 | p->mark = _mark; |
5123 | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n" , p->level, ' ', |
5124 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_except_stmt_indent" )); |
5125 | } |
5126 | { // 'except' expression ['as' NAME] ':' block |
5127 | if (p->error_indicator) { |
5128 | p->level--; |
5129 | return NULL; |
5130 | } |
5131 | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block" )); |
5132 | Token * _keyword; |
5133 | Token * _literal; |
5134 | asdl_stmt_seq* b; |
5135 | expr_ty e; |
5136 | void *t; |
5137 | if ( |
5138 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
5139 | && |
5140 | (e = expression_rule(p)) // expression |
5141 | && |
5142 | (t = _tmp_49_rule(p), !p->error_indicator) // ['as' NAME] |
5143 | && |
5144 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
5145 | && |
5146 | (b = block_rule(p)) // block |
5147 | ) |
5148 | { |
5149 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block" )); |
5150 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
5151 | if (_token == NULL) { |
5152 | p->level--; |
5153 | return NULL; |
5154 | } |
5155 | int _end_lineno = _token->end_lineno; |
5156 | UNUSED(_end_lineno); // Only used by EXTRA macro |
5157 | int _end_col_offset = _token->end_col_offset; |
5158 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
5159 | _res = _PyAST_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA ); |
5160 | if (_res == NULL && PyErr_Occurred()) { |
5161 | p->error_indicator = 1; |
5162 | p->level--; |
5163 | return NULL; |
5164 | } |
5165 | goto done; |
5166 | } |
5167 | p->mark = _mark; |
5168 | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n" , p->level, ' ', |
5169 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'except' expression ['as' NAME] ':' block" )); |
5170 | } |
5171 | { // 'except' ':' block |
5172 | if (p->error_indicator) { |
5173 | p->level--; |
5174 | return NULL; |
5175 | } |
5176 | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'except' ':' block" )); |
5177 | Token * _keyword; |
5178 | Token * _literal; |
5179 | asdl_stmt_seq* b; |
5180 | if ( |
5181 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
5182 | && |
5183 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
5184 | && |
5185 | (b = block_rule(p)) // block |
5186 | ) |
5187 | { |
5188 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'except' ':' block" )); |
5189 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
5190 | if (_token == NULL) { |
5191 | p->level--; |
5192 | return NULL; |
5193 | } |
5194 | int _end_lineno = _token->end_lineno; |
5195 | UNUSED(_end_lineno); // Only used by EXTRA macro |
5196 | int _end_col_offset = _token->end_col_offset; |
5197 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
5198 | _res = _PyAST_ExceptHandler ( NULL , NULL , b , EXTRA ); |
5199 | if (_res == NULL && PyErr_Occurred()) { |
5200 | p->error_indicator = 1; |
5201 | p->level--; |
5202 | return NULL; |
5203 | } |
5204 | goto done; |
5205 | } |
5206 | p->mark = _mark; |
5207 | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n" , p->level, ' ', |
5208 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'except' ':' block" )); |
5209 | } |
5210 | if (p->call_invalid_rules) { // invalid_except_stmt |
5211 | if (p->error_indicator) { |
5212 | p->level--; |
5213 | return NULL; |
5214 | } |
5215 | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_except_stmt" )); |
5216 | void *invalid_except_stmt_var; |
5217 | if ( |
5218 | (invalid_except_stmt_var = invalid_except_stmt_rule(p)) // invalid_except_stmt |
5219 | ) |
5220 | { |
5221 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_except_stmt" )); |
5222 | _res = invalid_except_stmt_var; |
5223 | goto done; |
5224 | } |
5225 | p->mark = _mark; |
5226 | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n" , p->level, ' ', |
5227 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_except_stmt" )); |
5228 | } |
5229 | _res = NULL; |
5230 | done: |
5231 | p->level--; |
5232 | return _res; |
5233 | } |
5234 | |
5235 | // finally_block: invalid_finally_stmt | 'finally' &&':' block |
5236 | static asdl_stmt_seq* |
5237 | finally_block_rule(Parser *p) |
5238 | { |
5239 | if (p->level++ == MAXSTACK) { |
5240 | p->error_indicator = 1; |
5241 | PyErr_NoMemory(); |
5242 | } |
5243 | if (p->error_indicator) { |
5244 | p->level--; |
5245 | return NULL; |
5246 | } |
5247 | asdl_stmt_seq* _res = NULL; |
5248 | int _mark = p->mark; |
5249 | if (p->call_invalid_rules) { // invalid_finally_stmt |
5250 | if (p->error_indicator) { |
5251 | p->level--; |
5252 | return NULL; |
5253 | } |
5254 | D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_finally_stmt" )); |
5255 | void *invalid_finally_stmt_var; |
5256 | if ( |
5257 | (invalid_finally_stmt_var = invalid_finally_stmt_rule(p)) // invalid_finally_stmt |
5258 | ) |
5259 | { |
5260 | D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_finally_stmt" )); |
5261 | _res = invalid_finally_stmt_var; |
5262 | goto done; |
5263 | } |
5264 | p->mark = _mark; |
5265 | D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n" , p->level, ' ', |
5266 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_finally_stmt" )); |
5267 | } |
5268 | { // 'finally' &&':' block |
5269 | if (p->error_indicator) { |
5270 | p->level--; |
5271 | return NULL; |
5272 | } |
5273 | D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'finally' &&':' block" )); |
5274 | Token * _keyword; |
5275 | Token * _literal; |
5276 | asdl_stmt_seq* a; |
5277 | if ( |
5278 | (_keyword = _PyPegen_expect_token(p, 522)) // token='finally' |
5279 | && |
5280 | (_literal = _PyPegen_expect_forced_token(p, 11, ":" )) // forced_token=':' |
5281 | && |
5282 | (a = block_rule(p)) // block |
5283 | ) |
5284 | { |
5285 | D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'finally' &&':' block" )); |
5286 | _res = a; |
5287 | if (_res == NULL && PyErr_Occurred()) { |
5288 | p->error_indicator = 1; |
5289 | p->level--; |
5290 | return NULL; |
5291 | } |
5292 | goto done; |
5293 | } |
5294 | p->mark = _mark; |
5295 | D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n" , p->level, ' ', |
5296 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'finally' &&':' block" )); |
5297 | } |
5298 | _res = NULL; |
5299 | done: |
5300 | p->level--; |
5301 | return _res; |
5302 | } |
5303 | |
5304 | // match_stmt: |
5305 | // | "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT |
5306 | // | invalid_match_stmt |
5307 | static stmt_ty |
5308 | match_stmt_rule(Parser *p) |
5309 | { |
5310 | if (p->level++ == MAXSTACK) { |
5311 | p->error_indicator = 1; |
5312 | PyErr_NoMemory(); |
5313 | } |
5314 | if (p->error_indicator) { |
5315 | p->level--; |
5316 | return NULL; |
5317 | } |
5318 | stmt_ty _res = NULL; |
5319 | int _mark = p->mark; |
5320 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
5321 | p->error_indicator = 1; |
5322 | p->level--; |
5323 | return NULL; |
5324 | } |
5325 | int _start_lineno = p->tokens[_mark]->lineno; |
5326 | UNUSED(_start_lineno); // Only used by EXTRA macro |
5327 | int _start_col_offset = p->tokens[_mark]->col_offset; |
5328 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
5329 | { // "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT |
5330 | if (p->error_indicator) { |
5331 | p->level--; |
5332 | return NULL; |
5333 | } |
5334 | D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT" )); |
5335 | expr_ty _keyword; |
5336 | Token * _literal; |
5337 | asdl_match_case_seq* cases; |
5338 | Token * dedent_var; |
5339 | Token * indent_var; |
5340 | Token * newline_var; |
5341 | expr_ty subject; |
5342 | if ( |
5343 | (_keyword = _PyPegen_expect_soft_keyword(p, "match" )) // soft_keyword='"match"' |
5344 | && |
5345 | (subject = subject_expr_rule(p)) // subject_expr |
5346 | && |
5347 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
5348 | && |
5349 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
5350 | && |
5351 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
5352 | && |
5353 | (cases = (asdl_match_case_seq*)_loop1_50_rule(p)) // case_block+ |
5354 | && |
5355 | (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' |
5356 | ) |
5357 | { |
5358 | D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT" )); |
5359 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
5360 | if (_token == NULL) { |
5361 | p->level--; |
5362 | return NULL; |
5363 | } |
5364 | int _end_lineno = _token->end_lineno; |
5365 | UNUSED(_end_lineno); // Only used by EXTRA macro |
5366 | int _end_col_offset = _token->end_col_offset; |
5367 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
5368 | _res = CHECK_VERSION ( stmt_ty , 10 , "Pattern matching is" , _PyAST_Match ( subject , cases , EXTRA ) ); |
5369 | if (_res == NULL && PyErr_Occurred()) { |
5370 | p->error_indicator = 1; |
5371 | p->level--; |
5372 | return NULL; |
5373 | } |
5374 | goto done; |
5375 | } |
5376 | p->mark = _mark; |
5377 | D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
5378 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT" )); |
5379 | } |
5380 | if (p->call_invalid_rules) { // invalid_match_stmt |
5381 | if (p->error_indicator) { |
5382 | p->level--; |
5383 | return NULL; |
5384 | } |
5385 | D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_match_stmt" )); |
5386 | void *invalid_match_stmt_var; |
5387 | if ( |
5388 | (invalid_match_stmt_var = invalid_match_stmt_rule(p)) // invalid_match_stmt |
5389 | ) |
5390 | { |
5391 | D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_match_stmt" )); |
5392 | _res = invalid_match_stmt_var; |
5393 | goto done; |
5394 | } |
5395 | p->mark = _mark; |
5396 | D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
5397 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_match_stmt" )); |
5398 | } |
5399 | _res = NULL; |
5400 | done: |
5401 | p->level--; |
5402 | return _res; |
5403 | } |
5404 | |
5405 | // subject_expr: star_named_expression ',' star_named_expressions? | named_expression |
5406 | static expr_ty |
5407 | subject_expr_rule(Parser *p) |
5408 | { |
5409 | if (p->level++ == MAXSTACK) { |
5410 | p->error_indicator = 1; |
5411 | PyErr_NoMemory(); |
5412 | } |
5413 | if (p->error_indicator) { |
5414 | p->level--; |
5415 | return NULL; |
5416 | } |
5417 | expr_ty _res = NULL; |
5418 | int _mark = p->mark; |
5419 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
5420 | p->error_indicator = 1; |
5421 | p->level--; |
5422 | return NULL; |
5423 | } |
5424 | int _start_lineno = p->tokens[_mark]->lineno; |
5425 | UNUSED(_start_lineno); // Only used by EXTRA macro |
5426 | int _start_col_offset = p->tokens[_mark]->col_offset; |
5427 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
5428 | { // star_named_expression ',' star_named_expressions? |
5429 | if (p->error_indicator) { |
5430 | p->level--; |
5431 | return NULL; |
5432 | } |
5433 | D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?" )); |
5434 | Token * _literal; |
5435 | expr_ty value; |
5436 | void *values; |
5437 | if ( |
5438 | (value = star_named_expression_rule(p)) // star_named_expression |
5439 | && |
5440 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
5441 | && |
5442 | (values = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions? |
5443 | ) |
5444 | { |
5445 | D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?" )); |
5446 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
5447 | if (_token == NULL) { |
5448 | p->level--; |
5449 | return NULL; |
5450 | } |
5451 | int _end_lineno = _token->end_lineno; |
5452 | UNUSED(_end_lineno); // Only used by EXTRA macro |
5453 | int _end_col_offset = _token->end_col_offset; |
5454 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
5455 | _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA ); |
5456 | if (_res == NULL && PyErr_Occurred()) { |
5457 | p->error_indicator = 1; |
5458 | p->level--; |
5459 | return NULL; |
5460 | } |
5461 | goto done; |
5462 | } |
5463 | p->mark = _mark; |
5464 | D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
5465 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_named_expression ',' star_named_expressions?" )); |
5466 | } |
5467 | { // named_expression |
5468 | if (p->error_indicator) { |
5469 | p->level--; |
5470 | return NULL; |
5471 | } |
5472 | D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "named_expression" )); |
5473 | expr_ty named_expression_var; |
5474 | if ( |
5475 | (named_expression_var = named_expression_rule(p)) // named_expression |
5476 | ) |
5477 | { |
5478 | D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "named_expression" )); |
5479 | _res = named_expression_var; |
5480 | goto done; |
5481 | } |
5482 | p->mark = _mark; |
5483 | D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
5484 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "named_expression" )); |
5485 | } |
5486 | _res = NULL; |
5487 | done: |
5488 | p->level--; |
5489 | return _res; |
5490 | } |
5491 | |
5492 | // case_block: invalid_case_block | "case" patterns guard? ':' block |
5493 | static match_case_ty |
5494 | case_block_rule(Parser *p) |
5495 | { |
5496 | if (p->level++ == MAXSTACK) { |
5497 | p->error_indicator = 1; |
5498 | PyErr_NoMemory(); |
5499 | } |
5500 | if (p->error_indicator) { |
5501 | p->level--; |
5502 | return NULL; |
5503 | } |
5504 | match_case_ty _res = NULL; |
5505 | int _mark = p->mark; |
5506 | if (p->call_invalid_rules) { // invalid_case_block |
5507 | if (p->error_indicator) { |
5508 | p->level--; |
5509 | return NULL; |
5510 | } |
5511 | D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_case_block" )); |
5512 | void *invalid_case_block_var; |
5513 | if ( |
5514 | (invalid_case_block_var = invalid_case_block_rule(p)) // invalid_case_block |
5515 | ) |
5516 | { |
5517 | D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_case_block" )); |
5518 | _res = invalid_case_block_var; |
5519 | goto done; |
5520 | } |
5521 | p->mark = _mark; |
5522 | D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n" , p->level, ' ', |
5523 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_case_block" )); |
5524 | } |
5525 | { // "case" patterns guard? ':' block |
5526 | if (p->error_indicator) { |
5527 | p->level--; |
5528 | return NULL; |
5529 | } |
5530 | D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block" )); |
5531 | expr_ty _keyword; |
5532 | Token * _literal; |
5533 | asdl_stmt_seq* body; |
5534 | void *guard; |
5535 | pattern_ty pattern; |
5536 | if ( |
5537 | (_keyword = _PyPegen_expect_soft_keyword(p, "case" )) // soft_keyword='"case"' |
5538 | && |
5539 | (pattern = patterns_rule(p)) // patterns |
5540 | && |
5541 | (guard = guard_rule(p), !p->error_indicator) // guard? |
5542 | && |
5543 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
5544 | && |
5545 | (body = block_rule(p)) // block |
5546 | ) |
5547 | { |
5548 | D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block" )); |
5549 | _res = _PyAST_match_case ( pattern , guard , body , p -> arena ); |
5550 | if (_res == NULL && PyErr_Occurred()) { |
5551 | p->error_indicator = 1; |
5552 | p->level--; |
5553 | return NULL; |
5554 | } |
5555 | goto done; |
5556 | } |
5557 | p->mark = _mark; |
5558 | D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n" , p->level, ' ', |
5559 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "\"case\" patterns guard? ':' block" )); |
5560 | } |
5561 | _res = NULL; |
5562 | done: |
5563 | p->level--; |
5564 | return _res; |
5565 | } |
5566 | |
5567 | // guard: 'if' named_expression |
5568 | static expr_ty |
5569 | guard_rule(Parser *p) |
5570 | { |
5571 | if (p->level++ == MAXSTACK) { |
5572 | p->error_indicator = 1; |
5573 | PyErr_NoMemory(); |
5574 | } |
5575 | if (p->error_indicator) { |
5576 | p->level--; |
5577 | return NULL; |
5578 | } |
5579 | expr_ty _res = NULL; |
5580 | int _mark = p->mark; |
5581 | { // 'if' named_expression |
5582 | if (p->error_indicator) { |
5583 | p->level--; |
5584 | return NULL; |
5585 | } |
5586 | D(fprintf(stderr, "%*c> guard[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'if' named_expression" )); |
5587 | Token * _keyword; |
5588 | expr_ty guard; |
5589 | if ( |
5590 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
5591 | && |
5592 | (guard = named_expression_rule(p)) // named_expression |
5593 | ) |
5594 | { |
5595 | D(fprintf(stderr, "%*c+ guard[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'if' named_expression" )); |
5596 | _res = guard; |
5597 | if (_res == NULL && PyErr_Occurred()) { |
5598 | p->error_indicator = 1; |
5599 | p->level--; |
5600 | return NULL; |
5601 | } |
5602 | goto done; |
5603 | } |
5604 | p->mark = _mark; |
5605 | D(fprintf(stderr, "%*c%s guard[%d-%d]: %s failed!\n" , p->level, ' ', |
5606 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'if' named_expression" )); |
5607 | } |
5608 | _res = NULL; |
5609 | done: |
5610 | p->level--; |
5611 | return _res; |
5612 | } |
5613 | |
5614 | // patterns: open_sequence_pattern | pattern |
5615 | static pattern_ty |
5616 | patterns_rule(Parser *p) |
5617 | { |
5618 | if (p->level++ == MAXSTACK) { |
5619 | p->error_indicator = 1; |
5620 | PyErr_NoMemory(); |
5621 | } |
5622 | if (p->error_indicator) { |
5623 | p->level--; |
5624 | return NULL; |
5625 | } |
5626 | pattern_ty _res = NULL; |
5627 | int _mark = p->mark; |
5628 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
5629 | p->error_indicator = 1; |
5630 | p->level--; |
5631 | return NULL; |
5632 | } |
5633 | int _start_lineno = p->tokens[_mark]->lineno; |
5634 | UNUSED(_start_lineno); // Only used by EXTRA macro |
5635 | int _start_col_offset = p->tokens[_mark]->col_offset; |
5636 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
5637 | { // open_sequence_pattern |
5638 | if (p->error_indicator) { |
5639 | p->level--; |
5640 | return NULL; |
5641 | } |
5642 | D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "open_sequence_pattern" )); |
5643 | asdl_pattern_seq* patterns; |
5644 | if ( |
5645 | (patterns = (asdl_pattern_seq*)open_sequence_pattern_rule(p)) // open_sequence_pattern |
5646 | ) |
5647 | { |
5648 | D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "open_sequence_pattern" )); |
5649 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
5650 | if (_token == NULL) { |
5651 | p->level--; |
5652 | return NULL; |
5653 | } |
5654 | int _end_lineno = _token->end_lineno; |
5655 | UNUSED(_end_lineno); // Only used by EXTRA macro |
5656 | int _end_col_offset = _token->end_col_offset; |
5657 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
5658 | _res = _PyAST_MatchSequence ( patterns , EXTRA ); |
5659 | if (_res == NULL && PyErr_Occurred()) { |
5660 | p->error_indicator = 1; |
5661 | p->level--; |
5662 | return NULL; |
5663 | } |
5664 | goto done; |
5665 | } |
5666 | p->mark = _mark; |
5667 | D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n" , p->level, ' ', |
5668 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "open_sequence_pattern" )); |
5669 | } |
5670 | { // pattern |
5671 | if (p->error_indicator) { |
5672 | p->level--; |
5673 | return NULL; |
5674 | } |
5675 | D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "pattern" )); |
5676 | pattern_ty pattern_var; |
5677 | if ( |
5678 | (pattern_var = pattern_rule(p)) // pattern |
5679 | ) |
5680 | { |
5681 | D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "pattern" )); |
5682 | _res = pattern_var; |
5683 | goto done; |
5684 | } |
5685 | p->mark = _mark; |
5686 | D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n" , p->level, ' ', |
5687 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "pattern" )); |
5688 | } |
5689 | _res = NULL; |
5690 | done: |
5691 | p->level--; |
5692 | return _res; |
5693 | } |
5694 | |
5695 | // pattern: as_pattern | or_pattern |
5696 | static pattern_ty |
5697 | pattern_rule(Parser *p) |
5698 | { |
5699 | if (p->level++ == MAXSTACK) { |
5700 | p->error_indicator = 1; |
5701 | PyErr_NoMemory(); |
5702 | } |
5703 | if (p->error_indicator) { |
5704 | p->level--; |
5705 | return NULL; |
5706 | } |
5707 | pattern_ty _res = NULL; |
5708 | int _mark = p->mark; |
5709 | { // as_pattern |
5710 | if (p->error_indicator) { |
5711 | p->level--; |
5712 | return NULL; |
5713 | } |
5714 | D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "as_pattern" )); |
5715 | pattern_ty as_pattern_var; |
5716 | if ( |
5717 | (as_pattern_var = as_pattern_rule(p)) // as_pattern |
5718 | ) |
5719 | { |
5720 | D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "as_pattern" )); |
5721 | _res = as_pattern_var; |
5722 | goto done; |
5723 | } |
5724 | p->mark = _mark; |
5725 | D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
5726 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "as_pattern" )); |
5727 | } |
5728 | { // or_pattern |
5729 | if (p->error_indicator) { |
5730 | p->level--; |
5731 | return NULL; |
5732 | } |
5733 | D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "or_pattern" )); |
5734 | pattern_ty or_pattern_var; |
5735 | if ( |
5736 | (or_pattern_var = or_pattern_rule(p)) // or_pattern |
5737 | ) |
5738 | { |
5739 | D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "or_pattern" )); |
5740 | _res = or_pattern_var; |
5741 | goto done; |
5742 | } |
5743 | p->mark = _mark; |
5744 | D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
5745 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "or_pattern" )); |
5746 | } |
5747 | _res = NULL; |
5748 | done: |
5749 | p->level--; |
5750 | return _res; |
5751 | } |
5752 | |
5753 | // as_pattern: or_pattern 'as' pattern_capture_target | invalid_as_pattern |
5754 | static pattern_ty |
5755 | as_pattern_rule(Parser *p) |
5756 | { |
5757 | if (p->level++ == MAXSTACK) { |
5758 | p->error_indicator = 1; |
5759 | PyErr_NoMemory(); |
5760 | } |
5761 | if (p->error_indicator) { |
5762 | p->level--; |
5763 | return NULL; |
5764 | } |
5765 | pattern_ty _res = NULL; |
5766 | int _mark = p->mark; |
5767 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
5768 | p->error_indicator = 1; |
5769 | p->level--; |
5770 | return NULL; |
5771 | } |
5772 | int _start_lineno = p->tokens[_mark]->lineno; |
5773 | UNUSED(_start_lineno); // Only used by EXTRA macro |
5774 | int _start_col_offset = p->tokens[_mark]->col_offset; |
5775 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
5776 | { // or_pattern 'as' pattern_capture_target |
5777 | if (p->error_indicator) { |
5778 | p->level--; |
5779 | return NULL; |
5780 | } |
5781 | D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "or_pattern 'as' pattern_capture_target" )); |
5782 | Token * _keyword; |
5783 | pattern_ty pattern; |
5784 | expr_ty target; |
5785 | if ( |
5786 | (pattern = or_pattern_rule(p)) // or_pattern |
5787 | && |
5788 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
5789 | && |
5790 | (target = pattern_capture_target_rule(p)) // pattern_capture_target |
5791 | ) |
5792 | { |
5793 | D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "or_pattern 'as' pattern_capture_target" )); |
5794 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
5795 | if (_token == NULL) { |
5796 | p->level--; |
5797 | return NULL; |
5798 | } |
5799 | int _end_lineno = _token->end_lineno; |
5800 | UNUSED(_end_lineno); // Only used by EXTRA macro |
5801 | int _end_col_offset = _token->end_col_offset; |
5802 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
5803 | _res = _PyAST_MatchAs ( pattern , target -> v . Name . id , EXTRA ); |
5804 | if (_res == NULL && PyErr_Occurred()) { |
5805 | p->error_indicator = 1; |
5806 | p->level--; |
5807 | return NULL; |
5808 | } |
5809 | goto done; |
5810 | } |
5811 | p->mark = _mark; |
5812 | D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
5813 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "or_pattern 'as' pattern_capture_target" )); |
5814 | } |
5815 | if (p->call_invalid_rules) { // invalid_as_pattern |
5816 | if (p->error_indicator) { |
5817 | p->level--; |
5818 | return NULL; |
5819 | } |
5820 | D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_as_pattern" )); |
5821 | void *invalid_as_pattern_var; |
5822 | if ( |
5823 | (invalid_as_pattern_var = invalid_as_pattern_rule(p)) // invalid_as_pattern |
5824 | ) |
5825 | { |
5826 | D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_as_pattern" )); |
5827 | _res = invalid_as_pattern_var; |
5828 | goto done; |
5829 | } |
5830 | p->mark = _mark; |
5831 | D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
5832 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_as_pattern" )); |
5833 | } |
5834 | _res = NULL; |
5835 | done: |
5836 | p->level--; |
5837 | return _res; |
5838 | } |
5839 | |
5840 | // or_pattern: '|'.closed_pattern+ |
5841 | static pattern_ty |
5842 | or_pattern_rule(Parser *p) |
5843 | { |
5844 | if (p->level++ == MAXSTACK) { |
5845 | p->error_indicator = 1; |
5846 | PyErr_NoMemory(); |
5847 | } |
5848 | if (p->error_indicator) { |
5849 | p->level--; |
5850 | return NULL; |
5851 | } |
5852 | pattern_ty _res = NULL; |
5853 | int _mark = p->mark; |
5854 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
5855 | p->error_indicator = 1; |
5856 | p->level--; |
5857 | return NULL; |
5858 | } |
5859 | int _start_lineno = p->tokens[_mark]->lineno; |
5860 | UNUSED(_start_lineno); // Only used by EXTRA macro |
5861 | int _start_col_offset = p->tokens[_mark]->col_offset; |
5862 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
5863 | { // '|'.closed_pattern+ |
5864 | if (p->error_indicator) { |
5865 | p->level--; |
5866 | return NULL; |
5867 | } |
5868 | D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'|'.closed_pattern+" )); |
5869 | asdl_pattern_seq* patterns; |
5870 | if ( |
5871 | (patterns = (asdl_pattern_seq*)_gather_51_rule(p)) // '|'.closed_pattern+ |
5872 | ) |
5873 | { |
5874 | D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'|'.closed_pattern+" )); |
5875 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
5876 | if (_token == NULL) { |
5877 | p->level--; |
5878 | return NULL; |
5879 | } |
5880 | int _end_lineno = _token->end_lineno; |
5881 | UNUSED(_end_lineno); // Only used by EXTRA macro |
5882 | int _end_col_offset = _token->end_col_offset; |
5883 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
5884 | _res = asdl_seq_LEN ( patterns ) == 1 ? asdl_seq_GET ( patterns , 0 ) : _PyAST_MatchOr ( patterns , EXTRA ); |
5885 | if (_res == NULL && PyErr_Occurred()) { |
5886 | p->error_indicator = 1; |
5887 | p->level--; |
5888 | return NULL; |
5889 | } |
5890 | goto done; |
5891 | } |
5892 | p->mark = _mark; |
5893 | D(fprintf(stderr, "%*c%s or_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
5894 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'|'.closed_pattern+" )); |
5895 | } |
5896 | _res = NULL; |
5897 | done: |
5898 | p->level--; |
5899 | return _res; |
5900 | } |
5901 | |
5902 | // closed_pattern: |
5903 | // | literal_pattern |
5904 | // | capture_pattern |
5905 | // | wildcard_pattern |
5906 | // | value_pattern |
5907 | // | group_pattern |
5908 | // | sequence_pattern |
5909 | // | mapping_pattern |
5910 | // | class_pattern |
5911 | static pattern_ty |
5912 | closed_pattern_rule(Parser *p) |
5913 | { |
5914 | if (p->level++ == MAXSTACK) { |
5915 | p->error_indicator = 1; |
5916 | PyErr_NoMemory(); |
5917 | } |
5918 | if (p->error_indicator) { |
5919 | p->level--; |
5920 | return NULL; |
5921 | } |
5922 | pattern_ty _res = NULL; |
5923 | int _mark = p->mark; |
5924 | { // literal_pattern |
5925 | if (p->error_indicator) { |
5926 | p->level--; |
5927 | return NULL; |
5928 | } |
5929 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "literal_pattern" )); |
5930 | pattern_ty literal_pattern_var; |
5931 | if ( |
5932 | (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern |
5933 | ) |
5934 | { |
5935 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "literal_pattern" )); |
5936 | _res = literal_pattern_var; |
5937 | goto done; |
5938 | } |
5939 | p->mark = _mark; |
5940 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
5941 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "literal_pattern" )); |
5942 | } |
5943 | { // capture_pattern |
5944 | if (p->error_indicator) { |
5945 | p->level--; |
5946 | return NULL; |
5947 | } |
5948 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "capture_pattern" )); |
5949 | pattern_ty capture_pattern_var; |
5950 | if ( |
5951 | (capture_pattern_var = capture_pattern_rule(p)) // capture_pattern |
5952 | ) |
5953 | { |
5954 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "capture_pattern" )); |
5955 | _res = capture_pattern_var; |
5956 | goto done; |
5957 | } |
5958 | p->mark = _mark; |
5959 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
5960 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "capture_pattern" )); |
5961 | } |
5962 | { // wildcard_pattern |
5963 | if (p->error_indicator) { |
5964 | p->level--; |
5965 | return NULL; |
5966 | } |
5967 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "wildcard_pattern" )); |
5968 | pattern_ty wildcard_pattern_var; |
5969 | if ( |
5970 | (wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern |
5971 | ) |
5972 | { |
5973 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "wildcard_pattern" )); |
5974 | _res = wildcard_pattern_var; |
5975 | goto done; |
5976 | } |
5977 | p->mark = _mark; |
5978 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
5979 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "wildcard_pattern" )); |
5980 | } |
5981 | { // value_pattern |
5982 | if (p->error_indicator) { |
5983 | p->level--; |
5984 | return NULL; |
5985 | } |
5986 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "value_pattern" )); |
5987 | pattern_ty value_pattern_var; |
5988 | if ( |
5989 | (value_pattern_var = value_pattern_rule(p)) // value_pattern |
5990 | ) |
5991 | { |
5992 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "value_pattern" )); |
5993 | _res = value_pattern_var; |
5994 | goto done; |
5995 | } |
5996 | p->mark = _mark; |
5997 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
5998 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "value_pattern" )); |
5999 | } |
6000 | { // group_pattern |
6001 | if (p->error_indicator) { |
6002 | p->level--; |
6003 | return NULL; |
6004 | } |
6005 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "group_pattern" )); |
6006 | pattern_ty group_pattern_var; |
6007 | if ( |
6008 | (group_pattern_var = group_pattern_rule(p)) // group_pattern |
6009 | ) |
6010 | { |
6011 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "group_pattern" )); |
6012 | _res = group_pattern_var; |
6013 | goto done; |
6014 | } |
6015 | p->mark = _mark; |
6016 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
6017 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "group_pattern" )); |
6018 | } |
6019 | { // sequence_pattern |
6020 | if (p->error_indicator) { |
6021 | p->level--; |
6022 | return NULL; |
6023 | } |
6024 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "sequence_pattern" )); |
6025 | pattern_ty sequence_pattern_var; |
6026 | if ( |
6027 | (sequence_pattern_var = sequence_pattern_rule(p)) // sequence_pattern |
6028 | ) |
6029 | { |
6030 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "sequence_pattern" )); |
6031 | _res = sequence_pattern_var; |
6032 | goto done; |
6033 | } |
6034 | p->mark = _mark; |
6035 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
6036 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "sequence_pattern" )); |
6037 | } |
6038 | { // mapping_pattern |
6039 | if (p->error_indicator) { |
6040 | p->level--; |
6041 | return NULL; |
6042 | } |
6043 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "mapping_pattern" )); |
6044 | pattern_ty mapping_pattern_var; |
6045 | if ( |
6046 | (mapping_pattern_var = mapping_pattern_rule(p)) // mapping_pattern |
6047 | ) |
6048 | { |
6049 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "mapping_pattern" )); |
6050 | _res = mapping_pattern_var; |
6051 | goto done; |
6052 | } |
6053 | p->mark = _mark; |
6054 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
6055 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "mapping_pattern" )); |
6056 | } |
6057 | { // class_pattern |
6058 | if (p->error_indicator) { |
6059 | p->level--; |
6060 | return NULL; |
6061 | } |
6062 | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "class_pattern" )); |
6063 | pattern_ty class_pattern_var; |
6064 | if ( |
6065 | (class_pattern_var = class_pattern_rule(p)) // class_pattern |
6066 | ) |
6067 | { |
6068 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "class_pattern" )); |
6069 | _res = class_pattern_var; |
6070 | goto done; |
6071 | } |
6072 | p->mark = _mark; |
6073 | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
6074 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "class_pattern" )); |
6075 | } |
6076 | _res = NULL; |
6077 | done: |
6078 | p->level--; |
6079 | return _res; |
6080 | } |
6081 | |
6082 | // literal_pattern: |
6083 | // | signed_number !('+' | '-') |
6084 | // | complex_number |
6085 | // | strings |
6086 | // | 'None' |
6087 | // | 'True' |
6088 | // | 'False' |
6089 | static pattern_ty |
6090 | literal_pattern_rule(Parser *p) |
6091 | { |
6092 | if (p->level++ == MAXSTACK) { |
6093 | p->error_indicator = 1; |
6094 | PyErr_NoMemory(); |
6095 | } |
6096 | if (p->error_indicator) { |
6097 | p->level--; |
6098 | return NULL; |
6099 | } |
6100 | pattern_ty _res = NULL; |
6101 | int _mark = p->mark; |
6102 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
6103 | p->error_indicator = 1; |
6104 | p->level--; |
6105 | return NULL; |
6106 | } |
6107 | int _start_lineno = p->tokens[_mark]->lineno; |
6108 | UNUSED(_start_lineno); // Only used by EXTRA macro |
6109 | int _start_col_offset = p->tokens[_mark]->col_offset; |
6110 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
6111 | { // signed_number !('+' | '-') |
6112 | if (p->error_indicator) { |
6113 | p->level--; |
6114 | return NULL; |
6115 | } |
6116 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')" )); |
6117 | expr_ty value; |
6118 | if ( |
6119 | (value = signed_number_rule(p)) // signed_number |
6120 | && |
6121 | _PyPegen_lookahead(0, _tmp_53_rule, p) |
6122 | ) |
6123 | { |
6124 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')" )); |
6125 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6126 | if (_token == NULL) { |
6127 | p->level--; |
6128 | return NULL; |
6129 | } |
6130 | int _end_lineno = _token->end_lineno; |
6131 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6132 | int _end_col_offset = _token->end_col_offset; |
6133 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6134 | _res = _PyAST_MatchValue ( value , EXTRA ); |
6135 | if (_res == NULL && PyErr_Occurred()) { |
6136 | p->error_indicator = 1; |
6137 | p->level--; |
6138 | return NULL; |
6139 | } |
6140 | goto done; |
6141 | } |
6142 | p->mark = _mark; |
6143 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
6144 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "signed_number !('+' | '-')" )); |
6145 | } |
6146 | { // complex_number |
6147 | if (p->error_indicator) { |
6148 | p->level--; |
6149 | return NULL; |
6150 | } |
6151 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "complex_number" )); |
6152 | expr_ty value; |
6153 | if ( |
6154 | (value = complex_number_rule(p)) // complex_number |
6155 | ) |
6156 | { |
6157 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "complex_number" )); |
6158 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6159 | if (_token == NULL) { |
6160 | p->level--; |
6161 | return NULL; |
6162 | } |
6163 | int _end_lineno = _token->end_lineno; |
6164 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6165 | int _end_col_offset = _token->end_col_offset; |
6166 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6167 | _res = _PyAST_MatchValue ( value , EXTRA ); |
6168 | if (_res == NULL && PyErr_Occurred()) { |
6169 | p->error_indicator = 1; |
6170 | p->level--; |
6171 | return NULL; |
6172 | } |
6173 | goto done; |
6174 | } |
6175 | p->mark = _mark; |
6176 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
6177 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "complex_number" )); |
6178 | } |
6179 | { // strings |
6180 | if (p->error_indicator) { |
6181 | p->level--; |
6182 | return NULL; |
6183 | } |
6184 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "strings" )); |
6185 | expr_ty value; |
6186 | if ( |
6187 | (value = strings_rule(p)) // strings |
6188 | ) |
6189 | { |
6190 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "strings" )); |
6191 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6192 | if (_token == NULL) { |
6193 | p->level--; |
6194 | return NULL; |
6195 | } |
6196 | int _end_lineno = _token->end_lineno; |
6197 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6198 | int _end_col_offset = _token->end_col_offset; |
6199 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6200 | _res = _PyAST_MatchValue ( value , EXTRA ); |
6201 | if (_res == NULL && PyErr_Occurred()) { |
6202 | p->error_indicator = 1; |
6203 | p->level--; |
6204 | return NULL; |
6205 | } |
6206 | goto done; |
6207 | } |
6208 | p->mark = _mark; |
6209 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
6210 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "strings" )); |
6211 | } |
6212 | { // 'None' |
6213 | if (p->error_indicator) { |
6214 | p->level--; |
6215 | return NULL; |
6216 | } |
6217 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'None'" )); |
6218 | Token * _keyword; |
6219 | if ( |
6220 | (_keyword = _PyPegen_expect_token(p, 523)) // token='None' |
6221 | ) |
6222 | { |
6223 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'None'" )); |
6224 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6225 | if (_token == NULL) { |
6226 | p->level--; |
6227 | return NULL; |
6228 | } |
6229 | int _end_lineno = _token->end_lineno; |
6230 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6231 | int _end_col_offset = _token->end_col_offset; |
6232 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6233 | _res = _PyAST_MatchSingleton ( Py_None , EXTRA ); |
6234 | if (_res == NULL && PyErr_Occurred()) { |
6235 | p->error_indicator = 1; |
6236 | p->level--; |
6237 | return NULL; |
6238 | } |
6239 | goto done; |
6240 | } |
6241 | p->mark = _mark; |
6242 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
6243 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'None'" )); |
6244 | } |
6245 | { // 'True' |
6246 | if (p->error_indicator) { |
6247 | p->level--; |
6248 | return NULL; |
6249 | } |
6250 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'True'" )); |
6251 | Token * _keyword; |
6252 | if ( |
6253 | (_keyword = _PyPegen_expect_token(p, 524)) // token='True' |
6254 | ) |
6255 | { |
6256 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'True'" )); |
6257 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6258 | if (_token == NULL) { |
6259 | p->level--; |
6260 | return NULL; |
6261 | } |
6262 | int _end_lineno = _token->end_lineno; |
6263 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6264 | int _end_col_offset = _token->end_col_offset; |
6265 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6266 | _res = _PyAST_MatchSingleton ( Py_True , EXTRA ); |
6267 | if (_res == NULL && PyErr_Occurred()) { |
6268 | p->error_indicator = 1; |
6269 | p->level--; |
6270 | return NULL; |
6271 | } |
6272 | goto done; |
6273 | } |
6274 | p->mark = _mark; |
6275 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
6276 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'True'" )); |
6277 | } |
6278 | { // 'False' |
6279 | if (p->error_indicator) { |
6280 | p->level--; |
6281 | return NULL; |
6282 | } |
6283 | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'False'" )); |
6284 | Token * _keyword; |
6285 | if ( |
6286 | (_keyword = _PyPegen_expect_token(p, 525)) // token='False' |
6287 | ) |
6288 | { |
6289 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'False'" )); |
6290 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6291 | if (_token == NULL) { |
6292 | p->level--; |
6293 | return NULL; |
6294 | } |
6295 | int _end_lineno = _token->end_lineno; |
6296 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6297 | int _end_col_offset = _token->end_col_offset; |
6298 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6299 | _res = _PyAST_MatchSingleton ( Py_False , EXTRA ); |
6300 | if (_res == NULL && PyErr_Occurred()) { |
6301 | p->error_indicator = 1; |
6302 | p->level--; |
6303 | return NULL; |
6304 | } |
6305 | goto done; |
6306 | } |
6307 | p->mark = _mark; |
6308 | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
6309 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'False'" )); |
6310 | } |
6311 | _res = NULL; |
6312 | done: |
6313 | p->level--; |
6314 | return _res; |
6315 | } |
6316 | |
6317 | // literal_expr: |
6318 | // | signed_number !('+' | '-') |
6319 | // | complex_number |
6320 | // | strings |
6321 | // | 'None' |
6322 | // | 'True' |
6323 | // | 'False' |
6324 | static expr_ty |
6325 | literal_expr_rule(Parser *p) |
6326 | { |
6327 | if (p->level++ == MAXSTACK) { |
6328 | p->error_indicator = 1; |
6329 | PyErr_NoMemory(); |
6330 | } |
6331 | if (p->error_indicator) { |
6332 | p->level--; |
6333 | return NULL; |
6334 | } |
6335 | expr_ty _res = NULL; |
6336 | int _mark = p->mark; |
6337 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
6338 | p->error_indicator = 1; |
6339 | p->level--; |
6340 | return NULL; |
6341 | } |
6342 | int _start_lineno = p->tokens[_mark]->lineno; |
6343 | UNUSED(_start_lineno); // Only used by EXTRA macro |
6344 | int _start_col_offset = p->tokens[_mark]->col_offset; |
6345 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
6346 | { // signed_number !('+' | '-') |
6347 | if (p->error_indicator) { |
6348 | p->level--; |
6349 | return NULL; |
6350 | } |
6351 | D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')" )); |
6352 | expr_ty signed_number_var; |
6353 | if ( |
6354 | (signed_number_var = signed_number_rule(p)) // signed_number |
6355 | && |
6356 | _PyPegen_lookahead(0, _tmp_54_rule, p) |
6357 | ) |
6358 | { |
6359 | D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')" )); |
6360 | _res = signed_number_var; |
6361 | goto done; |
6362 | } |
6363 | p->mark = _mark; |
6364 | D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
6365 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "signed_number !('+' | '-')" )); |
6366 | } |
6367 | { // complex_number |
6368 | if (p->error_indicator) { |
6369 | p->level--; |
6370 | return NULL; |
6371 | } |
6372 | D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "complex_number" )); |
6373 | expr_ty complex_number_var; |
6374 | if ( |
6375 | (complex_number_var = complex_number_rule(p)) // complex_number |
6376 | ) |
6377 | { |
6378 | D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "complex_number" )); |
6379 | _res = complex_number_var; |
6380 | goto done; |
6381 | } |
6382 | p->mark = _mark; |
6383 | D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
6384 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "complex_number" )); |
6385 | } |
6386 | { // strings |
6387 | if (p->error_indicator) { |
6388 | p->level--; |
6389 | return NULL; |
6390 | } |
6391 | D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "strings" )); |
6392 | expr_ty strings_var; |
6393 | if ( |
6394 | (strings_var = strings_rule(p)) // strings |
6395 | ) |
6396 | { |
6397 | D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "strings" )); |
6398 | _res = strings_var; |
6399 | goto done; |
6400 | } |
6401 | p->mark = _mark; |
6402 | D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
6403 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "strings" )); |
6404 | } |
6405 | { // 'None' |
6406 | if (p->error_indicator) { |
6407 | p->level--; |
6408 | return NULL; |
6409 | } |
6410 | D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'None'" )); |
6411 | Token * _keyword; |
6412 | if ( |
6413 | (_keyword = _PyPegen_expect_token(p, 523)) // token='None' |
6414 | ) |
6415 | { |
6416 | D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'None'" )); |
6417 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6418 | if (_token == NULL) { |
6419 | p->level--; |
6420 | return NULL; |
6421 | } |
6422 | int _end_lineno = _token->end_lineno; |
6423 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6424 | int _end_col_offset = _token->end_col_offset; |
6425 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6426 | _res = _PyAST_Constant ( Py_None , NULL , EXTRA ); |
6427 | if (_res == NULL && PyErr_Occurred()) { |
6428 | p->error_indicator = 1; |
6429 | p->level--; |
6430 | return NULL; |
6431 | } |
6432 | goto done; |
6433 | } |
6434 | p->mark = _mark; |
6435 | D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
6436 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'None'" )); |
6437 | } |
6438 | { // 'True' |
6439 | if (p->error_indicator) { |
6440 | p->level--; |
6441 | return NULL; |
6442 | } |
6443 | D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'True'" )); |
6444 | Token * _keyword; |
6445 | if ( |
6446 | (_keyword = _PyPegen_expect_token(p, 524)) // token='True' |
6447 | ) |
6448 | { |
6449 | D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'True'" )); |
6450 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6451 | if (_token == NULL) { |
6452 | p->level--; |
6453 | return NULL; |
6454 | } |
6455 | int _end_lineno = _token->end_lineno; |
6456 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6457 | int _end_col_offset = _token->end_col_offset; |
6458 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6459 | _res = _PyAST_Constant ( Py_True , NULL , EXTRA ); |
6460 | if (_res == NULL && PyErr_Occurred()) { |
6461 | p->error_indicator = 1; |
6462 | p->level--; |
6463 | return NULL; |
6464 | } |
6465 | goto done; |
6466 | } |
6467 | p->mark = _mark; |
6468 | D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
6469 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'True'" )); |
6470 | } |
6471 | { // 'False' |
6472 | if (p->error_indicator) { |
6473 | p->level--; |
6474 | return NULL; |
6475 | } |
6476 | D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'False'" )); |
6477 | Token * _keyword; |
6478 | if ( |
6479 | (_keyword = _PyPegen_expect_token(p, 525)) // token='False' |
6480 | ) |
6481 | { |
6482 | D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'False'" )); |
6483 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6484 | if (_token == NULL) { |
6485 | p->level--; |
6486 | return NULL; |
6487 | } |
6488 | int _end_lineno = _token->end_lineno; |
6489 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6490 | int _end_col_offset = _token->end_col_offset; |
6491 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6492 | _res = _PyAST_Constant ( Py_False , NULL , EXTRA ); |
6493 | if (_res == NULL && PyErr_Occurred()) { |
6494 | p->error_indicator = 1; |
6495 | p->level--; |
6496 | return NULL; |
6497 | } |
6498 | goto done; |
6499 | } |
6500 | p->mark = _mark; |
6501 | D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
6502 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'False'" )); |
6503 | } |
6504 | _res = NULL; |
6505 | done: |
6506 | p->level--; |
6507 | return _res; |
6508 | } |
6509 | |
6510 | // complex_number: |
6511 | // | signed_real_number '+' imaginary_number |
6512 | // | signed_real_number '-' imaginary_number |
6513 | static expr_ty |
6514 | complex_number_rule(Parser *p) |
6515 | { |
6516 | if (p->level++ == MAXSTACK) { |
6517 | p->error_indicator = 1; |
6518 | PyErr_NoMemory(); |
6519 | } |
6520 | if (p->error_indicator) { |
6521 | p->level--; |
6522 | return NULL; |
6523 | } |
6524 | expr_ty _res = NULL; |
6525 | int _mark = p->mark; |
6526 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
6527 | p->error_indicator = 1; |
6528 | p->level--; |
6529 | return NULL; |
6530 | } |
6531 | int _start_lineno = p->tokens[_mark]->lineno; |
6532 | UNUSED(_start_lineno); // Only used by EXTRA macro |
6533 | int _start_col_offset = p->tokens[_mark]->col_offset; |
6534 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
6535 | { // signed_real_number '+' imaginary_number |
6536 | if (p->error_indicator) { |
6537 | p->level--; |
6538 | return NULL; |
6539 | } |
6540 | D(fprintf(stderr, "%*c> complex_number[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "signed_real_number '+' imaginary_number" )); |
6541 | Token * _literal; |
6542 | expr_ty imag; |
6543 | expr_ty real; |
6544 | if ( |
6545 | (real = signed_real_number_rule(p)) // signed_real_number |
6546 | && |
6547 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
6548 | && |
6549 | (imag = imaginary_number_rule(p)) // imaginary_number |
6550 | ) |
6551 | { |
6552 | D(fprintf(stderr, "%*c+ complex_number[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "signed_real_number '+' imaginary_number" )); |
6553 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6554 | if (_token == NULL) { |
6555 | p->level--; |
6556 | return NULL; |
6557 | } |
6558 | int _end_lineno = _token->end_lineno; |
6559 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6560 | int _end_col_offset = _token->end_col_offset; |
6561 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6562 | _res = _PyAST_BinOp ( real , Add , imag , EXTRA ); |
6563 | if (_res == NULL && PyErr_Occurred()) { |
6564 | p->error_indicator = 1; |
6565 | p->level--; |
6566 | return NULL; |
6567 | } |
6568 | goto done; |
6569 | } |
6570 | p->mark = _mark; |
6571 | D(fprintf(stderr, "%*c%s complex_number[%d-%d]: %s failed!\n" , p->level, ' ', |
6572 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "signed_real_number '+' imaginary_number" )); |
6573 | } |
6574 | { // signed_real_number '-' imaginary_number |
6575 | if (p->error_indicator) { |
6576 | p->level--; |
6577 | return NULL; |
6578 | } |
6579 | D(fprintf(stderr, "%*c> complex_number[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "signed_real_number '-' imaginary_number" )); |
6580 | Token * _literal; |
6581 | expr_ty imag; |
6582 | expr_ty real; |
6583 | if ( |
6584 | (real = signed_real_number_rule(p)) // signed_real_number |
6585 | && |
6586 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
6587 | && |
6588 | (imag = imaginary_number_rule(p)) // imaginary_number |
6589 | ) |
6590 | { |
6591 | D(fprintf(stderr, "%*c+ complex_number[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "signed_real_number '-' imaginary_number" )); |
6592 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6593 | if (_token == NULL) { |
6594 | p->level--; |
6595 | return NULL; |
6596 | } |
6597 | int _end_lineno = _token->end_lineno; |
6598 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6599 | int _end_col_offset = _token->end_col_offset; |
6600 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6601 | _res = _PyAST_BinOp ( real , Sub , imag , EXTRA ); |
6602 | if (_res == NULL && PyErr_Occurred()) { |
6603 | p->error_indicator = 1; |
6604 | p->level--; |
6605 | return NULL; |
6606 | } |
6607 | goto done; |
6608 | } |
6609 | p->mark = _mark; |
6610 | D(fprintf(stderr, "%*c%s complex_number[%d-%d]: %s failed!\n" , p->level, ' ', |
6611 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "signed_real_number '-' imaginary_number" )); |
6612 | } |
6613 | _res = NULL; |
6614 | done: |
6615 | p->level--; |
6616 | return _res; |
6617 | } |
6618 | |
6619 | // signed_number: NUMBER | '-' NUMBER |
6620 | static expr_ty |
6621 | signed_number_rule(Parser *p) |
6622 | { |
6623 | if (p->level++ == MAXSTACK) { |
6624 | p->error_indicator = 1; |
6625 | PyErr_NoMemory(); |
6626 | } |
6627 | if (p->error_indicator) { |
6628 | p->level--; |
6629 | return NULL; |
6630 | } |
6631 | expr_ty _res = NULL; |
6632 | int _mark = p->mark; |
6633 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
6634 | p->error_indicator = 1; |
6635 | p->level--; |
6636 | return NULL; |
6637 | } |
6638 | int _start_lineno = p->tokens[_mark]->lineno; |
6639 | UNUSED(_start_lineno); // Only used by EXTRA macro |
6640 | int _start_col_offset = p->tokens[_mark]->col_offset; |
6641 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
6642 | { // NUMBER |
6643 | if (p->error_indicator) { |
6644 | p->level--; |
6645 | return NULL; |
6646 | } |
6647 | D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NUMBER" )); |
6648 | expr_ty number_var; |
6649 | if ( |
6650 | (number_var = _PyPegen_number_token(p)) // NUMBER |
6651 | ) |
6652 | { |
6653 | D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NUMBER" )); |
6654 | _res = number_var; |
6655 | goto done; |
6656 | } |
6657 | p->mark = _mark; |
6658 | D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n" , p->level, ' ', |
6659 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NUMBER" )); |
6660 | } |
6661 | { // '-' NUMBER |
6662 | if (p->error_indicator) { |
6663 | p->level--; |
6664 | return NULL; |
6665 | } |
6666 | D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'-' NUMBER" )); |
6667 | Token * _literal; |
6668 | expr_ty number; |
6669 | if ( |
6670 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
6671 | && |
6672 | (number = _PyPegen_number_token(p)) // NUMBER |
6673 | ) |
6674 | { |
6675 | D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'-' NUMBER" )); |
6676 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6677 | if (_token == NULL) { |
6678 | p->level--; |
6679 | return NULL; |
6680 | } |
6681 | int _end_lineno = _token->end_lineno; |
6682 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6683 | int _end_col_offset = _token->end_col_offset; |
6684 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6685 | _res = _PyAST_UnaryOp ( USub , number , EXTRA ); |
6686 | if (_res == NULL && PyErr_Occurred()) { |
6687 | p->error_indicator = 1; |
6688 | p->level--; |
6689 | return NULL; |
6690 | } |
6691 | goto done; |
6692 | } |
6693 | p->mark = _mark; |
6694 | D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n" , p->level, ' ', |
6695 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'-' NUMBER" )); |
6696 | } |
6697 | _res = NULL; |
6698 | done: |
6699 | p->level--; |
6700 | return _res; |
6701 | } |
6702 | |
6703 | // signed_real_number: real_number | '-' real_number |
6704 | static expr_ty |
6705 | signed_real_number_rule(Parser *p) |
6706 | { |
6707 | if (p->level++ == MAXSTACK) { |
6708 | p->error_indicator = 1; |
6709 | PyErr_NoMemory(); |
6710 | } |
6711 | if (p->error_indicator) { |
6712 | p->level--; |
6713 | return NULL; |
6714 | } |
6715 | expr_ty _res = NULL; |
6716 | int _mark = p->mark; |
6717 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
6718 | p->error_indicator = 1; |
6719 | p->level--; |
6720 | return NULL; |
6721 | } |
6722 | int _start_lineno = p->tokens[_mark]->lineno; |
6723 | UNUSED(_start_lineno); // Only used by EXTRA macro |
6724 | int _start_col_offset = p->tokens[_mark]->col_offset; |
6725 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
6726 | { // real_number |
6727 | if (p->error_indicator) { |
6728 | p->level--; |
6729 | return NULL; |
6730 | } |
6731 | D(fprintf(stderr, "%*c> signed_real_number[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "real_number" )); |
6732 | expr_ty real_number_var; |
6733 | if ( |
6734 | (real_number_var = real_number_rule(p)) // real_number |
6735 | ) |
6736 | { |
6737 | D(fprintf(stderr, "%*c+ signed_real_number[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "real_number" )); |
6738 | _res = real_number_var; |
6739 | goto done; |
6740 | } |
6741 | p->mark = _mark; |
6742 | D(fprintf(stderr, "%*c%s signed_real_number[%d-%d]: %s failed!\n" , p->level, ' ', |
6743 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "real_number" )); |
6744 | } |
6745 | { // '-' real_number |
6746 | if (p->error_indicator) { |
6747 | p->level--; |
6748 | return NULL; |
6749 | } |
6750 | D(fprintf(stderr, "%*c> signed_real_number[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'-' real_number" )); |
6751 | Token * _literal; |
6752 | expr_ty real; |
6753 | if ( |
6754 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
6755 | && |
6756 | (real = real_number_rule(p)) // real_number |
6757 | ) |
6758 | { |
6759 | D(fprintf(stderr, "%*c+ signed_real_number[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'-' real_number" )); |
6760 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6761 | if (_token == NULL) { |
6762 | p->level--; |
6763 | return NULL; |
6764 | } |
6765 | int _end_lineno = _token->end_lineno; |
6766 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6767 | int _end_col_offset = _token->end_col_offset; |
6768 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6769 | _res = _PyAST_UnaryOp ( USub , real , EXTRA ); |
6770 | if (_res == NULL && PyErr_Occurred()) { |
6771 | p->error_indicator = 1; |
6772 | p->level--; |
6773 | return NULL; |
6774 | } |
6775 | goto done; |
6776 | } |
6777 | p->mark = _mark; |
6778 | D(fprintf(stderr, "%*c%s signed_real_number[%d-%d]: %s failed!\n" , p->level, ' ', |
6779 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'-' real_number" )); |
6780 | } |
6781 | _res = NULL; |
6782 | done: |
6783 | p->level--; |
6784 | return _res; |
6785 | } |
6786 | |
6787 | // real_number: NUMBER |
6788 | static expr_ty |
6789 | real_number_rule(Parser *p) |
6790 | { |
6791 | if (p->level++ == MAXSTACK) { |
6792 | p->error_indicator = 1; |
6793 | PyErr_NoMemory(); |
6794 | } |
6795 | if (p->error_indicator) { |
6796 | p->level--; |
6797 | return NULL; |
6798 | } |
6799 | expr_ty _res = NULL; |
6800 | int _mark = p->mark; |
6801 | { // NUMBER |
6802 | if (p->error_indicator) { |
6803 | p->level--; |
6804 | return NULL; |
6805 | } |
6806 | D(fprintf(stderr, "%*c> real_number[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NUMBER" )); |
6807 | expr_ty real; |
6808 | if ( |
6809 | (real = _PyPegen_number_token(p)) // NUMBER |
6810 | ) |
6811 | { |
6812 | D(fprintf(stderr, "%*c+ real_number[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NUMBER" )); |
6813 | _res = _PyPegen_ensure_real ( p , real ); |
6814 | if (_res == NULL && PyErr_Occurred()) { |
6815 | p->error_indicator = 1; |
6816 | p->level--; |
6817 | return NULL; |
6818 | } |
6819 | goto done; |
6820 | } |
6821 | p->mark = _mark; |
6822 | D(fprintf(stderr, "%*c%s real_number[%d-%d]: %s failed!\n" , p->level, ' ', |
6823 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NUMBER" )); |
6824 | } |
6825 | _res = NULL; |
6826 | done: |
6827 | p->level--; |
6828 | return _res; |
6829 | } |
6830 | |
6831 | // imaginary_number: NUMBER |
6832 | static expr_ty |
6833 | imaginary_number_rule(Parser *p) |
6834 | { |
6835 | if (p->level++ == MAXSTACK) { |
6836 | p->error_indicator = 1; |
6837 | PyErr_NoMemory(); |
6838 | } |
6839 | if (p->error_indicator) { |
6840 | p->level--; |
6841 | return NULL; |
6842 | } |
6843 | expr_ty _res = NULL; |
6844 | int _mark = p->mark; |
6845 | { // NUMBER |
6846 | if (p->error_indicator) { |
6847 | p->level--; |
6848 | return NULL; |
6849 | } |
6850 | D(fprintf(stderr, "%*c> imaginary_number[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NUMBER" )); |
6851 | expr_ty imag; |
6852 | if ( |
6853 | (imag = _PyPegen_number_token(p)) // NUMBER |
6854 | ) |
6855 | { |
6856 | D(fprintf(stderr, "%*c+ imaginary_number[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NUMBER" )); |
6857 | _res = _PyPegen_ensure_imaginary ( p , imag ); |
6858 | if (_res == NULL && PyErr_Occurred()) { |
6859 | p->error_indicator = 1; |
6860 | p->level--; |
6861 | return NULL; |
6862 | } |
6863 | goto done; |
6864 | } |
6865 | p->mark = _mark; |
6866 | D(fprintf(stderr, "%*c%s imaginary_number[%d-%d]: %s failed!\n" , p->level, ' ', |
6867 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NUMBER" )); |
6868 | } |
6869 | _res = NULL; |
6870 | done: |
6871 | p->level--; |
6872 | return _res; |
6873 | } |
6874 | |
6875 | // capture_pattern: pattern_capture_target |
6876 | static pattern_ty |
6877 | capture_pattern_rule(Parser *p) |
6878 | { |
6879 | if (p->level++ == MAXSTACK) { |
6880 | p->error_indicator = 1; |
6881 | PyErr_NoMemory(); |
6882 | } |
6883 | if (p->error_indicator) { |
6884 | p->level--; |
6885 | return NULL; |
6886 | } |
6887 | pattern_ty _res = NULL; |
6888 | int _mark = p->mark; |
6889 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
6890 | p->error_indicator = 1; |
6891 | p->level--; |
6892 | return NULL; |
6893 | } |
6894 | int _start_lineno = p->tokens[_mark]->lineno; |
6895 | UNUSED(_start_lineno); // Only used by EXTRA macro |
6896 | int _start_col_offset = p->tokens[_mark]->col_offset; |
6897 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
6898 | { // pattern_capture_target |
6899 | if (p->error_indicator) { |
6900 | p->level--; |
6901 | return NULL; |
6902 | } |
6903 | D(fprintf(stderr, "%*c> capture_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "pattern_capture_target" )); |
6904 | expr_ty target; |
6905 | if ( |
6906 | (target = pattern_capture_target_rule(p)) // pattern_capture_target |
6907 | ) |
6908 | { |
6909 | D(fprintf(stderr, "%*c+ capture_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "pattern_capture_target" )); |
6910 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6911 | if (_token == NULL) { |
6912 | p->level--; |
6913 | return NULL; |
6914 | } |
6915 | int _end_lineno = _token->end_lineno; |
6916 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6917 | int _end_col_offset = _token->end_col_offset; |
6918 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6919 | _res = _PyAST_MatchAs ( NULL , target -> v . Name . id , EXTRA ); |
6920 | if (_res == NULL && PyErr_Occurred()) { |
6921 | p->error_indicator = 1; |
6922 | p->level--; |
6923 | return NULL; |
6924 | } |
6925 | goto done; |
6926 | } |
6927 | p->mark = _mark; |
6928 | D(fprintf(stderr, "%*c%s capture_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
6929 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "pattern_capture_target" )); |
6930 | } |
6931 | _res = NULL; |
6932 | done: |
6933 | p->level--; |
6934 | return _res; |
6935 | } |
6936 | |
6937 | // pattern_capture_target: !"_" NAME !('.' | '(' | '=') |
6938 | static expr_ty |
6939 | pattern_capture_target_rule(Parser *p) |
6940 | { |
6941 | if (p->level++ == MAXSTACK) { |
6942 | p->error_indicator = 1; |
6943 | PyErr_NoMemory(); |
6944 | } |
6945 | if (p->error_indicator) { |
6946 | p->level--; |
6947 | return NULL; |
6948 | } |
6949 | expr_ty _res = NULL; |
6950 | int _mark = p->mark; |
6951 | { // !"_" NAME !('.' | '(' | '=') |
6952 | if (p->error_indicator) { |
6953 | p->level--; |
6954 | return NULL; |
6955 | } |
6956 | D(fprintf(stderr, "%*c> pattern_capture_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')" )); |
6957 | expr_ty name; |
6958 | if ( |
6959 | _PyPegen_lookahead_with_string(0, _PyPegen_expect_soft_keyword, p, "_" ) |
6960 | && |
6961 | (name = _PyPegen_name_token(p)) // NAME |
6962 | && |
6963 | _PyPegen_lookahead(0, _tmp_55_rule, p) |
6964 | ) |
6965 | { |
6966 | D(fprintf(stderr, "%*c+ pattern_capture_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')" )); |
6967 | _res = _PyPegen_set_expr_context ( p , name , Store ); |
6968 | if (_res == NULL && PyErr_Occurred()) { |
6969 | p->error_indicator = 1; |
6970 | p->level--; |
6971 | return NULL; |
6972 | } |
6973 | goto done; |
6974 | } |
6975 | p->mark = _mark; |
6976 | D(fprintf(stderr, "%*c%s pattern_capture_target[%d-%d]: %s failed!\n" , p->level, ' ', |
6977 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')" )); |
6978 | } |
6979 | _res = NULL; |
6980 | done: |
6981 | p->level--; |
6982 | return _res; |
6983 | } |
6984 | |
6985 | // wildcard_pattern: "_" |
6986 | static pattern_ty |
6987 | wildcard_pattern_rule(Parser *p) |
6988 | { |
6989 | if (p->level++ == MAXSTACK) { |
6990 | p->error_indicator = 1; |
6991 | PyErr_NoMemory(); |
6992 | } |
6993 | if (p->error_indicator) { |
6994 | p->level--; |
6995 | return NULL; |
6996 | } |
6997 | pattern_ty _res = NULL; |
6998 | int _mark = p->mark; |
6999 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
7000 | p->error_indicator = 1; |
7001 | p->level--; |
7002 | return NULL; |
7003 | } |
7004 | int _start_lineno = p->tokens[_mark]->lineno; |
7005 | UNUSED(_start_lineno); // Only used by EXTRA macro |
7006 | int _start_col_offset = p->tokens[_mark]->col_offset; |
7007 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
7008 | { // "_" |
7009 | if (p->error_indicator) { |
7010 | p->level--; |
7011 | return NULL; |
7012 | } |
7013 | D(fprintf(stderr, "%*c> wildcard_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "\"_\"" )); |
7014 | expr_ty _keyword; |
7015 | if ( |
7016 | (_keyword = _PyPegen_expect_soft_keyword(p, "_" )) // soft_keyword='"_"' |
7017 | ) |
7018 | { |
7019 | D(fprintf(stderr, "%*c+ wildcard_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "\"_\"" )); |
7020 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7021 | if (_token == NULL) { |
7022 | p->level--; |
7023 | return NULL; |
7024 | } |
7025 | int _end_lineno = _token->end_lineno; |
7026 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7027 | int _end_col_offset = _token->end_col_offset; |
7028 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7029 | _res = _PyAST_MatchAs ( NULL , NULL , EXTRA ); |
7030 | if (_res == NULL && PyErr_Occurred()) { |
7031 | p->error_indicator = 1; |
7032 | p->level--; |
7033 | return NULL; |
7034 | } |
7035 | goto done; |
7036 | } |
7037 | p->mark = _mark; |
7038 | D(fprintf(stderr, "%*c%s wildcard_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7039 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "\"_\"" )); |
7040 | } |
7041 | _res = NULL; |
7042 | done: |
7043 | p->level--; |
7044 | return _res; |
7045 | } |
7046 | |
7047 | // value_pattern: attr !('.' | '(' | '=') |
7048 | static pattern_ty |
7049 | value_pattern_rule(Parser *p) |
7050 | { |
7051 | if (p->level++ == MAXSTACK) { |
7052 | p->error_indicator = 1; |
7053 | PyErr_NoMemory(); |
7054 | } |
7055 | if (p->error_indicator) { |
7056 | p->level--; |
7057 | return NULL; |
7058 | } |
7059 | pattern_ty _res = NULL; |
7060 | int _mark = p->mark; |
7061 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
7062 | p->error_indicator = 1; |
7063 | p->level--; |
7064 | return NULL; |
7065 | } |
7066 | int _start_lineno = p->tokens[_mark]->lineno; |
7067 | UNUSED(_start_lineno); // Only used by EXTRA macro |
7068 | int _start_col_offset = p->tokens[_mark]->col_offset; |
7069 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
7070 | { // attr !('.' | '(' | '=') |
7071 | if (p->error_indicator) { |
7072 | p->level--; |
7073 | return NULL; |
7074 | } |
7075 | D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')" )); |
7076 | expr_ty attr; |
7077 | if ( |
7078 | (attr = attr_rule(p)) // attr |
7079 | && |
7080 | _PyPegen_lookahead(0, _tmp_56_rule, p) |
7081 | ) |
7082 | { |
7083 | D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')" )); |
7084 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7085 | if (_token == NULL) { |
7086 | p->level--; |
7087 | return NULL; |
7088 | } |
7089 | int _end_lineno = _token->end_lineno; |
7090 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7091 | int _end_col_offset = _token->end_col_offset; |
7092 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7093 | _res = _PyAST_MatchValue ( attr , EXTRA ); |
7094 | if (_res == NULL && PyErr_Occurred()) { |
7095 | p->error_indicator = 1; |
7096 | p->level--; |
7097 | return NULL; |
7098 | } |
7099 | goto done; |
7100 | } |
7101 | p->mark = _mark; |
7102 | D(fprintf(stderr, "%*c%s value_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7103 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "attr !('.' | '(' | '=')" )); |
7104 | } |
7105 | _res = NULL; |
7106 | done: |
7107 | p->level--; |
7108 | return _res; |
7109 | } |
7110 | |
7111 | // Left-recursive |
7112 | // attr: name_or_attr '.' NAME |
7113 | static expr_ty attr_raw(Parser *); |
7114 | static expr_ty |
7115 | attr_rule(Parser *p) |
7116 | { |
7117 | if (p->level++ == MAXSTACK) { |
7118 | p->error_indicator = 1; |
7119 | PyErr_NoMemory(); |
7120 | } |
7121 | expr_ty _res = NULL; |
7122 | if (_PyPegen_is_memoized(p, attr_type, &_res)) { |
7123 | p->level--; |
7124 | return _res; |
7125 | } |
7126 | int _mark = p->mark; |
7127 | int _resmark = p->mark; |
7128 | while (1) { |
7129 | int tmpvar_1 = _PyPegen_update_memo(p, _mark, attr_type, _res); |
7130 | if (tmpvar_1) { |
7131 | p->level--; |
7132 | return _res; |
7133 | } |
7134 | p->mark = _mark; |
7135 | void *_raw = attr_raw(p); |
7136 | if (p->error_indicator) { |
7137 | p->level--; |
7138 | return NULL; |
7139 | } |
7140 | if (_raw == NULL || p->mark <= _resmark) |
7141 | break; |
7142 | _resmark = p->mark; |
7143 | _res = _raw; |
7144 | } |
7145 | p->mark = _resmark; |
7146 | p->level--; |
7147 | return _res; |
7148 | } |
7149 | static expr_ty |
7150 | attr_raw(Parser *p) |
7151 | { |
7152 | if (p->level++ == MAXSTACK) { |
7153 | p->error_indicator = 1; |
7154 | PyErr_NoMemory(); |
7155 | } |
7156 | if (p->error_indicator) { |
7157 | p->level--; |
7158 | return NULL; |
7159 | } |
7160 | expr_ty _res = NULL; |
7161 | int _mark = p->mark; |
7162 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
7163 | p->error_indicator = 1; |
7164 | p->level--; |
7165 | return NULL; |
7166 | } |
7167 | int _start_lineno = p->tokens[_mark]->lineno; |
7168 | UNUSED(_start_lineno); // Only used by EXTRA macro |
7169 | int _start_col_offset = p->tokens[_mark]->col_offset; |
7170 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
7171 | { // name_or_attr '.' NAME |
7172 | if (p->error_indicator) { |
7173 | p->level--; |
7174 | return NULL; |
7175 | } |
7176 | D(fprintf(stderr, "%*c> attr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME" )); |
7177 | Token * _literal; |
7178 | expr_ty attr; |
7179 | expr_ty value; |
7180 | if ( |
7181 | (value = name_or_attr_rule(p)) // name_or_attr |
7182 | && |
7183 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
7184 | && |
7185 | (attr = _PyPegen_name_token(p)) // NAME |
7186 | ) |
7187 | { |
7188 | D(fprintf(stderr, "%*c+ attr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME" )); |
7189 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7190 | if (_token == NULL) { |
7191 | p->level--; |
7192 | return NULL; |
7193 | } |
7194 | int _end_lineno = _token->end_lineno; |
7195 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7196 | int _end_col_offset = _token->end_col_offset; |
7197 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7198 | _res = _PyAST_Attribute ( value , attr -> v . Name . id , Load , EXTRA ); |
7199 | if (_res == NULL && PyErr_Occurred()) { |
7200 | p->error_indicator = 1; |
7201 | p->level--; |
7202 | return NULL; |
7203 | } |
7204 | goto done; |
7205 | } |
7206 | p->mark = _mark; |
7207 | D(fprintf(stderr, "%*c%s attr[%d-%d]: %s failed!\n" , p->level, ' ', |
7208 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "name_or_attr '.' NAME" )); |
7209 | } |
7210 | _res = NULL; |
7211 | done: |
7212 | p->level--; |
7213 | return _res; |
7214 | } |
7215 | |
7216 | // Left-recursive |
7217 | // name_or_attr: attr | NAME |
7218 | static expr_ty |
7219 | name_or_attr_rule(Parser *p) |
7220 | { |
7221 | if (p->level++ == MAXSTACK) { |
7222 | p->error_indicator = 1; |
7223 | PyErr_NoMemory(); |
7224 | } |
7225 | if (p->error_indicator) { |
7226 | p->level--; |
7227 | return NULL; |
7228 | } |
7229 | expr_ty _res = NULL; |
7230 | int _mark = p->mark; |
7231 | { // attr |
7232 | if (p->error_indicator) { |
7233 | p->level--; |
7234 | return NULL; |
7235 | } |
7236 | D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "attr" )); |
7237 | expr_ty attr_var; |
7238 | if ( |
7239 | (attr_var = attr_rule(p)) // attr |
7240 | ) |
7241 | { |
7242 | D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "attr" )); |
7243 | _res = attr_var; |
7244 | goto done; |
7245 | } |
7246 | p->mark = _mark; |
7247 | D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n" , p->level, ' ', |
7248 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "attr" )); |
7249 | } |
7250 | { // NAME |
7251 | if (p->error_indicator) { |
7252 | p->level--; |
7253 | return NULL; |
7254 | } |
7255 | D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
7256 | expr_ty name_var; |
7257 | if ( |
7258 | (name_var = _PyPegen_name_token(p)) // NAME |
7259 | ) |
7260 | { |
7261 | D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
7262 | _res = name_var; |
7263 | goto done; |
7264 | } |
7265 | p->mark = _mark; |
7266 | D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n" , p->level, ' ', |
7267 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME" )); |
7268 | } |
7269 | _res = NULL; |
7270 | done: |
7271 | p->level--; |
7272 | return _res; |
7273 | } |
7274 | |
7275 | // group_pattern: '(' pattern ')' |
7276 | static pattern_ty |
7277 | group_pattern_rule(Parser *p) |
7278 | { |
7279 | if (p->level++ == MAXSTACK) { |
7280 | p->error_indicator = 1; |
7281 | PyErr_NoMemory(); |
7282 | } |
7283 | if (p->error_indicator) { |
7284 | p->level--; |
7285 | return NULL; |
7286 | } |
7287 | pattern_ty _res = NULL; |
7288 | int _mark = p->mark; |
7289 | { // '(' pattern ')' |
7290 | if (p->error_indicator) { |
7291 | p->level--; |
7292 | return NULL; |
7293 | } |
7294 | D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' pattern ')'" )); |
7295 | Token * _literal; |
7296 | Token * _literal_1; |
7297 | pattern_ty pattern; |
7298 | if ( |
7299 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
7300 | && |
7301 | (pattern = pattern_rule(p)) // pattern |
7302 | && |
7303 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
7304 | ) |
7305 | { |
7306 | D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' pattern ')'" )); |
7307 | _res = pattern; |
7308 | if (_res == NULL && PyErr_Occurred()) { |
7309 | p->error_indicator = 1; |
7310 | p->level--; |
7311 | return NULL; |
7312 | } |
7313 | goto done; |
7314 | } |
7315 | p->mark = _mark; |
7316 | D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7317 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' pattern ')'" )); |
7318 | } |
7319 | _res = NULL; |
7320 | done: |
7321 | p->level--; |
7322 | return _res; |
7323 | } |
7324 | |
7325 | // sequence_pattern: '[' maybe_sequence_pattern? ']' | '(' open_sequence_pattern? ')' |
7326 | static pattern_ty |
7327 | sequence_pattern_rule(Parser *p) |
7328 | { |
7329 | if (p->level++ == MAXSTACK) { |
7330 | p->error_indicator = 1; |
7331 | PyErr_NoMemory(); |
7332 | } |
7333 | if (p->error_indicator) { |
7334 | p->level--; |
7335 | return NULL; |
7336 | } |
7337 | pattern_ty _res = NULL; |
7338 | int _mark = p->mark; |
7339 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
7340 | p->error_indicator = 1; |
7341 | p->level--; |
7342 | return NULL; |
7343 | } |
7344 | int _start_lineno = p->tokens[_mark]->lineno; |
7345 | UNUSED(_start_lineno); // Only used by EXTRA macro |
7346 | int _start_col_offset = p->tokens[_mark]->col_offset; |
7347 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
7348 | { // '[' maybe_sequence_pattern? ']' |
7349 | if (p->error_indicator) { |
7350 | p->level--; |
7351 | return NULL; |
7352 | } |
7353 | D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'" )); |
7354 | Token * _literal; |
7355 | Token * _literal_1; |
7356 | void *patterns; |
7357 | if ( |
7358 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
7359 | && |
7360 | (patterns = maybe_sequence_pattern_rule(p), !p->error_indicator) // maybe_sequence_pattern? |
7361 | && |
7362 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
7363 | ) |
7364 | { |
7365 | D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'" )); |
7366 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7367 | if (_token == NULL) { |
7368 | p->level--; |
7369 | return NULL; |
7370 | } |
7371 | int _end_lineno = _token->end_lineno; |
7372 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7373 | int _end_col_offset = _token->end_col_offset; |
7374 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7375 | _res = _PyAST_MatchSequence ( patterns , EXTRA ); |
7376 | if (_res == NULL && PyErr_Occurred()) { |
7377 | p->error_indicator = 1; |
7378 | p->level--; |
7379 | return NULL; |
7380 | } |
7381 | goto done; |
7382 | } |
7383 | p->mark = _mark; |
7384 | D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7385 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'[' maybe_sequence_pattern? ']'" )); |
7386 | } |
7387 | { // '(' open_sequence_pattern? ')' |
7388 | if (p->error_indicator) { |
7389 | p->level--; |
7390 | return NULL; |
7391 | } |
7392 | D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'" )); |
7393 | Token * _literal; |
7394 | Token * _literal_1; |
7395 | void *patterns; |
7396 | if ( |
7397 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
7398 | && |
7399 | (patterns = open_sequence_pattern_rule(p), !p->error_indicator) // open_sequence_pattern? |
7400 | && |
7401 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
7402 | ) |
7403 | { |
7404 | D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'" )); |
7405 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7406 | if (_token == NULL) { |
7407 | p->level--; |
7408 | return NULL; |
7409 | } |
7410 | int _end_lineno = _token->end_lineno; |
7411 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7412 | int _end_col_offset = _token->end_col_offset; |
7413 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7414 | _res = _PyAST_MatchSequence ( patterns , EXTRA ); |
7415 | if (_res == NULL && PyErr_Occurred()) { |
7416 | p->error_indicator = 1; |
7417 | p->level--; |
7418 | return NULL; |
7419 | } |
7420 | goto done; |
7421 | } |
7422 | p->mark = _mark; |
7423 | D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7424 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' open_sequence_pattern? ')'" )); |
7425 | } |
7426 | _res = NULL; |
7427 | done: |
7428 | p->level--; |
7429 | return _res; |
7430 | } |
7431 | |
7432 | // open_sequence_pattern: maybe_star_pattern ',' maybe_sequence_pattern? |
7433 | static asdl_seq* |
7434 | open_sequence_pattern_rule(Parser *p) |
7435 | { |
7436 | if (p->level++ == MAXSTACK) { |
7437 | p->error_indicator = 1; |
7438 | PyErr_NoMemory(); |
7439 | } |
7440 | if (p->error_indicator) { |
7441 | p->level--; |
7442 | return NULL; |
7443 | } |
7444 | asdl_seq* _res = NULL; |
7445 | int _mark = p->mark; |
7446 | { // maybe_star_pattern ',' maybe_sequence_pattern? |
7447 | if (p->error_indicator) { |
7448 | p->level--; |
7449 | return NULL; |
7450 | } |
7451 | D(fprintf(stderr, "%*c> open_sequence_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?" )); |
7452 | Token * _literal; |
7453 | pattern_ty pattern; |
7454 | void *patterns; |
7455 | if ( |
7456 | (pattern = maybe_star_pattern_rule(p)) // maybe_star_pattern |
7457 | && |
7458 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
7459 | && |
7460 | (patterns = maybe_sequence_pattern_rule(p), !p->error_indicator) // maybe_sequence_pattern? |
7461 | ) |
7462 | { |
7463 | D(fprintf(stderr, "%*c+ open_sequence_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?" )); |
7464 | _res = _PyPegen_seq_insert_in_front ( p , pattern , patterns ); |
7465 | if (_res == NULL && PyErr_Occurred()) { |
7466 | p->error_indicator = 1; |
7467 | p->level--; |
7468 | return NULL; |
7469 | } |
7470 | goto done; |
7471 | } |
7472 | p->mark = _mark; |
7473 | D(fprintf(stderr, "%*c%s open_sequence_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7474 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?" )); |
7475 | } |
7476 | _res = NULL; |
7477 | done: |
7478 | p->level--; |
7479 | return _res; |
7480 | } |
7481 | |
7482 | // maybe_sequence_pattern: ','.maybe_star_pattern+ ','? |
7483 | static asdl_seq* |
7484 | maybe_sequence_pattern_rule(Parser *p) |
7485 | { |
7486 | if (p->level++ == MAXSTACK) { |
7487 | p->error_indicator = 1; |
7488 | PyErr_NoMemory(); |
7489 | } |
7490 | if (p->error_indicator) { |
7491 | p->level--; |
7492 | return NULL; |
7493 | } |
7494 | asdl_seq* _res = NULL; |
7495 | int _mark = p->mark; |
7496 | { // ','.maybe_star_pattern+ ','? |
7497 | if (p->error_indicator) { |
7498 | p->level--; |
7499 | return NULL; |
7500 | } |
7501 | D(fprintf(stderr, "%*c> maybe_sequence_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?" )); |
7502 | void *_opt_var; |
7503 | UNUSED(_opt_var); // Silence compiler warnings |
7504 | asdl_seq * patterns; |
7505 | if ( |
7506 | (patterns = _gather_57_rule(p)) // ','.maybe_star_pattern+ |
7507 | && |
7508 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
7509 | ) |
7510 | { |
7511 | D(fprintf(stderr, "%*c+ maybe_sequence_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?" )); |
7512 | _res = patterns; |
7513 | if (_res == NULL && PyErr_Occurred()) { |
7514 | p->error_indicator = 1; |
7515 | p->level--; |
7516 | return NULL; |
7517 | } |
7518 | goto done; |
7519 | } |
7520 | p->mark = _mark; |
7521 | D(fprintf(stderr, "%*c%s maybe_sequence_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7522 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.maybe_star_pattern+ ','?" )); |
7523 | } |
7524 | _res = NULL; |
7525 | done: |
7526 | p->level--; |
7527 | return _res; |
7528 | } |
7529 | |
7530 | // maybe_star_pattern: star_pattern | pattern |
7531 | static pattern_ty |
7532 | maybe_star_pattern_rule(Parser *p) |
7533 | { |
7534 | if (p->level++ == MAXSTACK) { |
7535 | p->error_indicator = 1; |
7536 | PyErr_NoMemory(); |
7537 | } |
7538 | if (p->error_indicator) { |
7539 | p->level--; |
7540 | return NULL; |
7541 | } |
7542 | pattern_ty _res = NULL; |
7543 | int _mark = p->mark; |
7544 | { // star_pattern |
7545 | if (p->error_indicator) { |
7546 | p->level--; |
7547 | return NULL; |
7548 | } |
7549 | D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_pattern" )); |
7550 | pattern_ty star_pattern_var; |
7551 | if ( |
7552 | (star_pattern_var = star_pattern_rule(p)) // star_pattern |
7553 | ) |
7554 | { |
7555 | D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_pattern" )); |
7556 | _res = star_pattern_var; |
7557 | goto done; |
7558 | } |
7559 | p->mark = _mark; |
7560 | D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7561 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_pattern" )); |
7562 | } |
7563 | { // pattern |
7564 | if (p->error_indicator) { |
7565 | p->level--; |
7566 | return NULL; |
7567 | } |
7568 | D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "pattern" )); |
7569 | pattern_ty pattern_var; |
7570 | if ( |
7571 | (pattern_var = pattern_rule(p)) // pattern |
7572 | ) |
7573 | { |
7574 | D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "pattern" )); |
7575 | _res = pattern_var; |
7576 | goto done; |
7577 | } |
7578 | p->mark = _mark; |
7579 | D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7580 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "pattern" )); |
7581 | } |
7582 | _res = NULL; |
7583 | done: |
7584 | p->level--; |
7585 | return _res; |
7586 | } |
7587 | |
7588 | // star_pattern: '*' pattern_capture_target | '*' wildcard_pattern |
7589 | static pattern_ty |
7590 | star_pattern_rule(Parser *p) |
7591 | { |
7592 | if (p->level++ == MAXSTACK) { |
7593 | p->error_indicator = 1; |
7594 | PyErr_NoMemory(); |
7595 | } |
7596 | if (p->error_indicator) { |
7597 | p->level--; |
7598 | return NULL; |
7599 | } |
7600 | pattern_ty _res = NULL; |
7601 | int _mark = p->mark; |
7602 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
7603 | p->error_indicator = 1; |
7604 | p->level--; |
7605 | return NULL; |
7606 | } |
7607 | int _start_lineno = p->tokens[_mark]->lineno; |
7608 | UNUSED(_start_lineno); // Only used by EXTRA macro |
7609 | int _start_col_offset = p->tokens[_mark]->col_offset; |
7610 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
7611 | { // '*' pattern_capture_target |
7612 | if (p->error_indicator) { |
7613 | p->level--; |
7614 | return NULL; |
7615 | } |
7616 | D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' pattern_capture_target" )); |
7617 | Token * _literal; |
7618 | expr_ty target; |
7619 | if ( |
7620 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
7621 | && |
7622 | (target = pattern_capture_target_rule(p)) // pattern_capture_target |
7623 | ) |
7624 | { |
7625 | D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' pattern_capture_target" )); |
7626 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7627 | if (_token == NULL) { |
7628 | p->level--; |
7629 | return NULL; |
7630 | } |
7631 | int _end_lineno = _token->end_lineno; |
7632 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7633 | int _end_col_offset = _token->end_col_offset; |
7634 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7635 | _res = _PyAST_MatchStar ( target -> v . Name . id , EXTRA ); |
7636 | if (_res == NULL && PyErr_Occurred()) { |
7637 | p->error_indicator = 1; |
7638 | p->level--; |
7639 | return NULL; |
7640 | } |
7641 | goto done; |
7642 | } |
7643 | p->mark = _mark; |
7644 | D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7645 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' pattern_capture_target" )); |
7646 | } |
7647 | { // '*' wildcard_pattern |
7648 | if (p->error_indicator) { |
7649 | p->level--; |
7650 | return NULL; |
7651 | } |
7652 | D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' wildcard_pattern" )); |
7653 | Token * _literal; |
7654 | pattern_ty wildcard_pattern_var; |
7655 | if ( |
7656 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
7657 | && |
7658 | (wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern |
7659 | ) |
7660 | { |
7661 | D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' wildcard_pattern" )); |
7662 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7663 | if (_token == NULL) { |
7664 | p->level--; |
7665 | return NULL; |
7666 | } |
7667 | int _end_lineno = _token->end_lineno; |
7668 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7669 | int _end_col_offset = _token->end_col_offset; |
7670 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7671 | _res = _PyAST_MatchStar ( NULL , EXTRA ); |
7672 | if (_res == NULL && PyErr_Occurred()) { |
7673 | p->error_indicator = 1; |
7674 | p->level--; |
7675 | return NULL; |
7676 | } |
7677 | goto done; |
7678 | } |
7679 | p->mark = _mark; |
7680 | D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7681 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' wildcard_pattern" )); |
7682 | } |
7683 | _res = NULL; |
7684 | done: |
7685 | p->level--; |
7686 | return _res; |
7687 | } |
7688 | |
7689 | // mapping_pattern: |
7690 | // | '{' '}' |
7691 | // | '{' double_star_pattern ','? '}' |
7692 | // | '{' items_pattern ',' double_star_pattern ','? '}' |
7693 | // | '{' items_pattern ','? '}' |
7694 | static pattern_ty |
7695 | mapping_pattern_rule(Parser *p) |
7696 | { |
7697 | if (p->level++ == MAXSTACK) { |
7698 | p->error_indicator = 1; |
7699 | PyErr_NoMemory(); |
7700 | } |
7701 | if (p->error_indicator) { |
7702 | p->level--; |
7703 | return NULL; |
7704 | } |
7705 | pattern_ty _res = NULL; |
7706 | int _mark = p->mark; |
7707 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
7708 | p->error_indicator = 1; |
7709 | p->level--; |
7710 | return NULL; |
7711 | } |
7712 | int _start_lineno = p->tokens[_mark]->lineno; |
7713 | UNUSED(_start_lineno); // Only used by EXTRA macro |
7714 | int _start_col_offset = p->tokens[_mark]->col_offset; |
7715 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
7716 | { // '{' '}' |
7717 | if (p->error_indicator) { |
7718 | p->level--; |
7719 | return NULL; |
7720 | } |
7721 | D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{' '}'" )); |
7722 | Token * _literal; |
7723 | Token * _literal_1; |
7724 | if ( |
7725 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
7726 | && |
7727 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
7728 | ) |
7729 | { |
7730 | D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{' '}'" )); |
7731 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7732 | if (_token == NULL) { |
7733 | p->level--; |
7734 | return NULL; |
7735 | } |
7736 | int _end_lineno = _token->end_lineno; |
7737 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7738 | int _end_col_offset = _token->end_col_offset; |
7739 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7740 | _res = _PyAST_MatchMapping ( NULL , NULL , NULL , EXTRA ); |
7741 | if (_res == NULL && PyErr_Occurred()) { |
7742 | p->error_indicator = 1; |
7743 | p->level--; |
7744 | return NULL; |
7745 | } |
7746 | goto done; |
7747 | } |
7748 | p->mark = _mark; |
7749 | D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7750 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{' '}'" )); |
7751 | } |
7752 | { // '{' double_star_pattern ','? '}' |
7753 | if (p->error_indicator) { |
7754 | p->level--; |
7755 | return NULL; |
7756 | } |
7757 | D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{' double_star_pattern ','? '}'" )); |
7758 | Token * _literal; |
7759 | Token * _literal_1; |
7760 | void *_opt_var; |
7761 | UNUSED(_opt_var); // Silence compiler warnings |
7762 | expr_ty rest; |
7763 | if ( |
7764 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
7765 | && |
7766 | (rest = double_star_pattern_rule(p)) // double_star_pattern |
7767 | && |
7768 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
7769 | && |
7770 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
7771 | ) |
7772 | { |
7773 | D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{' double_star_pattern ','? '}'" )); |
7774 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7775 | if (_token == NULL) { |
7776 | p->level--; |
7777 | return NULL; |
7778 | } |
7779 | int _end_lineno = _token->end_lineno; |
7780 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7781 | int _end_col_offset = _token->end_col_offset; |
7782 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7783 | _res = _PyAST_MatchMapping ( NULL , NULL , rest -> v . Name . id , EXTRA ); |
7784 | if (_res == NULL && PyErr_Occurred()) { |
7785 | p->error_indicator = 1; |
7786 | p->level--; |
7787 | return NULL; |
7788 | } |
7789 | goto done; |
7790 | } |
7791 | p->mark = _mark; |
7792 | D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7793 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{' double_star_pattern ','? '}'" )); |
7794 | } |
7795 | { // '{' items_pattern ',' double_star_pattern ','? '}' |
7796 | if (p->error_indicator) { |
7797 | p->level--; |
7798 | return NULL; |
7799 | } |
7800 | D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'" )); |
7801 | Token * _literal; |
7802 | Token * _literal_1; |
7803 | Token * _literal_2; |
7804 | void *_opt_var; |
7805 | UNUSED(_opt_var); // Silence compiler warnings |
7806 | asdl_seq* items; |
7807 | expr_ty rest; |
7808 | if ( |
7809 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
7810 | && |
7811 | (items = items_pattern_rule(p)) // items_pattern |
7812 | && |
7813 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
7814 | && |
7815 | (rest = double_star_pattern_rule(p)) // double_star_pattern |
7816 | && |
7817 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
7818 | && |
7819 | (_literal_2 = _PyPegen_expect_token(p, 26)) // token='}' |
7820 | ) |
7821 | { |
7822 | D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'" )); |
7823 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7824 | if (_token == NULL) { |
7825 | p->level--; |
7826 | return NULL; |
7827 | } |
7828 | int _end_lineno = _token->end_lineno; |
7829 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7830 | int _end_col_offset = _token->end_col_offset; |
7831 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7832 | _res = _PyAST_MatchMapping ( CHECK ( asdl_expr_seq * , _PyPegen_get_pattern_keys ( p , items ) ) , CHECK ( asdl_pattern_seq * , _PyPegen_get_patterns ( p , items ) ) , rest -> v . Name . id , EXTRA ); |
7833 | if (_res == NULL && PyErr_Occurred()) { |
7834 | p->error_indicator = 1; |
7835 | p->level--; |
7836 | return NULL; |
7837 | } |
7838 | goto done; |
7839 | } |
7840 | p->mark = _mark; |
7841 | D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7842 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'" )); |
7843 | } |
7844 | { // '{' items_pattern ','? '}' |
7845 | if (p->error_indicator) { |
7846 | p->level--; |
7847 | return NULL; |
7848 | } |
7849 | D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{' items_pattern ','? '}'" )); |
7850 | Token * _literal; |
7851 | Token * _literal_1; |
7852 | void *_opt_var; |
7853 | UNUSED(_opt_var); // Silence compiler warnings |
7854 | asdl_seq* items; |
7855 | if ( |
7856 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
7857 | && |
7858 | (items = items_pattern_rule(p)) // items_pattern |
7859 | && |
7860 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
7861 | && |
7862 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
7863 | ) |
7864 | { |
7865 | D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{' items_pattern ','? '}'" )); |
7866 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7867 | if (_token == NULL) { |
7868 | p->level--; |
7869 | return NULL; |
7870 | } |
7871 | int _end_lineno = _token->end_lineno; |
7872 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7873 | int _end_col_offset = _token->end_col_offset; |
7874 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7875 | _res = _PyAST_MatchMapping ( CHECK ( asdl_expr_seq * , _PyPegen_get_pattern_keys ( p , items ) ) , CHECK ( asdl_pattern_seq * , _PyPegen_get_patterns ( p , items ) ) , NULL , EXTRA ); |
7876 | if (_res == NULL && PyErr_Occurred()) { |
7877 | p->error_indicator = 1; |
7878 | p->level--; |
7879 | return NULL; |
7880 | } |
7881 | goto done; |
7882 | } |
7883 | p->mark = _mark; |
7884 | D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7885 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{' items_pattern ','? '}'" )); |
7886 | } |
7887 | _res = NULL; |
7888 | done: |
7889 | p->level--; |
7890 | return _res; |
7891 | } |
7892 | |
7893 | // items_pattern: ','.key_value_pattern+ |
7894 | static asdl_seq* |
7895 | items_pattern_rule(Parser *p) |
7896 | { |
7897 | if (p->level++ == MAXSTACK) { |
7898 | p->error_indicator = 1; |
7899 | PyErr_NoMemory(); |
7900 | } |
7901 | if (p->error_indicator) { |
7902 | p->level--; |
7903 | return NULL; |
7904 | } |
7905 | asdl_seq* _res = NULL; |
7906 | int _mark = p->mark; |
7907 | { // ','.key_value_pattern+ |
7908 | if (p->error_indicator) { |
7909 | p->level--; |
7910 | return NULL; |
7911 | } |
7912 | D(fprintf(stderr, "%*c> items_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.key_value_pattern+" )); |
7913 | asdl_seq * _gather_59_var; |
7914 | if ( |
7915 | (_gather_59_var = _gather_59_rule(p)) // ','.key_value_pattern+ |
7916 | ) |
7917 | { |
7918 | D(fprintf(stderr, "%*c+ items_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.key_value_pattern+" )); |
7919 | _res = _gather_59_var; |
7920 | goto done; |
7921 | } |
7922 | p->mark = _mark; |
7923 | D(fprintf(stderr, "%*c%s items_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7924 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.key_value_pattern+" )); |
7925 | } |
7926 | _res = NULL; |
7927 | done: |
7928 | p->level--; |
7929 | return _res; |
7930 | } |
7931 | |
7932 | // key_value_pattern: (literal_expr | attr) ':' pattern |
7933 | static KeyPatternPair* |
7934 | key_value_pattern_rule(Parser *p) |
7935 | { |
7936 | if (p->level++ == MAXSTACK) { |
7937 | p->error_indicator = 1; |
7938 | PyErr_NoMemory(); |
7939 | } |
7940 | if (p->error_indicator) { |
7941 | p->level--; |
7942 | return NULL; |
7943 | } |
7944 | KeyPatternPair* _res = NULL; |
7945 | int _mark = p->mark; |
7946 | { // (literal_expr | attr) ':' pattern |
7947 | if (p->error_indicator) { |
7948 | p->level--; |
7949 | return NULL; |
7950 | } |
7951 | D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(literal_expr | attr) ':' pattern" )); |
7952 | Token * _literal; |
7953 | void *key; |
7954 | pattern_ty pattern; |
7955 | if ( |
7956 | (key = _tmp_61_rule(p)) // literal_expr | attr |
7957 | && |
7958 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
7959 | && |
7960 | (pattern = pattern_rule(p)) // pattern |
7961 | ) |
7962 | { |
7963 | D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "(literal_expr | attr) ':' pattern" )); |
7964 | _res = _PyPegen_key_pattern_pair ( p , key , pattern ); |
7965 | if (_res == NULL && PyErr_Occurred()) { |
7966 | p->error_indicator = 1; |
7967 | p->level--; |
7968 | return NULL; |
7969 | } |
7970 | goto done; |
7971 | } |
7972 | p->mark = _mark; |
7973 | D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
7974 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(literal_expr | attr) ':' pattern" )); |
7975 | } |
7976 | _res = NULL; |
7977 | done: |
7978 | p->level--; |
7979 | return _res; |
7980 | } |
7981 | |
7982 | // double_star_pattern: '**' pattern_capture_target |
7983 | static expr_ty |
7984 | double_star_pattern_rule(Parser *p) |
7985 | { |
7986 | if (p->level++ == MAXSTACK) { |
7987 | p->error_indicator = 1; |
7988 | PyErr_NoMemory(); |
7989 | } |
7990 | if (p->error_indicator) { |
7991 | p->level--; |
7992 | return NULL; |
7993 | } |
7994 | expr_ty _res = NULL; |
7995 | int _mark = p->mark; |
7996 | { // '**' pattern_capture_target |
7997 | if (p->error_indicator) { |
7998 | p->level--; |
7999 | return NULL; |
8000 | } |
8001 | D(fprintf(stderr, "%*c> double_star_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'**' pattern_capture_target" )); |
8002 | Token * _literal; |
8003 | expr_ty target; |
8004 | if ( |
8005 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
8006 | && |
8007 | (target = pattern_capture_target_rule(p)) // pattern_capture_target |
8008 | ) |
8009 | { |
8010 | D(fprintf(stderr, "%*c+ double_star_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'**' pattern_capture_target" )); |
8011 | _res = target; |
8012 | if (_res == NULL && PyErr_Occurred()) { |
8013 | p->error_indicator = 1; |
8014 | p->level--; |
8015 | return NULL; |
8016 | } |
8017 | goto done; |
8018 | } |
8019 | p->mark = _mark; |
8020 | D(fprintf(stderr, "%*c%s double_star_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
8021 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'**' pattern_capture_target" )); |
8022 | } |
8023 | _res = NULL; |
8024 | done: |
8025 | p->level--; |
8026 | return _res; |
8027 | } |
8028 | |
8029 | // class_pattern: |
8030 | // | name_or_attr '(' ')' |
8031 | // | name_or_attr '(' positional_patterns ','? ')' |
8032 | // | name_or_attr '(' keyword_patterns ','? ')' |
8033 | // | name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')' |
8034 | // | invalid_class_pattern |
8035 | static pattern_ty |
8036 | class_pattern_rule(Parser *p) |
8037 | { |
8038 | if (p->level++ == MAXSTACK) { |
8039 | p->error_indicator = 1; |
8040 | PyErr_NoMemory(); |
8041 | } |
8042 | if (p->error_indicator) { |
8043 | p->level--; |
8044 | return NULL; |
8045 | } |
8046 | pattern_ty _res = NULL; |
8047 | int _mark = p->mark; |
8048 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
8049 | p->error_indicator = 1; |
8050 | p->level--; |
8051 | return NULL; |
8052 | } |
8053 | int _start_lineno = p->tokens[_mark]->lineno; |
8054 | UNUSED(_start_lineno); // Only used by EXTRA macro |
8055 | int _start_col_offset = p->tokens[_mark]->col_offset; |
8056 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
8057 | { // name_or_attr '(' ')' |
8058 | if (p->error_indicator) { |
8059 | p->level--; |
8060 | return NULL; |
8061 | } |
8062 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'" )); |
8063 | Token * _literal; |
8064 | Token * _literal_1; |
8065 | expr_ty cls; |
8066 | if ( |
8067 | (cls = name_or_attr_rule(p)) // name_or_attr |
8068 | && |
8069 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
8070 | && |
8071 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
8072 | ) |
8073 | { |
8074 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'" )); |
8075 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8076 | if (_token == NULL) { |
8077 | p->level--; |
8078 | return NULL; |
8079 | } |
8080 | int _end_lineno = _token->end_lineno; |
8081 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8082 | int _end_col_offset = _token->end_col_offset; |
8083 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8084 | _res = _PyAST_MatchClass ( cls , NULL , NULL , NULL , EXTRA ); |
8085 | if (_res == NULL && PyErr_Occurred()) { |
8086 | p->error_indicator = 1; |
8087 | p->level--; |
8088 | return NULL; |
8089 | } |
8090 | goto done; |
8091 | } |
8092 | p->mark = _mark; |
8093 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
8094 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "name_or_attr '(' ')'" )); |
8095 | } |
8096 | { // name_or_attr '(' positional_patterns ','? ')' |
8097 | if (p->error_indicator) { |
8098 | p->level--; |
8099 | return NULL; |
8100 | } |
8101 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'" )); |
8102 | Token * _literal; |
8103 | Token * _literal_1; |
8104 | void *_opt_var; |
8105 | UNUSED(_opt_var); // Silence compiler warnings |
8106 | expr_ty cls; |
8107 | asdl_pattern_seq* patterns; |
8108 | if ( |
8109 | (cls = name_or_attr_rule(p)) // name_or_attr |
8110 | && |
8111 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
8112 | && |
8113 | (patterns = positional_patterns_rule(p)) // positional_patterns |
8114 | && |
8115 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
8116 | && |
8117 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
8118 | ) |
8119 | { |
8120 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'" )); |
8121 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8122 | if (_token == NULL) { |
8123 | p->level--; |
8124 | return NULL; |
8125 | } |
8126 | int _end_lineno = _token->end_lineno; |
8127 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8128 | int _end_col_offset = _token->end_col_offset; |
8129 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8130 | _res = _PyAST_MatchClass ( cls , patterns , NULL , NULL , EXTRA ); |
8131 | if (_res == NULL && PyErr_Occurred()) { |
8132 | p->error_indicator = 1; |
8133 | p->level--; |
8134 | return NULL; |
8135 | } |
8136 | goto done; |
8137 | } |
8138 | p->mark = _mark; |
8139 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
8140 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'" )); |
8141 | } |
8142 | { // name_or_attr '(' keyword_patterns ','? ')' |
8143 | if (p->error_indicator) { |
8144 | p->level--; |
8145 | return NULL; |
8146 | } |
8147 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'" )); |
8148 | Token * _literal; |
8149 | Token * _literal_1; |
8150 | void *_opt_var; |
8151 | UNUSED(_opt_var); // Silence compiler warnings |
8152 | expr_ty cls; |
8153 | asdl_seq* keywords; |
8154 | if ( |
8155 | (cls = name_or_attr_rule(p)) // name_or_attr |
8156 | && |
8157 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
8158 | && |
8159 | (keywords = keyword_patterns_rule(p)) // keyword_patterns |
8160 | && |
8161 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
8162 | && |
8163 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
8164 | ) |
8165 | { |
8166 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'" )); |
8167 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8168 | if (_token == NULL) { |
8169 | p->level--; |
8170 | return NULL; |
8171 | } |
8172 | int _end_lineno = _token->end_lineno; |
8173 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8174 | int _end_col_offset = _token->end_col_offset; |
8175 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8176 | _res = _PyAST_MatchClass ( cls , NULL , CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , CHECK ( asdl_expr_seq * , _PyPegen_get_pattern_keys ( p , keywords ) ) ) ) , CHECK ( asdl_pattern_seq * , _PyPegen_get_patterns ( p , keywords ) ) , EXTRA ); |
8177 | if (_res == NULL && PyErr_Occurred()) { |
8178 | p->error_indicator = 1; |
8179 | p->level--; |
8180 | return NULL; |
8181 | } |
8182 | goto done; |
8183 | } |
8184 | p->mark = _mark; |
8185 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
8186 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'" )); |
8187 | } |
8188 | { // name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')' |
8189 | if (p->error_indicator) { |
8190 | p->level--; |
8191 | return NULL; |
8192 | } |
8193 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'" )); |
8194 | Token * _literal; |
8195 | Token * _literal_1; |
8196 | Token * _literal_2; |
8197 | void *_opt_var; |
8198 | UNUSED(_opt_var); // Silence compiler warnings |
8199 | expr_ty cls; |
8200 | asdl_seq* keywords; |
8201 | asdl_pattern_seq* patterns; |
8202 | if ( |
8203 | (cls = name_or_attr_rule(p)) // name_or_attr |
8204 | && |
8205 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
8206 | && |
8207 | (patterns = positional_patterns_rule(p)) // positional_patterns |
8208 | && |
8209 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
8210 | && |
8211 | (keywords = keyword_patterns_rule(p)) // keyword_patterns |
8212 | && |
8213 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
8214 | && |
8215 | (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' |
8216 | ) |
8217 | { |
8218 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'" )); |
8219 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8220 | if (_token == NULL) { |
8221 | p->level--; |
8222 | return NULL; |
8223 | } |
8224 | int _end_lineno = _token->end_lineno; |
8225 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8226 | int _end_col_offset = _token->end_col_offset; |
8227 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8228 | _res = _PyAST_MatchClass ( cls , patterns , CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , CHECK ( asdl_expr_seq * , _PyPegen_get_pattern_keys ( p , keywords ) ) ) ) , CHECK ( asdl_pattern_seq * , _PyPegen_get_patterns ( p , keywords ) ) , EXTRA ); |
8229 | if (_res == NULL && PyErr_Occurred()) { |
8230 | p->error_indicator = 1; |
8231 | p->level--; |
8232 | return NULL; |
8233 | } |
8234 | goto done; |
8235 | } |
8236 | p->mark = _mark; |
8237 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
8238 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'" )); |
8239 | } |
8240 | if (p->call_invalid_rules) { // invalid_class_pattern |
8241 | if (p->error_indicator) { |
8242 | p->level--; |
8243 | return NULL; |
8244 | } |
8245 | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_class_pattern" )); |
8246 | void *invalid_class_pattern_var; |
8247 | if ( |
8248 | (invalid_class_pattern_var = invalid_class_pattern_rule(p)) // invalid_class_pattern |
8249 | ) |
8250 | { |
8251 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_class_pattern" )); |
8252 | _res = invalid_class_pattern_var; |
8253 | goto done; |
8254 | } |
8255 | p->mark = _mark; |
8256 | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
8257 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_class_pattern" )); |
8258 | } |
8259 | _res = NULL; |
8260 | done: |
8261 | p->level--; |
8262 | return _res; |
8263 | } |
8264 | |
8265 | // positional_patterns: ','.pattern+ |
8266 | static asdl_pattern_seq* |
8267 | positional_patterns_rule(Parser *p) |
8268 | { |
8269 | if (p->level++ == MAXSTACK) { |
8270 | p->error_indicator = 1; |
8271 | PyErr_NoMemory(); |
8272 | } |
8273 | if (p->error_indicator) { |
8274 | p->level--; |
8275 | return NULL; |
8276 | } |
8277 | asdl_pattern_seq* _res = NULL; |
8278 | int _mark = p->mark; |
8279 | { // ','.pattern+ |
8280 | if (p->error_indicator) { |
8281 | p->level--; |
8282 | return NULL; |
8283 | } |
8284 | D(fprintf(stderr, "%*c> positional_patterns[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.pattern+" )); |
8285 | asdl_pattern_seq* args; |
8286 | if ( |
8287 | (args = (asdl_pattern_seq*)_gather_62_rule(p)) // ','.pattern+ |
8288 | ) |
8289 | { |
8290 | D(fprintf(stderr, "%*c+ positional_patterns[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.pattern+" )); |
8291 | _res = args; |
8292 | if (_res == NULL && PyErr_Occurred()) { |
8293 | p->error_indicator = 1; |
8294 | p->level--; |
8295 | return NULL; |
8296 | } |
8297 | goto done; |
8298 | } |
8299 | p->mark = _mark; |
8300 | D(fprintf(stderr, "%*c%s positional_patterns[%d-%d]: %s failed!\n" , p->level, ' ', |
8301 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.pattern+" )); |
8302 | } |
8303 | _res = NULL; |
8304 | done: |
8305 | p->level--; |
8306 | return _res; |
8307 | } |
8308 | |
8309 | // keyword_patterns: ','.keyword_pattern+ |
8310 | static asdl_seq* |
8311 | keyword_patterns_rule(Parser *p) |
8312 | { |
8313 | if (p->level++ == MAXSTACK) { |
8314 | p->error_indicator = 1; |
8315 | PyErr_NoMemory(); |
8316 | } |
8317 | if (p->error_indicator) { |
8318 | p->level--; |
8319 | return NULL; |
8320 | } |
8321 | asdl_seq* _res = NULL; |
8322 | int _mark = p->mark; |
8323 | { // ','.keyword_pattern+ |
8324 | if (p->error_indicator) { |
8325 | p->level--; |
8326 | return NULL; |
8327 | } |
8328 | D(fprintf(stderr, "%*c> keyword_patterns[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.keyword_pattern+" )); |
8329 | asdl_seq * _gather_64_var; |
8330 | if ( |
8331 | (_gather_64_var = _gather_64_rule(p)) // ','.keyword_pattern+ |
8332 | ) |
8333 | { |
8334 | D(fprintf(stderr, "%*c+ keyword_patterns[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.keyword_pattern+" )); |
8335 | _res = _gather_64_var; |
8336 | goto done; |
8337 | } |
8338 | p->mark = _mark; |
8339 | D(fprintf(stderr, "%*c%s keyword_patterns[%d-%d]: %s failed!\n" , p->level, ' ', |
8340 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.keyword_pattern+" )); |
8341 | } |
8342 | _res = NULL; |
8343 | done: |
8344 | p->level--; |
8345 | return _res; |
8346 | } |
8347 | |
8348 | // keyword_pattern: NAME '=' pattern |
8349 | static KeyPatternPair* |
8350 | keyword_pattern_rule(Parser *p) |
8351 | { |
8352 | if (p->level++ == MAXSTACK) { |
8353 | p->error_indicator = 1; |
8354 | PyErr_NoMemory(); |
8355 | } |
8356 | if (p->error_indicator) { |
8357 | p->level--; |
8358 | return NULL; |
8359 | } |
8360 | KeyPatternPair* _res = NULL; |
8361 | int _mark = p->mark; |
8362 | { // NAME '=' pattern |
8363 | if (p->error_indicator) { |
8364 | p->level--; |
8365 | return NULL; |
8366 | } |
8367 | D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME '=' pattern" )); |
8368 | Token * _literal; |
8369 | expr_ty arg; |
8370 | pattern_ty value; |
8371 | if ( |
8372 | (arg = _PyPegen_name_token(p)) // NAME |
8373 | && |
8374 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
8375 | && |
8376 | (value = pattern_rule(p)) // pattern |
8377 | ) |
8378 | { |
8379 | D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME '=' pattern" )); |
8380 | _res = _PyPegen_key_pattern_pair ( p , arg , value ); |
8381 | if (_res == NULL && PyErr_Occurred()) { |
8382 | p->error_indicator = 1; |
8383 | p->level--; |
8384 | return NULL; |
8385 | } |
8386 | goto done; |
8387 | } |
8388 | p->mark = _mark; |
8389 | D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
8390 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME '=' pattern" )); |
8391 | } |
8392 | _res = NULL; |
8393 | done: |
8394 | p->level--; |
8395 | return _res; |
8396 | } |
8397 | |
8398 | // return_stmt: 'return' star_expressions? |
8399 | static stmt_ty |
8400 | return_stmt_rule(Parser *p) |
8401 | { |
8402 | if (p->level++ == MAXSTACK) { |
8403 | p->error_indicator = 1; |
8404 | PyErr_NoMemory(); |
8405 | } |
8406 | if (p->error_indicator) { |
8407 | p->level--; |
8408 | return NULL; |
8409 | } |
8410 | stmt_ty _res = NULL; |
8411 | int _mark = p->mark; |
8412 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
8413 | p->error_indicator = 1; |
8414 | p->level--; |
8415 | return NULL; |
8416 | } |
8417 | int _start_lineno = p->tokens[_mark]->lineno; |
8418 | UNUSED(_start_lineno); // Only used by EXTRA macro |
8419 | int _start_col_offset = p->tokens[_mark]->col_offset; |
8420 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
8421 | { // 'return' star_expressions? |
8422 | if (p->error_indicator) { |
8423 | p->level--; |
8424 | return NULL; |
8425 | } |
8426 | D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'return' star_expressions?" )); |
8427 | Token * _keyword; |
8428 | void *a; |
8429 | if ( |
8430 | (_keyword = _PyPegen_expect_token(p, 500)) // token='return' |
8431 | && |
8432 | (a = star_expressions_rule(p), !p->error_indicator) // star_expressions? |
8433 | ) |
8434 | { |
8435 | D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'return' star_expressions?" )); |
8436 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8437 | if (_token == NULL) { |
8438 | p->level--; |
8439 | return NULL; |
8440 | } |
8441 | int _end_lineno = _token->end_lineno; |
8442 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8443 | int _end_col_offset = _token->end_col_offset; |
8444 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8445 | _res = _PyAST_Return ( a , EXTRA ); |
8446 | if (_res == NULL && PyErr_Occurred()) { |
8447 | p->error_indicator = 1; |
8448 | p->level--; |
8449 | return NULL; |
8450 | } |
8451 | goto done; |
8452 | } |
8453 | p->mark = _mark; |
8454 | D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
8455 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'return' star_expressions?" )); |
8456 | } |
8457 | _res = NULL; |
8458 | done: |
8459 | p->level--; |
8460 | return _res; |
8461 | } |
8462 | |
8463 | // raise_stmt: 'raise' expression ['from' expression] | 'raise' |
8464 | static stmt_ty |
8465 | raise_stmt_rule(Parser *p) |
8466 | { |
8467 | if (p->level++ == MAXSTACK) { |
8468 | p->error_indicator = 1; |
8469 | PyErr_NoMemory(); |
8470 | } |
8471 | if (p->error_indicator) { |
8472 | p->level--; |
8473 | return NULL; |
8474 | } |
8475 | stmt_ty _res = NULL; |
8476 | int _mark = p->mark; |
8477 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
8478 | p->error_indicator = 1; |
8479 | p->level--; |
8480 | return NULL; |
8481 | } |
8482 | int _start_lineno = p->tokens[_mark]->lineno; |
8483 | UNUSED(_start_lineno); // Only used by EXTRA macro |
8484 | int _start_col_offset = p->tokens[_mark]->col_offset; |
8485 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
8486 | { // 'raise' expression ['from' expression] |
8487 | if (p->error_indicator) { |
8488 | p->level--; |
8489 | return NULL; |
8490 | } |
8491 | D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]" )); |
8492 | Token * _keyword; |
8493 | expr_ty a; |
8494 | void *b; |
8495 | if ( |
8496 | (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' |
8497 | && |
8498 | (a = expression_rule(p)) // expression |
8499 | && |
8500 | (b = _tmp_66_rule(p), !p->error_indicator) // ['from' expression] |
8501 | ) |
8502 | { |
8503 | D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]" )); |
8504 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8505 | if (_token == NULL) { |
8506 | p->level--; |
8507 | return NULL; |
8508 | } |
8509 | int _end_lineno = _token->end_lineno; |
8510 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8511 | int _end_col_offset = _token->end_col_offset; |
8512 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8513 | _res = _PyAST_Raise ( a , b , EXTRA ); |
8514 | if (_res == NULL && PyErr_Occurred()) { |
8515 | p->error_indicator = 1; |
8516 | p->level--; |
8517 | return NULL; |
8518 | } |
8519 | goto done; |
8520 | } |
8521 | p->mark = _mark; |
8522 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
8523 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'raise' expression ['from' expression]" )); |
8524 | } |
8525 | { // 'raise' |
8526 | if (p->error_indicator) { |
8527 | p->level--; |
8528 | return NULL; |
8529 | } |
8530 | D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'raise'" )); |
8531 | Token * _keyword; |
8532 | if ( |
8533 | (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' |
8534 | ) |
8535 | { |
8536 | D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'raise'" )); |
8537 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8538 | if (_token == NULL) { |
8539 | p->level--; |
8540 | return NULL; |
8541 | } |
8542 | int _end_lineno = _token->end_lineno; |
8543 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8544 | int _end_col_offset = _token->end_col_offset; |
8545 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8546 | _res = _PyAST_Raise ( NULL , NULL , EXTRA ); |
8547 | if (_res == NULL && PyErr_Occurred()) { |
8548 | p->error_indicator = 1; |
8549 | p->level--; |
8550 | return NULL; |
8551 | } |
8552 | goto done; |
8553 | } |
8554 | p->mark = _mark; |
8555 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
8556 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'raise'" )); |
8557 | } |
8558 | _res = NULL; |
8559 | done: |
8560 | p->level--; |
8561 | return _res; |
8562 | } |
8563 | |
8564 | // function_def: decorators function_def_raw | function_def_raw |
8565 | static stmt_ty |
8566 | function_def_rule(Parser *p) |
8567 | { |
8568 | if (p->level++ == MAXSTACK) { |
8569 | p->error_indicator = 1; |
8570 | PyErr_NoMemory(); |
8571 | } |
8572 | if (p->error_indicator) { |
8573 | p->level--; |
8574 | return NULL; |
8575 | } |
8576 | stmt_ty _res = NULL; |
8577 | int _mark = p->mark; |
8578 | { // decorators function_def_raw |
8579 | if (p->error_indicator) { |
8580 | p->level--; |
8581 | return NULL; |
8582 | } |
8583 | D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "decorators function_def_raw" )); |
8584 | asdl_expr_seq* d; |
8585 | stmt_ty f; |
8586 | if ( |
8587 | (d = decorators_rule(p)) // decorators |
8588 | && |
8589 | (f = function_def_raw_rule(p)) // function_def_raw |
8590 | ) |
8591 | { |
8592 | D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "decorators function_def_raw" )); |
8593 | _res = _PyPegen_function_def_decorators ( p , d , f ); |
8594 | if (_res == NULL && PyErr_Occurred()) { |
8595 | p->error_indicator = 1; |
8596 | p->level--; |
8597 | return NULL; |
8598 | } |
8599 | goto done; |
8600 | } |
8601 | p->mark = _mark; |
8602 | D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n" , p->level, ' ', |
8603 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "decorators function_def_raw" )); |
8604 | } |
8605 | { // function_def_raw |
8606 | if (p->error_indicator) { |
8607 | p->level--; |
8608 | return NULL; |
8609 | } |
8610 | D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "function_def_raw" )); |
8611 | stmt_ty function_def_raw_var; |
8612 | if ( |
8613 | (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw |
8614 | ) |
8615 | { |
8616 | D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "function_def_raw" )); |
8617 | _res = function_def_raw_var; |
8618 | goto done; |
8619 | } |
8620 | p->mark = _mark; |
8621 | D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n" , p->level, ' ', |
8622 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "function_def_raw" )); |
8623 | } |
8624 | _res = NULL; |
8625 | done: |
8626 | p->level--; |
8627 | return _res; |
8628 | } |
8629 | |
8630 | // function_def_raw: |
8631 | // | invalid_def_raw |
8632 | // | 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block |
8633 | // | ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block |
8634 | static stmt_ty |
8635 | function_def_raw_rule(Parser *p) |
8636 | { |
8637 | if (p->level++ == MAXSTACK) { |
8638 | p->error_indicator = 1; |
8639 | PyErr_NoMemory(); |
8640 | } |
8641 | if (p->error_indicator) { |
8642 | p->level--; |
8643 | return NULL; |
8644 | } |
8645 | stmt_ty _res = NULL; |
8646 | int _mark = p->mark; |
8647 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
8648 | p->error_indicator = 1; |
8649 | p->level--; |
8650 | return NULL; |
8651 | } |
8652 | int _start_lineno = p->tokens[_mark]->lineno; |
8653 | UNUSED(_start_lineno); // Only used by EXTRA macro |
8654 | int _start_col_offset = p->tokens[_mark]->col_offset; |
8655 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
8656 | if (p->call_invalid_rules) { // invalid_def_raw |
8657 | if (p->error_indicator) { |
8658 | p->level--; |
8659 | return NULL; |
8660 | } |
8661 | D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_def_raw" )); |
8662 | void *invalid_def_raw_var; |
8663 | if ( |
8664 | (invalid_def_raw_var = invalid_def_raw_rule(p)) // invalid_def_raw |
8665 | ) |
8666 | { |
8667 | D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_def_raw" )); |
8668 | _res = invalid_def_raw_var; |
8669 | goto done; |
8670 | } |
8671 | p->mark = _mark; |
8672 | D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n" , p->level, ' ', |
8673 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_def_raw" )); |
8674 | } |
8675 | { // 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block |
8676 | if (p->error_indicator) { |
8677 | p->level--; |
8678 | return NULL; |
8679 | } |
8680 | D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block" )); |
8681 | Token * _keyword; |
8682 | Token * _literal; |
8683 | Token * _literal_1; |
8684 | Token * _literal_2; |
8685 | void *a; |
8686 | asdl_stmt_seq* b; |
8687 | expr_ty n; |
8688 | void *params; |
8689 | void *tc; |
8690 | if ( |
8691 | (_keyword = _PyPegen_expect_token(p, 526)) // token='def' |
8692 | && |
8693 | (n = _PyPegen_name_token(p)) // NAME |
8694 | && |
8695 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
8696 | && |
8697 | (params = params_rule(p), !p->error_indicator) // params? |
8698 | && |
8699 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
8700 | && |
8701 | (a = _tmp_67_rule(p), !p->error_indicator) // ['->' expression] |
8702 | && |
8703 | (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":" )) // forced_token=':' |
8704 | && |
8705 | (tc = func_type_comment_rule(p), !p->error_indicator) // func_type_comment? |
8706 | && |
8707 | (b = block_rule(p)) // block |
8708 | ) |
8709 | { |
8710 | D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block" )); |
8711 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8712 | if (_token == NULL) { |
8713 | p->level--; |
8714 | return NULL; |
8715 | } |
8716 | int _end_lineno = _token->end_lineno; |
8717 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8718 | int _end_col_offset = _token->end_col_offset; |
8719 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8720 | _res = _PyAST_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
8721 | if (_res == NULL && PyErr_Occurred()) { |
8722 | p->error_indicator = 1; |
8723 | p->level--; |
8724 | return NULL; |
8725 | } |
8726 | goto done; |
8727 | } |
8728 | p->mark = _mark; |
8729 | D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n" , p->level, ' ', |
8730 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block" )); |
8731 | } |
8732 | { // ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block |
8733 | if (p->error_indicator) { |
8734 | p->level--; |
8735 | return NULL; |
8736 | } |
8737 | D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block" )); |
8738 | Token * _keyword; |
8739 | Token * _literal; |
8740 | Token * _literal_1; |
8741 | Token * _literal_2; |
8742 | void *a; |
8743 | Token * async_var; |
8744 | asdl_stmt_seq* b; |
8745 | expr_ty n; |
8746 | void *params; |
8747 | void *tc; |
8748 | if ( |
8749 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
8750 | && |
8751 | (_keyword = _PyPegen_expect_token(p, 526)) // token='def' |
8752 | && |
8753 | (n = _PyPegen_name_token(p)) // NAME |
8754 | && |
8755 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
8756 | && |
8757 | (params = params_rule(p), !p->error_indicator) // params? |
8758 | && |
8759 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
8760 | && |
8761 | (a = _tmp_68_rule(p), !p->error_indicator) // ['->' expression] |
8762 | && |
8763 | (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":" )) // forced_token=':' |
8764 | && |
8765 | (tc = func_type_comment_rule(p), !p->error_indicator) // func_type_comment? |
8766 | && |
8767 | (b = block_rule(p)) // block |
8768 | ) |
8769 | { |
8770 | D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block" )); |
8771 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8772 | if (_token == NULL) { |
8773 | p->level--; |
8774 | return NULL; |
8775 | } |
8776 | int _end_lineno = _token->end_lineno; |
8777 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8778 | int _end_col_offset = _token->end_col_offset; |
8779 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8780 | _res = CHECK_VERSION ( stmt_ty , 5 , "Async functions are" , _PyAST_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
8781 | if (_res == NULL && PyErr_Occurred()) { |
8782 | p->error_indicator = 1; |
8783 | p->level--; |
8784 | return NULL; |
8785 | } |
8786 | goto done; |
8787 | } |
8788 | p->mark = _mark; |
8789 | D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n" , p->level, ' ', |
8790 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block" )); |
8791 | } |
8792 | _res = NULL; |
8793 | done: |
8794 | p->level--; |
8795 | return _res; |
8796 | } |
8797 | |
8798 | // func_type_comment: |
8799 | // | NEWLINE TYPE_COMMENT &(NEWLINE INDENT) |
8800 | // | invalid_double_type_comments |
8801 | // | TYPE_COMMENT |
8802 | static Token* |
8803 | (Parser *p) |
8804 | { |
8805 | if (p->level++ == MAXSTACK) { |
8806 | p->error_indicator = 1; |
8807 | PyErr_NoMemory(); |
8808 | } |
8809 | if (p->error_indicator) { |
8810 | p->level--; |
8811 | return NULL; |
8812 | } |
8813 | Token* _res = NULL; |
8814 | int _mark = p->mark; |
8815 | { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT) |
8816 | if (p->error_indicator) { |
8817 | p->level--; |
8818 | return NULL; |
8819 | } |
8820 | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)" )); |
8821 | Token * newline_var; |
8822 | Token * t; |
8823 | if ( |
8824 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
8825 | && |
8826 | (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
8827 | && |
8828 | _PyPegen_lookahead(1, _tmp_69_rule, p) |
8829 | ) |
8830 | { |
8831 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)" )); |
8832 | _res = t; |
8833 | if (_res == NULL && PyErr_Occurred()) { |
8834 | p->error_indicator = 1; |
8835 | p->level--; |
8836 | return NULL; |
8837 | } |
8838 | goto done; |
8839 | } |
8840 | p->mark = _mark; |
8841 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n" , p->level, ' ', |
8842 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)" )); |
8843 | } |
8844 | if (p->call_invalid_rules) { // invalid_double_type_comments |
8845 | if (p->error_indicator) { |
8846 | p->level--; |
8847 | return NULL; |
8848 | } |
8849 | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_double_type_comments" )); |
8850 | void *; |
8851 | if ( |
8852 | (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments |
8853 | ) |
8854 | { |
8855 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_double_type_comments" )); |
8856 | _res = invalid_double_type_comments_var; |
8857 | goto done; |
8858 | } |
8859 | p->mark = _mark; |
8860 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n" , p->level, ' ', |
8861 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_double_type_comments" )); |
8862 | } |
8863 | { // TYPE_COMMENT |
8864 | if (p->error_indicator) { |
8865 | p->level--; |
8866 | return NULL; |
8867 | } |
8868 | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "TYPE_COMMENT" )); |
8869 | Token * ; |
8870 | if ( |
8871 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
8872 | ) |
8873 | { |
8874 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "TYPE_COMMENT" )); |
8875 | _res = type_comment_var; |
8876 | goto done; |
8877 | } |
8878 | p->mark = _mark; |
8879 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n" , p->level, ' ', |
8880 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "TYPE_COMMENT" )); |
8881 | } |
8882 | _res = NULL; |
8883 | done: |
8884 | p->level--; |
8885 | return _res; |
8886 | } |
8887 | |
8888 | // params: invalid_parameters | parameters |
8889 | static arguments_ty |
8890 | params_rule(Parser *p) |
8891 | { |
8892 | if (p->level++ == MAXSTACK) { |
8893 | p->error_indicator = 1; |
8894 | PyErr_NoMemory(); |
8895 | } |
8896 | if (p->error_indicator) { |
8897 | p->level--; |
8898 | return NULL; |
8899 | } |
8900 | arguments_ty _res = NULL; |
8901 | int _mark = p->mark; |
8902 | if (p->call_invalid_rules) { // invalid_parameters |
8903 | if (p->error_indicator) { |
8904 | p->level--; |
8905 | return NULL; |
8906 | } |
8907 | D(fprintf(stderr, "%*c> params[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_parameters" )); |
8908 | void *invalid_parameters_var; |
8909 | if ( |
8910 | (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters |
8911 | ) |
8912 | { |
8913 | D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_parameters" )); |
8914 | _res = invalid_parameters_var; |
8915 | goto done; |
8916 | } |
8917 | p->mark = _mark; |
8918 | D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n" , p->level, ' ', |
8919 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_parameters" )); |
8920 | } |
8921 | { // parameters |
8922 | if (p->error_indicator) { |
8923 | p->level--; |
8924 | return NULL; |
8925 | } |
8926 | D(fprintf(stderr, "%*c> params[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "parameters" )); |
8927 | arguments_ty parameters_var; |
8928 | if ( |
8929 | (parameters_var = parameters_rule(p)) // parameters |
8930 | ) |
8931 | { |
8932 | D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "parameters" )); |
8933 | _res = parameters_var; |
8934 | goto done; |
8935 | } |
8936 | p->mark = _mark; |
8937 | D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n" , p->level, ' ', |
8938 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "parameters" )); |
8939 | } |
8940 | _res = NULL; |
8941 | done: |
8942 | p->level--; |
8943 | return _res; |
8944 | } |
8945 | |
8946 | // parameters: |
8947 | // | slash_no_default param_no_default* param_with_default* star_etc? |
8948 | // | slash_with_default param_with_default* star_etc? |
8949 | // | param_no_default+ param_with_default* star_etc? |
8950 | // | param_with_default+ star_etc? |
8951 | // | star_etc |
8952 | static arguments_ty |
8953 | parameters_rule(Parser *p) |
8954 | { |
8955 | if (p->level++ == MAXSTACK) { |
8956 | p->error_indicator = 1; |
8957 | PyErr_NoMemory(); |
8958 | } |
8959 | if (p->error_indicator) { |
8960 | p->level--; |
8961 | return NULL; |
8962 | } |
8963 | arguments_ty _res = NULL; |
8964 | int _mark = p->mark; |
8965 | { // slash_no_default param_no_default* param_with_default* star_etc? |
8966 | if (p->error_indicator) { |
8967 | p->level--; |
8968 | return NULL; |
8969 | } |
8970 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?" )); |
8971 | asdl_arg_seq* a; |
8972 | asdl_arg_seq* b; |
8973 | asdl_seq * c; |
8974 | void *d; |
8975 | if ( |
8976 | (a = slash_no_default_rule(p)) // slash_no_default |
8977 | && |
8978 | (b = (asdl_arg_seq*)_loop0_70_rule(p)) // param_no_default* |
8979 | && |
8980 | (c = _loop0_71_rule(p)) // param_with_default* |
8981 | && |
8982 | (d = star_etc_rule(p), !p->error_indicator) // star_etc? |
8983 | ) |
8984 | { |
8985 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?" )); |
8986 | _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); |
8987 | if (_res == NULL && PyErr_Occurred()) { |
8988 | p->error_indicator = 1; |
8989 | p->level--; |
8990 | return NULL; |
8991 | } |
8992 | goto done; |
8993 | } |
8994 | p->mark = _mark; |
8995 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n" , p->level, ' ', |
8996 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?" )); |
8997 | } |
8998 | { // slash_with_default param_with_default* star_etc? |
8999 | if (p->error_indicator) { |
9000 | p->level--; |
9001 | return NULL; |
9002 | } |
9003 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?" )); |
9004 | SlashWithDefault* a; |
9005 | asdl_seq * b; |
9006 | void *c; |
9007 | if ( |
9008 | (a = slash_with_default_rule(p)) // slash_with_default |
9009 | && |
9010 | (b = _loop0_72_rule(p)) // param_with_default* |
9011 | && |
9012 | (c = star_etc_rule(p), !p->error_indicator) // star_etc? |
9013 | ) |
9014 | { |
9015 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?" )); |
9016 | _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); |
9017 | if (_res == NULL && PyErr_Occurred()) { |
9018 | p->error_indicator = 1; |
9019 | p->level--; |
9020 | return NULL; |
9021 | } |
9022 | goto done; |
9023 | } |
9024 | p->mark = _mark; |
9025 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n" , p->level, ' ', |
9026 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "slash_with_default param_with_default* star_etc?" )); |
9027 | } |
9028 | { // param_no_default+ param_with_default* star_etc? |
9029 | if (p->error_indicator) { |
9030 | p->level--; |
9031 | return NULL; |
9032 | } |
9033 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?" )); |
9034 | asdl_arg_seq* a; |
9035 | asdl_seq * b; |
9036 | void *c; |
9037 | if ( |
9038 | (a = (asdl_arg_seq*)_loop1_73_rule(p)) // param_no_default+ |
9039 | && |
9040 | (b = _loop0_74_rule(p)) // param_with_default* |
9041 | && |
9042 | (c = star_etc_rule(p), !p->error_indicator) // star_etc? |
9043 | ) |
9044 | { |
9045 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?" )); |
9046 | _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); |
9047 | if (_res == NULL && PyErr_Occurred()) { |
9048 | p->error_indicator = 1; |
9049 | p->level--; |
9050 | return NULL; |
9051 | } |
9052 | goto done; |
9053 | } |
9054 | p->mark = _mark; |
9055 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n" , p->level, ' ', |
9056 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default+ param_with_default* star_etc?" )); |
9057 | } |
9058 | { // param_with_default+ star_etc? |
9059 | if (p->error_indicator) { |
9060 | p->level--; |
9061 | return NULL; |
9062 | } |
9063 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?" )); |
9064 | asdl_seq * a; |
9065 | void *b; |
9066 | if ( |
9067 | (a = _loop1_75_rule(p)) // param_with_default+ |
9068 | && |
9069 | (b = star_etc_rule(p), !p->error_indicator) // star_etc? |
9070 | ) |
9071 | { |
9072 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?" )); |
9073 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); |
9074 | if (_res == NULL && PyErr_Occurred()) { |
9075 | p->error_indicator = 1; |
9076 | p->level--; |
9077 | return NULL; |
9078 | } |
9079 | goto done; |
9080 | } |
9081 | p->mark = _mark; |
9082 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n" , p->level, ' ', |
9083 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_with_default+ star_etc?" )); |
9084 | } |
9085 | { // star_etc |
9086 | if (p->error_indicator) { |
9087 | p->level--; |
9088 | return NULL; |
9089 | } |
9090 | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_etc" )); |
9091 | StarEtc* a; |
9092 | if ( |
9093 | (a = star_etc_rule(p)) // star_etc |
9094 | ) |
9095 | { |
9096 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_etc" )); |
9097 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); |
9098 | if (_res == NULL && PyErr_Occurred()) { |
9099 | p->error_indicator = 1; |
9100 | p->level--; |
9101 | return NULL; |
9102 | } |
9103 | goto done; |
9104 | } |
9105 | p->mark = _mark; |
9106 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n" , p->level, ' ', |
9107 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_etc" )); |
9108 | } |
9109 | _res = NULL; |
9110 | done: |
9111 | p->level--; |
9112 | return _res; |
9113 | } |
9114 | |
9115 | // slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')' |
9116 | static asdl_arg_seq* |
9117 | slash_no_default_rule(Parser *p) |
9118 | { |
9119 | if (p->level++ == MAXSTACK) { |
9120 | p->error_indicator = 1; |
9121 | PyErr_NoMemory(); |
9122 | } |
9123 | if (p->error_indicator) { |
9124 | p->level--; |
9125 | return NULL; |
9126 | } |
9127 | asdl_arg_seq* _res = NULL; |
9128 | int _mark = p->mark; |
9129 | { // param_no_default+ '/' ',' |
9130 | if (p->error_indicator) { |
9131 | p->level--; |
9132 | return NULL; |
9133 | } |
9134 | D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','" )); |
9135 | Token * _literal; |
9136 | Token * _literal_1; |
9137 | asdl_arg_seq* a; |
9138 | if ( |
9139 | (a = (asdl_arg_seq*)_loop1_76_rule(p)) // param_no_default+ |
9140 | && |
9141 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
9142 | && |
9143 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
9144 | ) |
9145 | { |
9146 | D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','" )); |
9147 | _res = a; |
9148 | if (_res == NULL && PyErr_Occurred()) { |
9149 | p->error_indicator = 1; |
9150 | p->level--; |
9151 | return NULL; |
9152 | } |
9153 | goto done; |
9154 | } |
9155 | p->mark = _mark; |
9156 | D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n" , p->level, ' ', |
9157 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default+ '/' ','" )); |
9158 | } |
9159 | { // param_no_default+ '/' &')' |
9160 | if (p->error_indicator) { |
9161 | p->level--; |
9162 | return NULL; |
9163 | } |
9164 | D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'" )); |
9165 | Token * _literal; |
9166 | asdl_arg_seq* a; |
9167 | if ( |
9168 | (a = (asdl_arg_seq*)_loop1_77_rule(p)) // param_no_default+ |
9169 | && |
9170 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
9171 | && |
9172 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
9173 | ) |
9174 | { |
9175 | D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'" )); |
9176 | _res = a; |
9177 | if (_res == NULL && PyErr_Occurred()) { |
9178 | p->error_indicator = 1; |
9179 | p->level--; |
9180 | return NULL; |
9181 | } |
9182 | goto done; |
9183 | } |
9184 | p->mark = _mark; |
9185 | D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n" , p->level, ' ', |
9186 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default+ '/' &')'" )); |
9187 | } |
9188 | _res = NULL; |
9189 | done: |
9190 | p->level--; |
9191 | return _res; |
9192 | } |
9193 | |
9194 | // slash_with_default: |
9195 | // | param_no_default* param_with_default+ '/' ',' |
9196 | // | param_no_default* param_with_default+ '/' &')' |
9197 | static SlashWithDefault* |
9198 | slash_with_default_rule(Parser *p) |
9199 | { |
9200 | if (p->level++ == MAXSTACK) { |
9201 | p->error_indicator = 1; |
9202 | PyErr_NoMemory(); |
9203 | } |
9204 | if (p->error_indicator) { |
9205 | p->level--; |
9206 | return NULL; |
9207 | } |
9208 | SlashWithDefault* _res = NULL; |
9209 | int _mark = p->mark; |
9210 | { // param_no_default* param_with_default+ '/' ',' |
9211 | if (p->error_indicator) { |
9212 | p->level--; |
9213 | return NULL; |
9214 | } |
9215 | D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','" )); |
9216 | Token * _literal; |
9217 | Token * _literal_1; |
9218 | asdl_seq * a; |
9219 | asdl_seq * b; |
9220 | if ( |
9221 | (a = _loop0_78_rule(p)) // param_no_default* |
9222 | && |
9223 | (b = _loop1_79_rule(p)) // param_with_default+ |
9224 | && |
9225 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
9226 | && |
9227 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
9228 | ) |
9229 | { |
9230 | D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','" )); |
9231 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b ); |
9232 | if (_res == NULL && PyErr_Occurred()) { |
9233 | p->error_indicator = 1; |
9234 | p->level--; |
9235 | return NULL; |
9236 | } |
9237 | goto done; |
9238 | } |
9239 | p->mark = _mark; |
9240 | D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n" , p->level, ' ', |
9241 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default* param_with_default+ '/' ','" )); |
9242 | } |
9243 | { // param_no_default* param_with_default+ '/' &')' |
9244 | if (p->error_indicator) { |
9245 | p->level--; |
9246 | return NULL; |
9247 | } |
9248 | D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'" )); |
9249 | Token * _literal; |
9250 | asdl_seq * a; |
9251 | asdl_seq * b; |
9252 | if ( |
9253 | (a = _loop0_80_rule(p)) // param_no_default* |
9254 | && |
9255 | (b = _loop1_81_rule(p)) // param_with_default+ |
9256 | && |
9257 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
9258 | && |
9259 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
9260 | ) |
9261 | { |
9262 | D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'" )); |
9263 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b ); |
9264 | if (_res == NULL && PyErr_Occurred()) { |
9265 | p->error_indicator = 1; |
9266 | p->level--; |
9267 | return NULL; |
9268 | } |
9269 | goto done; |
9270 | } |
9271 | p->mark = _mark; |
9272 | D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n" , p->level, ' ', |
9273 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default* param_with_default+ '/' &')'" )); |
9274 | } |
9275 | _res = NULL; |
9276 | done: |
9277 | p->level--; |
9278 | return _res; |
9279 | } |
9280 | |
9281 | // star_etc: |
9282 | // | '*' param_no_default param_maybe_default* kwds? |
9283 | // | '*' ',' param_maybe_default+ kwds? |
9284 | // | kwds |
9285 | // | invalid_star_etc |
9286 | static StarEtc* |
9287 | star_etc_rule(Parser *p) |
9288 | { |
9289 | if (p->level++ == MAXSTACK) { |
9290 | p->error_indicator = 1; |
9291 | PyErr_NoMemory(); |
9292 | } |
9293 | if (p->error_indicator) { |
9294 | p->level--; |
9295 | return NULL; |
9296 | } |
9297 | StarEtc* _res = NULL; |
9298 | int _mark = p->mark; |
9299 | { // '*' param_no_default param_maybe_default* kwds? |
9300 | if (p->error_indicator) { |
9301 | p->level--; |
9302 | return NULL; |
9303 | } |
9304 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?" )); |
9305 | Token * _literal; |
9306 | arg_ty a; |
9307 | asdl_seq * b; |
9308 | void *c; |
9309 | if ( |
9310 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
9311 | && |
9312 | (a = param_no_default_rule(p)) // param_no_default |
9313 | && |
9314 | (b = _loop0_82_rule(p)) // param_maybe_default* |
9315 | && |
9316 | (c = kwds_rule(p), !p->error_indicator) // kwds? |
9317 | ) |
9318 | { |
9319 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?" )); |
9320 | _res = _PyPegen_star_etc ( p , a , b , c ); |
9321 | if (_res == NULL && PyErr_Occurred()) { |
9322 | p->error_indicator = 1; |
9323 | p->level--; |
9324 | return NULL; |
9325 | } |
9326 | goto done; |
9327 | } |
9328 | p->mark = _mark; |
9329 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n" , p->level, ' ', |
9330 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?" )); |
9331 | } |
9332 | { // '*' ',' param_maybe_default+ kwds? |
9333 | if (p->error_indicator) { |
9334 | p->level--; |
9335 | return NULL; |
9336 | } |
9337 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?" )); |
9338 | Token * _literal; |
9339 | Token * _literal_1; |
9340 | asdl_seq * b; |
9341 | void *c; |
9342 | if ( |
9343 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
9344 | && |
9345 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
9346 | && |
9347 | (b = _loop1_83_rule(p)) // param_maybe_default+ |
9348 | && |
9349 | (c = kwds_rule(p), !p->error_indicator) // kwds? |
9350 | ) |
9351 | { |
9352 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?" )); |
9353 | _res = _PyPegen_star_etc ( p , NULL , b , c ); |
9354 | if (_res == NULL && PyErr_Occurred()) { |
9355 | p->error_indicator = 1; |
9356 | p->level--; |
9357 | return NULL; |
9358 | } |
9359 | goto done; |
9360 | } |
9361 | p->mark = _mark; |
9362 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n" , p->level, ' ', |
9363 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' ',' param_maybe_default+ kwds?" )); |
9364 | } |
9365 | { // kwds |
9366 | if (p->error_indicator) { |
9367 | p->level--; |
9368 | return NULL; |
9369 | } |
9370 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "kwds" )); |
9371 | arg_ty a; |
9372 | if ( |
9373 | (a = kwds_rule(p)) // kwds |
9374 | ) |
9375 | { |
9376 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "kwds" )); |
9377 | _res = _PyPegen_star_etc ( p , NULL , NULL , a ); |
9378 | if (_res == NULL && PyErr_Occurred()) { |
9379 | p->error_indicator = 1; |
9380 | p->level--; |
9381 | return NULL; |
9382 | } |
9383 | goto done; |
9384 | } |
9385 | p->mark = _mark; |
9386 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n" , p->level, ' ', |
9387 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "kwds" )); |
9388 | } |
9389 | if (p->call_invalid_rules) { // invalid_star_etc |
9390 | if (p->error_indicator) { |
9391 | p->level--; |
9392 | return NULL; |
9393 | } |
9394 | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_star_etc" )); |
9395 | void *invalid_star_etc_var; |
9396 | if ( |
9397 | (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc |
9398 | ) |
9399 | { |
9400 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_star_etc" )); |
9401 | _res = invalid_star_etc_var; |
9402 | goto done; |
9403 | } |
9404 | p->mark = _mark; |
9405 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n" , p->level, ' ', |
9406 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_star_etc" )); |
9407 | } |
9408 | _res = NULL; |
9409 | done: |
9410 | p->level--; |
9411 | return _res; |
9412 | } |
9413 | |
9414 | // kwds: '**' param_no_default |
9415 | static arg_ty |
9416 | kwds_rule(Parser *p) |
9417 | { |
9418 | if (p->level++ == MAXSTACK) { |
9419 | p->error_indicator = 1; |
9420 | PyErr_NoMemory(); |
9421 | } |
9422 | if (p->error_indicator) { |
9423 | p->level--; |
9424 | return NULL; |
9425 | } |
9426 | arg_ty _res = NULL; |
9427 | int _mark = p->mark; |
9428 | { // '**' param_no_default |
9429 | if (p->error_indicator) { |
9430 | p->level--; |
9431 | return NULL; |
9432 | } |
9433 | D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'**' param_no_default" )); |
9434 | Token * _literal; |
9435 | arg_ty a; |
9436 | if ( |
9437 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
9438 | && |
9439 | (a = param_no_default_rule(p)) // param_no_default |
9440 | ) |
9441 | { |
9442 | D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'**' param_no_default" )); |
9443 | _res = a; |
9444 | if (_res == NULL && PyErr_Occurred()) { |
9445 | p->error_indicator = 1; |
9446 | p->level--; |
9447 | return NULL; |
9448 | } |
9449 | goto done; |
9450 | } |
9451 | p->mark = _mark; |
9452 | D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n" , p->level, ' ', |
9453 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'**' param_no_default" )); |
9454 | } |
9455 | _res = NULL; |
9456 | done: |
9457 | p->level--; |
9458 | return _res; |
9459 | } |
9460 | |
9461 | // param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')' |
9462 | static arg_ty |
9463 | param_no_default_rule(Parser *p) |
9464 | { |
9465 | if (p->level++ == MAXSTACK) { |
9466 | p->error_indicator = 1; |
9467 | PyErr_NoMemory(); |
9468 | } |
9469 | if (p->error_indicator) { |
9470 | p->level--; |
9471 | return NULL; |
9472 | } |
9473 | arg_ty _res = NULL; |
9474 | int _mark = p->mark; |
9475 | { // param ',' TYPE_COMMENT? |
9476 | if (p->error_indicator) { |
9477 | p->level--; |
9478 | return NULL; |
9479 | } |
9480 | D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?" )); |
9481 | Token * _literal; |
9482 | arg_ty a; |
9483 | void *tc; |
9484 | if ( |
9485 | (a = param_rule(p)) // param |
9486 | && |
9487 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
9488 | && |
9489 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
9490 | ) |
9491 | { |
9492 | D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?" )); |
9493 | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
9494 | if (_res == NULL && PyErr_Occurred()) { |
9495 | p->error_indicator = 1; |
9496 | p->level--; |
9497 | return NULL; |
9498 | } |
9499 | goto done; |
9500 | } |
9501 | p->mark = _mark; |
9502 | D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n" , p->level, ' ', |
9503 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param ',' TYPE_COMMENT?" )); |
9504 | } |
9505 | { // param TYPE_COMMENT? &')' |
9506 | if (p->error_indicator) { |
9507 | p->level--; |
9508 | return NULL; |
9509 | } |
9510 | D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'" )); |
9511 | arg_ty a; |
9512 | void *tc; |
9513 | if ( |
9514 | (a = param_rule(p)) // param |
9515 | && |
9516 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
9517 | && |
9518 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
9519 | ) |
9520 | { |
9521 | D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'" )); |
9522 | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
9523 | if (_res == NULL && PyErr_Occurred()) { |
9524 | p->error_indicator = 1; |
9525 | p->level--; |
9526 | return NULL; |
9527 | } |
9528 | goto done; |
9529 | } |
9530 | p->mark = _mark; |
9531 | D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n" , p->level, ' ', |
9532 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param TYPE_COMMENT? &')'" )); |
9533 | } |
9534 | _res = NULL; |
9535 | done: |
9536 | p->level--; |
9537 | return _res; |
9538 | } |
9539 | |
9540 | // param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')' |
9541 | static NameDefaultPair* |
9542 | param_with_default_rule(Parser *p) |
9543 | { |
9544 | if (p->level++ == MAXSTACK) { |
9545 | p->error_indicator = 1; |
9546 | PyErr_NoMemory(); |
9547 | } |
9548 | if (p->error_indicator) { |
9549 | p->level--; |
9550 | return NULL; |
9551 | } |
9552 | NameDefaultPair* _res = NULL; |
9553 | int _mark = p->mark; |
9554 | { // param default ',' TYPE_COMMENT? |
9555 | if (p->error_indicator) { |
9556 | p->level--; |
9557 | return NULL; |
9558 | } |
9559 | D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?" )); |
9560 | Token * _literal; |
9561 | arg_ty a; |
9562 | expr_ty c; |
9563 | void *tc; |
9564 | if ( |
9565 | (a = param_rule(p)) // param |
9566 | && |
9567 | (c = default_rule(p)) // default |
9568 | && |
9569 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
9570 | && |
9571 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
9572 | ) |
9573 | { |
9574 | D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?" )); |
9575 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
9576 | if (_res == NULL && PyErr_Occurred()) { |
9577 | p->error_indicator = 1; |
9578 | p->level--; |
9579 | return NULL; |
9580 | } |
9581 | goto done; |
9582 | } |
9583 | p->mark = _mark; |
9584 | D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n" , p->level, ' ', |
9585 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param default ',' TYPE_COMMENT?" )); |
9586 | } |
9587 | { // param default TYPE_COMMENT? &')' |
9588 | if (p->error_indicator) { |
9589 | p->level--; |
9590 | return NULL; |
9591 | } |
9592 | D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'" )); |
9593 | arg_ty a; |
9594 | expr_ty c; |
9595 | void *tc; |
9596 | if ( |
9597 | (a = param_rule(p)) // param |
9598 | && |
9599 | (c = default_rule(p)) // default |
9600 | && |
9601 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
9602 | && |
9603 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
9604 | ) |
9605 | { |
9606 | D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'" )); |
9607 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
9608 | if (_res == NULL && PyErr_Occurred()) { |
9609 | p->error_indicator = 1; |
9610 | p->level--; |
9611 | return NULL; |
9612 | } |
9613 | goto done; |
9614 | } |
9615 | p->mark = _mark; |
9616 | D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n" , p->level, ' ', |
9617 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param default TYPE_COMMENT? &')'" )); |
9618 | } |
9619 | _res = NULL; |
9620 | done: |
9621 | p->level--; |
9622 | return _res; |
9623 | } |
9624 | |
9625 | // param_maybe_default: |
9626 | // | param default? ',' TYPE_COMMENT? |
9627 | // | param default? TYPE_COMMENT? &')' |
9628 | static NameDefaultPair* |
9629 | param_maybe_default_rule(Parser *p) |
9630 | { |
9631 | if (p->level++ == MAXSTACK) { |
9632 | p->error_indicator = 1; |
9633 | PyErr_NoMemory(); |
9634 | } |
9635 | if (p->error_indicator) { |
9636 | p->level--; |
9637 | return NULL; |
9638 | } |
9639 | NameDefaultPair* _res = NULL; |
9640 | int _mark = p->mark; |
9641 | { // param default? ',' TYPE_COMMENT? |
9642 | if (p->error_indicator) { |
9643 | p->level--; |
9644 | return NULL; |
9645 | } |
9646 | D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?" )); |
9647 | Token * _literal; |
9648 | arg_ty a; |
9649 | void *c; |
9650 | void *tc; |
9651 | if ( |
9652 | (a = param_rule(p)) // param |
9653 | && |
9654 | (c = default_rule(p), !p->error_indicator) // default? |
9655 | && |
9656 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
9657 | && |
9658 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
9659 | ) |
9660 | { |
9661 | D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?" )); |
9662 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
9663 | if (_res == NULL && PyErr_Occurred()) { |
9664 | p->error_indicator = 1; |
9665 | p->level--; |
9666 | return NULL; |
9667 | } |
9668 | goto done; |
9669 | } |
9670 | p->mark = _mark; |
9671 | D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n" , p->level, ' ', |
9672 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param default? ',' TYPE_COMMENT?" )); |
9673 | } |
9674 | { // param default? TYPE_COMMENT? &')' |
9675 | if (p->error_indicator) { |
9676 | p->level--; |
9677 | return NULL; |
9678 | } |
9679 | D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'" )); |
9680 | arg_ty a; |
9681 | void *c; |
9682 | void *tc; |
9683 | if ( |
9684 | (a = param_rule(p)) // param |
9685 | && |
9686 | (c = default_rule(p), !p->error_indicator) // default? |
9687 | && |
9688 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
9689 | && |
9690 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
9691 | ) |
9692 | { |
9693 | D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'" )); |
9694 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
9695 | if (_res == NULL && PyErr_Occurred()) { |
9696 | p->error_indicator = 1; |
9697 | p->level--; |
9698 | return NULL; |
9699 | } |
9700 | goto done; |
9701 | } |
9702 | p->mark = _mark; |
9703 | D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n" , p->level, ' ', |
9704 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param default? TYPE_COMMENT? &')'" )); |
9705 | } |
9706 | _res = NULL; |
9707 | done: |
9708 | p->level--; |
9709 | return _res; |
9710 | } |
9711 | |
9712 | // param: NAME annotation? |
9713 | static arg_ty |
9714 | param_rule(Parser *p) |
9715 | { |
9716 | if (p->level++ == MAXSTACK) { |
9717 | p->error_indicator = 1; |
9718 | PyErr_NoMemory(); |
9719 | } |
9720 | if (p->error_indicator) { |
9721 | p->level--; |
9722 | return NULL; |
9723 | } |
9724 | arg_ty _res = NULL; |
9725 | int _mark = p->mark; |
9726 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
9727 | p->error_indicator = 1; |
9728 | p->level--; |
9729 | return NULL; |
9730 | } |
9731 | int _start_lineno = p->tokens[_mark]->lineno; |
9732 | UNUSED(_start_lineno); // Only used by EXTRA macro |
9733 | int _start_col_offset = p->tokens[_mark]->col_offset; |
9734 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
9735 | { // NAME annotation? |
9736 | if (p->error_indicator) { |
9737 | p->level--; |
9738 | return NULL; |
9739 | } |
9740 | D(fprintf(stderr, "%*c> param[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME annotation?" )); |
9741 | expr_ty a; |
9742 | void *b; |
9743 | if ( |
9744 | (a = _PyPegen_name_token(p)) // NAME |
9745 | && |
9746 | (b = annotation_rule(p), !p->error_indicator) // annotation? |
9747 | ) |
9748 | { |
9749 | D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME annotation?" )); |
9750 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
9751 | if (_token == NULL) { |
9752 | p->level--; |
9753 | return NULL; |
9754 | } |
9755 | int _end_lineno = _token->end_lineno; |
9756 | UNUSED(_end_lineno); // Only used by EXTRA macro |
9757 | int _end_col_offset = _token->end_col_offset; |
9758 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
9759 | _res = _PyAST_arg ( a -> v . Name . id , b , NULL , EXTRA ); |
9760 | if (_res == NULL && PyErr_Occurred()) { |
9761 | p->error_indicator = 1; |
9762 | p->level--; |
9763 | return NULL; |
9764 | } |
9765 | goto done; |
9766 | } |
9767 | p->mark = _mark; |
9768 | D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n" , p->level, ' ', |
9769 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME annotation?" )); |
9770 | } |
9771 | _res = NULL; |
9772 | done: |
9773 | p->level--; |
9774 | return _res; |
9775 | } |
9776 | |
9777 | // annotation: ':' expression |
9778 | static expr_ty |
9779 | annotation_rule(Parser *p) |
9780 | { |
9781 | if (p->level++ == MAXSTACK) { |
9782 | p->error_indicator = 1; |
9783 | PyErr_NoMemory(); |
9784 | } |
9785 | if (p->error_indicator) { |
9786 | p->level--; |
9787 | return NULL; |
9788 | } |
9789 | expr_ty _res = NULL; |
9790 | int _mark = p->mark; |
9791 | { // ':' expression |
9792 | if (p->error_indicator) { |
9793 | p->level--; |
9794 | return NULL; |
9795 | } |
9796 | D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "':' expression" )); |
9797 | Token * _literal; |
9798 | expr_ty a; |
9799 | if ( |
9800 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
9801 | && |
9802 | (a = expression_rule(p)) // expression |
9803 | ) |
9804 | { |
9805 | D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "':' expression" )); |
9806 | _res = a; |
9807 | if (_res == NULL && PyErr_Occurred()) { |
9808 | p->error_indicator = 1; |
9809 | p->level--; |
9810 | return NULL; |
9811 | } |
9812 | goto done; |
9813 | } |
9814 | p->mark = _mark; |
9815 | D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n" , p->level, ' ', |
9816 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "':' expression" )); |
9817 | } |
9818 | _res = NULL; |
9819 | done: |
9820 | p->level--; |
9821 | return _res; |
9822 | } |
9823 | |
9824 | // default: '=' expression |
9825 | static expr_ty |
9826 | default_rule(Parser *p) |
9827 | { |
9828 | if (p->level++ == MAXSTACK) { |
9829 | p->error_indicator = 1; |
9830 | PyErr_NoMemory(); |
9831 | } |
9832 | if (p->error_indicator) { |
9833 | p->level--; |
9834 | return NULL; |
9835 | } |
9836 | expr_ty _res = NULL; |
9837 | int _mark = p->mark; |
9838 | { // '=' expression |
9839 | if (p->error_indicator) { |
9840 | p->level--; |
9841 | return NULL; |
9842 | } |
9843 | D(fprintf(stderr, "%*c> default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'=' expression" )); |
9844 | Token * _literal; |
9845 | expr_ty a; |
9846 | if ( |
9847 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
9848 | && |
9849 | (a = expression_rule(p)) // expression |
9850 | ) |
9851 | { |
9852 | D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'=' expression" )); |
9853 | _res = a; |
9854 | if (_res == NULL && PyErr_Occurred()) { |
9855 | p->error_indicator = 1; |
9856 | p->level--; |
9857 | return NULL; |
9858 | } |
9859 | goto done; |
9860 | } |
9861 | p->mark = _mark; |
9862 | D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n" , p->level, ' ', |
9863 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'=' expression" )); |
9864 | } |
9865 | _res = NULL; |
9866 | done: |
9867 | p->level--; |
9868 | return _res; |
9869 | } |
9870 | |
9871 | // decorators: (('@' named_expression NEWLINE))+ |
9872 | static asdl_expr_seq* |
9873 | decorators_rule(Parser *p) |
9874 | { |
9875 | if (p->level++ == MAXSTACK) { |
9876 | p->error_indicator = 1; |
9877 | PyErr_NoMemory(); |
9878 | } |
9879 | if (p->error_indicator) { |
9880 | p->level--; |
9881 | return NULL; |
9882 | } |
9883 | asdl_expr_seq* _res = NULL; |
9884 | int _mark = p->mark; |
9885 | { // (('@' named_expression NEWLINE))+ |
9886 | if (p->error_indicator) { |
9887 | p->level--; |
9888 | return NULL; |
9889 | } |
9890 | D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+" )); |
9891 | asdl_expr_seq* a; |
9892 | if ( |
9893 | (a = (asdl_expr_seq*)_loop1_84_rule(p)) // (('@' named_expression NEWLINE))+ |
9894 | ) |
9895 | { |
9896 | D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+" )); |
9897 | _res = a; |
9898 | if (_res == NULL && PyErr_Occurred()) { |
9899 | p->error_indicator = 1; |
9900 | p->level--; |
9901 | return NULL; |
9902 | } |
9903 | goto done; |
9904 | } |
9905 | p->mark = _mark; |
9906 | D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n" , p->level, ' ', |
9907 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(('@' named_expression NEWLINE))+" )); |
9908 | } |
9909 | _res = NULL; |
9910 | done: |
9911 | p->level--; |
9912 | return _res; |
9913 | } |
9914 | |
9915 | // class_def: decorators class_def_raw | class_def_raw |
9916 | static stmt_ty |
9917 | class_def_rule(Parser *p) |
9918 | { |
9919 | if (p->level++ == MAXSTACK) { |
9920 | p->error_indicator = 1; |
9921 | PyErr_NoMemory(); |
9922 | } |
9923 | if (p->error_indicator) { |
9924 | p->level--; |
9925 | return NULL; |
9926 | } |
9927 | stmt_ty _res = NULL; |
9928 | int _mark = p->mark; |
9929 | { // decorators class_def_raw |
9930 | if (p->error_indicator) { |
9931 | p->level--; |
9932 | return NULL; |
9933 | } |
9934 | D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "decorators class_def_raw" )); |
9935 | asdl_expr_seq* a; |
9936 | stmt_ty b; |
9937 | if ( |
9938 | (a = decorators_rule(p)) // decorators |
9939 | && |
9940 | (b = class_def_raw_rule(p)) // class_def_raw |
9941 | ) |
9942 | { |
9943 | D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "decorators class_def_raw" )); |
9944 | _res = _PyPegen_class_def_decorators ( p , a , b ); |
9945 | if (_res == NULL && PyErr_Occurred()) { |
9946 | p->error_indicator = 1; |
9947 | p->level--; |
9948 | return NULL; |
9949 | } |
9950 | goto done; |
9951 | } |
9952 | p->mark = _mark; |
9953 | D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n" , p->level, ' ', |
9954 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "decorators class_def_raw" )); |
9955 | } |
9956 | { // class_def_raw |
9957 | if (p->error_indicator) { |
9958 | p->level--; |
9959 | return NULL; |
9960 | } |
9961 | D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "class_def_raw" )); |
9962 | stmt_ty class_def_raw_var; |
9963 | if ( |
9964 | (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw |
9965 | ) |
9966 | { |
9967 | D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "class_def_raw" )); |
9968 | _res = class_def_raw_var; |
9969 | goto done; |
9970 | } |
9971 | p->mark = _mark; |
9972 | D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n" , p->level, ' ', |
9973 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "class_def_raw" )); |
9974 | } |
9975 | _res = NULL; |
9976 | done: |
9977 | p->level--; |
9978 | return _res; |
9979 | } |
9980 | |
9981 | // class_def_raw: invalid_class_def_raw | 'class' NAME ['(' arguments? ')'] &&':' block |
9982 | static stmt_ty |
9983 | class_def_raw_rule(Parser *p) |
9984 | { |
9985 | if (p->level++ == MAXSTACK) { |
9986 | p->error_indicator = 1; |
9987 | PyErr_NoMemory(); |
9988 | } |
9989 | if (p->error_indicator) { |
9990 | p->level--; |
9991 | return NULL; |
9992 | } |
9993 | stmt_ty _res = NULL; |
9994 | int _mark = p->mark; |
9995 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
9996 | p->error_indicator = 1; |
9997 | p->level--; |
9998 | return NULL; |
9999 | } |
10000 | int _start_lineno = p->tokens[_mark]->lineno; |
10001 | UNUSED(_start_lineno); // Only used by EXTRA macro |
10002 | int _start_col_offset = p->tokens[_mark]->col_offset; |
10003 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
10004 | if (p->call_invalid_rules) { // invalid_class_def_raw |
10005 | if (p->error_indicator) { |
10006 | p->level--; |
10007 | return NULL; |
10008 | } |
10009 | D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_class_def_raw" )); |
10010 | void *invalid_class_def_raw_var; |
10011 | if ( |
10012 | (invalid_class_def_raw_var = invalid_class_def_raw_rule(p)) // invalid_class_def_raw |
10013 | ) |
10014 | { |
10015 | D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_class_def_raw" )); |
10016 | _res = invalid_class_def_raw_var; |
10017 | goto done; |
10018 | } |
10019 | p->mark = _mark; |
10020 | D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n" , p->level, ' ', |
10021 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_class_def_raw" )); |
10022 | } |
10023 | { // 'class' NAME ['(' arguments? ')'] &&':' block |
10024 | if (p->error_indicator) { |
10025 | p->level--; |
10026 | return NULL; |
10027 | } |
10028 | D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block" )); |
10029 | Token * _keyword; |
10030 | Token * _literal; |
10031 | expr_ty a; |
10032 | void *b; |
10033 | asdl_stmt_seq* c; |
10034 | if ( |
10035 | (_keyword = _PyPegen_expect_token(p, 527)) // token='class' |
10036 | && |
10037 | (a = _PyPegen_name_token(p)) // NAME |
10038 | && |
10039 | (b = _tmp_85_rule(p), !p->error_indicator) // ['(' arguments? ')'] |
10040 | && |
10041 | (_literal = _PyPegen_expect_forced_token(p, 11, ":" )) // forced_token=':' |
10042 | && |
10043 | (c = block_rule(p)) // block |
10044 | ) |
10045 | { |
10046 | D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block" )); |
10047 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10048 | if (_token == NULL) { |
10049 | p->level--; |
10050 | return NULL; |
10051 | } |
10052 | int _end_lineno = _token->end_lineno; |
10053 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10054 | int _end_col_offset = _token->end_col_offset; |
10055 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10056 | _res = _PyAST_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , EXTRA ); |
10057 | if (_res == NULL && PyErr_Occurred()) { |
10058 | p->error_indicator = 1; |
10059 | p->level--; |
10060 | return NULL; |
10061 | } |
10062 | goto done; |
10063 | } |
10064 | p->mark = _mark; |
10065 | D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n" , p->level, ' ', |
10066 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block" )); |
10067 | } |
10068 | _res = NULL; |
10069 | done: |
10070 | p->level--; |
10071 | return _res; |
10072 | } |
10073 | |
10074 | // block: NEWLINE INDENT statements DEDENT | simple_stmts | invalid_block |
10075 | static asdl_stmt_seq* |
10076 | block_rule(Parser *p) |
10077 | { |
10078 | if (p->level++ == MAXSTACK) { |
10079 | p->error_indicator = 1; |
10080 | PyErr_NoMemory(); |
10081 | } |
10082 | if (p->error_indicator) { |
10083 | p->level--; |
10084 | return NULL; |
10085 | } |
10086 | asdl_stmt_seq* _res = NULL; |
10087 | if (_PyPegen_is_memoized(p, block_type, &_res)) { |
10088 | p->level--; |
10089 | return _res; |
10090 | } |
10091 | int _mark = p->mark; |
10092 | { // NEWLINE INDENT statements DEDENT |
10093 | if (p->error_indicator) { |
10094 | p->level--; |
10095 | return NULL; |
10096 | } |
10097 | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT" )); |
10098 | asdl_stmt_seq* a; |
10099 | Token * dedent_var; |
10100 | Token * indent_var; |
10101 | Token * newline_var; |
10102 | if ( |
10103 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
10104 | && |
10105 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
10106 | && |
10107 | (a = statements_rule(p)) // statements |
10108 | && |
10109 | (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' |
10110 | ) |
10111 | { |
10112 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT" )); |
10113 | _res = a; |
10114 | if (_res == NULL && PyErr_Occurred()) { |
10115 | p->error_indicator = 1; |
10116 | p->level--; |
10117 | return NULL; |
10118 | } |
10119 | goto done; |
10120 | } |
10121 | p->mark = _mark; |
10122 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n" , p->level, ' ', |
10123 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NEWLINE INDENT statements DEDENT" )); |
10124 | } |
10125 | { // simple_stmts |
10126 | if (p->error_indicator) { |
10127 | p->level--; |
10128 | return NULL; |
10129 | } |
10130 | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "simple_stmts" )); |
10131 | asdl_stmt_seq* simple_stmts_var; |
10132 | if ( |
10133 | (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts |
10134 | ) |
10135 | { |
10136 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "simple_stmts" )); |
10137 | _res = simple_stmts_var; |
10138 | goto done; |
10139 | } |
10140 | p->mark = _mark; |
10141 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n" , p->level, ' ', |
10142 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "simple_stmts" )); |
10143 | } |
10144 | if (p->call_invalid_rules) { // invalid_block |
10145 | if (p->error_indicator) { |
10146 | p->level--; |
10147 | return NULL; |
10148 | } |
10149 | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_block" )); |
10150 | void *invalid_block_var; |
10151 | if ( |
10152 | (invalid_block_var = invalid_block_rule(p)) // invalid_block |
10153 | ) |
10154 | { |
10155 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_block" )); |
10156 | _res = invalid_block_var; |
10157 | goto done; |
10158 | } |
10159 | p->mark = _mark; |
10160 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n" , p->level, ' ', |
10161 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_block" )); |
10162 | } |
10163 | _res = NULL; |
10164 | done: |
10165 | _PyPegen_insert_memo(p, _mark, block_type, _res); |
10166 | p->level--; |
10167 | return _res; |
10168 | } |
10169 | |
10170 | // star_expressions: |
10171 | // | star_expression ((',' star_expression))+ ','? |
10172 | // | star_expression ',' |
10173 | // | star_expression |
10174 | static expr_ty |
10175 | star_expressions_rule(Parser *p) |
10176 | { |
10177 | if (p->level++ == MAXSTACK) { |
10178 | p->error_indicator = 1; |
10179 | PyErr_NoMemory(); |
10180 | } |
10181 | if (p->error_indicator) { |
10182 | p->level--; |
10183 | return NULL; |
10184 | } |
10185 | expr_ty _res = NULL; |
10186 | int _mark = p->mark; |
10187 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
10188 | p->error_indicator = 1; |
10189 | p->level--; |
10190 | return NULL; |
10191 | } |
10192 | int _start_lineno = p->tokens[_mark]->lineno; |
10193 | UNUSED(_start_lineno); // Only used by EXTRA macro |
10194 | int _start_col_offset = p->tokens[_mark]->col_offset; |
10195 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
10196 | { // star_expression ((',' star_expression))+ ','? |
10197 | if (p->error_indicator) { |
10198 | p->level--; |
10199 | return NULL; |
10200 | } |
10201 | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?" )); |
10202 | void *_opt_var; |
10203 | UNUSED(_opt_var); // Silence compiler warnings |
10204 | expr_ty a; |
10205 | asdl_seq * b; |
10206 | if ( |
10207 | (a = star_expression_rule(p)) // star_expression |
10208 | && |
10209 | (b = _loop1_86_rule(p)) // ((',' star_expression))+ |
10210 | && |
10211 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
10212 | ) |
10213 | { |
10214 | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?" )); |
10215 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10216 | if (_token == NULL) { |
10217 | p->level--; |
10218 | return NULL; |
10219 | } |
10220 | int _end_lineno = _token->end_lineno; |
10221 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10222 | int _end_col_offset = _token->end_col_offset; |
10223 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10224 | _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); |
10225 | if (_res == NULL && PyErr_Occurred()) { |
10226 | p->error_indicator = 1; |
10227 | p->level--; |
10228 | return NULL; |
10229 | } |
10230 | goto done; |
10231 | } |
10232 | p->mark = _mark; |
10233 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
10234 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_expression ((',' star_expression))+ ','?" )); |
10235 | } |
10236 | { // star_expression ',' |
10237 | if (p->error_indicator) { |
10238 | p->level--; |
10239 | return NULL; |
10240 | } |
10241 | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_expression ','" )); |
10242 | Token * _literal; |
10243 | expr_ty a; |
10244 | if ( |
10245 | (a = star_expression_rule(p)) // star_expression |
10246 | && |
10247 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
10248 | ) |
10249 | { |
10250 | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_expression ','" )); |
10251 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10252 | if (_token == NULL) { |
10253 | p->level--; |
10254 | return NULL; |
10255 | } |
10256 | int _end_lineno = _token->end_lineno; |
10257 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10258 | int _end_col_offset = _token->end_col_offset; |
10259 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10260 | _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); |
10261 | if (_res == NULL && PyErr_Occurred()) { |
10262 | p->error_indicator = 1; |
10263 | p->level--; |
10264 | return NULL; |
10265 | } |
10266 | goto done; |
10267 | } |
10268 | p->mark = _mark; |
10269 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
10270 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_expression ','" )); |
10271 | } |
10272 | { // star_expression |
10273 | if (p->error_indicator) { |
10274 | p->level--; |
10275 | return NULL; |
10276 | } |
10277 | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_expression" )); |
10278 | expr_ty star_expression_var; |
10279 | if ( |
10280 | (star_expression_var = star_expression_rule(p)) // star_expression |
10281 | ) |
10282 | { |
10283 | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_expression" )); |
10284 | _res = star_expression_var; |
10285 | goto done; |
10286 | } |
10287 | p->mark = _mark; |
10288 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
10289 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_expression" )); |
10290 | } |
10291 | _res = NULL; |
10292 | done: |
10293 | p->level--; |
10294 | return _res; |
10295 | } |
10296 | |
10297 | // star_expression: '*' bitwise_or | expression |
10298 | static expr_ty |
10299 | star_expression_rule(Parser *p) |
10300 | { |
10301 | if (p->level++ == MAXSTACK) { |
10302 | p->error_indicator = 1; |
10303 | PyErr_NoMemory(); |
10304 | } |
10305 | if (p->error_indicator) { |
10306 | p->level--; |
10307 | return NULL; |
10308 | } |
10309 | expr_ty _res = NULL; |
10310 | if (_PyPegen_is_memoized(p, star_expression_type, &_res)) { |
10311 | p->level--; |
10312 | return _res; |
10313 | } |
10314 | int _mark = p->mark; |
10315 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
10316 | p->error_indicator = 1; |
10317 | p->level--; |
10318 | return NULL; |
10319 | } |
10320 | int _start_lineno = p->tokens[_mark]->lineno; |
10321 | UNUSED(_start_lineno); // Only used by EXTRA macro |
10322 | int _start_col_offset = p->tokens[_mark]->col_offset; |
10323 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
10324 | { // '*' bitwise_or |
10325 | if (p->error_indicator) { |
10326 | p->level--; |
10327 | return NULL; |
10328 | } |
10329 | D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' bitwise_or" )); |
10330 | Token * _literal; |
10331 | expr_ty a; |
10332 | if ( |
10333 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
10334 | && |
10335 | (a = bitwise_or_rule(p)) // bitwise_or |
10336 | ) |
10337 | { |
10338 | D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' bitwise_or" )); |
10339 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10340 | if (_token == NULL) { |
10341 | p->level--; |
10342 | return NULL; |
10343 | } |
10344 | int _end_lineno = _token->end_lineno; |
10345 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10346 | int _end_col_offset = _token->end_col_offset; |
10347 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10348 | _res = _PyAST_Starred ( a , Load , EXTRA ); |
10349 | if (_res == NULL && PyErr_Occurred()) { |
10350 | p->error_indicator = 1; |
10351 | p->level--; |
10352 | return NULL; |
10353 | } |
10354 | goto done; |
10355 | } |
10356 | p->mark = _mark; |
10357 | D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
10358 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' bitwise_or" )); |
10359 | } |
10360 | { // expression |
10361 | if (p->error_indicator) { |
10362 | p->level--; |
10363 | return NULL; |
10364 | } |
10365 | D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression" )); |
10366 | expr_ty expression_var; |
10367 | if ( |
10368 | (expression_var = expression_rule(p)) // expression |
10369 | ) |
10370 | { |
10371 | D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression" )); |
10372 | _res = expression_var; |
10373 | goto done; |
10374 | } |
10375 | p->mark = _mark; |
10376 | D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
10377 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression" )); |
10378 | } |
10379 | _res = NULL; |
10380 | done: |
10381 | _PyPegen_insert_memo(p, _mark, star_expression_type, _res); |
10382 | p->level--; |
10383 | return _res; |
10384 | } |
10385 | |
10386 | // star_named_expressions: ','.star_named_expression+ ','? |
10387 | static asdl_expr_seq* |
10388 | star_named_expressions_rule(Parser *p) |
10389 | { |
10390 | if (p->level++ == MAXSTACK) { |
10391 | p->error_indicator = 1; |
10392 | PyErr_NoMemory(); |
10393 | } |
10394 | if (p->error_indicator) { |
10395 | p->level--; |
10396 | return NULL; |
10397 | } |
10398 | asdl_expr_seq* _res = NULL; |
10399 | int _mark = p->mark; |
10400 | { // ','.star_named_expression+ ','? |
10401 | if (p->error_indicator) { |
10402 | p->level--; |
10403 | return NULL; |
10404 | } |
10405 | D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?" )); |
10406 | void *_opt_var; |
10407 | UNUSED(_opt_var); // Silence compiler warnings |
10408 | asdl_expr_seq* a; |
10409 | if ( |
10410 | (a = (asdl_expr_seq*)_gather_87_rule(p)) // ','.star_named_expression+ |
10411 | && |
10412 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
10413 | ) |
10414 | { |
10415 | D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?" )); |
10416 | _res = a; |
10417 | if (_res == NULL && PyErr_Occurred()) { |
10418 | p->error_indicator = 1; |
10419 | p->level--; |
10420 | return NULL; |
10421 | } |
10422 | goto done; |
10423 | } |
10424 | p->mark = _mark; |
10425 | D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
10426 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.star_named_expression+ ','?" )); |
10427 | } |
10428 | _res = NULL; |
10429 | done: |
10430 | p->level--; |
10431 | return _res; |
10432 | } |
10433 | |
10434 | // star_named_expression: '*' bitwise_or | named_expression |
10435 | static expr_ty |
10436 | star_named_expression_rule(Parser *p) |
10437 | { |
10438 | if (p->level++ == MAXSTACK) { |
10439 | p->error_indicator = 1; |
10440 | PyErr_NoMemory(); |
10441 | } |
10442 | if (p->error_indicator) { |
10443 | p->level--; |
10444 | return NULL; |
10445 | } |
10446 | expr_ty _res = NULL; |
10447 | int _mark = p->mark; |
10448 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
10449 | p->error_indicator = 1; |
10450 | p->level--; |
10451 | return NULL; |
10452 | } |
10453 | int _start_lineno = p->tokens[_mark]->lineno; |
10454 | UNUSED(_start_lineno); // Only used by EXTRA macro |
10455 | int _start_col_offset = p->tokens[_mark]->col_offset; |
10456 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
10457 | { // '*' bitwise_or |
10458 | if (p->error_indicator) { |
10459 | p->level--; |
10460 | return NULL; |
10461 | } |
10462 | D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' bitwise_or" )); |
10463 | Token * _literal; |
10464 | expr_ty a; |
10465 | if ( |
10466 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
10467 | && |
10468 | (a = bitwise_or_rule(p)) // bitwise_or |
10469 | ) |
10470 | { |
10471 | D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' bitwise_or" )); |
10472 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10473 | if (_token == NULL) { |
10474 | p->level--; |
10475 | return NULL; |
10476 | } |
10477 | int _end_lineno = _token->end_lineno; |
10478 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10479 | int _end_col_offset = _token->end_col_offset; |
10480 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10481 | _res = _PyAST_Starred ( a , Load , EXTRA ); |
10482 | if (_res == NULL && PyErr_Occurred()) { |
10483 | p->error_indicator = 1; |
10484 | p->level--; |
10485 | return NULL; |
10486 | } |
10487 | goto done; |
10488 | } |
10489 | p->mark = _mark; |
10490 | D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
10491 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' bitwise_or" )); |
10492 | } |
10493 | { // named_expression |
10494 | if (p->error_indicator) { |
10495 | p->level--; |
10496 | return NULL; |
10497 | } |
10498 | D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "named_expression" )); |
10499 | expr_ty named_expression_var; |
10500 | if ( |
10501 | (named_expression_var = named_expression_rule(p)) // named_expression |
10502 | ) |
10503 | { |
10504 | D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "named_expression" )); |
10505 | _res = named_expression_var; |
10506 | goto done; |
10507 | } |
10508 | p->mark = _mark; |
10509 | D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
10510 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "named_expression" )); |
10511 | } |
10512 | _res = NULL; |
10513 | done: |
10514 | p->level--; |
10515 | return _res; |
10516 | } |
10517 | |
10518 | // assignment_expression: NAME ':=' ~ expression |
10519 | static expr_ty |
10520 | assignment_expression_rule(Parser *p) |
10521 | { |
10522 | if (p->level++ == MAXSTACK) { |
10523 | p->error_indicator = 1; |
10524 | PyErr_NoMemory(); |
10525 | } |
10526 | if (p->error_indicator) { |
10527 | p->level--; |
10528 | return NULL; |
10529 | } |
10530 | expr_ty _res = NULL; |
10531 | int _mark = p->mark; |
10532 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
10533 | p->error_indicator = 1; |
10534 | p->level--; |
10535 | return NULL; |
10536 | } |
10537 | int _start_lineno = p->tokens[_mark]->lineno; |
10538 | UNUSED(_start_lineno); // Only used by EXTRA macro |
10539 | int _start_col_offset = p->tokens[_mark]->col_offset; |
10540 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
10541 | { // NAME ':=' ~ expression |
10542 | if (p->error_indicator) { |
10543 | p->level--; |
10544 | return NULL; |
10545 | } |
10546 | D(fprintf(stderr, "%*c> assignment_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression" )); |
10547 | int _cut_var = 0; |
10548 | Token * _literal; |
10549 | expr_ty a; |
10550 | expr_ty b; |
10551 | if ( |
10552 | (a = _PyPegen_name_token(p)) // NAME |
10553 | && |
10554 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
10555 | && |
10556 | (_cut_var = 1) |
10557 | && |
10558 | (b = expression_rule(p)) // expression |
10559 | ) |
10560 | { |
10561 | D(fprintf(stderr, "%*c+ assignment_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression" )); |
10562 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10563 | if (_token == NULL) { |
10564 | p->level--; |
10565 | return NULL; |
10566 | } |
10567 | int _end_lineno = _token->end_lineno; |
10568 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10569 | int _end_col_offset = _token->end_col_offset; |
10570 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10571 | _res = _PyAST_NamedExpr ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ); |
10572 | if (_res == NULL && PyErr_Occurred()) { |
10573 | p->error_indicator = 1; |
10574 | p->level--; |
10575 | return NULL; |
10576 | } |
10577 | goto done; |
10578 | } |
10579 | p->mark = _mark; |
10580 | D(fprintf(stderr, "%*c%s assignment_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
10581 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME ':=' ~ expression" )); |
10582 | if (_cut_var) { |
10583 | p->level--; |
10584 | return NULL; |
10585 | } |
10586 | } |
10587 | _res = NULL; |
10588 | done: |
10589 | p->level--; |
10590 | return _res; |
10591 | } |
10592 | |
10593 | // named_expression: assignment_expression | invalid_named_expression | expression !':=' |
10594 | static expr_ty |
10595 | named_expression_rule(Parser *p) |
10596 | { |
10597 | if (p->level++ == MAXSTACK) { |
10598 | p->error_indicator = 1; |
10599 | PyErr_NoMemory(); |
10600 | } |
10601 | if (p->error_indicator) { |
10602 | p->level--; |
10603 | return NULL; |
10604 | } |
10605 | expr_ty _res = NULL; |
10606 | int _mark = p->mark; |
10607 | { // assignment_expression |
10608 | if (p->error_indicator) { |
10609 | p->level--; |
10610 | return NULL; |
10611 | } |
10612 | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "assignment_expression" )); |
10613 | expr_ty assignment_expression_var; |
10614 | if ( |
10615 | (assignment_expression_var = assignment_expression_rule(p)) // assignment_expression |
10616 | ) |
10617 | { |
10618 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "assignment_expression" )); |
10619 | _res = assignment_expression_var; |
10620 | goto done; |
10621 | } |
10622 | p->mark = _mark; |
10623 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
10624 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "assignment_expression" )); |
10625 | } |
10626 | if (p->call_invalid_rules) { // invalid_named_expression |
10627 | if (p->error_indicator) { |
10628 | p->level--; |
10629 | return NULL; |
10630 | } |
10631 | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_named_expression" )); |
10632 | void *invalid_named_expression_var; |
10633 | if ( |
10634 | (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression |
10635 | ) |
10636 | { |
10637 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_named_expression" )); |
10638 | _res = invalid_named_expression_var; |
10639 | goto done; |
10640 | } |
10641 | p->mark = _mark; |
10642 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
10643 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_named_expression" )); |
10644 | } |
10645 | { // expression !':=' |
10646 | if (p->error_indicator) { |
10647 | p->level--; |
10648 | return NULL; |
10649 | } |
10650 | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression !':='" )); |
10651 | expr_ty expression_var; |
10652 | if ( |
10653 | (expression_var = expression_rule(p)) // expression |
10654 | && |
10655 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' |
10656 | ) |
10657 | { |
10658 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression !':='" )); |
10659 | _res = expression_var; |
10660 | goto done; |
10661 | } |
10662 | p->mark = _mark; |
10663 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
10664 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression !':='" )); |
10665 | } |
10666 | _res = NULL; |
10667 | done: |
10668 | p->level--; |
10669 | return _res; |
10670 | } |
10671 | |
10672 | // annotated_rhs: yield_expr | star_expressions |
10673 | static expr_ty |
10674 | annotated_rhs_rule(Parser *p) |
10675 | { |
10676 | if (p->level++ == MAXSTACK) { |
10677 | p->error_indicator = 1; |
10678 | PyErr_NoMemory(); |
10679 | } |
10680 | if (p->error_indicator) { |
10681 | p->level--; |
10682 | return NULL; |
10683 | } |
10684 | expr_ty _res = NULL; |
10685 | int _mark = p->mark; |
10686 | { // yield_expr |
10687 | if (p->error_indicator) { |
10688 | p->level--; |
10689 | return NULL; |
10690 | } |
10691 | D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "yield_expr" )); |
10692 | expr_ty yield_expr_var; |
10693 | if ( |
10694 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
10695 | ) |
10696 | { |
10697 | D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "yield_expr" )); |
10698 | _res = yield_expr_var; |
10699 | goto done; |
10700 | } |
10701 | p->mark = _mark; |
10702 | D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n" , p->level, ' ', |
10703 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "yield_expr" )); |
10704 | } |
10705 | { // star_expressions |
10706 | if (p->error_indicator) { |
10707 | p->level--; |
10708 | return NULL; |
10709 | } |
10710 | D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_expressions" )); |
10711 | expr_ty star_expressions_var; |
10712 | if ( |
10713 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
10714 | ) |
10715 | { |
10716 | D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_expressions" )); |
10717 | _res = star_expressions_var; |
10718 | goto done; |
10719 | } |
10720 | p->mark = _mark; |
10721 | D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n" , p->level, ' ', |
10722 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_expressions" )); |
10723 | } |
10724 | _res = NULL; |
10725 | done: |
10726 | p->level--; |
10727 | return _res; |
10728 | } |
10729 | |
10730 | // expressions: expression ((',' expression))+ ','? | expression ',' | expression |
10731 | static expr_ty |
10732 | expressions_rule(Parser *p) |
10733 | { |
10734 | if (p->level++ == MAXSTACK) { |
10735 | p->error_indicator = 1; |
10736 | PyErr_NoMemory(); |
10737 | } |
10738 | if (p->error_indicator) { |
10739 | p->level--; |
10740 | return NULL; |
10741 | } |
10742 | expr_ty _res = NULL; |
10743 | int _mark = p->mark; |
10744 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
10745 | p->error_indicator = 1; |
10746 | p->level--; |
10747 | return NULL; |
10748 | } |
10749 | int _start_lineno = p->tokens[_mark]->lineno; |
10750 | UNUSED(_start_lineno); // Only used by EXTRA macro |
10751 | int _start_col_offset = p->tokens[_mark]->col_offset; |
10752 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
10753 | { // expression ((',' expression))+ ','? |
10754 | if (p->error_indicator) { |
10755 | p->level--; |
10756 | return NULL; |
10757 | } |
10758 | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?" )); |
10759 | void *_opt_var; |
10760 | UNUSED(_opt_var); // Silence compiler warnings |
10761 | expr_ty a; |
10762 | asdl_seq * b; |
10763 | if ( |
10764 | (a = expression_rule(p)) // expression |
10765 | && |
10766 | (b = _loop1_89_rule(p)) // ((',' expression))+ |
10767 | && |
10768 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
10769 | ) |
10770 | { |
10771 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?" )); |
10772 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10773 | if (_token == NULL) { |
10774 | p->level--; |
10775 | return NULL; |
10776 | } |
10777 | int _end_lineno = _token->end_lineno; |
10778 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10779 | int _end_col_offset = _token->end_col_offset; |
10780 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10781 | _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); |
10782 | if (_res == NULL && PyErr_Occurred()) { |
10783 | p->error_indicator = 1; |
10784 | p->level--; |
10785 | return NULL; |
10786 | } |
10787 | goto done; |
10788 | } |
10789 | p->mark = _mark; |
10790 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
10791 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression ((',' expression))+ ','?" )); |
10792 | } |
10793 | { // expression ',' |
10794 | if (p->error_indicator) { |
10795 | p->level--; |
10796 | return NULL; |
10797 | } |
10798 | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression ','" )); |
10799 | Token * _literal; |
10800 | expr_ty a; |
10801 | if ( |
10802 | (a = expression_rule(p)) // expression |
10803 | && |
10804 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
10805 | ) |
10806 | { |
10807 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression ','" )); |
10808 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10809 | if (_token == NULL) { |
10810 | p->level--; |
10811 | return NULL; |
10812 | } |
10813 | int _end_lineno = _token->end_lineno; |
10814 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10815 | int _end_col_offset = _token->end_col_offset; |
10816 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10817 | _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); |
10818 | if (_res == NULL && PyErr_Occurred()) { |
10819 | p->error_indicator = 1; |
10820 | p->level--; |
10821 | return NULL; |
10822 | } |
10823 | goto done; |
10824 | } |
10825 | p->mark = _mark; |
10826 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
10827 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression ','" )); |
10828 | } |
10829 | { // expression |
10830 | if (p->error_indicator) { |
10831 | p->level--; |
10832 | return NULL; |
10833 | } |
10834 | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression" )); |
10835 | expr_ty expression_var; |
10836 | if ( |
10837 | (expression_var = expression_rule(p)) // expression |
10838 | ) |
10839 | { |
10840 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression" )); |
10841 | _res = expression_var; |
10842 | goto done; |
10843 | } |
10844 | p->mark = _mark; |
10845 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n" , p->level, ' ', |
10846 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression" )); |
10847 | } |
10848 | _res = NULL; |
10849 | done: |
10850 | p->level--; |
10851 | return _res; |
10852 | } |
10853 | |
10854 | // expression: |
10855 | // | invalid_expression |
10856 | // | invalid_legacy_expression |
10857 | // | disjunction 'if' disjunction 'else' expression |
10858 | // | disjunction |
10859 | // | lambdef |
10860 | static expr_ty |
10861 | expression_rule(Parser *p) |
10862 | { |
10863 | if (p->level++ == MAXSTACK) { |
10864 | p->error_indicator = 1; |
10865 | PyErr_NoMemory(); |
10866 | } |
10867 | if (p->error_indicator) { |
10868 | p->level--; |
10869 | return NULL; |
10870 | } |
10871 | expr_ty _res = NULL; |
10872 | if (_PyPegen_is_memoized(p, expression_type, &_res)) { |
10873 | p->level--; |
10874 | return _res; |
10875 | } |
10876 | int _mark = p->mark; |
10877 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
10878 | p->error_indicator = 1; |
10879 | p->level--; |
10880 | return NULL; |
10881 | } |
10882 | int _start_lineno = p->tokens[_mark]->lineno; |
10883 | UNUSED(_start_lineno); // Only used by EXTRA macro |
10884 | int _start_col_offset = p->tokens[_mark]->col_offset; |
10885 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
10886 | if (p->call_invalid_rules) { // invalid_expression |
10887 | if (p->error_indicator) { |
10888 | p->level--; |
10889 | return NULL; |
10890 | } |
10891 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_expression" )); |
10892 | void *invalid_expression_var; |
10893 | if ( |
10894 | (invalid_expression_var = invalid_expression_rule(p)) // invalid_expression |
10895 | ) |
10896 | { |
10897 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_expression" )); |
10898 | _res = invalid_expression_var; |
10899 | goto done; |
10900 | } |
10901 | p->mark = _mark; |
10902 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n" , p->level, ' ', |
10903 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_expression" )); |
10904 | } |
10905 | if (p->call_invalid_rules) { // invalid_legacy_expression |
10906 | if (p->error_indicator) { |
10907 | p->level--; |
10908 | return NULL; |
10909 | } |
10910 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_legacy_expression" )); |
10911 | void *invalid_legacy_expression_var; |
10912 | if ( |
10913 | (invalid_legacy_expression_var = invalid_legacy_expression_rule(p)) // invalid_legacy_expression |
10914 | ) |
10915 | { |
10916 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_legacy_expression" )); |
10917 | _res = invalid_legacy_expression_var; |
10918 | goto done; |
10919 | } |
10920 | p->mark = _mark; |
10921 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n" , p->level, ' ', |
10922 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_legacy_expression" )); |
10923 | } |
10924 | { // disjunction 'if' disjunction 'else' expression |
10925 | if (p->error_indicator) { |
10926 | p->level--; |
10927 | return NULL; |
10928 | } |
10929 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression" )); |
10930 | Token * _keyword; |
10931 | Token * _keyword_1; |
10932 | expr_ty a; |
10933 | expr_ty b; |
10934 | expr_ty c; |
10935 | if ( |
10936 | (a = disjunction_rule(p)) // disjunction |
10937 | && |
10938 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
10939 | && |
10940 | (b = disjunction_rule(p)) // disjunction |
10941 | && |
10942 | (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else' |
10943 | && |
10944 | (c = expression_rule(p)) // expression |
10945 | ) |
10946 | { |
10947 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression" )); |
10948 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10949 | if (_token == NULL) { |
10950 | p->level--; |
10951 | return NULL; |
10952 | } |
10953 | int _end_lineno = _token->end_lineno; |
10954 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10955 | int _end_col_offset = _token->end_col_offset; |
10956 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10957 | _res = _PyAST_IfExp ( b , a , c , EXTRA ); |
10958 | if (_res == NULL && PyErr_Occurred()) { |
10959 | p->error_indicator = 1; |
10960 | p->level--; |
10961 | return NULL; |
10962 | } |
10963 | goto done; |
10964 | } |
10965 | p->mark = _mark; |
10966 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n" , p->level, ' ', |
10967 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "disjunction 'if' disjunction 'else' expression" )); |
10968 | } |
10969 | { // disjunction |
10970 | if (p->error_indicator) { |
10971 | p->level--; |
10972 | return NULL; |
10973 | } |
10974 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "disjunction" )); |
10975 | expr_ty disjunction_var; |
10976 | if ( |
10977 | (disjunction_var = disjunction_rule(p)) // disjunction |
10978 | ) |
10979 | { |
10980 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "disjunction" )); |
10981 | _res = disjunction_var; |
10982 | goto done; |
10983 | } |
10984 | p->mark = _mark; |
10985 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n" , p->level, ' ', |
10986 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "disjunction" )); |
10987 | } |
10988 | { // lambdef |
10989 | if (p->error_indicator) { |
10990 | p->level--; |
10991 | return NULL; |
10992 | } |
10993 | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambdef" )); |
10994 | expr_ty lambdef_var; |
10995 | if ( |
10996 | (lambdef_var = lambdef_rule(p)) // lambdef |
10997 | ) |
10998 | { |
10999 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambdef" )); |
11000 | _res = lambdef_var; |
11001 | goto done; |
11002 | } |
11003 | p->mark = _mark; |
11004 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n" , p->level, ' ', |
11005 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambdef" )); |
11006 | } |
11007 | _res = NULL; |
11008 | done: |
11009 | _PyPegen_insert_memo(p, _mark, expression_type, _res); |
11010 | p->level--; |
11011 | return _res; |
11012 | } |
11013 | |
11014 | // lambdef: 'lambda' lambda_params? ':' expression |
11015 | static expr_ty |
11016 | lambdef_rule(Parser *p) |
11017 | { |
11018 | if (p->level++ == MAXSTACK) { |
11019 | p->error_indicator = 1; |
11020 | PyErr_NoMemory(); |
11021 | } |
11022 | if (p->error_indicator) { |
11023 | p->level--; |
11024 | return NULL; |
11025 | } |
11026 | expr_ty _res = NULL; |
11027 | int _mark = p->mark; |
11028 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
11029 | p->error_indicator = 1; |
11030 | p->level--; |
11031 | return NULL; |
11032 | } |
11033 | int _start_lineno = p->tokens[_mark]->lineno; |
11034 | UNUSED(_start_lineno); // Only used by EXTRA macro |
11035 | int _start_col_offset = p->tokens[_mark]->col_offset; |
11036 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
11037 | { // 'lambda' lambda_params? ':' expression |
11038 | if (p->error_indicator) { |
11039 | p->level--; |
11040 | return NULL; |
11041 | } |
11042 | D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression" )); |
11043 | Token * _keyword; |
11044 | Token * _literal; |
11045 | void *a; |
11046 | expr_ty b; |
11047 | if ( |
11048 | (_keyword = _PyPegen_expect_token(p, 528)) // token='lambda' |
11049 | && |
11050 | (a = lambda_params_rule(p), !p->error_indicator) // lambda_params? |
11051 | && |
11052 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
11053 | && |
11054 | (b = expression_rule(p)) // expression |
11055 | ) |
11056 | { |
11057 | D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression" )); |
11058 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11059 | if (_token == NULL) { |
11060 | p->level--; |
11061 | return NULL; |
11062 | } |
11063 | int _end_lineno = _token->end_lineno; |
11064 | UNUSED(_end_lineno); // Only used by EXTRA macro |
11065 | int _end_col_offset = _token->end_col_offset; |
11066 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11067 | _res = _PyAST_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA ); |
11068 | if (_res == NULL && PyErr_Occurred()) { |
11069 | p->error_indicator = 1; |
11070 | p->level--; |
11071 | return NULL; |
11072 | } |
11073 | goto done; |
11074 | } |
11075 | p->mark = _mark; |
11076 | D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n" , p->level, ' ', |
11077 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'lambda' lambda_params? ':' expression" )); |
11078 | } |
11079 | _res = NULL; |
11080 | done: |
11081 | p->level--; |
11082 | return _res; |
11083 | } |
11084 | |
11085 | // lambda_params: invalid_lambda_parameters | lambda_parameters |
11086 | static arguments_ty |
11087 | lambda_params_rule(Parser *p) |
11088 | { |
11089 | if (p->level++ == MAXSTACK) { |
11090 | p->error_indicator = 1; |
11091 | PyErr_NoMemory(); |
11092 | } |
11093 | if (p->error_indicator) { |
11094 | p->level--; |
11095 | return NULL; |
11096 | } |
11097 | arguments_ty _res = NULL; |
11098 | int _mark = p->mark; |
11099 | if (p->call_invalid_rules) { // invalid_lambda_parameters |
11100 | if (p->error_indicator) { |
11101 | p->level--; |
11102 | return NULL; |
11103 | } |
11104 | D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_lambda_parameters" )); |
11105 | void *invalid_lambda_parameters_var; |
11106 | if ( |
11107 | (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters |
11108 | ) |
11109 | { |
11110 | D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_lambda_parameters" )); |
11111 | _res = invalid_lambda_parameters_var; |
11112 | goto done; |
11113 | } |
11114 | p->mark = _mark; |
11115 | D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n" , p->level, ' ', |
11116 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_lambda_parameters" )); |
11117 | } |
11118 | { // lambda_parameters |
11119 | if (p->error_indicator) { |
11120 | p->level--; |
11121 | return NULL; |
11122 | } |
11123 | D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_parameters" )); |
11124 | arguments_ty lambda_parameters_var; |
11125 | if ( |
11126 | (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters |
11127 | ) |
11128 | { |
11129 | D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_parameters" )); |
11130 | _res = lambda_parameters_var; |
11131 | goto done; |
11132 | } |
11133 | p->mark = _mark; |
11134 | D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n" , p->level, ' ', |
11135 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_parameters" )); |
11136 | } |
11137 | _res = NULL; |
11138 | done: |
11139 | p->level--; |
11140 | return _res; |
11141 | } |
11142 | |
11143 | // lambda_parameters: |
11144 | // | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? |
11145 | // | lambda_slash_with_default lambda_param_with_default* lambda_star_etc? |
11146 | // | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? |
11147 | // | lambda_param_with_default+ lambda_star_etc? |
11148 | // | lambda_star_etc |
11149 | static arguments_ty |
11150 | lambda_parameters_rule(Parser *p) |
11151 | { |
11152 | if (p->level++ == MAXSTACK) { |
11153 | p->error_indicator = 1; |
11154 | PyErr_NoMemory(); |
11155 | } |
11156 | if (p->error_indicator) { |
11157 | p->level--; |
11158 | return NULL; |
11159 | } |
11160 | arguments_ty _res = NULL; |
11161 | int _mark = p->mark; |
11162 | { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? |
11163 | if (p->error_indicator) { |
11164 | p->level--; |
11165 | return NULL; |
11166 | } |
11167 | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?" )); |
11168 | asdl_arg_seq* a; |
11169 | asdl_arg_seq* b; |
11170 | asdl_seq * c; |
11171 | void *d; |
11172 | if ( |
11173 | (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default |
11174 | && |
11175 | (b = (asdl_arg_seq*)_loop0_90_rule(p)) // lambda_param_no_default* |
11176 | && |
11177 | (c = _loop0_91_rule(p)) // lambda_param_with_default* |
11178 | && |
11179 | (d = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc? |
11180 | ) |
11181 | { |
11182 | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?" )); |
11183 | _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); |
11184 | if (_res == NULL && PyErr_Occurred()) { |
11185 | p->error_indicator = 1; |
11186 | p->level--; |
11187 | return NULL; |
11188 | } |
11189 | goto done; |
11190 | } |
11191 | p->mark = _mark; |
11192 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n" , p->level, ' ', |
11193 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?" )); |
11194 | } |
11195 | { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc? |
11196 | if (p->error_indicator) { |
11197 | p->level--; |
11198 | return NULL; |
11199 | } |
11200 | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?" )); |
11201 | SlashWithDefault* a; |
11202 | asdl_seq * b; |
11203 | void *c; |
11204 | if ( |
11205 | (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default |
11206 | && |
11207 | (b = _loop0_92_rule(p)) // lambda_param_with_default* |
11208 | && |
11209 | (c = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc? |
11210 | ) |
11211 | { |
11212 | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?" )); |
11213 | _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); |
11214 | if (_res == NULL && PyErr_Occurred()) { |
11215 | p->error_indicator = 1; |
11216 | p->level--; |
11217 | return NULL; |
11218 | } |
11219 | goto done; |
11220 | } |
11221 | p->mark = _mark; |
11222 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n" , p->level, ' ', |
11223 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?" )); |
11224 | } |
11225 | { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? |
11226 | if (p->error_indicator) { |
11227 | p->level--; |
11228 | return NULL; |
11229 | } |
11230 | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?" )); |
11231 | asdl_arg_seq* a; |
11232 | asdl_seq * b; |
11233 | void *c; |
11234 | if ( |
11235 | (a = (asdl_arg_seq*)_loop1_93_rule(p)) // lambda_param_no_default+ |
11236 | && |
11237 | (b = _loop0_94_rule(p)) // lambda_param_with_default* |
11238 | && |
11239 | (c = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc? |
11240 | ) |
11241 | { |
11242 | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?" )); |
11243 | _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); |
11244 | if (_res == NULL && PyErr_Occurred()) { |
11245 | p->error_indicator = 1; |
11246 | p->level--; |
11247 | return NULL; |
11248 | } |
11249 | goto done; |
11250 | } |
11251 | p->mark = _mark; |
11252 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n" , p->level, ' ', |
11253 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?" )); |
11254 | } |
11255 | { // lambda_param_with_default+ lambda_star_etc? |
11256 | if (p->error_indicator) { |
11257 | p->level--; |
11258 | return NULL; |
11259 | } |
11260 | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?" )); |
11261 | asdl_seq * a; |
11262 | void *b; |
11263 | if ( |
11264 | (a = _loop1_95_rule(p)) // lambda_param_with_default+ |
11265 | && |
11266 | (b = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc? |
11267 | ) |
11268 | { |
11269 | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?" )); |
11270 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); |
11271 | if (_res == NULL && PyErr_Occurred()) { |
11272 | p->error_indicator = 1; |
11273 | p->level--; |
11274 | return NULL; |
11275 | } |
11276 | goto done; |
11277 | } |
11278 | p->mark = _mark; |
11279 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n" , p->level, ' ', |
11280 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?" )); |
11281 | } |
11282 | { // lambda_star_etc |
11283 | if (p->error_indicator) { |
11284 | p->level--; |
11285 | return NULL; |
11286 | } |
11287 | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_star_etc" )); |
11288 | StarEtc* a; |
11289 | if ( |
11290 | (a = lambda_star_etc_rule(p)) // lambda_star_etc |
11291 | ) |
11292 | { |
11293 | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_star_etc" )); |
11294 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); |
11295 | if (_res == NULL && PyErr_Occurred()) { |
11296 | p->error_indicator = 1; |
11297 | p->level--; |
11298 | return NULL; |
11299 | } |
11300 | goto done; |
11301 | } |
11302 | p->mark = _mark; |
11303 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n" , p->level, ' ', |
11304 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_star_etc" )); |
11305 | } |
11306 | _res = NULL; |
11307 | done: |
11308 | p->level--; |
11309 | return _res; |
11310 | } |
11311 | |
11312 | // lambda_slash_no_default: |
11313 | // | lambda_param_no_default+ '/' ',' |
11314 | // | lambda_param_no_default+ '/' &':' |
11315 | static asdl_arg_seq* |
11316 | lambda_slash_no_default_rule(Parser *p) |
11317 | { |
11318 | if (p->level++ == MAXSTACK) { |
11319 | p->error_indicator = 1; |
11320 | PyErr_NoMemory(); |
11321 | } |
11322 | if (p->error_indicator) { |
11323 | p->level--; |
11324 | return NULL; |
11325 | } |
11326 | asdl_arg_seq* _res = NULL; |
11327 | int _mark = p->mark; |
11328 | { // lambda_param_no_default+ '/' ',' |
11329 | if (p->error_indicator) { |
11330 | p->level--; |
11331 | return NULL; |
11332 | } |
11333 | D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','" )); |
11334 | Token * _literal; |
11335 | Token * _literal_1; |
11336 | asdl_arg_seq* a; |
11337 | if ( |
11338 | (a = (asdl_arg_seq*)_loop1_96_rule(p)) // lambda_param_no_default+ |
11339 | && |
11340 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
11341 | && |
11342 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
11343 | ) |
11344 | { |
11345 | D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','" )); |
11346 | _res = a; |
11347 | if (_res == NULL && PyErr_Occurred()) { |
11348 | p->error_indicator = 1; |
11349 | p->level--; |
11350 | return NULL; |
11351 | } |
11352 | goto done; |
11353 | } |
11354 | p->mark = _mark; |
11355 | D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n" , p->level, ' ', |
11356 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default+ '/' ','" )); |
11357 | } |
11358 | { // lambda_param_no_default+ '/' &':' |
11359 | if (p->error_indicator) { |
11360 | p->level--; |
11361 | return NULL; |
11362 | } |
11363 | D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'" )); |
11364 | Token * _literal; |
11365 | asdl_arg_seq* a; |
11366 | if ( |
11367 | (a = (asdl_arg_seq*)_loop1_97_rule(p)) // lambda_param_no_default+ |
11368 | && |
11369 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
11370 | && |
11371 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
11372 | ) |
11373 | { |
11374 | D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'" )); |
11375 | _res = a; |
11376 | if (_res == NULL && PyErr_Occurred()) { |
11377 | p->error_indicator = 1; |
11378 | p->level--; |
11379 | return NULL; |
11380 | } |
11381 | goto done; |
11382 | } |
11383 | p->mark = _mark; |
11384 | D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n" , p->level, ' ', |
11385 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default+ '/' &':'" )); |
11386 | } |
11387 | _res = NULL; |
11388 | done: |
11389 | p->level--; |
11390 | return _res; |
11391 | } |
11392 | |
11393 | // lambda_slash_with_default: |
11394 | // | lambda_param_no_default* lambda_param_with_default+ '/' ',' |
11395 | // | lambda_param_no_default* lambda_param_with_default+ '/' &':' |
11396 | static SlashWithDefault* |
11397 | lambda_slash_with_default_rule(Parser *p) |
11398 | { |
11399 | if (p->level++ == MAXSTACK) { |
11400 | p->error_indicator = 1; |
11401 | PyErr_NoMemory(); |
11402 | } |
11403 | if (p->error_indicator) { |
11404 | p->level--; |
11405 | return NULL; |
11406 | } |
11407 | SlashWithDefault* _res = NULL; |
11408 | int _mark = p->mark; |
11409 | { // lambda_param_no_default* lambda_param_with_default+ '/' ',' |
11410 | if (p->error_indicator) { |
11411 | p->level--; |
11412 | return NULL; |
11413 | } |
11414 | D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','" )); |
11415 | Token * _literal; |
11416 | Token * _literal_1; |
11417 | asdl_seq * a; |
11418 | asdl_seq * b; |
11419 | if ( |
11420 | (a = _loop0_98_rule(p)) // lambda_param_no_default* |
11421 | && |
11422 | (b = _loop1_99_rule(p)) // lambda_param_with_default+ |
11423 | && |
11424 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
11425 | && |
11426 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
11427 | ) |
11428 | { |
11429 | D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','" )); |
11430 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b ); |
11431 | if (_res == NULL && PyErr_Occurred()) { |
11432 | p->error_indicator = 1; |
11433 | p->level--; |
11434 | return NULL; |
11435 | } |
11436 | goto done; |
11437 | } |
11438 | p->mark = _mark; |
11439 | D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n" , p->level, ' ', |
11440 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','" )); |
11441 | } |
11442 | { // lambda_param_no_default* lambda_param_with_default+ '/' &':' |
11443 | if (p->error_indicator) { |
11444 | p->level--; |
11445 | return NULL; |
11446 | } |
11447 | D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'" )); |
11448 | Token * _literal; |
11449 | asdl_seq * a; |
11450 | asdl_seq * b; |
11451 | if ( |
11452 | (a = _loop0_100_rule(p)) // lambda_param_no_default* |
11453 | && |
11454 | (b = _loop1_101_rule(p)) // lambda_param_with_default+ |
11455 | && |
11456 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
11457 | && |
11458 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
11459 | ) |
11460 | { |
11461 | D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'" )); |
11462 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b ); |
11463 | if (_res == NULL && PyErr_Occurred()) { |
11464 | p->error_indicator = 1; |
11465 | p->level--; |
11466 | return NULL; |
11467 | } |
11468 | goto done; |
11469 | } |
11470 | p->mark = _mark; |
11471 | D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n" , p->level, ' ', |
11472 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'" )); |
11473 | } |
11474 | _res = NULL; |
11475 | done: |
11476 | p->level--; |
11477 | return _res; |
11478 | } |
11479 | |
11480 | // lambda_star_etc: |
11481 | // | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? |
11482 | // | '*' ',' lambda_param_maybe_default+ lambda_kwds? |
11483 | // | lambda_kwds |
11484 | // | invalid_lambda_star_etc |
11485 | static StarEtc* |
11486 | lambda_star_etc_rule(Parser *p) |
11487 | { |
11488 | if (p->level++ == MAXSTACK) { |
11489 | p->error_indicator = 1; |
11490 | PyErr_NoMemory(); |
11491 | } |
11492 | if (p->error_indicator) { |
11493 | p->level--; |
11494 | return NULL; |
11495 | } |
11496 | StarEtc* _res = NULL; |
11497 | int _mark = p->mark; |
11498 | { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? |
11499 | if (p->error_indicator) { |
11500 | p->level--; |
11501 | return NULL; |
11502 | } |
11503 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?" )); |
11504 | Token * _literal; |
11505 | arg_ty a; |
11506 | asdl_seq * b; |
11507 | void *c; |
11508 | if ( |
11509 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
11510 | && |
11511 | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
11512 | && |
11513 | (b = _loop0_102_rule(p)) // lambda_param_maybe_default* |
11514 | && |
11515 | (c = lambda_kwds_rule(p), !p->error_indicator) // lambda_kwds? |
11516 | ) |
11517 | { |
11518 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?" )); |
11519 | _res = _PyPegen_star_etc ( p , a , b , c ); |
11520 | if (_res == NULL && PyErr_Occurred()) { |
11521 | p->error_indicator = 1; |
11522 | p->level--; |
11523 | return NULL; |
11524 | } |
11525 | goto done; |
11526 | } |
11527 | p->mark = _mark; |
11528 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n" , p->level, ' ', |
11529 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?" )); |
11530 | } |
11531 | { // '*' ',' lambda_param_maybe_default+ lambda_kwds? |
11532 | if (p->error_indicator) { |
11533 | p->level--; |
11534 | return NULL; |
11535 | } |
11536 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?" )); |
11537 | Token * _literal; |
11538 | Token * _literal_1; |
11539 | asdl_seq * b; |
11540 | void *c; |
11541 | if ( |
11542 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
11543 | && |
11544 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
11545 | && |
11546 | (b = _loop1_103_rule(p)) // lambda_param_maybe_default+ |
11547 | && |
11548 | (c = lambda_kwds_rule(p), !p->error_indicator) // lambda_kwds? |
11549 | ) |
11550 | { |
11551 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?" )); |
11552 | _res = _PyPegen_star_etc ( p , NULL , b , c ); |
11553 | if (_res == NULL && PyErr_Occurred()) { |
11554 | p->error_indicator = 1; |
11555 | p->level--; |
11556 | return NULL; |
11557 | } |
11558 | goto done; |
11559 | } |
11560 | p->mark = _mark; |
11561 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n" , p->level, ' ', |
11562 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?" )); |
11563 | } |
11564 | { // lambda_kwds |
11565 | if (p->error_indicator) { |
11566 | p->level--; |
11567 | return NULL; |
11568 | } |
11569 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_kwds" )); |
11570 | arg_ty a; |
11571 | if ( |
11572 | (a = lambda_kwds_rule(p)) // lambda_kwds |
11573 | ) |
11574 | { |
11575 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_kwds" )); |
11576 | _res = _PyPegen_star_etc ( p , NULL , NULL , a ); |
11577 | if (_res == NULL && PyErr_Occurred()) { |
11578 | p->error_indicator = 1; |
11579 | p->level--; |
11580 | return NULL; |
11581 | } |
11582 | goto done; |
11583 | } |
11584 | p->mark = _mark; |
11585 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n" , p->level, ' ', |
11586 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_kwds" )); |
11587 | } |
11588 | if (p->call_invalid_rules) { // invalid_lambda_star_etc |
11589 | if (p->error_indicator) { |
11590 | p->level--; |
11591 | return NULL; |
11592 | } |
11593 | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc" )); |
11594 | void *invalid_lambda_star_etc_var; |
11595 | if ( |
11596 | (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc |
11597 | ) |
11598 | { |
11599 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc" )); |
11600 | _res = invalid_lambda_star_etc_var; |
11601 | goto done; |
11602 | } |
11603 | p->mark = _mark; |
11604 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n" , p->level, ' ', |
11605 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_lambda_star_etc" )); |
11606 | } |
11607 | _res = NULL; |
11608 | done: |
11609 | p->level--; |
11610 | return _res; |
11611 | } |
11612 | |
11613 | // lambda_kwds: '**' lambda_param_no_default |
11614 | static arg_ty |
11615 | lambda_kwds_rule(Parser *p) |
11616 | { |
11617 | if (p->level++ == MAXSTACK) { |
11618 | p->error_indicator = 1; |
11619 | PyErr_NoMemory(); |
11620 | } |
11621 | if (p->error_indicator) { |
11622 | p->level--; |
11623 | return NULL; |
11624 | } |
11625 | arg_ty _res = NULL; |
11626 | int _mark = p->mark; |
11627 | { // '**' lambda_param_no_default |
11628 | if (p->error_indicator) { |
11629 | p->level--; |
11630 | return NULL; |
11631 | } |
11632 | D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default" )); |
11633 | Token * _literal; |
11634 | arg_ty a; |
11635 | if ( |
11636 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
11637 | && |
11638 | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
11639 | ) |
11640 | { |
11641 | D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default" )); |
11642 | _res = a; |
11643 | if (_res == NULL && PyErr_Occurred()) { |
11644 | p->error_indicator = 1; |
11645 | p->level--; |
11646 | return NULL; |
11647 | } |
11648 | goto done; |
11649 | } |
11650 | p->mark = _mark; |
11651 | D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n" , p->level, ' ', |
11652 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'**' lambda_param_no_default" )); |
11653 | } |
11654 | _res = NULL; |
11655 | done: |
11656 | p->level--; |
11657 | return _res; |
11658 | } |
11659 | |
11660 | // lambda_param_no_default: lambda_param ',' | lambda_param &':' |
11661 | static arg_ty |
11662 | lambda_param_no_default_rule(Parser *p) |
11663 | { |
11664 | if (p->level++ == MAXSTACK) { |
11665 | p->error_indicator = 1; |
11666 | PyErr_NoMemory(); |
11667 | } |
11668 | if (p->error_indicator) { |
11669 | p->level--; |
11670 | return NULL; |
11671 | } |
11672 | arg_ty _res = NULL; |
11673 | int _mark = p->mark; |
11674 | { // lambda_param ',' |
11675 | if (p->error_indicator) { |
11676 | p->level--; |
11677 | return NULL; |
11678 | } |
11679 | D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param ','" )); |
11680 | Token * _literal; |
11681 | arg_ty a; |
11682 | if ( |
11683 | (a = lambda_param_rule(p)) // lambda_param |
11684 | && |
11685 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
11686 | ) |
11687 | { |
11688 | D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param ','" )); |
11689 | _res = a; |
11690 | if (_res == NULL && PyErr_Occurred()) { |
11691 | p->error_indicator = 1; |
11692 | p->level--; |
11693 | return NULL; |
11694 | } |
11695 | goto done; |
11696 | } |
11697 | p->mark = _mark; |
11698 | D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n" , p->level, ' ', |
11699 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param ','" )); |
11700 | } |
11701 | { // lambda_param &':' |
11702 | if (p->error_indicator) { |
11703 | p->level--; |
11704 | return NULL; |
11705 | } |
11706 | D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param &':'" )); |
11707 | arg_ty a; |
11708 | if ( |
11709 | (a = lambda_param_rule(p)) // lambda_param |
11710 | && |
11711 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
11712 | ) |
11713 | { |
11714 | D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param &':'" )); |
11715 | _res = a; |
11716 | if (_res == NULL && PyErr_Occurred()) { |
11717 | p->error_indicator = 1; |
11718 | p->level--; |
11719 | return NULL; |
11720 | } |
11721 | goto done; |
11722 | } |
11723 | p->mark = _mark; |
11724 | D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n" , p->level, ' ', |
11725 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param &':'" )); |
11726 | } |
11727 | _res = NULL; |
11728 | done: |
11729 | p->level--; |
11730 | return _res; |
11731 | } |
11732 | |
11733 | // lambda_param_with_default: lambda_param default ',' | lambda_param default &':' |
11734 | static NameDefaultPair* |
11735 | lambda_param_with_default_rule(Parser *p) |
11736 | { |
11737 | if (p->level++ == MAXSTACK) { |
11738 | p->error_indicator = 1; |
11739 | PyErr_NoMemory(); |
11740 | } |
11741 | if (p->error_indicator) { |
11742 | p->level--; |
11743 | return NULL; |
11744 | } |
11745 | NameDefaultPair* _res = NULL; |
11746 | int _mark = p->mark; |
11747 | { // lambda_param default ',' |
11748 | if (p->error_indicator) { |
11749 | p->level--; |
11750 | return NULL; |
11751 | } |
11752 | D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param default ','" )); |
11753 | Token * _literal; |
11754 | arg_ty a; |
11755 | expr_ty c; |
11756 | if ( |
11757 | (a = lambda_param_rule(p)) // lambda_param |
11758 | && |
11759 | (c = default_rule(p)) // default |
11760 | && |
11761 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
11762 | ) |
11763 | { |
11764 | D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param default ','" )); |
11765 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
11766 | if (_res == NULL && PyErr_Occurred()) { |
11767 | p->error_indicator = 1; |
11768 | p->level--; |
11769 | return NULL; |
11770 | } |
11771 | goto done; |
11772 | } |
11773 | p->mark = _mark; |
11774 | D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n" , p->level, ' ', |
11775 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param default ','" )); |
11776 | } |
11777 | { // lambda_param default &':' |
11778 | if (p->error_indicator) { |
11779 | p->level--; |
11780 | return NULL; |
11781 | } |
11782 | D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param default &':'" )); |
11783 | arg_ty a; |
11784 | expr_ty c; |
11785 | if ( |
11786 | (a = lambda_param_rule(p)) // lambda_param |
11787 | && |
11788 | (c = default_rule(p)) // default |
11789 | && |
11790 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
11791 | ) |
11792 | { |
11793 | D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param default &':'" )); |
11794 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
11795 | if (_res == NULL && PyErr_Occurred()) { |
11796 | p->error_indicator = 1; |
11797 | p->level--; |
11798 | return NULL; |
11799 | } |
11800 | goto done; |
11801 | } |
11802 | p->mark = _mark; |
11803 | D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n" , p->level, ' ', |
11804 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param default &':'" )); |
11805 | } |
11806 | _res = NULL; |
11807 | done: |
11808 | p->level--; |
11809 | return _res; |
11810 | } |
11811 | |
11812 | // lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':' |
11813 | static NameDefaultPair* |
11814 | lambda_param_maybe_default_rule(Parser *p) |
11815 | { |
11816 | if (p->level++ == MAXSTACK) { |
11817 | p->error_indicator = 1; |
11818 | PyErr_NoMemory(); |
11819 | } |
11820 | if (p->error_indicator) { |
11821 | p->level--; |
11822 | return NULL; |
11823 | } |
11824 | NameDefaultPair* _res = NULL; |
11825 | int _mark = p->mark; |
11826 | { // lambda_param default? ',' |
11827 | if (p->error_indicator) { |
11828 | p->level--; |
11829 | return NULL; |
11830 | } |
11831 | D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param default? ','" )); |
11832 | Token * _literal; |
11833 | arg_ty a; |
11834 | void *c; |
11835 | if ( |
11836 | (a = lambda_param_rule(p)) // lambda_param |
11837 | && |
11838 | (c = default_rule(p), !p->error_indicator) // default? |
11839 | && |
11840 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
11841 | ) |
11842 | { |
11843 | D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param default? ','" )); |
11844 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
11845 | if (_res == NULL && PyErr_Occurred()) { |
11846 | p->error_indicator = 1; |
11847 | p->level--; |
11848 | return NULL; |
11849 | } |
11850 | goto done; |
11851 | } |
11852 | p->mark = _mark; |
11853 | D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n" , p->level, ' ', |
11854 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param default? ','" )); |
11855 | } |
11856 | { // lambda_param default? &':' |
11857 | if (p->error_indicator) { |
11858 | p->level--; |
11859 | return NULL; |
11860 | } |
11861 | D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param default? &':'" )); |
11862 | arg_ty a; |
11863 | void *c; |
11864 | if ( |
11865 | (a = lambda_param_rule(p)) // lambda_param |
11866 | && |
11867 | (c = default_rule(p), !p->error_indicator) // default? |
11868 | && |
11869 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
11870 | ) |
11871 | { |
11872 | D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param default? &':'" )); |
11873 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
11874 | if (_res == NULL && PyErr_Occurred()) { |
11875 | p->error_indicator = 1; |
11876 | p->level--; |
11877 | return NULL; |
11878 | } |
11879 | goto done; |
11880 | } |
11881 | p->mark = _mark; |
11882 | D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n" , p->level, ' ', |
11883 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param default? &':'" )); |
11884 | } |
11885 | _res = NULL; |
11886 | done: |
11887 | p->level--; |
11888 | return _res; |
11889 | } |
11890 | |
11891 | // lambda_param: NAME |
11892 | static arg_ty |
11893 | lambda_param_rule(Parser *p) |
11894 | { |
11895 | if (p->level++ == MAXSTACK) { |
11896 | p->error_indicator = 1; |
11897 | PyErr_NoMemory(); |
11898 | } |
11899 | if (p->error_indicator) { |
11900 | p->level--; |
11901 | return NULL; |
11902 | } |
11903 | arg_ty _res = NULL; |
11904 | int _mark = p->mark; |
11905 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
11906 | p->error_indicator = 1; |
11907 | p->level--; |
11908 | return NULL; |
11909 | } |
11910 | int _start_lineno = p->tokens[_mark]->lineno; |
11911 | UNUSED(_start_lineno); // Only used by EXTRA macro |
11912 | int _start_col_offset = p->tokens[_mark]->col_offset; |
11913 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
11914 | { // NAME |
11915 | if (p->error_indicator) { |
11916 | p->level--; |
11917 | return NULL; |
11918 | } |
11919 | D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
11920 | expr_ty a; |
11921 | if ( |
11922 | (a = _PyPegen_name_token(p)) // NAME |
11923 | ) |
11924 | { |
11925 | D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
11926 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11927 | if (_token == NULL) { |
11928 | p->level--; |
11929 | return NULL; |
11930 | } |
11931 | int _end_lineno = _token->end_lineno; |
11932 | UNUSED(_end_lineno); // Only used by EXTRA macro |
11933 | int _end_col_offset = _token->end_col_offset; |
11934 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11935 | _res = _PyAST_arg ( a -> v . Name . id , NULL , NULL , EXTRA ); |
11936 | if (_res == NULL && PyErr_Occurred()) { |
11937 | p->error_indicator = 1; |
11938 | p->level--; |
11939 | return NULL; |
11940 | } |
11941 | goto done; |
11942 | } |
11943 | p->mark = _mark; |
11944 | D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n" , p->level, ' ', |
11945 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME" )); |
11946 | } |
11947 | _res = NULL; |
11948 | done: |
11949 | p->level--; |
11950 | return _res; |
11951 | } |
11952 | |
11953 | // disjunction: conjunction (('or' conjunction))+ | conjunction |
11954 | static expr_ty |
11955 | disjunction_rule(Parser *p) |
11956 | { |
11957 | if (p->level++ == MAXSTACK) { |
11958 | p->error_indicator = 1; |
11959 | PyErr_NoMemory(); |
11960 | } |
11961 | if (p->error_indicator) { |
11962 | p->level--; |
11963 | return NULL; |
11964 | } |
11965 | expr_ty _res = NULL; |
11966 | if (_PyPegen_is_memoized(p, disjunction_type, &_res)) { |
11967 | p->level--; |
11968 | return _res; |
11969 | } |
11970 | int _mark = p->mark; |
11971 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
11972 | p->error_indicator = 1; |
11973 | p->level--; |
11974 | return NULL; |
11975 | } |
11976 | int _start_lineno = p->tokens[_mark]->lineno; |
11977 | UNUSED(_start_lineno); // Only used by EXTRA macro |
11978 | int _start_col_offset = p->tokens[_mark]->col_offset; |
11979 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
11980 | { // conjunction (('or' conjunction))+ |
11981 | if (p->error_indicator) { |
11982 | p->level--; |
11983 | return NULL; |
11984 | } |
11985 | D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+" )); |
11986 | expr_ty a; |
11987 | asdl_seq * b; |
11988 | if ( |
11989 | (a = conjunction_rule(p)) // conjunction |
11990 | && |
11991 | (b = _loop1_104_rule(p)) // (('or' conjunction))+ |
11992 | ) |
11993 | { |
11994 | D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+" )); |
11995 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11996 | if (_token == NULL) { |
11997 | p->level--; |
11998 | return NULL; |
11999 | } |
12000 | int _end_lineno = _token->end_lineno; |
12001 | UNUSED(_end_lineno); // Only used by EXTRA macro |
12002 | int _end_col_offset = _token->end_col_offset; |
12003 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
12004 | _res = _PyAST_BoolOp ( Or , CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); |
12005 | if (_res == NULL && PyErr_Occurred()) { |
12006 | p->error_indicator = 1; |
12007 | p->level--; |
12008 | return NULL; |
12009 | } |
12010 | goto done; |
12011 | } |
12012 | p->mark = _mark; |
12013 | D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n" , p->level, ' ', |
12014 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "conjunction (('or' conjunction))+" )); |
12015 | } |
12016 | { // conjunction |
12017 | if (p->error_indicator) { |
12018 | p->level--; |
12019 | return NULL; |
12020 | } |
12021 | D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "conjunction" )); |
12022 | expr_ty conjunction_var; |
12023 | if ( |
12024 | (conjunction_var = conjunction_rule(p)) // conjunction |
12025 | ) |
12026 | { |
12027 | D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "conjunction" )); |
12028 | _res = conjunction_var; |
12029 | goto done; |
12030 | } |
12031 | p->mark = _mark; |
12032 | D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n" , p->level, ' ', |
12033 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "conjunction" )); |
12034 | } |
12035 | _res = NULL; |
12036 | done: |
12037 | _PyPegen_insert_memo(p, _mark, disjunction_type, _res); |
12038 | p->level--; |
12039 | return _res; |
12040 | } |
12041 | |
12042 | // conjunction: inversion (('and' inversion))+ | inversion |
12043 | static expr_ty |
12044 | conjunction_rule(Parser *p) |
12045 | { |
12046 | if (p->level++ == MAXSTACK) { |
12047 | p->error_indicator = 1; |
12048 | PyErr_NoMemory(); |
12049 | } |
12050 | if (p->error_indicator) { |
12051 | p->level--; |
12052 | return NULL; |
12053 | } |
12054 | expr_ty _res = NULL; |
12055 | if (_PyPegen_is_memoized(p, conjunction_type, &_res)) { |
12056 | p->level--; |
12057 | return _res; |
12058 | } |
12059 | int _mark = p->mark; |
12060 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
12061 | p->error_indicator = 1; |
12062 | p->level--; |
12063 | return NULL; |
12064 | } |
12065 | int _start_lineno = p->tokens[_mark]->lineno; |
12066 | UNUSED(_start_lineno); // Only used by EXTRA macro |
12067 | int _start_col_offset = p->tokens[_mark]->col_offset; |
12068 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
12069 | { // inversion (('and' inversion))+ |
12070 | if (p->error_indicator) { |
12071 | p->level--; |
12072 | return NULL; |
12073 | } |
12074 | D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+" )); |
12075 | expr_ty a; |
12076 | asdl_seq * b; |
12077 | if ( |
12078 | (a = inversion_rule(p)) // inversion |
12079 | && |
12080 | (b = _loop1_105_rule(p)) // (('and' inversion))+ |
12081 | ) |
12082 | { |
12083 | D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+" )); |
12084 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
12085 | if (_token == NULL) { |
12086 | p->level--; |
12087 | return NULL; |
12088 | } |
12089 | int _end_lineno = _token->end_lineno; |
12090 | UNUSED(_end_lineno); // Only used by EXTRA macro |
12091 | int _end_col_offset = _token->end_col_offset; |
12092 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
12093 | _res = _PyAST_BoolOp ( And , CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); |
12094 | if (_res == NULL && PyErr_Occurred()) { |
12095 | p->error_indicator = 1; |
12096 | p->level--; |
12097 | return NULL; |
12098 | } |
12099 | goto done; |
12100 | } |
12101 | p->mark = _mark; |
12102 | D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n" , p->level, ' ', |
12103 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "inversion (('and' inversion))+" )); |
12104 | } |
12105 | { // inversion |
12106 | if (p->error_indicator) { |
12107 | p->level--; |
12108 | return NULL; |
12109 | } |
12110 | D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "inversion" )); |
12111 | expr_ty inversion_var; |
12112 | if ( |
12113 | (inversion_var = inversion_rule(p)) // inversion |
12114 | ) |
12115 | { |
12116 | D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "inversion" )); |
12117 | _res = inversion_var; |
12118 | goto done; |
12119 | } |
12120 | p->mark = _mark; |
12121 | D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n" , p->level, ' ', |
12122 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "inversion" )); |
12123 | } |
12124 | _res = NULL; |
12125 | done: |
12126 | _PyPegen_insert_memo(p, _mark, conjunction_type, _res); |
12127 | p->level--; |
12128 | return _res; |
12129 | } |
12130 | |
12131 | // inversion: 'not' inversion | comparison |
12132 | static expr_ty |
12133 | inversion_rule(Parser *p) |
12134 | { |
12135 | if (p->level++ == MAXSTACK) { |
12136 | p->error_indicator = 1; |
12137 | PyErr_NoMemory(); |
12138 | } |
12139 | if (p->error_indicator) { |
12140 | p->level--; |
12141 | return NULL; |
12142 | } |
12143 | expr_ty _res = NULL; |
12144 | if (_PyPegen_is_memoized(p, inversion_type, &_res)) { |
12145 | p->level--; |
12146 | return _res; |
12147 | } |
12148 | int _mark = p->mark; |
12149 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
12150 | p->error_indicator = 1; |
12151 | p->level--; |
12152 | return NULL; |
12153 | } |
12154 | int _start_lineno = p->tokens[_mark]->lineno; |
12155 | UNUSED(_start_lineno); // Only used by EXTRA macro |
12156 | int _start_col_offset = p->tokens[_mark]->col_offset; |
12157 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
12158 | { // 'not' inversion |
12159 | if (p->error_indicator) { |
12160 | p->level--; |
12161 | return NULL; |
12162 | } |
12163 | D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'not' inversion" )); |
12164 | Token * _keyword; |
12165 | expr_ty a; |
12166 | if ( |
12167 | (_keyword = _PyPegen_expect_token(p, 529)) // token='not' |
12168 | && |
12169 | (a = inversion_rule(p)) // inversion |
12170 | ) |
12171 | { |
12172 | D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'not' inversion" )); |
12173 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
12174 | if (_token == NULL) { |
12175 | p->level--; |
12176 | return NULL; |
12177 | } |
12178 | int _end_lineno = _token->end_lineno; |
12179 | UNUSED(_end_lineno); // Only used by EXTRA macro |
12180 | int _end_col_offset = _token->end_col_offset; |
12181 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
12182 | _res = _PyAST_UnaryOp ( Not , a , EXTRA ); |
12183 | if (_res == NULL && PyErr_Occurred()) { |
12184 | p->error_indicator = 1; |
12185 | p->level--; |
12186 | return NULL; |
12187 | } |
12188 | goto done; |
12189 | } |
12190 | p->mark = _mark; |
12191 | D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n" , p->level, ' ', |
12192 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'not' inversion" )); |
12193 | } |
12194 | { // comparison |
12195 | if (p->error_indicator) { |
12196 | p->level--; |
12197 | return NULL; |
12198 | } |
12199 | D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "comparison" )); |
12200 | expr_ty comparison_var; |
12201 | if ( |
12202 | (comparison_var = comparison_rule(p)) // comparison |
12203 | ) |
12204 | { |
12205 | D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "comparison" )); |
12206 | _res = comparison_var; |
12207 | goto done; |
12208 | } |
12209 | p->mark = _mark; |
12210 | D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n" , p->level, ' ', |
12211 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "comparison" )); |
12212 | } |
12213 | _res = NULL; |
12214 | done: |
12215 | _PyPegen_insert_memo(p, _mark, inversion_type, _res); |
12216 | p->level--; |
12217 | return _res; |
12218 | } |
12219 | |
12220 | // comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or |
12221 | static expr_ty |
12222 | comparison_rule(Parser *p) |
12223 | { |
12224 | if (p->level++ == MAXSTACK) { |
12225 | p->error_indicator = 1; |
12226 | PyErr_NoMemory(); |
12227 | } |
12228 | if (p->error_indicator) { |
12229 | p->level--; |
12230 | return NULL; |
12231 | } |
12232 | expr_ty _res = NULL; |
12233 | int _mark = p->mark; |
12234 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
12235 | p->error_indicator = 1; |
12236 | p->level--; |
12237 | return NULL; |
12238 | } |
12239 | int _start_lineno = p->tokens[_mark]->lineno; |
12240 | UNUSED(_start_lineno); // Only used by EXTRA macro |
12241 | int _start_col_offset = p->tokens[_mark]->col_offset; |
12242 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
12243 | { // bitwise_or compare_op_bitwise_or_pair+ |
12244 | if (p->error_indicator) { |
12245 | p->level--; |
12246 | return NULL; |
12247 | } |
12248 | D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+" )); |
12249 | expr_ty a; |
12250 | asdl_seq * b; |
12251 | if ( |
12252 | (a = bitwise_or_rule(p)) // bitwise_or |
12253 | && |
12254 | (b = _loop1_106_rule(p)) // compare_op_bitwise_or_pair+ |
12255 | ) |
12256 | { |
12257 | D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+" )); |
12258 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
12259 | if (_token == NULL) { |
12260 | p->level--; |
12261 | return NULL; |
12262 | } |
12263 | int _end_lineno = _token->end_lineno; |
12264 | UNUSED(_end_lineno); // Only used by EXTRA macro |
12265 | int _end_col_offset = _token->end_col_offset; |
12266 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
12267 | _res = _PyAST_Compare ( a , CHECK ( asdl_int_seq * , _PyPegen_get_cmpops ( p , b ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_exprs ( p , b ) ) , EXTRA ); |
12268 | if (_res == NULL && PyErr_Occurred()) { |
12269 | p->error_indicator = 1; |
12270 | p->level--; |
12271 | return NULL; |
12272 | } |
12273 | goto done; |
12274 | } |
12275 | p->mark = _mark; |
12276 | D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n" , p->level, ' ', |
12277 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+" )); |
12278 | } |
12279 | { // bitwise_or |
12280 | if (p->error_indicator) { |
12281 | p->level--; |
12282 | return NULL; |
12283 | } |
12284 | D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "bitwise_or" )); |
12285 | expr_ty bitwise_or_var; |
12286 | if ( |
12287 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
12288 | ) |
12289 | { |
12290 | D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "bitwise_or" )); |
12291 | _res = bitwise_or_var; |
12292 | goto done; |
12293 | } |
12294 | p->mark = _mark; |
12295 | D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n" , p->level, ' ', |
12296 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "bitwise_or" )); |
12297 | } |
12298 | _res = NULL; |
12299 | done: |
12300 | p->level--; |
12301 | return _res; |
12302 | } |
12303 | |
12304 | // compare_op_bitwise_or_pair: |
12305 | // | eq_bitwise_or |
12306 | // | noteq_bitwise_or |
12307 | // | lte_bitwise_or |
12308 | // | lt_bitwise_or |
12309 | // | gte_bitwise_or |
12310 | // | gt_bitwise_or |
12311 | // | notin_bitwise_or |
12312 | // | in_bitwise_or |
12313 | // | isnot_bitwise_or |
12314 | // | is_bitwise_or |
12315 | static CmpopExprPair* |
12316 | compare_op_bitwise_or_pair_rule(Parser *p) |
12317 | { |
12318 | if (p->level++ == MAXSTACK) { |
12319 | p->error_indicator = 1; |
12320 | PyErr_NoMemory(); |
12321 | } |
12322 | if (p->error_indicator) { |
12323 | p->level--; |
12324 | return NULL; |
12325 | } |
12326 | CmpopExprPair* _res = NULL; |
12327 | int _mark = p->mark; |
12328 | { // eq_bitwise_or |
12329 | if (p->error_indicator) { |
12330 | p->level--; |
12331 | return NULL; |
12332 | } |
12333 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "eq_bitwise_or" )); |
12334 | CmpopExprPair* eq_bitwise_or_var; |
12335 | if ( |
12336 | (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or |
12337 | ) |
12338 | { |
12339 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "eq_bitwise_or" )); |
12340 | _res = eq_bitwise_or_var; |
12341 | goto done; |
12342 | } |
12343 | p->mark = _mark; |
12344 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n" , p->level, ' ', |
12345 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "eq_bitwise_or" )); |
12346 | } |
12347 | { // noteq_bitwise_or |
12348 | if (p->error_indicator) { |
12349 | p->level--; |
12350 | return NULL; |
12351 | } |
12352 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "noteq_bitwise_or" )); |
12353 | CmpopExprPair* noteq_bitwise_or_var; |
12354 | if ( |
12355 | (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or |
12356 | ) |
12357 | { |
12358 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "noteq_bitwise_or" )); |
12359 | _res = noteq_bitwise_or_var; |
12360 | goto done; |
12361 | } |
12362 | p->mark = _mark; |
12363 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n" , p->level, ' ', |
12364 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "noteq_bitwise_or" )); |
12365 | } |
12366 | { // lte_bitwise_or |
12367 | if (p->error_indicator) { |
12368 | p->level--; |
12369 | return NULL; |
12370 | } |
12371 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lte_bitwise_or" )); |
12372 | CmpopExprPair* lte_bitwise_or_var; |
12373 | if ( |
12374 | (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or |
12375 | ) |
12376 | { |
12377 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lte_bitwise_or" )); |
12378 | _res = lte_bitwise_or_var; |
12379 | goto done; |
12380 | } |
12381 | p->mark = _mark; |
12382 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n" , p->level, ' ', |
12383 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lte_bitwise_or" )); |
12384 | } |
12385 | { // lt_bitwise_or |
12386 | if (p->error_indicator) { |
12387 | p->level--; |
12388 | return NULL; |
12389 | } |
12390 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lt_bitwise_or" )); |
12391 | CmpopExprPair* lt_bitwise_or_var; |
12392 | if ( |
12393 | (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or |
12394 | ) |
12395 | { |
12396 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lt_bitwise_or" )); |
12397 | _res = lt_bitwise_or_var; |
12398 | goto done; |
12399 | } |
12400 | p->mark = _mark; |
12401 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n" , p->level, ' ', |
12402 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lt_bitwise_or" )); |
12403 | } |
12404 | { // gte_bitwise_or |
12405 | if (p->error_indicator) { |
12406 | p->level--; |
12407 | return NULL; |
12408 | } |
12409 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "gte_bitwise_or" )); |
12410 | CmpopExprPair* gte_bitwise_or_var; |
12411 | if ( |
12412 | (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or |
12413 | ) |
12414 | { |
12415 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "gte_bitwise_or" )); |
12416 | _res = gte_bitwise_or_var; |
12417 | goto done; |
12418 | } |
12419 | p->mark = _mark; |
12420 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n" , p->level, ' ', |
12421 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "gte_bitwise_or" )); |
12422 | } |
12423 | { // gt_bitwise_or |
12424 | if (p->error_indicator) { |
12425 | p->level--; |
12426 | return NULL; |
12427 | } |
12428 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "gt_bitwise_or" )); |
12429 | CmpopExprPair* gt_bitwise_or_var; |
12430 | if ( |
12431 | (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or |
12432 | ) |
12433 | { |
12434 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "gt_bitwise_or" )); |
12435 | _res = gt_bitwise_or_var; |
12436 | goto done; |
12437 | } |
12438 | p->mark = _mark; |
12439 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n" , p->level, ' ', |
12440 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "gt_bitwise_or" )); |
12441 | } |
12442 | { // notin_bitwise_or |
12443 | if (p->error_indicator) { |
12444 | p->level--; |
12445 | return NULL; |
12446 | } |
12447 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "notin_bitwise_or" )); |
12448 | CmpopExprPair* notin_bitwise_or_var; |
12449 | if ( |
12450 | (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or |
12451 | ) |
12452 | { |
12453 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "notin_bitwise_or" )); |
12454 | _res = notin_bitwise_or_var; |
12455 | goto done; |
12456 | } |
12457 | p->mark = _mark; |
12458 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n" , p->level, ' ', |
12459 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "notin_bitwise_or" )); |
12460 | } |
12461 | { // in_bitwise_or |
12462 | if (p->error_indicator) { |
12463 | p->level--; |
12464 | return NULL; |
12465 | } |
12466 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "in_bitwise_or" )); |
12467 | CmpopExprPair* in_bitwise_or_var; |
12468 | if ( |
12469 | (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or |
12470 | ) |
12471 | { |
12472 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "in_bitwise_or" )); |
12473 | _res = in_bitwise_or_var; |
12474 | goto done; |
12475 | } |
12476 | p->mark = _mark; |
12477 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n" , p->level, ' ', |
12478 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "in_bitwise_or" )); |
12479 | } |
12480 | { // isnot_bitwise_or |
12481 | if (p->error_indicator) { |
12482 | p->level--; |
12483 | return NULL; |
12484 | } |
12485 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "isnot_bitwise_or" )); |
12486 | CmpopExprPair* isnot_bitwise_or_var; |
12487 | if ( |
12488 | (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or |
12489 | ) |
12490 | { |
12491 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "isnot_bitwise_or" )); |
12492 | _res = isnot_bitwise_or_var; |
12493 | goto done; |
12494 | } |
12495 | p->mark = _mark; |
12496 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n" , p->level, ' ', |
12497 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "isnot_bitwise_or" )); |
12498 | } |
12499 | { // is_bitwise_or |
12500 | if (p->error_indicator) { |
12501 | p->level--; |
12502 | return NULL; |
12503 | } |
12504 | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "is_bitwise_or" )); |
12505 | CmpopExprPair* is_bitwise_or_var; |
12506 | if ( |
12507 | (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or |
12508 | ) |
12509 | { |
12510 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "is_bitwise_or" )); |
12511 | _res = is_bitwise_or_var; |
12512 | goto done; |
12513 | } |
12514 | p->mark = _mark; |
12515 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n" , p->level, ' ', |
12516 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "is_bitwise_or" )); |
12517 | } |
12518 | _res = NULL; |
12519 | done: |
12520 | p->level--; |
12521 | return _res; |
12522 | } |
12523 | |
12524 | // eq_bitwise_or: '==' bitwise_or |
12525 | static CmpopExprPair* |
12526 | eq_bitwise_or_rule(Parser *p) |
12527 | { |
12528 | if (p->level++ == MAXSTACK) { |
12529 | p->error_indicator = 1; |
12530 | PyErr_NoMemory(); |
12531 | } |
12532 | if (p->error_indicator) { |
12533 | p->level--; |
12534 | return NULL; |
12535 | } |
12536 | CmpopExprPair* _res = NULL; |
12537 | int _mark = p->mark; |
12538 | { // '==' bitwise_or |
12539 | if (p->error_indicator) { |
12540 | p->level--; |
12541 | return NULL; |
12542 | } |
12543 | D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'==' bitwise_or" )); |
12544 | Token * _literal; |
12545 | expr_ty a; |
12546 | if ( |
12547 | (_literal = _PyPegen_expect_token(p, 27)) // token='==' |
12548 | && |
12549 | (a = bitwise_or_rule(p)) // bitwise_or |
12550 | ) |
12551 | { |
12552 | D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'==' bitwise_or" )); |
12553 | _res = _PyPegen_cmpop_expr_pair ( p , Eq , a ); |
12554 | if (_res == NULL && PyErr_Occurred()) { |
12555 | p->error_indicator = 1; |
12556 | p->level--; |
12557 | return NULL; |
12558 | } |
12559 | goto done; |
12560 | } |
12561 | p->mark = _mark; |
12562 | D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n" , p->level, ' ', |
12563 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'==' bitwise_or" )); |
12564 | } |
12565 | _res = NULL; |
12566 | done: |
12567 | p->level--; |
12568 | return _res; |
12569 | } |
12570 | |
12571 | // noteq_bitwise_or: ('!=') bitwise_or |
12572 | static CmpopExprPair* |
12573 | noteq_bitwise_or_rule(Parser *p) |
12574 | { |
12575 | if (p->level++ == MAXSTACK) { |
12576 | p->error_indicator = 1; |
12577 | PyErr_NoMemory(); |
12578 | } |
12579 | if (p->error_indicator) { |
12580 | p->level--; |
12581 | return NULL; |
12582 | } |
12583 | CmpopExprPair* _res = NULL; |
12584 | int _mark = p->mark; |
12585 | { // ('!=') bitwise_or |
12586 | if (p->error_indicator) { |
12587 | p->level--; |
12588 | return NULL; |
12589 | } |
12590 | D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('!=') bitwise_or" )); |
12591 | void *_tmp_107_var; |
12592 | expr_ty a; |
12593 | if ( |
12594 | (_tmp_107_var = _tmp_107_rule(p)) // '!=' |
12595 | && |
12596 | (a = bitwise_or_rule(p)) // bitwise_or |
12597 | ) |
12598 | { |
12599 | D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "('!=') bitwise_or" )); |
12600 | _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a ); |
12601 | if (_res == NULL && PyErr_Occurred()) { |
12602 | p->error_indicator = 1; |
12603 | p->level--; |
12604 | return NULL; |
12605 | } |
12606 | goto done; |
12607 | } |
12608 | p->mark = _mark; |
12609 | D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n" , p->level, ' ', |
12610 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('!=') bitwise_or" )); |
12611 | } |
12612 | _res = NULL; |
12613 | done: |
12614 | p->level--; |
12615 | return _res; |
12616 | } |
12617 | |
12618 | // lte_bitwise_or: '<=' bitwise_or |
12619 | static CmpopExprPair* |
12620 | lte_bitwise_or_rule(Parser *p) |
12621 | { |
12622 | if (p->level++ == MAXSTACK) { |
12623 | p->error_indicator = 1; |
12624 | PyErr_NoMemory(); |
12625 | } |
12626 | if (p->error_indicator) { |
12627 | p->level--; |
12628 | return NULL; |
12629 | } |
12630 | CmpopExprPair* _res = NULL; |
12631 | int _mark = p->mark; |
12632 | { // '<=' bitwise_or |
12633 | if (p->error_indicator) { |
12634 | p->level--; |
12635 | return NULL; |
12636 | } |
12637 | D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'<=' bitwise_or" )); |
12638 | Token * _literal; |
12639 | expr_ty a; |
12640 | if ( |
12641 | (_literal = _PyPegen_expect_token(p, 29)) // token='<=' |
12642 | && |
12643 | (a = bitwise_or_rule(p)) // bitwise_or |
12644 | ) |
12645 | { |
12646 | D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'<=' bitwise_or" )); |
12647 | _res = _PyPegen_cmpop_expr_pair ( p , LtE , a ); |
12648 | if (_res == NULL && PyErr_Occurred()) { |
12649 | p->error_indicator = 1; |
12650 | p->level--; |
12651 | return NULL; |
12652 | } |
12653 | goto done; |
12654 | } |
12655 | p->mark = _mark; |
12656 | D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n" , p->level, ' ', |
12657 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'<=' bitwise_or" )); |
12658 | } |
12659 | _res = NULL; |
12660 | done: |
12661 | p->level--; |
12662 | return _res; |
12663 | } |
12664 | |
12665 | // lt_bitwise_or: '<' bitwise_or |
12666 | static CmpopExprPair* |
12667 | lt_bitwise_or_rule(Parser *p) |
12668 | { |
12669 | if (p->level++ == MAXSTACK) { |
12670 | p->error_indicator = 1; |
12671 | PyErr_NoMemory(); |
12672 | } |
12673 | if (p->error_indicator) { |
12674 | p->level--; |
12675 | return NULL; |
12676 | } |
12677 | CmpopExprPair* _res = NULL; |
12678 | int _mark = p->mark; |
12679 | { // '<' bitwise_or |
12680 | if (p->error_indicator) { |
12681 | p->level--; |
12682 | return NULL; |
12683 | } |
12684 | D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'<' bitwise_or" )); |
12685 | Token * _literal; |
12686 | expr_ty a; |
12687 | if ( |
12688 | (_literal = _PyPegen_expect_token(p, 20)) // token='<' |
12689 | && |
12690 | (a = bitwise_or_rule(p)) // bitwise_or |
12691 | ) |
12692 | { |
12693 | D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'<' bitwise_or" )); |
12694 | _res = _PyPegen_cmpop_expr_pair ( p , Lt , a ); |
12695 | if (_res == NULL && PyErr_Occurred()) { |
12696 | p->error_indicator = 1; |
12697 | p->level--; |
12698 | return NULL; |
12699 | } |
12700 | goto done; |
12701 | } |
12702 | p->mark = _mark; |
12703 | D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n" , p->level, ' ', |
12704 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'<' bitwise_or" )); |
12705 | } |
12706 | _res = NULL; |
12707 | done: |
12708 | p->level--; |
12709 | return _res; |
12710 | } |
12711 | |
12712 | // gte_bitwise_or: '>=' bitwise_or |
12713 | static CmpopExprPair* |
12714 | gte_bitwise_or_rule(Parser *p) |
12715 | { |
12716 | if (p->level++ == MAXSTACK) { |
12717 | p->error_indicator = 1; |
12718 | PyErr_NoMemory(); |
12719 | } |
12720 | if (p->error_indicator) { |
12721 | p->level--; |
12722 | return NULL; |
12723 | } |
12724 | CmpopExprPair* _res = NULL; |
12725 | int _mark = p->mark; |
12726 | { // '>=' bitwise_or |
12727 | if (p->error_indicator) { |
12728 | p->level--; |
12729 | return NULL; |
12730 | } |
12731 | D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'>=' bitwise_or" )); |
12732 | Token * _literal; |
12733 | expr_ty a; |
12734 | if ( |
12735 | (_literal = _PyPegen_expect_token(p, 30)) // token='>=' |
12736 | && |
12737 | (a = bitwise_or_rule(p)) // bitwise_or |
12738 | ) |
12739 | { |
12740 | D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'>=' bitwise_or" )); |
12741 | _res = _PyPegen_cmpop_expr_pair ( p , GtE , a ); |
12742 | if (_res == NULL && PyErr_Occurred()) { |
12743 | p->error_indicator = 1; |
12744 | p->level--; |
12745 | return NULL; |
12746 | } |
12747 | goto done; |
12748 | } |
12749 | p->mark = _mark; |
12750 | D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n" , p->level, ' ', |
12751 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'>=' bitwise_or" )); |
12752 | } |
12753 | _res = NULL; |
12754 | done: |
12755 | p->level--; |
12756 | return _res; |
12757 | } |
12758 | |
12759 | // gt_bitwise_or: '>' bitwise_or |
12760 | static CmpopExprPair* |
12761 | gt_bitwise_or_rule(Parser *p) |
12762 | { |
12763 | if (p->level++ == MAXSTACK) { |
12764 | p->error_indicator = 1; |
12765 | PyErr_NoMemory(); |
12766 | } |
12767 | if (p->error_indicator) { |
12768 | p->level--; |
12769 | return NULL; |
12770 | } |
12771 | CmpopExprPair* _res = NULL; |
12772 | int _mark = p->mark; |
12773 | { // '>' bitwise_or |
12774 | if (p->error_indicator) { |
12775 | p->level--; |
12776 | return NULL; |
12777 | } |
12778 | D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'>' bitwise_or" )); |
12779 | Token * _literal; |
12780 | expr_ty a; |
12781 | if ( |
12782 | (_literal = _PyPegen_expect_token(p, 21)) // token='>' |
12783 | && |
12784 | (a = bitwise_or_rule(p)) // bitwise_or |
12785 | ) |
12786 | { |
12787 | D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'>' bitwise_or" )); |
12788 | _res = _PyPegen_cmpop_expr_pair ( p , Gt , a ); |
12789 | if (_res == NULL && PyErr_Occurred()) { |
12790 | p->error_indicator = 1; |
12791 | p->level--; |
12792 | return NULL; |
12793 | } |
12794 | goto done; |
12795 | } |
12796 | p->mark = _mark; |
12797 | D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n" , p->level, ' ', |
12798 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'>' bitwise_or" )); |
12799 | } |
12800 | _res = NULL; |
12801 | done: |
12802 | p->level--; |
12803 | return _res; |
12804 | } |
12805 | |
12806 | // notin_bitwise_or: 'not' 'in' bitwise_or |
12807 | static CmpopExprPair* |
12808 | notin_bitwise_or_rule(Parser *p) |
12809 | { |
12810 | if (p->level++ == MAXSTACK) { |
12811 | p->error_indicator = 1; |
12812 | PyErr_NoMemory(); |
12813 | } |
12814 | if (p->error_indicator) { |
12815 | p->level--; |
12816 | return NULL; |
12817 | } |
12818 | CmpopExprPair* _res = NULL; |
12819 | int _mark = p->mark; |
12820 | { // 'not' 'in' bitwise_or |
12821 | if (p->error_indicator) { |
12822 | p->level--; |
12823 | return NULL; |
12824 | } |
12825 | D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or" )); |
12826 | Token * _keyword; |
12827 | Token * _keyword_1; |
12828 | expr_ty a; |
12829 | if ( |
12830 | (_keyword = _PyPegen_expect_token(p, 529)) // token='not' |
12831 | && |
12832 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
12833 | && |
12834 | (a = bitwise_or_rule(p)) // bitwise_or |
12835 | ) |
12836 | { |
12837 | D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or" )); |
12838 | _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a ); |
12839 | if (_res == NULL && PyErr_Occurred()) { |
12840 | p->error_indicator = 1; |
12841 | p->level--; |
12842 | return NULL; |
12843 | } |
12844 | goto done; |
12845 | } |
12846 | p->mark = _mark; |
12847 | D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n" , p->level, ' ', |
12848 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'not' 'in' bitwise_or" )); |
12849 | } |
12850 | _res = NULL; |
12851 | done: |
12852 | p->level--; |
12853 | return _res; |
12854 | } |
12855 | |
12856 | // in_bitwise_or: 'in' bitwise_or |
12857 | static CmpopExprPair* |
12858 | in_bitwise_or_rule(Parser *p) |
12859 | { |
12860 | if (p->level++ == MAXSTACK) { |
12861 | p->error_indicator = 1; |
12862 | PyErr_NoMemory(); |
12863 | } |
12864 | if (p->error_indicator) { |
12865 | p->level--; |
12866 | return NULL; |
12867 | } |
12868 | CmpopExprPair* _res = NULL; |
12869 | int _mark = p->mark; |
12870 | { // 'in' bitwise_or |
12871 | if (p->error_indicator) { |
12872 | p->level--; |
12873 | return NULL; |
12874 | } |
12875 | D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'in' bitwise_or" )); |
12876 | Token * _keyword; |
12877 | expr_ty a; |
12878 | if ( |
12879 | (_keyword = _PyPegen_expect_token(p, 518)) // token='in' |
12880 | && |
12881 | (a = bitwise_or_rule(p)) // bitwise_or |
12882 | ) |
12883 | { |
12884 | D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'in' bitwise_or" )); |
12885 | _res = _PyPegen_cmpop_expr_pair ( p , In , a ); |
12886 | if (_res == NULL && PyErr_Occurred()) { |
12887 | p->error_indicator = 1; |
12888 | p->level--; |
12889 | return NULL; |
12890 | } |
12891 | goto done; |
12892 | } |
12893 | p->mark = _mark; |
12894 | D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n" , p->level, ' ', |
12895 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'in' bitwise_or" )); |
12896 | } |
12897 | _res = NULL; |
12898 | done: |
12899 | p->level--; |
12900 | return _res; |
12901 | } |
12902 | |
12903 | // isnot_bitwise_or: 'is' 'not' bitwise_or |
12904 | static CmpopExprPair* |
12905 | isnot_bitwise_or_rule(Parser *p) |
12906 | { |
12907 | if (p->level++ == MAXSTACK) { |
12908 | p->error_indicator = 1; |
12909 | PyErr_NoMemory(); |
12910 | } |
12911 | if (p->error_indicator) { |
12912 | p->level--; |
12913 | return NULL; |
12914 | } |
12915 | CmpopExprPair* _res = NULL; |
12916 | int _mark = p->mark; |
12917 | { // 'is' 'not' bitwise_or |
12918 | if (p->error_indicator) { |
12919 | p->level--; |
12920 | return NULL; |
12921 | } |
12922 | D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or" )); |
12923 | Token * _keyword; |
12924 | Token * _keyword_1; |
12925 | expr_ty a; |
12926 | if ( |
12927 | (_keyword = _PyPegen_expect_token(p, 530)) // token='is' |
12928 | && |
12929 | (_keyword_1 = _PyPegen_expect_token(p, 529)) // token='not' |
12930 | && |
12931 | (a = bitwise_or_rule(p)) // bitwise_or |
12932 | ) |
12933 | { |
12934 | D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or" )); |
12935 | _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a ); |
12936 | if (_res == NULL && PyErr_Occurred()) { |
12937 | p->error_indicator = 1; |
12938 | p->level--; |
12939 | return NULL; |
12940 | } |
12941 | goto done; |
12942 | } |
12943 | p->mark = _mark; |
12944 | D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n" , p->level, ' ', |
12945 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'is' 'not' bitwise_or" )); |
12946 | } |
12947 | _res = NULL; |
12948 | done: |
12949 | p->level--; |
12950 | return _res; |
12951 | } |
12952 | |
12953 | // is_bitwise_or: 'is' bitwise_or |
12954 | static CmpopExprPair* |
12955 | is_bitwise_or_rule(Parser *p) |
12956 | { |
12957 | if (p->level++ == MAXSTACK) { |
12958 | p->error_indicator = 1; |
12959 | PyErr_NoMemory(); |
12960 | } |
12961 | if (p->error_indicator) { |
12962 | p->level--; |
12963 | return NULL; |
12964 | } |
12965 | CmpopExprPair* _res = NULL; |
12966 | int _mark = p->mark; |
12967 | { // 'is' bitwise_or |
12968 | if (p->error_indicator) { |
12969 | p->level--; |
12970 | return NULL; |
12971 | } |
12972 | D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'is' bitwise_or" )); |
12973 | Token * _keyword; |
12974 | expr_ty a; |
12975 | if ( |
12976 | (_keyword = _PyPegen_expect_token(p, 530)) // token='is' |
12977 | && |
12978 | (a = bitwise_or_rule(p)) // bitwise_or |
12979 | ) |
12980 | { |
12981 | D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'is' bitwise_or" )); |
12982 | _res = _PyPegen_cmpop_expr_pair ( p , Is , a ); |
12983 | if (_res == NULL && PyErr_Occurred()) { |
12984 | p->error_indicator = 1; |
12985 | p->level--; |
12986 | return NULL; |
12987 | } |
12988 | goto done; |
12989 | } |
12990 | p->mark = _mark; |
12991 | D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n" , p->level, ' ', |
12992 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'is' bitwise_or" )); |
12993 | } |
12994 | _res = NULL; |
12995 | done: |
12996 | p->level--; |
12997 | return _res; |
12998 | } |
12999 | |
13000 | // Left-recursive |
13001 | // bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor |
13002 | static expr_ty bitwise_or_raw(Parser *); |
13003 | static expr_ty |
13004 | bitwise_or_rule(Parser *p) |
13005 | { |
13006 | if (p->level++ == MAXSTACK) { |
13007 | p->error_indicator = 1; |
13008 | PyErr_NoMemory(); |
13009 | } |
13010 | expr_ty _res = NULL; |
13011 | if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) { |
13012 | p->level--; |
13013 | return _res; |
13014 | } |
13015 | int _mark = p->mark; |
13016 | int _resmark = p->mark; |
13017 | while (1) { |
13018 | int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res); |
13019 | if (tmpvar_2) { |
13020 | p->level--; |
13021 | return _res; |
13022 | } |
13023 | p->mark = _mark; |
13024 | void *_raw = bitwise_or_raw(p); |
13025 | if (p->error_indicator) { |
13026 | p->level--; |
13027 | return NULL; |
13028 | } |
13029 | if (_raw == NULL || p->mark <= _resmark) |
13030 | break; |
13031 | _resmark = p->mark; |
13032 | _res = _raw; |
13033 | } |
13034 | p->mark = _resmark; |
13035 | p->level--; |
13036 | return _res; |
13037 | } |
13038 | static expr_ty |
13039 | bitwise_or_raw(Parser *p) |
13040 | { |
13041 | if (p->level++ == MAXSTACK) { |
13042 | p->error_indicator = 1; |
13043 | PyErr_NoMemory(); |
13044 | } |
13045 | if (p->error_indicator) { |
13046 | p->level--; |
13047 | return NULL; |
13048 | } |
13049 | expr_ty _res = NULL; |
13050 | int _mark = p->mark; |
13051 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
13052 | p->error_indicator = 1; |
13053 | p->level--; |
13054 | return NULL; |
13055 | } |
13056 | int _start_lineno = p->tokens[_mark]->lineno; |
13057 | UNUSED(_start_lineno); // Only used by EXTRA macro |
13058 | int _start_col_offset = p->tokens[_mark]->col_offset; |
13059 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
13060 | { // bitwise_or '|' bitwise_xor |
13061 | if (p->error_indicator) { |
13062 | p->level--; |
13063 | return NULL; |
13064 | } |
13065 | D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor" )); |
13066 | Token * _literal; |
13067 | expr_ty a; |
13068 | expr_ty b; |
13069 | if ( |
13070 | (a = bitwise_or_rule(p)) // bitwise_or |
13071 | && |
13072 | (_literal = _PyPegen_expect_token(p, 18)) // token='|' |
13073 | && |
13074 | (b = bitwise_xor_rule(p)) // bitwise_xor |
13075 | ) |
13076 | { |
13077 | D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor" )); |
13078 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13079 | if (_token == NULL) { |
13080 | p->level--; |
13081 | return NULL; |
13082 | } |
13083 | int _end_lineno = _token->end_lineno; |
13084 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13085 | int _end_col_offset = _token->end_col_offset; |
13086 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13087 | _res = _PyAST_BinOp ( a , BitOr , b , EXTRA ); |
13088 | if (_res == NULL && PyErr_Occurred()) { |
13089 | p->error_indicator = 1; |
13090 | p->level--; |
13091 | return NULL; |
13092 | } |
13093 | goto done; |
13094 | } |
13095 | p->mark = _mark; |
13096 | D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n" , p->level, ' ', |
13097 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "bitwise_or '|' bitwise_xor" )); |
13098 | } |
13099 | { // bitwise_xor |
13100 | if (p->error_indicator) { |
13101 | p->level--; |
13102 | return NULL; |
13103 | } |
13104 | D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "bitwise_xor" )); |
13105 | expr_ty bitwise_xor_var; |
13106 | if ( |
13107 | (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor |
13108 | ) |
13109 | { |
13110 | D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "bitwise_xor" )); |
13111 | _res = bitwise_xor_var; |
13112 | goto done; |
13113 | } |
13114 | p->mark = _mark; |
13115 | D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n" , p->level, ' ', |
13116 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "bitwise_xor" )); |
13117 | } |
13118 | _res = NULL; |
13119 | done: |
13120 | p->level--; |
13121 | return _res; |
13122 | } |
13123 | |
13124 | // Left-recursive |
13125 | // bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and |
13126 | static expr_ty bitwise_xor_raw(Parser *); |
13127 | static expr_ty |
13128 | bitwise_xor_rule(Parser *p) |
13129 | { |
13130 | if (p->level++ == MAXSTACK) { |
13131 | p->error_indicator = 1; |
13132 | PyErr_NoMemory(); |
13133 | } |
13134 | expr_ty _res = NULL; |
13135 | if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) { |
13136 | p->level--; |
13137 | return _res; |
13138 | } |
13139 | int _mark = p->mark; |
13140 | int _resmark = p->mark; |
13141 | while (1) { |
13142 | int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res); |
13143 | if (tmpvar_3) { |
13144 | p->level--; |
13145 | return _res; |
13146 | } |
13147 | p->mark = _mark; |
13148 | void *_raw = bitwise_xor_raw(p); |
13149 | if (p->error_indicator) { |
13150 | p->level--; |
13151 | return NULL; |
13152 | } |
13153 | if (_raw == NULL || p->mark <= _resmark) |
13154 | break; |
13155 | _resmark = p->mark; |
13156 | _res = _raw; |
13157 | } |
13158 | p->mark = _resmark; |
13159 | p->level--; |
13160 | return _res; |
13161 | } |
13162 | static expr_ty |
13163 | bitwise_xor_raw(Parser *p) |
13164 | { |
13165 | if (p->level++ == MAXSTACK) { |
13166 | p->error_indicator = 1; |
13167 | PyErr_NoMemory(); |
13168 | } |
13169 | if (p->error_indicator) { |
13170 | p->level--; |
13171 | return NULL; |
13172 | } |
13173 | expr_ty _res = NULL; |
13174 | int _mark = p->mark; |
13175 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
13176 | p->error_indicator = 1; |
13177 | p->level--; |
13178 | return NULL; |
13179 | } |
13180 | int _start_lineno = p->tokens[_mark]->lineno; |
13181 | UNUSED(_start_lineno); // Only used by EXTRA macro |
13182 | int _start_col_offset = p->tokens[_mark]->col_offset; |
13183 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
13184 | { // bitwise_xor '^' bitwise_and |
13185 | if (p->error_indicator) { |
13186 | p->level--; |
13187 | return NULL; |
13188 | } |
13189 | D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and" )); |
13190 | Token * _literal; |
13191 | expr_ty a; |
13192 | expr_ty b; |
13193 | if ( |
13194 | (a = bitwise_xor_rule(p)) // bitwise_xor |
13195 | && |
13196 | (_literal = _PyPegen_expect_token(p, 32)) // token='^' |
13197 | && |
13198 | (b = bitwise_and_rule(p)) // bitwise_and |
13199 | ) |
13200 | { |
13201 | D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and" )); |
13202 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13203 | if (_token == NULL) { |
13204 | p->level--; |
13205 | return NULL; |
13206 | } |
13207 | int _end_lineno = _token->end_lineno; |
13208 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13209 | int _end_col_offset = _token->end_col_offset; |
13210 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13211 | _res = _PyAST_BinOp ( a , BitXor , b , EXTRA ); |
13212 | if (_res == NULL && PyErr_Occurred()) { |
13213 | p->error_indicator = 1; |
13214 | p->level--; |
13215 | return NULL; |
13216 | } |
13217 | goto done; |
13218 | } |
13219 | p->mark = _mark; |
13220 | D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n" , p->level, ' ', |
13221 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "bitwise_xor '^' bitwise_and" )); |
13222 | } |
13223 | { // bitwise_and |
13224 | if (p->error_indicator) { |
13225 | p->level--; |
13226 | return NULL; |
13227 | } |
13228 | D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "bitwise_and" )); |
13229 | expr_ty bitwise_and_var; |
13230 | if ( |
13231 | (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and |
13232 | ) |
13233 | { |
13234 | D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "bitwise_and" )); |
13235 | _res = bitwise_and_var; |
13236 | goto done; |
13237 | } |
13238 | p->mark = _mark; |
13239 | D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n" , p->level, ' ', |
13240 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "bitwise_and" )); |
13241 | } |
13242 | _res = NULL; |
13243 | done: |
13244 | p->level--; |
13245 | return _res; |
13246 | } |
13247 | |
13248 | // Left-recursive |
13249 | // bitwise_and: bitwise_and '&' shift_expr | shift_expr |
13250 | static expr_ty bitwise_and_raw(Parser *); |
13251 | static expr_ty |
13252 | bitwise_and_rule(Parser *p) |
13253 | { |
13254 | if (p->level++ == MAXSTACK) { |
13255 | p->error_indicator = 1; |
13256 | PyErr_NoMemory(); |
13257 | } |
13258 | expr_ty _res = NULL; |
13259 | if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) { |
13260 | p->level--; |
13261 | return _res; |
13262 | } |
13263 | int _mark = p->mark; |
13264 | int _resmark = p->mark; |
13265 | while (1) { |
13266 | int tmpvar_4 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res); |
13267 | if (tmpvar_4) { |
13268 | p->level--; |
13269 | return _res; |
13270 | } |
13271 | p->mark = _mark; |
13272 | void *_raw = bitwise_and_raw(p); |
13273 | if (p->error_indicator) { |
13274 | p->level--; |
13275 | return NULL; |
13276 | } |
13277 | if (_raw == NULL || p->mark <= _resmark) |
13278 | break; |
13279 | _resmark = p->mark; |
13280 | _res = _raw; |
13281 | } |
13282 | p->mark = _resmark; |
13283 | p->level--; |
13284 | return _res; |
13285 | } |
13286 | static expr_ty |
13287 | bitwise_and_raw(Parser *p) |
13288 | { |
13289 | if (p->level++ == MAXSTACK) { |
13290 | p->error_indicator = 1; |
13291 | PyErr_NoMemory(); |
13292 | } |
13293 | if (p->error_indicator) { |
13294 | p->level--; |
13295 | return NULL; |
13296 | } |
13297 | expr_ty _res = NULL; |
13298 | int _mark = p->mark; |
13299 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
13300 | p->error_indicator = 1; |
13301 | p->level--; |
13302 | return NULL; |
13303 | } |
13304 | int _start_lineno = p->tokens[_mark]->lineno; |
13305 | UNUSED(_start_lineno); // Only used by EXTRA macro |
13306 | int _start_col_offset = p->tokens[_mark]->col_offset; |
13307 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
13308 | { // bitwise_and '&' shift_expr |
13309 | if (p->error_indicator) { |
13310 | p->level--; |
13311 | return NULL; |
13312 | } |
13313 | D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr" )); |
13314 | Token * _literal; |
13315 | expr_ty a; |
13316 | expr_ty b; |
13317 | if ( |
13318 | (a = bitwise_and_rule(p)) // bitwise_and |
13319 | && |
13320 | (_literal = _PyPegen_expect_token(p, 19)) // token='&' |
13321 | && |
13322 | (b = shift_expr_rule(p)) // shift_expr |
13323 | ) |
13324 | { |
13325 | D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr" )); |
13326 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13327 | if (_token == NULL) { |
13328 | p->level--; |
13329 | return NULL; |
13330 | } |
13331 | int _end_lineno = _token->end_lineno; |
13332 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13333 | int _end_col_offset = _token->end_col_offset; |
13334 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13335 | _res = _PyAST_BinOp ( a , BitAnd , b , EXTRA ); |
13336 | if (_res == NULL && PyErr_Occurred()) { |
13337 | p->error_indicator = 1; |
13338 | p->level--; |
13339 | return NULL; |
13340 | } |
13341 | goto done; |
13342 | } |
13343 | p->mark = _mark; |
13344 | D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n" , p->level, ' ', |
13345 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "bitwise_and '&' shift_expr" )); |
13346 | } |
13347 | { // shift_expr |
13348 | if (p->error_indicator) { |
13349 | p->level--; |
13350 | return NULL; |
13351 | } |
13352 | D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "shift_expr" )); |
13353 | expr_ty shift_expr_var; |
13354 | if ( |
13355 | (shift_expr_var = shift_expr_rule(p)) // shift_expr |
13356 | ) |
13357 | { |
13358 | D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "shift_expr" )); |
13359 | _res = shift_expr_var; |
13360 | goto done; |
13361 | } |
13362 | p->mark = _mark; |
13363 | D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n" , p->level, ' ', |
13364 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "shift_expr" )); |
13365 | } |
13366 | _res = NULL; |
13367 | done: |
13368 | p->level--; |
13369 | return _res; |
13370 | } |
13371 | |
13372 | // Left-recursive |
13373 | // shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum |
13374 | static expr_ty shift_expr_raw(Parser *); |
13375 | static expr_ty |
13376 | shift_expr_rule(Parser *p) |
13377 | { |
13378 | if (p->level++ == MAXSTACK) { |
13379 | p->error_indicator = 1; |
13380 | PyErr_NoMemory(); |
13381 | } |
13382 | expr_ty _res = NULL; |
13383 | if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) { |
13384 | p->level--; |
13385 | return _res; |
13386 | } |
13387 | int _mark = p->mark; |
13388 | int _resmark = p->mark; |
13389 | while (1) { |
13390 | int tmpvar_5 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res); |
13391 | if (tmpvar_5) { |
13392 | p->level--; |
13393 | return _res; |
13394 | } |
13395 | p->mark = _mark; |
13396 | void *_raw = shift_expr_raw(p); |
13397 | if (p->error_indicator) { |
13398 | p->level--; |
13399 | return NULL; |
13400 | } |
13401 | if (_raw == NULL || p->mark <= _resmark) |
13402 | break; |
13403 | _resmark = p->mark; |
13404 | _res = _raw; |
13405 | } |
13406 | p->mark = _resmark; |
13407 | p->level--; |
13408 | return _res; |
13409 | } |
13410 | static expr_ty |
13411 | shift_expr_raw(Parser *p) |
13412 | { |
13413 | if (p->level++ == MAXSTACK) { |
13414 | p->error_indicator = 1; |
13415 | PyErr_NoMemory(); |
13416 | } |
13417 | if (p->error_indicator) { |
13418 | p->level--; |
13419 | return NULL; |
13420 | } |
13421 | expr_ty _res = NULL; |
13422 | int _mark = p->mark; |
13423 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
13424 | p->error_indicator = 1; |
13425 | p->level--; |
13426 | return NULL; |
13427 | } |
13428 | int _start_lineno = p->tokens[_mark]->lineno; |
13429 | UNUSED(_start_lineno); // Only used by EXTRA macro |
13430 | int _start_col_offset = p->tokens[_mark]->col_offset; |
13431 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
13432 | { // shift_expr '<<' sum |
13433 | if (p->error_indicator) { |
13434 | p->level--; |
13435 | return NULL; |
13436 | } |
13437 | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "shift_expr '<<' sum" )); |
13438 | Token * _literal; |
13439 | expr_ty a; |
13440 | expr_ty b; |
13441 | if ( |
13442 | (a = shift_expr_rule(p)) // shift_expr |
13443 | && |
13444 | (_literal = _PyPegen_expect_token(p, 33)) // token='<<' |
13445 | && |
13446 | (b = sum_rule(p)) // sum |
13447 | ) |
13448 | { |
13449 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "shift_expr '<<' sum" )); |
13450 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13451 | if (_token == NULL) { |
13452 | p->level--; |
13453 | return NULL; |
13454 | } |
13455 | int _end_lineno = _token->end_lineno; |
13456 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13457 | int _end_col_offset = _token->end_col_offset; |
13458 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13459 | _res = _PyAST_BinOp ( a , LShift , b , EXTRA ); |
13460 | if (_res == NULL && PyErr_Occurred()) { |
13461 | p->error_indicator = 1; |
13462 | p->level--; |
13463 | return NULL; |
13464 | } |
13465 | goto done; |
13466 | } |
13467 | p->mark = _mark; |
13468 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
13469 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "shift_expr '<<' sum" )); |
13470 | } |
13471 | { // shift_expr '>>' sum |
13472 | if (p->error_indicator) { |
13473 | p->level--; |
13474 | return NULL; |
13475 | } |
13476 | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "shift_expr '>>' sum" )); |
13477 | Token * _literal; |
13478 | expr_ty a; |
13479 | expr_ty b; |
13480 | if ( |
13481 | (a = shift_expr_rule(p)) // shift_expr |
13482 | && |
13483 | (_literal = _PyPegen_expect_token(p, 34)) // token='>>' |
13484 | && |
13485 | (b = sum_rule(p)) // sum |
13486 | ) |
13487 | { |
13488 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "shift_expr '>>' sum" )); |
13489 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13490 | if (_token == NULL) { |
13491 | p->level--; |
13492 | return NULL; |
13493 | } |
13494 | int _end_lineno = _token->end_lineno; |
13495 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13496 | int _end_col_offset = _token->end_col_offset; |
13497 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13498 | _res = _PyAST_BinOp ( a , RShift , b , EXTRA ); |
13499 | if (_res == NULL && PyErr_Occurred()) { |
13500 | p->error_indicator = 1; |
13501 | p->level--; |
13502 | return NULL; |
13503 | } |
13504 | goto done; |
13505 | } |
13506 | p->mark = _mark; |
13507 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
13508 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "shift_expr '>>' sum" )); |
13509 | } |
13510 | { // sum |
13511 | if (p->error_indicator) { |
13512 | p->level--; |
13513 | return NULL; |
13514 | } |
13515 | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "sum" )); |
13516 | expr_ty sum_var; |
13517 | if ( |
13518 | (sum_var = sum_rule(p)) // sum |
13519 | ) |
13520 | { |
13521 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "sum" )); |
13522 | _res = sum_var; |
13523 | goto done; |
13524 | } |
13525 | p->mark = _mark; |
13526 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
13527 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "sum" )); |
13528 | } |
13529 | _res = NULL; |
13530 | done: |
13531 | p->level--; |
13532 | return _res; |
13533 | } |
13534 | |
13535 | // Left-recursive |
13536 | // sum: sum '+' term | sum '-' term | term |
13537 | static expr_ty sum_raw(Parser *); |
13538 | static expr_ty |
13539 | sum_rule(Parser *p) |
13540 | { |
13541 | if (p->level++ == MAXSTACK) { |
13542 | p->error_indicator = 1; |
13543 | PyErr_NoMemory(); |
13544 | } |
13545 | expr_ty _res = NULL; |
13546 | if (_PyPegen_is_memoized(p, sum_type, &_res)) { |
13547 | p->level--; |
13548 | return _res; |
13549 | } |
13550 | int _mark = p->mark; |
13551 | int _resmark = p->mark; |
13552 | while (1) { |
13553 | int tmpvar_6 = _PyPegen_update_memo(p, _mark, sum_type, _res); |
13554 | if (tmpvar_6) { |
13555 | p->level--; |
13556 | return _res; |
13557 | } |
13558 | p->mark = _mark; |
13559 | void *_raw = sum_raw(p); |
13560 | if (p->error_indicator) { |
13561 | p->level--; |
13562 | return NULL; |
13563 | } |
13564 | if (_raw == NULL || p->mark <= _resmark) |
13565 | break; |
13566 | _resmark = p->mark; |
13567 | _res = _raw; |
13568 | } |
13569 | p->mark = _resmark; |
13570 | p->level--; |
13571 | return _res; |
13572 | } |
13573 | static expr_ty |
13574 | sum_raw(Parser *p) |
13575 | { |
13576 | if (p->level++ == MAXSTACK) { |
13577 | p->error_indicator = 1; |
13578 | PyErr_NoMemory(); |
13579 | } |
13580 | if (p->error_indicator) { |
13581 | p->level--; |
13582 | return NULL; |
13583 | } |
13584 | expr_ty _res = NULL; |
13585 | int _mark = p->mark; |
13586 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
13587 | p->error_indicator = 1; |
13588 | p->level--; |
13589 | return NULL; |
13590 | } |
13591 | int _start_lineno = p->tokens[_mark]->lineno; |
13592 | UNUSED(_start_lineno); // Only used by EXTRA macro |
13593 | int _start_col_offset = p->tokens[_mark]->col_offset; |
13594 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
13595 | { // sum '+' term |
13596 | if (p->error_indicator) { |
13597 | p->level--; |
13598 | return NULL; |
13599 | } |
13600 | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "sum '+' term" )); |
13601 | Token * _literal; |
13602 | expr_ty a; |
13603 | expr_ty b; |
13604 | if ( |
13605 | (a = sum_rule(p)) // sum |
13606 | && |
13607 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
13608 | && |
13609 | (b = term_rule(p)) // term |
13610 | ) |
13611 | { |
13612 | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "sum '+' term" )); |
13613 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13614 | if (_token == NULL) { |
13615 | p->level--; |
13616 | return NULL; |
13617 | } |
13618 | int _end_lineno = _token->end_lineno; |
13619 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13620 | int _end_col_offset = _token->end_col_offset; |
13621 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13622 | _res = _PyAST_BinOp ( a , Add , b , EXTRA ); |
13623 | if (_res == NULL && PyErr_Occurred()) { |
13624 | p->error_indicator = 1; |
13625 | p->level--; |
13626 | return NULL; |
13627 | } |
13628 | goto done; |
13629 | } |
13630 | p->mark = _mark; |
13631 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n" , p->level, ' ', |
13632 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "sum '+' term" )); |
13633 | } |
13634 | { // sum '-' term |
13635 | if (p->error_indicator) { |
13636 | p->level--; |
13637 | return NULL; |
13638 | } |
13639 | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "sum '-' term" )); |
13640 | Token * _literal; |
13641 | expr_ty a; |
13642 | expr_ty b; |
13643 | if ( |
13644 | (a = sum_rule(p)) // sum |
13645 | && |
13646 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
13647 | && |
13648 | (b = term_rule(p)) // term |
13649 | ) |
13650 | { |
13651 | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "sum '-' term" )); |
13652 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13653 | if (_token == NULL) { |
13654 | p->level--; |
13655 | return NULL; |
13656 | } |
13657 | int _end_lineno = _token->end_lineno; |
13658 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13659 | int _end_col_offset = _token->end_col_offset; |
13660 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13661 | _res = _PyAST_BinOp ( a , Sub , b , EXTRA ); |
13662 | if (_res == NULL && PyErr_Occurred()) { |
13663 | p->error_indicator = 1; |
13664 | p->level--; |
13665 | return NULL; |
13666 | } |
13667 | goto done; |
13668 | } |
13669 | p->mark = _mark; |
13670 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n" , p->level, ' ', |
13671 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "sum '-' term" )); |
13672 | } |
13673 | { // term |
13674 | if (p->error_indicator) { |
13675 | p->level--; |
13676 | return NULL; |
13677 | } |
13678 | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "term" )); |
13679 | expr_ty term_var; |
13680 | if ( |
13681 | (term_var = term_rule(p)) // term |
13682 | ) |
13683 | { |
13684 | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "term" )); |
13685 | _res = term_var; |
13686 | goto done; |
13687 | } |
13688 | p->mark = _mark; |
13689 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n" , p->level, ' ', |
13690 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "term" )); |
13691 | } |
13692 | _res = NULL; |
13693 | done: |
13694 | p->level--; |
13695 | return _res; |
13696 | } |
13697 | |
13698 | // Left-recursive |
13699 | // term: |
13700 | // | term '*' factor |
13701 | // | term '/' factor |
13702 | // | term '//' factor |
13703 | // | term '%' factor |
13704 | // | term '@' factor |
13705 | // | factor |
13706 | static expr_ty term_raw(Parser *); |
13707 | static expr_ty |
13708 | term_rule(Parser *p) |
13709 | { |
13710 | if (p->level++ == MAXSTACK) { |
13711 | p->error_indicator = 1; |
13712 | PyErr_NoMemory(); |
13713 | } |
13714 | expr_ty _res = NULL; |
13715 | if (_PyPegen_is_memoized(p, term_type, &_res)) { |
13716 | p->level--; |
13717 | return _res; |
13718 | } |
13719 | int _mark = p->mark; |
13720 | int _resmark = p->mark; |
13721 | while (1) { |
13722 | int tmpvar_7 = _PyPegen_update_memo(p, _mark, term_type, _res); |
13723 | if (tmpvar_7) { |
13724 | p->level--; |
13725 | return _res; |
13726 | } |
13727 | p->mark = _mark; |
13728 | void *_raw = term_raw(p); |
13729 | if (p->error_indicator) { |
13730 | p->level--; |
13731 | return NULL; |
13732 | } |
13733 | if (_raw == NULL || p->mark <= _resmark) |
13734 | break; |
13735 | _resmark = p->mark; |
13736 | _res = _raw; |
13737 | } |
13738 | p->mark = _resmark; |
13739 | p->level--; |
13740 | return _res; |
13741 | } |
13742 | static expr_ty |
13743 | term_raw(Parser *p) |
13744 | { |
13745 | if (p->level++ == MAXSTACK) { |
13746 | p->error_indicator = 1; |
13747 | PyErr_NoMemory(); |
13748 | } |
13749 | if (p->error_indicator) { |
13750 | p->level--; |
13751 | return NULL; |
13752 | } |
13753 | expr_ty _res = NULL; |
13754 | int _mark = p->mark; |
13755 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
13756 | p->error_indicator = 1; |
13757 | p->level--; |
13758 | return NULL; |
13759 | } |
13760 | int _start_lineno = p->tokens[_mark]->lineno; |
13761 | UNUSED(_start_lineno); // Only used by EXTRA macro |
13762 | int _start_col_offset = p->tokens[_mark]->col_offset; |
13763 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
13764 | { // term '*' factor |
13765 | if (p->error_indicator) { |
13766 | p->level--; |
13767 | return NULL; |
13768 | } |
13769 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "term '*' factor" )); |
13770 | Token * _literal; |
13771 | expr_ty a; |
13772 | expr_ty b; |
13773 | if ( |
13774 | (a = term_rule(p)) // term |
13775 | && |
13776 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
13777 | && |
13778 | (b = factor_rule(p)) // factor |
13779 | ) |
13780 | { |
13781 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "term '*' factor" )); |
13782 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13783 | if (_token == NULL) { |
13784 | p->level--; |
13785 | return NULL; |
13786 | } |
13787 | int _end_lineno = _token->end_lineno; |
13788 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13789 | int _end_col_offset = _token->end_col_offset; |
13790 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13791 | _res = _PyAST_BinOp ( a , Mult , b , EXTRA ); |
13792 | if (_res == NULL && PyErr_Occurred()) { |
13793 | p->error_indicator = 1; |
13794 | p->level--; |
13795 | return NULL; |
13796 | } |
13797 | goto done; |
13798 | } |
13799 | p->mark = _mark; |
13800 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n" , p->level, ' ', |
13801 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "term '*' factor" )); |
13802 | } |
13803 | { // term '/' factor |
13804 | if (p->error_indicator) { |
13805 | p->level--; |
13806 | return NULL; |
13807 | } |
13808 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "term '/' factor" )); |
13809 | Token * _literal; |
13810 | expr_ty a; |
13811 | expr_ty b; |
13812 | if ( |
13813 | (a = term_rule(p)) // term |
13814 | && |
13815 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
13816 | && |
13817 | (b = factor_rule(p)) // factor |
13818 | ) |
13819 | { |
13820 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "term '/' factor" )); |
13821 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13822 | if (_token == NULL) { |
13823 | p->level--; |
13824 | return NULL; |
13825 | } |
13826 | int _end_lineno = _token->end_lineno; |
13827 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13828 | int _end_col_offset = _token->end_col_offset; |
13829 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13830 | _res = _PyAST_BinOp ( a , Div , b , EXTRA ); |
13831 | if (_res == NULL && PyErr_Occurred()) { |
13832 | p->error_indicator = 1; |
13833 | p->level--; |
13834 | return NULL; |
13835 | } |
13836 | goto done; |
13837 | } |
13838 | p->mark = _mark; |
13839 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n" , p->level, ' ', |
13840 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "term '/' factor" )); |
13841 | } |
13842 | { // term '//' factor |
13843 | if (p->error_indicator) { |
13844 | p->level--; |
13845 | return NULL; |
13846 | } |
13847 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "term '//' factor" )); |
13848 | Token * _literal; |
13849 | expr_ty a; |
13850 | expr_ty b; |
13851 | if ( |
13852 | (a = term_rule(p)) // term |
13853 | && |
13854 | (_literal = _PyPegen_expect_token(p, 47)) // token='//' |
13855 | && |
13856 | (b = factor_rule(p)) // factor |
13857 | ) |
13858 | { |
13859 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "term '//' factor" )); |
13860 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13861 | if (_token == NULL) { |
13862 | p->level--; |
13863 | return NULL; |
13864 | } |
13865 | int _end_lineno = _token->end_lineno; |
13866 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13867 | int _end_col_offset = _token->end_col_offset; |
13868 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13869 | _res = _PyAST_BinOp ( a , FloorDiv , b , EXTRA ); |
13870 | if (_res == NULL && PyErr_Occurred()) { |
13871 | p->error_indicator = 1; |
13872 | p->level--; |
13873 | return NULL; |
13874 | } |
13875 | goto done; |
13876 | } |
13877 | p->mark = _mark; |
13878 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n" , p->level, ' ', |
13879 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "term '//' factor" )); |
13880 | } |
13881 | { // term '%' factor |
13882 | if (p->error_indicator) { |
13883 | p->level--; |
13884 | return NULL; |
13885 | } |
13886 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "term '%' factor" )); |
13887 | Token * _literal; |
13888 | expr_ty a; |
13889 | expr_ty b; |
13890 | if ( |
13891 | (a = term_rule(p)) // term |
13892 | && |
13893 | (_literal = _PyPegen_expect_token(p, 24)) // token='%' |
13894 | && |
13895 | (b = factor_rule(p)) // factor |
13896 | ) |
13897 | { |
13898 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "term '%' factor" )); |
13899 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13900 | if (_token == NULL) { |
13901 | p->level--; |
13902 | return NULL; |
13903 | } |
13904 | int _end_lineno = _token->end_lineno; |
13905 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13906 | int _end_col_offset = _token->end_col_offset; |
13907 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13908 | _res = _PyAST_BinOp ( a , Mod , b , EXTRA ); |
13909 | if (_res == NULL && PyErr_Occurred()) { |
13910 | p->error_indicator = 1; |
13911 | p->level--; |
13912 | return NULL; |
13913 | } |
13914 | goto done; |
13915 | } |
13916 | p->mark = _mark; |
13917 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n" , p->level, ' ', |
13918 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "term '%' factor" )); |
13919 | } |
13920 | { // term '@' factor |
13921 | if (p->error_indicator) { |
13922 | p->level--; |
13923 | return NULL; |
13924 | } |
13925 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "term '@' factor" )); |
13926 | Token * _literal; |
13927 | expr_ty a; |
13928 | expr_ty b; |
13929 | if ( |
13930 | (a = term_rule(p)) // term |
13931 | && |
13932 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
13933 | && |
13934 | (b = factor_rule(p)) // factor |
13935 | ) |
13936 | { |
13937 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "term '@' factor" )); |
13938 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13939 | if (_token == NULL) { |
13940 | p->level--; |
13941 | return NULL; |
13942 | } |
13943 | int _end_lineno = _token->end_lineno; |
13944 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13945 | int _end_col_offset = _token->end_col_offset; |
13946 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13947 | _res = CHECK_VERSION ( expr_ty , 5 , "The '@' operator is" , _PyAST_BinOp ( a , MatMult , b , EXTRA ) ); |
13948 | if (_res == NULL && PyErr_Occurred()) { |
13949 | p->error_indicator = 1; |
13950 | p->level--; |
13951 | return NULL; |
13952 | } |
13953 | goto done; |
13954 | } |
13955 | p->mark = _mark; |
13956 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n" , p->level, ' ', |
13957 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "term '@' factor" )); |
13958 | } |
13959 | { // factor |
13960 | if (p->error_indicator) { |
13961 | p->level--; |
13962 | return NULL; |
13963 | } |
13964 | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "factor" )); |
13965 | expr_ty factor_var; |
13966 | if ( |
13967 | (factor_var = factor_rule(p)) // factor |
13968 | ) |
13969 | { |
13970 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "factor" )); |
13971 | _res = factor_var; |
13972 | goto done; |
13973 | } |
13974 | p->mark = _mark; |
13975 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n" , p->level, ' ', |
13976 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "factor" )); |
13977 | } |
13978 | _res = NULL; |
13979 | done: |
13980 | p->level--; |
13981 | return _res; |
13982 | } |
13983 | |
13984 | // factor: '+' factor | '-' factor | '~' factor | power |
13985 | static expr_ty |
13986 | factor_rule(Parser *p) |
13987 | { |
13988 | if (p->level++ == MAXSTACK) { |
13989 | p->error_indicator = 1; |
13990 | PyErr_NoMemory(); |
13991 | } |
13992 | if (p->error_indicator) { |
13993 | p->level--; |
13994 | return NULL; |
13995 | } |
13996 | expr_ty _res = NULL; |
13997 | if (_PyPegen_is_memoized(p, factor_type, &_res)) { |
13998 | p->level--; |
13999 | return _res; |
14000 | } |
14001 | int _mark = p->mark; |
14002 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14003 | p->error_indicator = 1; |
14004 | p->level--; |
14005 | return NULL; |
14006 | } |
14007 | int _start_lineno = p->tokens[_mark]->lineno; |
14008 | UNUSED(_start_lineno); // Only used by EXTRA macro |
14009 | int _start_col_offset = p->tokens[_mark]->col_offset; |
14010 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14011 | { // '+' factor |
14012 | if (p->error_indicator) { |
14013 | p->level--; |
14014 | return NULL; |
14015 | } |
14016 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'+' factor" )); |
14017 | Token * _literal; |
14018 | expr_ty a; |
14019 | if ( |
14020 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
14021 | && |
14022 | (a = factor_rule(p)) // factor |
14023 | ) |
14024 | { |
14025 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'+' factor" )); |
14026 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14027 | if (_token == NULL) { |
14028 | p->level--; |
14029 | return NULL; |
14030 | } |
14031 | int _end_lineno = _token->end_lineno; |
14032 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14033 | int _end_col_offset = _token->end_col_offset; |
14034 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14035 | _res = _PyAST_UnaryOp ( UAdd , a , EXTRA ); |
14036 | if (_res == NULL && PyErr_Occurred()) { |
14037 | p->error_indicator = 1; |
14038 | p->level--; |
14039 | return NULL; |
14040 | } |
14041 | goto done; |
14042 | } |
14043 | p->mark = _mark; |
14044 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n" , p->level, ' ', |
14045 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'+' factor" )); |
14046 | } |
14047 | { // '-' factor |
14048 | if (p->error_indicator) { |
14049 | p->level--; |
14050 | return NULL; |
14051 | } |
14052 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'-' factor" )); |
14053 | Token * _literal; |
14054 | expr_ty a; |
14055 | if ( |
14056 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
14057 | && |
14058 | (a = factor_rule(p)) // factor |
14059 | ) |
14060 | { |
14061 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'-' factor" )); |
14062 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14063 | if (_token == NULL) { |
14064 | p->level--; |
14065 | return NULL; |
14066 | } |
14067 | int _end_lineno = _token->end_lineno; |
14068 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14069 | int _end_col_offset = _token->end_col_offset; |
14070 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14071 | _res = _PyAST_UnaryOp ( USub , a , EXTRA ); |
14072 | if (_res == NULL && PyErr_Occurred()) { |
14073 | p->error_indicator = 1; |
14074 | p->level--; |
14075 | return NULL; |
14076 | } |
14077 | goto done; |
14078 | } |
14079 | p->mark = _mark; |
14080 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n" , p->level, ' ', |
14081 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'-' factor" )); |
14082 | } |
14083 | { // '~' factor |
14084 | if (p->error_indicator) { |
14085 | p->level--; |
14086 | return NULL; |
14087 | } |
14088 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'~' factor" )); |
14089 | Token * _literal; |
14090 | expr_ty a; |
14091 | if ( |
14092 | (_literal = _PyPegen_expect_token(p, 31)) // token='~' |
14093 | && |
14094 | (a = factor_rule(p)) // factor |
14095 | ) |
14096 | { |
14097 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'~' factor" )); |
14098 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14099 | if (_token == NULL) { |
14100 | p->level--; |
14101 | return NULL; |
14102 | } |
14103 | int _end_lineno = _token->end_lineno; |
14104 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14105 | int _end_col_offset = _token->end_col_offset; |
14106 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14107 | _res = _PyAST_UnaryOp ( Invert , a , EXTRA ); |
14108 | if (_res == NULL && PyErr_Occurred()) { |
14109 | p->error_indicator = 1; |
14110 | p->level--; |
14111 | return NULL; |
14112 | } |
14113 | goto done; |
14114 | } |
14115 | p->mark = _mark; |
14116 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n" , p->level, ' ', |
14117 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'~' factor" )); |
14118 | } |
14119 | { // power |
14120 | if (p->error_indicator) { |
14121 | p->level--; |
14122 | return NULL; |
14123 | } |
14124 | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "power" )); |
14125 | expr_ty power_var; |
14126 | if ( |
14127 | (power_var = power_rule(p)) // power |
14128 | ) |
14129 | { |
14130 | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "power" )); |
14131 | _res = power_var; |
14132 | goto done; |
14133 | } |
14134 | p->mark = _mark; |
14135 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n" , p->level, ' ', |
14136 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "power" )); |
14137 | } |
14138 | _res = NULL; |
14139 | done: |
14140 | _PyPegen_insert_memo(p, _mark, factor_type, _res); |
14141 | p->level--; |
14142 | return _res; |
14143 | } |
14144 | |
14145 | // power: await_primary '**' factor | await_primary |
14146 | static expr_ty |
14147 | power_rule(Parser *p) |
14148 | { |
14149 | if (p->level++ == MAXSTACK) { |
14150 | p->error_indicator = 1; |
14151 | PyErr_NoMemory(); |
14152 | } |
14153 | if (p->error_indicator) { |
14154 | p->level--; |
14155 | return NULL; |
14156 | } |
14157 | expr_ty _res = NULL; |
14158 | int _mark = p->mark; |
14159 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14160 | p->error_indicator = 1; |
14161 | p->level--; |
14162 | return NULL; |
14163 | } |
14164 | int _start_lineno = p->tokens[_mark]->lineno; |
14165 | UNUSED(_start_lineno); // Only used by EXTRA macro |
14166 | int _start_col_offset = p->tokens[_mark]->col_offset; |
14167 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14168 | { // await_primary '**' factor |
14169 | if (p->error_indicator) { |
14170 | p->level--; |
14171 | return NULL; |
14172 | } |
14173 | D(fprintf(stderr, "%*c> power[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "await_primary '**' factor" )); |
14174 | Token * _literal; |
14175 | expr_ty a; |
14176 | expr_ty b; |
14177 | if ( |
14178 | (a = await_primary_rule(p)) // await_primary |
14179 | && |
14180 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
14181 | && |
14182 | (b = factor_rule(p)) // factor |
14183 | ) |
14184 | { |
14185 | D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "await_primary '**' factor" )); |
14186 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14187 | if (_token == NULL) { |
14188 | p->level--; |
14189 | return NULL; |
14190 | } |
14191 | int _end_lineno = _token->end_lineno; |
14192 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14193 | int _end_col_offset = _token->end_col_offset; |
14194 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14195 | _res = _PyAST_BinOp ( a , Pow , b , EXTRA ); |
14196 | if (_res == NULL && PyErr_Occurred()) { |
14197 | p->error_indicator = 1; |
14198 | p->level--; |
14199 | return NULL; |
14200 | } |
14201 | goto done; |
14202 | } |
14203 | p->mark = _mark; |
14204 | D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n" , p->level, ' ', |
14205 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "await_primary '**' factor" )); |
14206 | } |
14207 | { // await_primary |
14208 | if (p->error_indicator) { |
14209 | p->level--; |
14210 | return NULL; |
14211 | } |
14212 | D(fprintf(stderr, "%*c> power[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "await_primary" )); |
14213 | expr_ty await_primary_var; |
14214 | if ( |
14215 | (await_primary_var = await_primary_rule(p)) // await_primary |
14216 | ) |
14217 | { |
14218 | D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "await_primary" )); |
14219 | _res = await_primary_var; |
14220 | goto done; |
14221 | } |
14222 | p->mark = _mark; |
14223 | D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n" , p->level, ' ', |
14224 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "await_primary" )); |
14225 | } |
14226 | _res = NULL; |
14227 | done: |
14228 | p->level--; |
14229 | return _res; |
14230 | } |
14231 | |
14232 | // await_primary: AWAIT primary | primary |
14233 | static expr_ty |
14234 | await_primary_rule(Parser *p) |
14235 | { |
14236 | if (p->level++ == MAXSTACK) { |
14237 | p->error_indicator = 1; |
14238 | PyErr_NoMemory(); |
14239 | } |
14240 | if (p->error_indicator) { |
14241 | p->level--; |
14242 | return NULL; |
14243 | } |
14244 | expr_ty _res = NULL; |
14245 | if (_PyPegen_is_memoized(p, await_primary_type, &_res)) { |
14246 | p->level--; |
14247 | return _res; |
14248 | } |
14249 | int _mark = p->mark; |
14250 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14251 | p->error_indicator = 1; |
14252 | p->level--; |
14253 | return NULL; |
14254 | } |
14255 | int _start_lineno = p->tokens[_mark]->lineno; |
14256 | UNUSED(_start_lineno); // Only used by EXTRA macro |
14257 | int _start_col_offset = p->tokens[_mark]->col_offset; |
14258 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14259 | { // AWAIT primary |
14260 | if (p->error_indicator) { |
14261 | p->level--; |
14262 | return NULL; |
14263 | } |
14264 | D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "AWAIT primary" )); |
14265 | expr_ty a; |
14266 | Token * await_var; |
14267 | if ( |
14268 | (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT' |
14269 | && |
14270 | (a = primary_rule(p)) // primary |
14271 | ) |
14272 | { |
14273 | D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "AWAIT primary" )); |
14274 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14275 | if (_token == NULL) { |
14276 | p->level--; |
14277 | return NULL; |
14278 | } |
14279 | int _end_lineno = _token->end_lineno; |
14280 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14281 | int _end_col_offset = _token->end_col_offset; |
14282 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14283 | _res = CHECK_VERSION ( expr_ty , 5 , "Await expressions are" , _PyAST_Await ( a , EXTRA ) ); |
14284 | if (_res == NULL && PyErr_Occurred()) { |
14285 | p->error_indicator = 1; |
14286 | p->level--; |
14287 | return NULL; |
14288 | } |
14289 | goto done; |
14290 | } |
14291 | p->mark = _mark; |
14292 | D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n" , p->level, ' ', |
14293 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "AWAIT primary" )); |
14294 | } |
14295 | { // primary |
14296 | if (p->error_indicator) { |
14297 | p->level--; |
14298 | return NULL; |
14299 | } |
14300 | D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "primary" )); |
14301 | expr_ty primary_var; |
14302 | if ( |
14303 | (primary_var = primary_rule(p)) // primary |
14304 | ) |
14305 | { |
14306 | D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "primary" )); |
14307 | _res = primary_var; |
14308 | goto done; |
14309 | } |
14310 | p->mark = _mark; |
14311 | D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n" , p->level, ' ', |
14312 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "primary" )); |
14313 | } |
14314 | _res = NULL; |
14315 | done: |
14316 | _PyPegen_insert_memo(p, _mark, await_primary_type, _res); |
14317 | p->level--; |
14318 | return _res; |
14319 | } |
14320 | |
14321 | // Left-recursive |
14322 | // primary: |
14323 | // | primary '.' NAME |
14324 | // | primary genexp |
14325 | // | primary '(' arguments? ')' |
14326 | // | primary '[' slices ']' |
14327 | // | atom |
14328 | static expr_ty primary_raw(Parser *); |
14329 | static expr_ty |
14330 | primary_rule(Parser *p) |
14331 | { |
14332 | if (p->level++ == MAXSTACK) { |
14333 | p->error_indicator = 1; |
14334 | PyErr_NoMemory(); |
14335 | } |
14336 | expr_ty _res = NULL; |
14337 | if (_PyPegen_is_memoized(p, primary_type, &_res)) { |
14338 | p->level--; |
14339 | return _res; |
14340 | } |
14341 | int _mark = p->mark; |
14342 | int _resmark = p->mark; |
14343 | while (1) { |
14344 | int tmpvar_8 = _PyPegen_update_memo(p, _mark, primary_type, _res); |
14345 | if (tmpvar_8) { |
14346 | p->level--; |
14347 | return _res; |
14348 | } |
14349 | p->mark = _mark; |
14350 | void *_raw = primary_raw(p); |
14351 | if (p->error_indicator) { |
14352 | p->level--; |
14353 | return NULL; |
14354 | } |
14355 | if (_raw == NULL || p->mark <= _resmark) |
14356 | break; |
14357 | _resmark = p->mark; |
14358 | _res = _raw; |
14359 | } |
14360 | p->mark = _resmark; |
14361 | p->level--; |
14362 | return _res; |
14363 | } |
14364 | static expr_ty |
14365 | primary_raw(Parser *p) |
14366 | { |
14367 | if (p->level++ == MAXSTACK) { |
14368 | p->error_indicator = 1; |
14369 | PyErr_NoMemory(); |
14370 | } |
14371 | if (p->error_indicator) { |
14372 | p->level--; |
14373 | return NULL; |
14374 | } |
14375 | expr_ty _res = NULL; |
14376 | int _mark = p->mark; |
14377 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14378 | p->error_indicator = 1; |
14379 | p->level--; |
14380 | return NULL; |
14381 | } |
14382 | int _start_lineno = p->tokens[_mark]->lineno; |
14383 | UNUSED(_start_lineno); // Only used by EXTRA macro |
14384 | int _start_col_offset = p->tokens[_mark]->col_offset; |
14385 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14386 | { // primary '.' NAME |
14387 | if (p->error_indicator) { |
14388 | p->level--; |
14389 | return NULL; |
14390 | } |
14391 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "primary '.' NAME" )); |
14392 | Token * _literal; |
14393 | expr_ty a; |
14394 | expr_ty b; |
14395 | if ( |
14396 | (a = primary_rule(p)) // primary |
14397 | && |
14398 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
14399 | && |
14400 | (b = _PyPegen_name_token(p)) // NAME |
14401 | ) |
14402 | { |
14403 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "primary '.' NAME" )); |
14404 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14405 | if (_token == NULL) { |
14406 | p->level--; |
14407 | return NULL; |
14408 | } |
14409 | int _end_lineno = _token->end_lineno; |
14410 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14411 | int _end_col_offset = _token->end_col_offset; |
14412 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14413 | _res = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA ); |
14414 | if (_res == NULL && PyErr_Occurred()) { |
14415 | p->error_indicator = 1; |
14416 | p->level--; |
14417 | return NULL; |
14418 | } |
14419 | goto done; |
14420 | } |
14421 | p->mark = _mark; |
14422 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n" , p->level, ' ', |
14423 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "primary '.' NAME" )); |
14424 | } |
14425 | { // primary genexp |
14426 | if (p->error_indicator) { |
14427 | p->level--; |
14428 | return NULL; |
14429 | } |
14430 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "primary genexp" )); |
14431 | expr_ty a; |
14432 | expr_ty b; |
14433 | if ( |
14434 | (a = primary_rule(p)) // primary |
14435 | && |
14436 | (b = genexp_rule(p)) // genexp |
14437 | ) |
14438 | { |
14439 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "primary genexp" )); |
14440 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14441 | if (_token == NULL) { |
14442 | p->level--; |
14443 | return NULL; |
14444 | } |
14445 | int _end_lineno = _token->end_lineno; |
14446 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14447 | int _end_col_offset = _token->end_col_offset; |
14448 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14449 | _res = _PyAST_Call ( a , CHECK ( asdl_expr_seq * , ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); |
14450 | if (_res == NULL && PyErr_Occurred()) { |
14451 | p->error_indicator = 1; |
14452 | p->level--; |
14453 | return NULL; |
14454 | } |
14455 | goto done; |
14456 | } |
14457 | p->mark = _mark; |
14458 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n" , p->level, ' ', |
14459 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "primary genexp" )); |
14460 | } |
14461 | { // primary '(' arguments? ')' |
14462 | if (p->error_indicator) { |
14463 | p->level--; |
14464 | return NULL; |
14465 | } |
14466 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'" )); |
14467 | Token * _literal; |
14468 | Token * _literal_1; |
14469 | expr_ty a; |
14470 | void *b; |
14471 | if ( |
14472 | (a = primary_rule(p)) // primary |
14473 | && |
14474 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
14475 | && |
14476 | (b = arguments_rule(p), !p->error_indicator) // arguments? |
14477 | && |
14478 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
14479 | ) |
14480 | { |
14481 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'" )); |
14482 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14483 | if (_token == NULL) { |
14484 | p->level--; |
14485 | return NULL; |
14486 | } |
14487 | int _end_lineno = _token->end_lineno; |
14488 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14489 | int _end_col_offset = _token->end_col_offset; |
14490 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14491 | _res = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
14492 | if (_res == NULL && PyErr_Occurred()) { |
14493 | p->error_indicator = 1; |
14494 | p->level--; |
14495 | return NULL; |
14496 | } |
14497 | goto done; |
14498 | } |
14499 | p->mark = _mark; |
14500 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n" , p->level, ' ', |
14501 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "primary '(' arguments? ')'" )); |
14502 | } |
14503 | { // primary '[' slices ']' |
14504 | if (p->error_indicator) { |
14505 | p->level--; |
14506 | return NULL; |
14507 | } |
14508 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "primary '[' slices ']'" )); |
14509 | Token * _literal; |
14510 | Token * _literal_1; |
14511 | expr_ty a; |
14512 | expr_ty b; |
14513 | if ( |
14514 | (a = primary_rule(p)) // primary |
14515 | && |
14516 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
14517 | && |
14518 | (b = slices_rule(p)) // slices |
14519 | && |
14520 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
14521 | ) |
14522 | { |
14523 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "primary '[' slices ']'" )); |
14524 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14525 | if (_token == NULL) { |
14526 | p->level--; |
14527 | return NULL; |
14528 | } |
14529 | int _end_lineno = _token->end_lineno; |
14530 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14531 | int _end_col_offset = _token->end_col_offset; |
14532 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14533 | _res = _PyAST_Subscript ( a , b , Load , EXTRA ); |
14534 | if (_res == NULL && PyErr_Occurred()) { |
14535 | p->error_indicator = 1; |
14536 | p->level--; |
14537 | return NULL; |
14538 | } |
14539 | goto done; |
14540 | } |
14541 | p->mark = _mark; |
14542 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n" , p->level, ' ', |
14543 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "primary '[' slices ']'" )); |
14544 | } |
14545 | { // atom |
14546 | if (p->error_indicator) { |
14547 | p->level--; |
14548 | return NULL; |
14549 | } |
14550 | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "atom" )); |
14551 | expr_ty atom_var; |
14552 | if ( |
14553 | (atom_var = atom_rule(p)) // atom |
14554 | ) |
14555 | { |
14556 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "atom" )); |
14557 | _res = atom_var; |
14558 | goto done; |
14559 | } |
14560 | p->mark = _mark; |
14561 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n" , p->level, ' ', |
14562 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "atom" )); |
14563 | } |
14564 | _res = NULL; |
14565 | done: |
14566 | p->level--; |
14567 | return _res; |
14568 | } |
14569 | |
14570 | // slices: slice !',' | ','.slice+ ','? |
14571 | static expr_ty |
14572 | slices_rule(Parser *p) |
14573 | { |
14574 | if (p->level++ == MAXSTACK) { |
14575 | p->error_indicator = 1; |
14576 | PyErr_NoMemory(); |
14577 | } |
14578 | if (p->error_indicator) { |
14579 | p->level--; |
14580 | return NULL; |
14581 | } |
14582 | expr_ty _res = NULL; |
14583 | int _mark = p->mark; |
14584 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14585 | p->error_indicator = 1; |
14586 | p->level--; |
14587 | return NULL; |
14588 | } |
14589 | int _start_lineno = p->tokens[_mark]->lineno; |
14590 | UNUSED(_start_lineno); // Only used by EXTRA macro |
14591 | int _start_col_offset = p->tokens[_mark]->col_offset; |
14592 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14593 | { // slice !',' |
14594 | if (p->error_indicator) { |
14595 | p->level--; |
14596 | return NULL; |
14597 | } |
14598 | D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "slice !','" )); |
14599 | expr_ty a; |
14600 | if ( |
14601 | (a = slice_rule(p)) // slice |
14602 | && |
14603 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
14604 | ) |
14605 | { |
14606 | D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "slice !','" )); |
14607 | _res = a; |
14608 | if (_res == NULL && PyErr_Occurred()) { |
14609 | p->error_indicator = 1; |
14610 | p->level--; |
14611 | return NULL; |
14612 | } |
14613 | goto done; |
14614 | } |
14615 | p->mark = _mark; |
14616 | D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n" , p->level, ' ', |
14617 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "slice !','" )); |
14618 | } |
14619 | { // ','.slice+ ','? |
14620 | if (p->error_indicator) { |
14621 | p->level--; |
14622 | return NULL; |
14623 | } |
14624 | D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.slice+ ','?" )); |
14625 | void *_opt_var; |
14626 | UNUSED(_opt_var); // Silence compiler warnings |
14627 | asdl_expr_seq* a; |
14628 | if ( |
14629 | (a = (asdl_expr_seq*)_gather_108_rule(p)) // ','.slice+ |
14630 | && |
14631 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
14632 | ) |
14633 | { |
14634 | D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.slice+ ','?" )); |
14635 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14636 | if (_token == NULL) { |
14637 | p->level--; |
14638 | return NULL; |
14639 | } |
14640 | int _end_lineno = _token->end_lineno; |
14641 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14642 | int _end_col_offset = _token->end_col_offset; |
14643 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14644 | _res = _PyAST_Tuple ( a , Load , EXTRA ); |
14645 | if (_res == NULL && PyErr_Occurred()) { |
14646 | p->error_indicator = 1; |
14647 | p->level--; |
14648 | return NULL; |
14649 | } |
14650 | goto done; |
14651 | } |
14652 | p->mark = _mark; |
14653 | D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n" , p->level, ' ', |
14654 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.slice+ ','?" )); |
14655 | } |
14656 | _res = NULL; |
14657 | done: |
14658 | p->level--; |
14659 | return _res; |
14660 | } |
14661 | |
14662 | // slice: expression? ':' expression? [':' expression?] | named_expression |
14663 | static expr_ty |
14664 | slice_rule(Parser *p) |
14665 | { |
14666 | if (p->level++ == MAXSTACK) { |
14667 | p->error_indicator = 1; |
14668 | PyErr_NoMemory(); |
14669 | } |
14670 | if (p->error_indicator) { |
14671 | p->level--; |
14672 | return NULL; |
14673 | } |
14674 | expr_ty _res = NULL; |
14675 | int _mark = p->mark; |
14676 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14677 | p->error_indicator = 1; |
14678 | p->level--; |
14679 | return NULL; |
14680 | } |
14681 | int _start_lineno = p->tokens[_mark]->lineno; |
14682 | UNUSED(_start_lineno); // Only used by EXTRA macro |
14683 | int _start_col_offset = p->tokens[_mark]->col_offset; |
14684 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14685 | { // expression? ':' expression? [':' expression?] |
14686 | if (p->error_indicator) { |
14687 | p->level--; |
14688 | return NULL; |
14689 | } |
14690 | D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]" )); |
14691 | Token * _literal; |
14692 | void *a; |
14693 | void *b; |
14694 | void *c; |
14695 | if ( |
14696 | (a = expression_rule(p), !p->error_indicator) // expression? |
14697 | && |
14698 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
14699 | && |
14700 | (b = expression_rule(p), !p->error_indicator) // expression? |
14701 | && |
14702 | (c = _tmp_110_rule(p), !p->error_indicator) // [':' expression?] |
14703 | ) |
14704 | { |
14705 | D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]" )); |
14706 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14707 | if (_token == NULL) { |
14708 | p->level--; |
14709 | return NULL; |
14710 | } |
14711 | int _end_lineno = _token->end_lineno; |
14712 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14713 | int _end_col_offset = _token->end_col_offset; |
14714 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14715 | _res = _PyAST_Slice ( a , b , c , EXTRA ); |
14716 | if (_res == NULL && PyErr_Occurred()) { |
14717 | p->error_indicator = 1; |
14718 | p->level--; |
14719 | return NULL; |
14720 | } |
14721 | goto done; |
14722 | } |
14723 | p->mark = _mark; |
14724 | D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n" , p->level, ' ', |
14725 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression? ':' expression? [':' expression?]" )); |
14726 | } |
14727 | { // named_expression |
14728 | if (p->error_indicator) { |
14729 | p->level--; |
14730 | return NULL; |
14731 | } |
14732 | D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "named_expression" )); |
14733 | expr_ty a; |
14734 | if ( |
14735 | (a = named_expression_rule(p)) // named_expression |
14736 | ) |
14737 | { |
14738 | D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "named_expression" )); |
14739 | _res = a; |
14740 | if (_res == NULL && PyErr_Occurred()) { |
14741 | p->error_indicator = 1; |
14742 | p->level--; |
14743 | return NULL; |
14744 | } |
14745 | goto done; |
14746 | } |
14747 | p->mark = _mark; |
14748 | D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n" , p->level, ' ', |
14749 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "named_expression" )); |
14750 | } |
14751 | _res = NULL; |
14752 | done: |
14753 | p->level--; |
14754 | return _res; |
14755 | } |
14756 | |
14757 | // atom: |
14758 | // | NAME |
14759 | // | 'True' |
14760 | // | 'False' |
14761 | // | 'None' |
14762 | // | &STRING strings |
14763 | // | NUMBER |
14764 | // | &'(' (tuple | group | genexp) |
14765 | // | &'[' (list | listcomp) |
14766 | // | &'{' (dict | set | dictcomp | setcomp) |
14767 | // | '...' |
14768 | static expr_ty |
14769 | atom_rule(Parser *p) |
14770 | { |
14771 | if (p->level++ == MAXSTACK) { |
14772 | p->error_indicator = 1; |
14773 | PyErr_NoMemory(); |
14774 | } |
14775 | if (p->error_indicator) { |
14776 | p->level--; |
14777 | return NULL; |
14778 | } |
14779 | expr_ty _res = NULL; |
14780 | int _mark = p->mark; |
14781 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14782 | p->error_indicator = 1; |
14783 | p->level--; |
14784 | return NULL; |
14785 | } |
14786 | int _start_lineno = p->tokens[_mark]->lineno; |
14787 | UNUSED(_start_lineno); // Only used by EXTRA macro |
14788 | int _start_col_offset = p->tokens[_mark]->col_offset; |
14789 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14790 | { // NAME |
14791 | if (p->error_indicator) { |
14792 | p->level--; |
14793 | return NULL; |
14794 | } |
14795 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
14796 | expr_ty name_var; |
14797 | if ( |
14798 | (name_var = _PyPegen_name_token(p)) // NAME |
14799 | ) |
14800 | { |
14801 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
14802 | _res = name_var; |
14803 | goto done; |
14804 | } |
14805 | p->mark = _mark; |
14806 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n" , p->level, ' ', |
14807 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME" )); |
14808 | } |
14809 | { // 'True' |
14810 | if (p->error_indicator) { |
14811 | p->level--; |
14812 | return NULL; |
14813 | } |
14814 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'True'" )); |
14815 | Token * _keyword; |
14816 | if ( |
14817 | (_keyword = _PyPegen_expect_token(p, 524)) // token='True' |
14818 | ) |
14819 | { |
14820 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'True'" )); |
14821 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14822 | if (_token == NULL) { |
14823 | p->level--; |
14824 | return NULL; |
14825 | } |
14826 | int _end_lineno = _token->end_lineno; |
14827 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14828 | int _end_col_offset = _token->end_col_offset; |
14829 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14830 | _res = _PyAST_Constant ( Py_True , NULL , EXTRA ); |
14831 | if (_res == NULL && PyErr_Occurred()) { |
14832 | p->error_indicator = 1; |
14833 | p->level--; |
14834 | return NULL; |
14835 | } |
14836 | goto done; |
14837 | } |
14838 | p->mark = _mark; |
14839 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n" , p->level, ' ', |
14840 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'True'" )); |
14841 | } |
14842 | { // 'False' |
14843 | if (p->error_indicator) { |
14844 | p->level--; |
14845 | return NULL; |
14846 | } |
14847 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'False'" )); |
14848 | Token * _keyword; |
14849 | if ( |
14850 | (_keyword = _PyPegen_expect_token(p, 525)) // token='False' |
14851 | ) |
14852 | { |
14853 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'False'" )); |
14854 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14855 | if (_token == NULL) { |
14856 | p->level--; |
14857 | return NULL; |
14858 | } |
14859 | int _end_lineno = _token->end_lineno; |
14860 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14861 | int _end_col_offset = _token->end_col_offset; |
14862 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14863 | _res = _PyAST_Constant ( Py_False , NULL , EXTRA ); |
14864 | if (_res == NULL && PyErr_Occurred()) { |
14865 | p->error_indicator = 1; |
14866 | p->level--; |
14867 | return NULL; |
14868 | } |
14869 | goto done; |
14870 | } |
14871 | p->mark = _mark; |
14872 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n" , p->level, ' ', |
14873 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'False'" )); |
14874 | } |
14875 | { // 'None' |
14876 | if (p->error_indicator) { |
14877 | p->level--; |
14878 | return NULL; |
14879 | } |
14880 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'None'" )); |
14881 | Token * _keyword; |
14882 | if ( |
14883 | (_keyword = _PyPegen_expect_token(p, 523)) // token='None' |
14884 | ) |
14885 | { |
14886 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'None'" )); |
14887 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14888 | if (_token == NULL) { |
14889 | p->level--; |
14890 | return NULL; |
14891 | } |
14892 | int _end_lineno = _token->end_lineno; |
14893 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14894 | int _end_col_offset = _token->end_col_offset; |
14895 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14896 | _res = _PyAST_Constant ( Py_None , NULL , EXTRA ); |
14897 | if (_res == NULL && PyErr_Occurred()) { |
14898 | p->error_indicator = 1; |
14899 | p->level--; |
14900 | return NULL; |
14901 | } |
14902 | goto done; |
14903 | } |
14904 | p->mark = _mark; |
14905 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n" , p->level, ' ', |
14906 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'None'" )); |
14907 | } |
14908 | { // &STRING strings |
14909 | if (p->error_indicator) { |
14910 | p->level--; |
14911 | return NULL; |
14912 | } |
14913 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&STRING strings" )); |
14914 | expr_ty strings_var; |
14915 | if ( |
14916 | _PyPegen_lookahead(1, _PyPegen_string_token, p) |
14917 | && |
14918 | (strings_var = strings_rule(p)) // strings |
14919 | ) |
14920 | { |
14921 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&STRING strings" )); |
14922 | _res = strings_var; |
14923 | goto done; |
14924 | } |
14925 | p->mark = _mark; |
14926 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n" , p->level, ' ', |
14927 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&STRING strings" )); |
14928 | } |
14929 | { // NUMBER |
14930 | if (p->error_indicator) { |
14931 | p->level--; |
14932 | return NULL; |
14933 | } |
14934 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NUMBER" )); |
14935 | expr_ty number_var; |
14936 | if ( |
14937 | (number_var = _PyPegen_number_token(p)) // NUMBER |
14938 | ) |
14939 | { |
14940 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NUMBER" )); |
14941 | _res = number_var; |
14942 | goto done; |
14943 | } |
14944 | p->mark = _mark; |
14945 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n" , p->level, ' ', |
14946 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NUMBER" )); |
14947 | } |
14948 | { // &'(' (tuple | group | genexp) |
14949 | if (p->error_indicator) { |
14950 | p->level--; |
14951 | return NULL; |
14952 | } |
14953 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)" )); |
14954 | void *_tmp_111_var; |
14955 | if ( |
14956 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' |
14957 | && |
14958 | (_tmp_111_var = _tmp_111_rule(p)) // tuple | group | genexp |
14959 | ) |
14960 | { |
14961 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)" )); |
14962 | _res = _tmp_111_var; |
14963 | goto done; |
14964 | } |
14965 | p->mark = _mark; |
14966 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n" , p->level, ' ', |
14967 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'(' (tuple | group | genexp)" )); |
14968 | } |
14969 | { // &'[' (list | listcomp) |
14970 | if (p->error_indicator) { |
14971 | p->level--; |
14972 | return NULL; |
14973 | } |
14974 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)" )); |
14975 | void *_tmp_112_var; |
14976 | if ( |
14977 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' |
14978 | && |
14979 | (_tmp_112_var = _tmp_112_rule(p)) // list | listcomp |
14980 | ) |
14981 | { |
14982 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)" )); |
14983 | _res = _tmp_112_var; |
14984 | goto done; |
14985 | } |
14986 | p->mark = _mark; |
14987 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n" , p->level, ' ', |
14988 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'[' (list | listcomp)" )); |
14989 | } |
14990 | { // &'{' (dict | set | dictcomp | setcomp) |
14991 | if (p->error_indicator) { |
14992 | p->level--; |
14993 | return NULL; |
14994 | } |
14995 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)" )); |
14996 | void *_tmp_113_var; |
14997 | if ( |
14998 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' |
14999 | && |
15000 | (_tmp_113_var = _tmp_113_rule(p)) // dict | set | dictcomp | setcomp |
15001 | ) |
15002 | { |
15003 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)" )); |
15004 | _res = _tmp_113_var; |
15005 | goto done; |
15006 | } |
15007 | p->mark = _mark; |
15008 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n" , p->level, ' ', |
15009 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)" )); |
15010 | } |
15011 | { // '...' |
15012 | if (p->error_indicator) { |
15013 | p->level--; |
15014 | return NULL; |
15015 | } |
15016 | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'...'" )); |
15017 | Token * _literal; |
15018 | if ( |
15019 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
15020 | ) |
15021 | { |
15022 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'...'" )); |
15023 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15024 | if (_token == NULL) { |
15025 | p->level--; |
15026 | return NULL; |
15027 | } |
15028 | int _end_lineno = _token->end_lineno; |
15029 | UNUSED(_end_lineno); // Only used by EXTRA macro |
15030 | int _end_col_offset = _token->end_col_offset; |
15031 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15032 | _res = _PyAST_Constant ( Py_Ellipsis , NULL , EXTRA ); |
15033 | if (_res == NULL && PyErr_Occurred()) { |
15034 | p->error_indicator = 1; |
15035 | p->level--; |
15036 | return NULL; |
15037 | } |
15038 | goto done; |
15039 | } |
15040 | p->mark = _mark; |
15041 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n" , p->level, ' ', |
15042 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'...'" )); |
15043 | } |
15044 | _res = NULL; |
15045 | done: |
15046 | p->level--; |
15047 | return _res; |
15048 | } |
15049 | |
15050 | // strings: STRING+ |
15051 | static expr_ty |
15052 | strings_rule(Parser *p) |
15053 | { |
15054 | if (p->level++ == MAXSTACK) { |
15055 | p->error_indicator = 1; |
15056 | PyErr_NoMemory(); |
15057 | } |
15058 | if (p->error_indicator) { |
15059 | p->level--; |
15060 | return NULL; |
15061 | } |
15062 | expr_ty _res = NULL; |
15063 | if (_PyPegen_is_memoized(p, strings_type, &_res)) { |
15064 | p->level--; |
15065 | return _res; |
15066 | } |
15067 | int _mark = p->mark; |
15068 | { // STRING+ |
15069 | if (p->error_indicator) { |
15070 | p->level--; |
15071 | return NULL; |
15072 | } |
15073 | D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "STRING+" )); |
15074 | asdl_seq * a; |
15075 | if ( |
15076 | (a = _loop1_114_rule(p)) // STRING+ |
15077 | ) |
15078 | { |
15079 | D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "STRING+" )); |
15080 | _res = _PyPegen_concatenate_strings ( p , a ); |
15081 | if (_res == NULL && PyErr_Occurred()) { |
15082 | p->error_indicator = 1; |
15083 | p->level--; |
15084 | return NULL; |
15085 | } |
15086 | goto done; |
15087 | } |
15088 | p->mark = _mark; |
15089 | D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n" , p->level, ' ', |
15090 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "STRING+" )); |
15091 | } |
15092 | _res = NULL; |
15093 | done: |
15094 | _PyPegen_insert_memo(p, _mark, strings_type, _res); |
15095 | p->level--; |
15096 | return _res; |
15097 | } |
15098 | |
15099 | // list: '[' star_named_expressions? ']' |
15100 | static expr_ty |
15101 | list_rule(Parser *p) |
15102 | { |
15103 | if (p->level++ == MAXSTACK) { |
15104 | p->error_indicator = 1; |
15105 | PyErr_NoMemory(); |
15106 | } |
15107 | if (p->error_indicator) { |
15108 | p->level--; |
15109 | return NULL; |
15110 | } |
15111 | expr_ty _res = NULL; |
15112 | int _mark = p->mark; |
15113 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
15114 | p->error_indicator = 1; |
15115 | p->level--; |
15116 | return NULL; |
15117 | } |
15118 | int _start_lineno = p->tokens[_mark]->lineno; |
15119 | UNUSED(_start_lineno); // Only used by EXTRA macro |
15120 | int _start_col_offset = p->tokens[_mark]->col_offset; |
15121 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
15122 | { // '[' star_named_expressions? ']' |
15123 | if (p->error_indicator) { |
15124 | p->level--; |
15125 | return NULL; |
15126 | } |
15127 | D(fprintf(stderr, "%*c> list[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'" )); |
15128 | Token * _literal; |
15129 | Token * _literal_1; |
15130 | void *a; |
15131 | if ( |
15132 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
15133 | && |
15134 | (a = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions? |
15135 | && |
15136 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
15137 | ) |
15138 | { |
15139 | D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'" )); |
15140 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15141 | if (_token == NULL) { |
15142 | p->level--; |
15143 | return NULL; |
15144 | } |
15145 | int _end_lineno = _token->end_lineno; |
15146 | UNUSED(_end_lineno); // Only used by EXTRA macro |
15147 | int _end_col_offset = _token->end_col_offset; |
15148 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15149 | _res = _PyAST_List ( a , Load , EXTRA ); |
15150 | if (_res == NULL && PyErr_Occurred()) { |
15151 | p->error_indicator = 1; |
15152 | p->level--; |
15153 | return NULL; |
15154 | } |
15155 | goto done; |
15156 | } |
15157 | p->mark = _mark; |
15158 | D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n" , p->level, ' ', |
15159 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'[' star_named_expressions? ']'" )); |
15160 | } |
15161 | _res = NULL; |
15162 | done: |
15163 | p->level--; |
15164 | return _res; |
15165 | } |
15166 | |
15167 | // listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension |
15168 | static expr_ty |
15169 | listcomp_rule(Parser *p) |
15170 | { |
15171 | if (p->level++ == MAXSTACK) { |
15172 | p->error_indicator = 1; |
15173 | PyErr_NoMemory(); |
15174 | } |
15175 | if (p->error_indicator) { |
15176 | p->level--; |
15177 | return NULL; |
15178 | } |
15179 | expr_ty _res = NULL; |
15180 | int _mark = p->mark; |
15181 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
15182 | p->error_indicator = 1; |
15183 | p->level--; |
15184 | return NULL; |
15185 | } |
15186 | int _start_lineno = p->tokens[_mark]->lineno; |
15187 | UNUSED(_start_lineno); // Only used by EXTRA macro |
15188 | int _start_col_offset = p->tokens[_mark]->col_offset; |
15189 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
15190 | { // '[' named_expression for_if_clauses ']' |
15191 | if (p->error_indicator) { |
15192 | p->level--; |
15193 | return NULL; |
15194 | } |
15195 | D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'" )); |
15196 | Token * _literal; |
15197 | Token * _literal_1; |
15198 | expr_ty a; |
15199 | asdl_comprehension_seq* b; |
15200 | if ( |
15201 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
15202 | && |
15203 | (a = named_expression_rule(p)) // named_expression |
15204 | && |
15205 | (b = for_if_clauses_rule(p)) // for_if_clauses |
15206 | && |
15207 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
15208 | ) |
15209 | { |
15210 | D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'" )); |
15211 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15212 | if (_token == NULL) { |
15213 | p->level--; |
15214 | return NULL; |
15215 | } |
15216 | int _end_lineno = _token->end_lineno; |
15217 | UNUSED(_end_lineno); // Only used by EXTRA macro |
15218 | int _end_col_offset = _token->end_col_offset; |
15219 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15220 | _res = _PyAST_ListComp ( a , b , EXTRA ); |
15221 | if (_res == NULL && PyErr_Occurred()) { |
15222 | p->error_indicator = 1; |
15223 | p->level--; |
15224 | return NULL; |
15225 | } |
15226 | goto done; |
15227 | } |
15228 | p->mark = _mark; |
15229 | D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n" , p->level, ' ', |
15230 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'[' named_expression for_if_clauses ']'" )); |
15231 | } |
15232 | if (p->call_invalid_rules) { // invalid_comprehension |
15233 | if (p->error_indicator) { |
15234 | p->level--; |
15235 | return NULL; |
15236 | } |
15237 | D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_comprehension" )); |
15238 | void *invalid_comprehension_var; |
15239 | if ( |
15240 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
15241 | ) |
15242 | { |
15243 | D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_comprehension" )); |
15244 | _res = invalid_comprehension_var; |
15245 | goto done; |
15246 | } |
15247 | p->mark = _mark; |
15248 | D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n" , p->level, ' ', |
15249 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_comprehension" )); |
15250 | } |
15251 | _res = NULL; |
15252 | done: |
15253 | p->level--; |
15254 | return _res; |
15255 | } |
15256 | |
15257 | // tuple: '(' [star_named_expression ',' star_named_expressions?] ')' |
15258 | static expr_ty |
15259 | tuple_rule(Parser *p) |
15260 | { |
15261 | if (p->level++ == MAXSTACK) { |
15262 | p->error_indicator = 1; |
15263 | PyErr_NoMemory(); |
15264 | } |
15265 | if (p->error_indicator) { |
15266 | p->level--; |
15267 | return NULL; |
15268 | } |
15269 | expr_ty _res = NULL; |
15270 | int _mark = p->mark; |
15271 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
15272 | p->error_indicator = 1; |
15273 | p->level--; |
15274 | return NULL; |
15275 | } |
15276 | int _start_lineno = p->tokens[_mark]->lineno; |
15277 | UNUSED(_start_lineno); // Only used by EXTRA macro |
15278 | int _start_col_offset = p->tokens[_mark]->col_offset; |
15279 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
15280 | { // '(' [star_named_expression ',' star_named_expressions?] ')' |
15281 | if (p->error_indicator) { |
15282 | p->level--; |
15283 | return NULL; |
15284 | } |
15285 | D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'" )); |
15286 | Token * _literal; |
15287 | Token * _literal_1; |
15288 | void *a; |
15289 | if ( |
15290 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
15291 | && |
15292 | (a = _tmp_115_rule(p), !p->error_indicator) // [star_named_expression ',' star_named_expressions?] |
15293 | && |
15294 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
15295 | ) |
15296 | { |
15297 | D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'" )); |
15298 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15299 | if (_token == NULL) { |
15300 | p->level--; |
15301 | return NULL; |
15302 | } |
15303 | int _end_lineno = _token->end_lineno; |
15304 | UNUSED(_end_lineno); // Only used by EXTRA macro |
15305 | int _end_col_offset = _token->end_col_offset; |
15306 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15307 | _res = _PyAST_Tuple ( a , Load , EXTRA ); |
15308 | if (_res == NULL && PyErr_Occurred()) { |
15309 | p->error_indicator = 1; |
15310 | p->level--; |
15311 | return NULL; |
15312 | } |
15313 | goto done; |
15314 | } |
15315 | p->mark = _mark; |
15316 | D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n" , p->level, ' ', |
15317 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'" )); |
15318 | } |
15319 | _res = NULL; |
15320 | done: |
15321 | p->level--; |
15322 | return _res; |
15323 | } |
15324 | |
15325 | // group: '(' (yield_expr | named_expression) ')' | invalid_group |
15326 | static expr_ty |
15327 | group_rule(Parser *p) |
15328 | { |
15329 | if (p->level++ == MAXSTACK) { |
15330 | p->error_indicator = 1; |
15331 | PyErr_NoMemory(); |
15332 | } |
15333 | if (p->error_indicator) { |
15334 | p->level--; |
15335 | return NULL; |
15336 | } |
15337 | expr_ty _res = NULL; |
15338 | int _mark = p->mark; |
15339 | { // '(' (yield_expr | named_expression) ')' |
15340 | if (p->error_indicator) { |
15341 | p->level--; |
15342 | return NULL; |
15343 | } |
15344 | D(fprintf(stderr, "%*c> group[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'" )); |
15345 | Token * _literal; |
15346 | Token * _literal_1; |
15347 | void *a; |
15348 | if ( |
15349 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
15350 | && |
15351 | (a = _tmp_116_rule(p)) // yield_expr | named_expression |
15352 | && |
15353 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
15354 | ) |
15355 | { |
15356 | D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'" )); |
15357 | _res = a; |
15358 | if (_res == NULL && PyErr_Occurred()) { |
15359 | p->error_indicator = 1; |
15360 | p->level--; |
15361 | return NULL; |
15362 | } |
15363 | goto done; |
15364 | } |
15365 | p->mark = _mark; |
15366 | D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n" , p->level, ' ', |
15367 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' (yield_expr | named_expression) ')'" )); |
15368 | } |
15369 | if (p->call_invalid_rules) { // invalid_group |
15370 | if (p->error_indicator) { |
15371 | p->level--; |
15372 | return NULL; |
15373 | } |
15374 | D(fprintf(stderr, "%*c> group[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_group" )); |
15375 | void *invalid_group_var; |
15376 | if ( |
15377 | (invalid_group_var = invalid_group_rule(p)) // invalid_group |
15378 | ) |
15379 | { |
15380 | D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_group" )); |
15381 | _res = invalid_group_var; |
15382 | goto done; |
15383 | } |
15384 | p->mark = _mark; |
15385 | D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n" , p->level, ' ', |
15386 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_group" )); |
15387 | } |
15388 | _res = NULL; |
15389 | done: |
15390 | p->level--; |
15391 | return _res; |
15392 | } |
15393 | |
15394 | // genexp: |
15395 | // | '(' (assignment_expression | expression !':=') for_if_clauses ')' |
15396 | // | invalid_comprehension |
15397 | static expr_ty |
15398 | genexp_rule(Parser *p) |
15399 | { |
15400 | if (p->level++ == MAXSTACK) { |
15401 | p->error_indicator = 1; |
15402 | PyErr_NoMemory(); |
15403 | } |
15404 | if (p->error_indicator) { |
15405 | p->level--; |
15406 | return NULL; |
15407 | } |
15408 | expr_ty _res = NULL; |
15409 | int _mark = p->mark; |
15410 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
15411 | p->error_indicator = 1; |
15412 | p->level--; |
15413 | return NULL; |
15414 | } |
15415 | int _start_lineno = p->tokens[_mark]->lineno; |
15416 | UNUSED(_start_lineno); // Only used by EXTRA macro |
15417 | int _start_col_offset = p->tokens[_mark]->col_offset; |
15418 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
15419 | { // '(' (assignment_expression | expression !':=') for_if_clauses ')' |
15420 | if (p->error_indicator) { |
15421 | p->level--; |
15422 | return NULL; |
15423 | } |
15424 | D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'" )); |
15425 | Token * _literal; |
15426 | Token * _literal_1; |
15427 | void *a; |
15428 | asdl_comprehension_seq* b; |
15429 | if ( |
15430 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
15431 | && |
15432 | (a = _tmp_117_rule(p)) // assignment_expression | expression !':=' |
15433 | && |
15434 | (b = for_if_clauses_rule(p)) // for_if_clauses |
15435 | && |
15436 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
15437 | ) |
15438 | { |
15439 | D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'" )); |
15440 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15441 | if (_token == NULL) { |
15442 | p->level--; |
15443 | return NULL; |
15444 | } |
15445 | int _end_lineno = _token->end_lineno; |
15446 | UNUSED(_end_lineno); // Only used by EXTRA macro |
15447 | int _end_col_offset = _token->end_col_offset; |
15448 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15449 | _res = _PyAST_GeneratorExp ( a , b , EXTRA ); |
15450 | if (_res == NULL && PyErr_Occurred()) { |
15451 | p->error_indicator = 1; |
15452 | p->level--; |
15453 | return NULL; |
15454 | } |
15455 | goto done; |
15456 | } |
15457 | p->mark = _mark; |
15458 | D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n" , p->level, ' ', |
15459 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'" )); |
15460 | } |
15461 | if (p->call_invalid_rules) { // invalid_comprehension |
15462 | if (p->error_indicator) { |
15463 | p->level--; |
15464 | return NULL; |
15465 | } |
15466 | D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_comprehension" )); |
15467 | void *invalid_comprehension_var; |
15468 | if ( |
15469 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
15470 | ) |
15471 | { |
15472 | D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_comprehension" )); |
15473 | _res = invalid_comprehension_var; |
15474 | goto done; |
15475 | } |
15476 | p->mark = _mark; |
15477 | D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n" , p->level, ' ', |
15478 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_comprehension" )); |
15479 | } |
15480 | _res = NULL; |
15481 | done: |
15482 | p->level--; |
15483 | return _res; |
15484 | } |
15485 | |
15486 | // set: '{' star_named_expressions '}' |
15487 | static expr_ty |
15488 | set_rule(Parser *p) |
15489 | { |
15490 | if (p->level++ == MAXSTACK) { |
15491 | p->error_indicator = 1; |
15492 | PyErr_NoMemory(); |
15493 | } |
15494 | if (p->error_indicator) { |
15495 | p->level--; |
15496 | return NULL; |
15497 | } |
15498 | expr_ty _res = NULL; |
15499 | int _mark = p->mark; |
15500 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
15501 | p->error_indicator = 1; |
15502 | p->level--; |
15503 | return NULL; |
15504 | } |
15505 | int _start_lineno = p->tokens[_mark]->lineno; |
15506 | UNUSED(_start_lineno); // Only used by EXTRA macro |
15507 | int _start_col_offset = p->tokens[_mark]->col_offset; |
15508 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
15509 | { // '{' star_named_expressions '}' |
15510 | if (p->error_indicator) { |
15511 | p->level--; |
15512 | return NULL; |
15513 | } |
15514 | D(fprintf(stderr, "%*c> set[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'" )); |
15515 | Token * _literal; |
15516 | Token * _literal_1; |
15517 | asdl_expr_seq* a; |
15518 | if ( |
15519 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
15520 | && |
15521 | (a = star_named_expressions_rule(p)) // star_named_expressions |
15522 | && |
15523 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
15524 | ) |
15525 | { |
15526 | D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'" )); |
15527 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15528 | if (_token == NULL) { |
15529 | p->level--; |
15530 | return NULL; |
15531 | } |
15532 | int _end_lineno = _token->end_lineno; |
15533 | UNUSED(_end_lineno); // Only used by EXTRA macro |
15534 | int _end_col_offset = _token->end_col_offset; |
15535 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15536 | _res = _PyAST_Set ( a , EXTRA ); |
15537 | if (_res == NULL && PyErr_Occurred()) { |
15538 | p->error_indicator = 1; |
15539 | p->level--; |
15540 | return NULL; |
15541 | } |
15542 | goto done; |
15543 | } |
15544 | p->mark = _mark; |
15545 | D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n" , p->level, ' ', |
15546 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{' star_named_expressions '}'" )); |
15547 | } |
15548 | _res = NULL; |
15549 | done: |
15550 | p->level--; |
15551 | return _res; |
15552 | } |
15553 | |
15554 | // setcomp: '{' named_expression for_if_clauses '}' | invalid_comprehension |
15555 | static expr_ty |
15556 | setcomp_rule(Parser *p) |
15557 | { |
15558 | if (p->level++ == MAXSTACK) { |
15559 | p->error_indicator = 1; |
15560 | PyErr_NoMemory(); |
15561 | } |
15562 | if (p->error_indicator) { |
15563 | p->level--; |
15564 | return NULL; |
15565 | } |
15566 | expr_ty _res = NULL; |
15567 | int _mark = p->mark; |
15568 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
15569 | p->error_indicator = 1; |
15570 | p->level--; |
15571 | return NULL; |
15572 | } |
15573 | int _start_lineno = p->tokens[_mark]->lineno; |
15574 | UNUSED(_start_lineno); // Only used by EXTRA macro |
15575 | int _start_col_offset = p->tokens[_mark]->col_offset; |
15576 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
15577 | { // '{' named_expression for_if_clauses '}' |
15578 | if (p->error_indicator) { |
15579 | p->level--; |
15580 | return NULL; |
15581 | } |
15582 | D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'" )); |
15583 | Token * _literal; |
15584 | Token * _literal_1; |
15585 | expr_ty a; |
15586 | asdl_comprehension_seq* b; |
15587 | if ( |
15588 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
15589 | && |
15590 | (a = named_expression_rule(p)) // named_expression |
15591 | && |
15592 | (b = for_if_clauses_rule(p)) // for_if_clauses |
15593 | && |
15594 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
15595 | ) |
15596 | { |
15597 | D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'" )); |
15598 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15599 | if (_token == NULL) { |
15600 | p->level--; |
15601 | return NULL; |
15602 | } |
15603 | int _end_lineno = _token->end_lineno; |
15604 | UNUSED(_end_lineno); // Only used by EXTRA macro |
15605 | int _end_col_offset = _token->end_col_offset; |
15606 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15607 | _res = _PyAST_SetComp ( a , b , EXTRA ); |
15608 | if (_res == NULL && PyErr_Occurred()) { |
15609 | p->error_indicator = 1; |
15610 | p->level--; |
15611 | return NULL; |
15612 | } |
15613 | goto done; |
15614 | } |
15615 | p->mark = _mark; |
15616 | D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n" , p->level, ' ', |
15617 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{' named_expression for_if_clauses '}'" )); |
15618 | } |
15619 | if (p->call_invalid_rules) { // invalid_comprehension |
15620 | if (p->error_indicator) { |
15621 | p->level--; |
15622 | return NULL; |
15623 | } |
15624 | D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_comprehension" )); |
15625 | void *invalid_comprehension_var; |
15626 | if ( |
15627 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
15628 | ) |
15629 | { |
15630 | D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_comprehension" )); |
15631 | _res = invalid_comprehension_var; |
15632 | goto done; |
15633 | } |
15634 | p->mark = _mark; |
15635 | D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n" , p->level, ' ', |
15636 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_comprehension" )); |
15637 | } |
15638 | _res = NULL; |
15639 | done: |
15640 | p->level--; |
15641 | return _res; |
15642 | } |
15643 | |
15644 | // dict: '{' double_starred_kvpairs? '}' | '{' invalid_double_starred_kvpairs '}' |
15645 | static expr_ty |
15646 | dict_rule(Parser *p) |
15647 | { |
15648 | if (p->level++ == MAXSTACK) { |
15649 | p->error_indicator = 1; |
15650 | PyErr_NoMemory(); |
15651 | } |
15652 | if (p->error_indicator) { |
15653 | p->level--; |
15654 | return NULL; |
15655 | } |
15656 | expr_ty _res = NULL; |
15657 | int _mark = p->mark; |
15658 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
15659 | p->error_indicator = 1; |
15660 | p->level--; |
15661 | return NULL; |
15662 | } |
15663 | int _start_lineno = p->tokens[_mark]->lineno; |
15664 | UNUSED(_start_lineno); // Only used by EXTRA macro |
15665 | int _start_col_offset = p->tokens[_mark]->col_offset; |
15666 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
15667 | { // '{' double_starred_kvpairs? '}' |
15668 | if (p->error_indicator) { |
15669 | p->level--; |
15670 | return NULL; |
15671 | } |
15672 | D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'" )); |
15673 | Token * _literal; |
15674 | Token * _literal_1; |
15675 | void *a; |
15676 | if ( |
15677 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
15678 | && |
15679 | (a = double_starred_kvpairs_rule(p), !p->error_indicator) // double_starred_kvpairs? |
15680 | && |
15681 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
15682 | ) |
15683 | { |
15684 | D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'" )); |
15685 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15686 | if (_token == NULL) { |
15687 | p->level--; |
15688 | return NULL; |
15689 | } |
15690 | int _end_lineno = _token->end_lineno; |
15691 | UNUSED(_end_lineno); // Only used by EXTRA macro |
15692 | int _end_col_offset = _token->end_col_offset; |
15693 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15694 | _res = _PyAST_Dict ( CHECK ( asdl_expr_seq * , _PyPegen_get_keys ( p , a ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_values ( p , a ) ) , EXTRA ); |
15695 | if (_res == NULL && PyErr_Occurred()) { |
15696 | p->error_indicator = 1; |
15697 | p->level--; |
15698 | return NULL; |
15699 | } |
15700 | goto done; |
15701 | } |
15702 | p->mark = _mark; |
15703 | D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n" , p->level, ' ', |
15704 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{' double_starred_kvpairs? '}'" )); |
15705 | } |
15706 | { // '{' invalid_double_starred_kvpairs '}' |
15707 | if (p->error_indicator) { |
15708 | p->level--; |
15709 | return NULL; |
15710 | } |
15711 | D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'" )); |
15712 | Token * _literal; |
15713 | Token * _literal_1; |
15714 | void *invalid_double_starred_kvpairs_var; |
15715 | if ( |
15716 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
15717 | && |
15718 | (invalid_double_starred_kvpairs_var = invalid_double_starred_kvpairs_rule(p)) // invalid_double_starred_kvpairs |
15719 | && |
15720 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
15721 | ) |
15722 | { |
15723 | D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'" )); |
15724 | _res = _PyPegen_dummy_name(p, _literal, invalid_double_starred_kvpairs_var, _literal_1); |
15725 | goto done; |
15726 | } |
15727 | p->mark = _mark; |
15728 | D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n" , p->level, ' ', |
15729 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'" )); |
15730 | } |
15731 | _res = NULL; |
15732 | done: |
15733 | p->level--; |
15734 | return _res; |
15735 | } |
15736 | |
15737 | // dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension |
15738 | static expr_ty |
15739 | dictcomp_rule(Parser *p) |
15740 | { |
15741 | if (p->level++ == MAXSTACK) { |
15742 | p->error_indicator = 1; |
15743 | PyErr_NoMemory(); |
15744 | } |
15745 | if (p->error_indicator) { |
15746 | p->level--; |
15747 | return NULL; |
15748 | } |
15749 | expr_ty _res = NULL; |
15750 | int _mark = p->mark; |
15751 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
15752 | p->error_indicator = 1; |
15753 | p->level--; |
15754 | return NULL; |
15755 | } |
15756 | int _start_lineno = p->tokens[_mark]->lineno; |
15757 | UNUSED(_start_lineno); // Only used by EXTRA macro |
15758 | int _start_col_offset = p->tokens[_mark]->col_offset; |
15759 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
15760 | { // '{' kvpair for_if_clauses '}' |
15761 | if (p->error_indicator) { |
15762 | p->level--; |
15763 | return NULL; |
15764 | } |
15765 | D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'" )); |
15766 | Token * _literal; |
15767 | Token * _literal_1; |
15768 | KeyValuePair* a; |
15769 | asdl_comprehension_seq* b; |
15770 | if ( |
15771 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
15772 | && |
15773 | (a = kvpair_rule(p)) // kvpair |
15774 | && |
15775 | (b = for_if_clauses_rule(p)) // for_if_clauses |
15776 | && |
15777 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
15778 | ) |
15779 | { |
15780 | D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'" )); |
15781 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15782 | if (_token == NULL) { |
15783 | p->level--; |
15784 | return NULL; |
15785 | } |
15786 | int _end_lineno = _token->end_lineno; |
15787 | UNUSED(_end_lineno); // Only used by EXTRA macro |
15788 | int _end_col_offset = _token->end_col_offset; |
15789 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15790 | _res = _PyAST_DictComp ( a -> key , a -> value , b , EXTRA ); |
15791 | if (_res == NULL && PyErr_Occurred()) { |
15792 | p->error_indicator = 1; |
15793 | p->level--; |
15794 | return NULL; |
15795 | } |
15796 | goto done; |
15797 | } |
15798 | p->mark = _mark; |
15799 | D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n" , p->level, ' ', |
15800 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{' kvpair for_if_clauses '}'" )); |
15801 | } |
15802 | if (p->call_invalid_rules) { // invalid_dict_comprehension |
15803 | if (p->error_indicator) { |
15804 | p->level--; |
15805 | return NULL; |
15806 | } |
15807 | D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_dict_comprehension" )); |
15808 | void *invalid_dict_comprehension_var; |
15809 | if ( |
15810 | (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension |
15811 | ) |
15812 | { |
15813 | D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_dict_comprehension" )); |
15814 | _res = invalid_dict_comprehension_var; |
15815 | goto done; |
15816 | } |
15817 | p->mark = _mark; |
15818 | D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n" , p->level, ' ', |
15819 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_dict_comprehension" )); |
15820 | } |
15821 | _res = NULL; |
15822 | done: |
15823 | p->level--; |
15824 | return _res; |
15825 | } |
15826 | |
15827 | // double_starred_kvpairs: ','.double_starred_kvpair+ ','? |
15828 | static asdl_seq* |
15829 | double_starred_kvpairs_rule(Parser *p) |
15830 | { |
15831 | if (p->level++ == MAXSTACK) { |
15832 | p->error_indicator = 1; |
15833 | PyErr_NoMemory(); |
15834 | } |
15835 | if (p->error_indicator) { |
15836 | p->level--; |
15837 | return NULL; |
15838 | } |
15839 | asdl_seq* _res = NULL; |
15840 | int _mark = p->mark; |
15841 | { // ','.double_starred_kvpair+ ','? |
15842 | if (p->error_indicator) { |
15843 | p->level--; |
15844 | return NULL; |
15845 | } |
15846 | D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?" )); |
15847 | void *_opt_var; |
15848 | UNUSED(_opt_var); // Silence compiler warnings |
15849 | asdl_seq * a; |
15850 | if ( |
15851 | (a = _gather_118_rule(p)) // ','.double_starred_kvpair+ |
15852 | && |
15853 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
15854 | ) |
15855 | { |
15856 | D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?" )); |
15857 | _res = a; |
15858 | if (_res == NULL && PyErr_Occurred()) { |
15859 | p->error_indicator = 1; |
15860 | p->level--; |
15861 | return NULL; |
15862 | } |
15863 | goto done; |
15864 | } |
15865 | p->mark = _mark; |
15866 | D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n" , p->level, ' ', |
15867 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.double_starred_kvpair+ ','?" )); |
15868 | } |
15869 | _res = NULL; |
15870 | done: |
15871 | p->level--; |
15872 | return _res; |
15873 | } |
15874 | |
15875 | // double_starred_kvpair: '**' bitwise_or | kvpair |
15876 | static KeyValuePair* |
15877 | double_starred_kvpair_rule(Parser *p) |
15878 | { |
15879 | if (p->level++ == MAXSTACK) { |
15880 | p->error_indicator = 1; |
15881 | PyErr_NoMemory(); |
15882 | } |
15883 | if (p->error_indicator) { |
15884 | p->level--; |
15885 | return NULL; |
15886 | } |
15887 | KeyValuePair* _res = NULL; |
15888 | int _mark = p->mark; |
15889 | { // '**' bitwise_or |
15890 | if (p->error_indicator) { |
15891 | p->level--; |
15892 | return NULL; |
15893 | } |
15894 | D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'**' bitwise_or" )); |
15895 | Token * _literal; |
15896 | expr_ty a; |
15897 | if ( |
15898 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
15899 | && |
15900 | (a = bitwise_or_rule(p)) // bitwise_or |
15901 | ) |
15902 | { |
15903 | D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'**' bitwise_or" )); |
15904 | _res = _PyPegen_key_value_pair ( p , NULL , a ); |
15905 | if (_res == NULL && PyErr_Occurred()) { |
15906 | p->error_indicator = 1; |
15907 | p->level--; |
15908 | return NULL; |
15909 | } |
15910 | goto done; |
15911 | } |
15912 | p->mark = _mark; |
15913 | D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n" , p->level, ' ', |
15914 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'**' bitwise_or" )); |
15915 | } |
15916 | { // kvpair |
15917 | if (p->error_indicator) { |
15918 | p->level--; |
15919 | return NULL; |
15920 | } |
15921 | D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "kvpair" )); |
15922 | KeyValuePair* kvpair_var; |
15923 | if ( |
15924 | (kvpair_var = kvpair_rule(p)) // kvpair |
15925 | ) |
15926 | { |
15927 | D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "kvpair" )); |
15928 | _res = kvpair_var; |
15929 | goto done; |
15930 | } |
15931 | p->mark = _mark; |
15932 | D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n" , p->level, ' ', |
15933 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "kvpair" )); |
15934 | } |
15935 | _res = NULL; |
15936 | done: |
15937 | p->level--; |
15938 | return _res; |
15939 | } |
15940 | |
15941 | // kvpair: expression ':' expression |
15942 | static KeyValuePair* |
15943 | kvpair_rule(Parser *p) |
15944 | { |
15945 | if (p->level++ == MAXSTACK) { |
15946 | p->error_indicator = 1; |
15947 | PyErr_NoMemory(); |
15948 | } |
15949 | if (p->error_indicator) { |
15950 | p->level--; |
15951 | return NULL; |
15952 | } |
15953 | KeyValuePair* _res = NULL; |
15954 | int _mark = p->mark; |
15955 | { // expression ':' expression |
15956 | if (p->error_indicator) { |
15957 | p->level--; |
15958 | return NULL; |
15959 | } |
15960 | D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression ':' expression" )); |
15961 | Token * _literal; |
15962 | expr_ty a; |
15963 | expr_ty b; |
15964 | if ( |
15965 | (a = expression_rule(p)) // expression |
15966 | && |
15967 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
15968 | && |
15969 | (b = expression_rule(p)) // expression |
15970 | ) |
15971 | { |
15972 | D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression ':' expression" )); |
15973 | _res = _PyPegen_key_value_pair ( p , a , b ); |
15974 | if (_res == NULL && PyErr_Occurred()) { |
15975 | p->error_indicator = 1; |
15976 | p->level--; |
15977 | return NULL; |
15978 | } |
15979 | goto done; |
15980 | } |
15981 | p->mark = _mark; |
15982 | D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n" , p->level, ' ', |
15983 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression ':' expression" )); |
15984 | } |
15985 | _res = NULL; |
15986 | done: |
15987 | p->level--; |
15988 | return _res; |
15989 | } |
15990 | |
15991 | // for_if_clauses: for_if_clause+ |
15992 | static asdl_comprehension_seq* |
15993 | for_if_clauses_rule(Parser *p) |
15994 | { |
15995 | if (p->level++ == MAXSTACK) { |
15996 | p->error_indicator = 1; |
15997 | PyErr_NoMemory(); |
15998 | } |
15999 | if (p->error_indicator) { |
16000 | p->level--; |
16001 | return NULL; |
16002 | } |
16003 | asdl_comprehension_seq* _res = NULL; |
16004 | int _mark = p->mark; |
16005 | { // for_if_clause+ |
16006 | if (p->error_indicator) { |
16007 | p->level--; |
16008 | return NULL; |
16009 | } |
16010 | D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "for_if_clause+" )); |
16011 | asdl_comprehension_seq* a; |
16012 | if ( |
16013 | (a = (asdl_comprehension_seq*)_loop1_120_rule(p)) // for_if_clause+ |
16014 | ) |
16015 | { |
16016 | D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "for_if_clause+" )); |
16017 | _res = a; |
16018 | if (_res == NULL && PyErr_Occurred()) { |
16019 | p->error_indicator = 1; |
16020 | p->level--; |
16021 | return NULL; |
16022 | } |
16023 | goto done; |
16024 | } |
16025 | p->mark = _mark; |
16026 | D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n" , p->level, ' ', |
16027 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "for_if_clause+" )); |
16028 | } |
16029 | _res = NULL; |
16030 | done: |
16031 | p->level--; |
16032 | return _res; |
16033 | } |
16034 | |
16035 | // for_if_clause: |
16036 | // | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
16037 | // | 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
16038 | // | invalid_for_target |
16039 | static comprehension_ty |
16040 | for_if_clause_rule(Parser *p) |
16041 | { |
16042 | if (p->level++ == MAXSTACK) { |
16043 | p->error_indicator = 1; |
16044 | PyErr_NoMemory(); |
16045 | } |
16046 | if (p->error_indicator) { |
16047 | p->level--; |
16048 | return NULL; |
16049 | } |
16050 | comprehension_ty _res = NULL; |
16051 | int _mark = p->mark; |
16052 | { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
16053 | if (p->error_indicator) { |
16054 | p->level--; |
16055 | return NULL; |
16056 | } |
16057 | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*" )); |
16058 | int _cut_var = 0; |
16059 | Token * _keyword; |
16060 | Token * _keyword_1; |
16061 | expr_ty a; |
16062 | Token * async_var; |
16063 | expr_ty b; |
16064 | asdl_expr_seq* c; |
16065 | if ( |
16066 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
16067 | && |
16068 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
16069 | && |
16070 | (a = star_targets_rule(p)) // star_targets |
16071 | && |
16072 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
16073 | && |
16074 | (_cut_var = 1) |
16075 | && |
16076 | (b = disjunction_rule(p)) // disjunction |
16077 | && |
16078 | (c = (asdl_expr_seq*)_loop0_121_rule(p)) // (('if' disjunction))* |
16079 | ) |
16080 | { |
16081 | D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*" )); |
16082 | _res = CHECK_VERSION ( comprehension_ty , 6 , "Async comprehensions are" , _PyAST_comprehension ( a , b , c , 1 , p -> arena ) ); |
16083 | if (_res == NULL && PyErr_Occurred()) { |
16084 | p->error_indicator = 1; |
16085 | p->level--; |
16086 | return NULL; |
16087 | } |
16088 | goto done; |
16089 | } |
16090 | p->mark = _mark; |
16091 | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n" , p->level, ' ', |
16092 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*" )); |
16093 | if (_cut_var) { |
16094 | p->level--; |
16095 | return NULL; |
16096 | } |
16097 | } |
16098 | { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
16099 | if (p->error_indicator) { |
16100 | p->level--; |
16101 | return NULL; |
16102 | } |
16103 | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*" )); |
16104 | int _cut_var = 0; |
16105 | Token * _keyword; |
16106 | Token * _keyword_1; |
16107 | expr_ty a; |
16108 | expr_ty b; |
16109 | asdl_expr_seq* c; |
16110 | if ( |
16111 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
16112 | && |
16113 | (a = star_targets_rule(p)) // star_targets |
16114 | && |
16115 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
16116 | && |
16117 | (_cut_var = 1) |
16118 | && |
16119 | (b = disjunction_rule(p)) // disjunction |
16120 | && |
16121 | (c = (asdl_expr_seq*)_loop0_122_rule(p)) // (('if' disjunction))* |
16122 | ) |
16123 | { |
16124 | D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*" )); |
16125 | _res = _PyAST_comprehension ( a , b , c , 0 , p -> arena ); |
16126 | if (_res == NULL && PyErr_Occurred()) { |
16127 | p->error_indicator = 1; |
16128 | p->level--; |
16129 | return NULL; |
16130 | } |
16131 | goto done; |
16132 | } |
16133 | p->mark = _mark; |
16134 | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n" , p->level, ' ', |
16135 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*" )); |
16136 | if (_cut_var) { |
16137 | p->level--; |
16138 | return NULL; |
16139 | } |
16140 | } |
16141 | if (p->call_invalid_rules) { // invalid_for_target |
16142 | if (p->error_indicator) { |
16143 | p->level--; |
16144 | return NULL; |
16145 | } |
16146 | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_for_target" )); |
16147 | void *invalid_for_target_var; |
16148 | if ( |
16149 | (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target |
16150 | ) |
16151 | { |
16152 | D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_for_target" )); |
16153 | _res = invalid_for_target_var; |
16154 | goto done; |
16155 | } |
16156 | p->mark = _mark; |
16157 | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n" , p->level, ' ', |
16158 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_for_target" )); |
16159 | } |
16160 | _res = NULL; |
16161 | done: |
16162 | p->level--; |
16163 | return _res; |
16164 | } |
16165 | |
16166 | // yield_expr: 'yield' 'from' expression | 'yield' star_expressions? |
16167 | static expr_ty |
16168 | yield_expr_rule(Parser *p) |
16169 | { |
16170 | if (p->level++ == MAXSTACK) { |
16171 | p->error_indicator = 1; |
16172 | PyErr_NoMemory(); |
16173 | } |
16174 | if (p->error_indicator) { |
16175 | p->level--; |
16176 | return NULL; |
16177 | } |
16178 | expr_ty _res = NULL; |
16179 | int _mark = p->mark; |
16180 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
16181 | p->error_indicator = 1; |
16182 | p->level--; |
16183 | return NULL; |
16184 | } |
16185 | int _start_lineno = p->tokens[_mark]->lineno; |
16186 | UNUSED(_start_lineno); // Only used by EXTRA macro |
16187 | int _start_col_offset = p->tokens[_mark]->col_offset; |
16188 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
16189 | { // 'yield' 'from' expression |
16190 | if (p->error_indicator) { |
16191 | p->level--; |
16192 | return NULL; |
16193 | } |
16194 | D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'yield' 'from' expression" )); |
16195 | Token * _keyword; |
16196 | Token * _keyword_1; |
16197 | expr_ty a; |
16198 | if ( |
16199 | (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' |
16200 | && |
16201 | (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from' |
16202 | && |
16203 | (a = expression_rule(p)) // expression |
16204 | ) |
16205 | { |
16206 | D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'yield' 'from' expression" )); |
16207 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16208 | if (_token == NULL) { |
16209 | p->level--; |
16210 | return NULL; |
16211 | } |
16212 | int _end_lineno = _token->end_lineno; |
16213 | UNUSED(_end_lineno); // Only used by EXTRA macro |
16214 | int _end_col_offset = _token->end_col_offset; |
16215 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16216 | _res = _PyAST_YieldFrom ( a , EXTRA ); |
16217 | if (_res == NULL && PyErr_Occurred()) { |
16218 | p->error_indicator = 1; |
16219 | p->level--; |
16220 | return NULL; |
16221 | } |
16222 | goto done; |
16223 | } |
16224 | p->mark = _mark; |
16225 | D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
16226 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'yield' 'from' expression" )); |
16227 | } |
16228 | { // 'yield' star_expressions? |
16229 | if (p->error_indicator) { |
16230 | p->level--; |
16231 | return NULL; |
16232 | } |
16233 | D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'yield' star_expressions?" )); |
16234 | Token * _keyword; |
16235 | void *a; |
16236 | if ( |
16237 | (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' |
16238 | && |
16239 | (a = star_expressions_rule(p), !p->error_indicator) // star_expressions? |
16240 | ) |
16241 | { |
16242 | D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'yield' star_expressions?" )); |
16243 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16244 | if (_token == NULL) { |
16245 | p->level--; |
16246 | return NULL; |
16247 | } |
16248 | int _end_lineno = _token->end_lineno; |
16249 | UNUSED(_end_lineno); // Only used by EXTRA macro |
16250 | int _end_col_offset = _token->end_col_offset; |
16251 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16252 | _res = _PyAST_Yield ( a , EXTRA ); |
16253 | if (_res == NULL && PyErr_Occurred()) { |
16254 | p->error_indicator = 1; |
16255 | p->level--; |
16256 | return NULL; |
16257 | } |
16258 | goto done; |
16259 | } |
16260 | p->mark = _mark; |
16261 | D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n" , p->level, ' ', |
16262 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'yield' star_expressions?" )); |
16263 | } |
16264 | _res = NULL; |
16265 | done: |
16266 | p->level--; |
16267 | return _res; |
16268 | } |
16269 | |
16270 | // arguments: args ','? &')' | invalid_arguments |
16271 | static expr_ty |
16272 | arguments_rule(Parser *p) |
16273 | { |
16274 | if (p->level++ == MAXSTACK) { |
16275 | p->error_indicator = 1; |
16276 | PyErr_NoMemory(); |
16277 | } |
16278 | if (p->error_indicator) { |
16279 | p->level--; |
16280 | return NULL; |
16281 | } |
16282 | expr_ty _res = NULL; |
16283 | if (_PyPegen_is_memoized(p, arguments_type, &_res)) { |
16284 | p->level--; |
16285 | return _res; |
16286 | } |
16287 | int _mark = p->mark; |
16288 | { // args ','? &')' |
16289 | if (p->error_indicator) { |
16290 | p->level--; |
16291 | return NULL; |
16292 | } |
16293 | D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "args ','? &')'" )); |
16294 | void *_opt_var; |
16295 | UNUSED(_opt_var); // Silence compiler warnings |
16296 | expr_ty a; |
16297 | if ( |
16298 | (a = args_rule(p)) // args |
16299 | && |
16300 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
16301 | && |
16302 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
16303 | ) |
16304 | { |
16305 | D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "args ','? &')'" )); |
16306 | _res = a; |
16307 | if (_res == NULL && PyErr_Occurred()) { |
16308 | p->error_indicator = 1; |
16309 | p->level--; |
16310 | return NULL; |
16311 | } |
16312 | goto done; |
16313 | } |
16314 | p->mark = _mark; |
16315 | D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n" , p->level, ' ', |
16316 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "args ','? &')'" )); |
16317 | } |
16318 | if (p->call_invalid_rules) { // invalid_arguments |
16319 | if (p->error_indicator) { |
16320 | p->level--; |
16321 | return NULL; |
16322 | } |
16323 | D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_arguments" )); |
16324 | void *invalid_arguments_var; |
16325 | if ( |
16326 | (invalid_arguments_var = invalid_arguments_rule(p)) // invalid_arguments |
16327 | ) |
16328 | { |
16329 | D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_arguments" )); |
16330 | _res = invalid_arguments_var; |
16331 | goto done; |
16332 | } |
16333 | p->mark = _mark; |
16334 | D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n" , p->level, ' ', |
16335 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_arguments" )); |
16336 | } |
16337 | _res = NULL; |
16338 | done: |
16339 | _PyPegen_insert_memo(p, _mark, arguments_type, _res); |
16340 | p->level--; |
16341 | return _res; |
16342 | } |
16343 | |
16344 | // args: |
16345 | // | ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs] |
16346 | // | kwargs |
16347 | static expr_ty |
16348 | args_rule(Parser *p) |
16349 | { |
16350 | if (p->level++ == MAXSTACK) { |
16351 | p->error_indicator = 1; |
16352 | PyErr_NoMemory(); |
16353 | } |
16354 | if (p->error_indicator) { |
16355 | p->level--; |
16356 | return NULL; |
16357 | } |
16358 | expr_ty _res = NULL; |
16359 | int _mark = p->mark; |
16360 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
16361 | p->error_indicator = 1; |
16362 | p->level--; |
16363 | return NULL; |
16364 | } |
16365 | int _start_lineno = p->tokens[_mark]->lineno; |
16366 | UNUSED(_start_lineno); // Only used by EXTRA macro |
16367 | int _start_col_offset = p->tokens[_mark]->col_offset; |
16368 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
16369 | { // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs] |
16370 | if (p->error_indicator) { |
16371 | p->level--; |
16372 | return NULL; |
16373 | } |
16374 | D(fprintf(stderr, "%*c> args[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]" )); |
16375 | asdl_expr_seq* a; |
16376 | void *b; |
16377 | if ( |
16378 | (a = (asdl_expr_seq*)_gather_123_rule(p)) // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ |
16379 | && |
16380 | (b = _tmp_125_rule(p), !p->error_indicator) // [',' kwargs] |
16381 | ) |
16382 | { |
16383 | D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]" )); |
16384 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16385 | if (_token == NULL) { |
16386 | p->level--; |
16387 | return NULL; |
16388 | } |
16389 | int _end_lineno = _token->end_lineno; |
16390 | UNUSED(_end_lineno); // Only used by EXTRA macro |
16391 | int _end_col_offset = _token->end_col_offset; |
16392 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16393 | _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA ); |
16394 | if (_res == NULL && PyErr_Occurred()) { |
16395 | p->error_indicator = 1; |
16396 | p->level--; |
16397 | return NULL; |
16398 | } |
16399 | goto done; |
16400 | } |
16401 | p->mark = _mark; |
16402 | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n" , p->level, ' ', |
16403 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]" )); |
16404 | } |
16405 | { // kwargs |
16406 | if (p->error_indicator) { |
16407 | p->level--; |
16408 | return NULL; |
16409 | } |
16410 | D(fprintf(stderr, "%*c> args[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "kwargs" )); |
16411 | asdl_seq* a; |
16412 | if ( |
16413 | (a = kwargs_rule(p)) // kwargs |
16414 | ) |
16415 | { |
16416 | D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "kwargs" )); |
16417 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16418 | if (_token == NULL) { |
16419 | p->level--; |
16420 | return NULL; |
16421 | } |
16422 | int _end_lineno = _token->end_lineno; |
16423 | UNUSED(_end_lineno); // Only used by EXTRA macro |
16424 | int _end_col_offset = _token->end_col_offset; |
16425 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16426 | _res = _PyAST_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( asdl_expr_seq * , _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( asdl_keyword_seq * , _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA ); |
16427 | if (_res == NULL && PyErr_Occurred()) { |
16428 | p->error_indicator = 1; |
16429 | p->level--; |
16430 | return NULL; |
16431 | } |
16432 | goto done; |
16433 | } |
16434 | p->mark = _mark; |
16435 | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n" , p->level, ' ', |
16436 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "kwargs" )); |
16437 | } |
16438 | _res = NULL; |
16439 | done: |
16440 | p->level--; |
16441 | return _res; |
16442 | } |
16443 | |
16444 | // kwargs: |
16445 | // | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ |
16446 | // | ','.kwarg_or_starred+ |
16447 | // | ','.kwarg_or_double_starred+ |
16448 | static asdl_seq* |
16449 | kwargs_rule(Parser *p) |
16450 | { |
16451 | if (p->level++ == MAXSTACK) { |
16452 | p->error_indicator = 1; |
16453 | PyErr_NoMemory(); |
16454 | } |
16455 | if (p->error_indicator) { |
16456 | p->level--; |
16457 | return NULL; |
16458 | } |
16459 | asdl_seq* _res = NULL; |
16460 | int _mark = p->mark; |
16461 | { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ |
16462 | if (p->error_indicator) { |
16463 | p->level--; |
16464 | return NULL; |
16465 | } |
16466 | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+" )); |
16467 | Token * _literal; |
16468 | asdl_seq * a; |
16469 | asdl_seq * b; |
16470 | if ( |
16471 | (a = _gather_126_rule(p)) // ','.kwarg_or_starred+ |
16472 | && |
16473 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
16474 | && |
16475 | (b = _gather_128_rule(p)) // ','.kwarg_or_double_starred+ |
16476 | ) |
16477 | { |
16478 | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+" )); |
16479 | _res = _PyPegen_join_sequences ( p , a , b ); |
16480 | if (_res == NULL && PyErr_Occurred()) { |
16481 | p->error_indicator = 1; |
16482 | p->level--; |
16483 | return NULL; |
16484 | } |
16485 | goto done; |
16486 | } |
16487 | p->mark = _mark; |
16488 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n" , p->level, ' ', |
16489 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+" )); |
16490 | } |
16491 | { // ','.kwarg_or_starred+ |
16492 | if (p->error_indicator) { |
16493 | p->level--; |
16494 | return NULL; |
16495 | } |
16496 | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+" )); |
16497 | asdl_seq * _gather_130_var; |
16498 | if ( |
16499 | (_gather_130_var = _gather_130_rule(p)) // ','.kwarg_or_starred+ |
16500 | ) |
16501 | { |
16502 | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+" )); |
16503 | _res = _gather_130_var; |
16504 | goto done; |
16505 | } |
16506 | p->mark = _mark; |
16507 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n" , p->level, ' ', |
16508 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.kwarg_or_starred+" )); |
16509 | } |
16510 | { // ','.kwarg_or_double_starred+ |
16511 | if (p->error_indicator) { |
16512 | p->level--; |
16513 | return NULL; |
16514 | } |
16515 | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+" )); |
16516 | asdl_seq * _gather_132_var; |
16517 | if ( |
16518 | (_gather_132_var = _gather_132_rule(p)) // ','.kwarg_or_double_starred+ |
16519 | ) |
16520 | { |
16521 | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+" )); |
16522 | _res = _gather_132_var; |
16523 | goto done; |
16524 | } |
16525 | p->mark = _mark; |
16526 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n" , p->level, ' ', |
16527 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.kwarg_or_double_starred+" )); |
16528 | } |
16529 | _res = NULL; |
16530 | done: |
16531 | p->level--; |
16532 | return _res; |
16533 | } |
16534 | |
16535 | // starred_expression: '*' expression |
16536 | static expr_ty |
16537 | starred_expression_rule(Parser *p) |
16538 | { |
16539 | if (p->level++ == MAXSTACK) { |
16540 | p->error_indicator = 1; |
16541 | PyErr_NoMemory(); |
16542 | } |
16543 | if (p->error_indicator) { |
16544 | p->level--; |
16545 | return NULL; |
16546 | } |
16547 | expr_ty _res = NULL; |
16548 | int _mark = p->mark; |
16549 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
16550 | p->error_indicator = 1; |
16551 | p->level--; |
16552 | return NULL; |
16553 | } |
16554 | int _start_lineno = p->tokens[_mark]->lineno; |
16555 | UNUSED(_start_lineno); // Only used by EXTRA macro |
16556 | int _start_col_offset = p->tokens[_mark]->col_offset; |
16557 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
16558 | { // '*' expression |
16559 | if (p->error_indicator) { |
16560 | p->level--; |
16561 | return NULL; |
16562 | } |
16563 | D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' expression" )); |
16564 | Token * _literal; |
16565 | expr_ty a; |
16566 | if ( |
16567 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
16568 | && |
16569 | (a = expression_rule(p)) // expression |
16570 | ) |
16571 | { |
16572 | D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' expression" )); |
16573 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16574 | if (_token == NULL) { |
16575 | p->level--; |
16576 | return NULL; |
16577 | } |
16578 | int _end_lineno = _token->end_lineno; |
16579 | UNUSED(_end_lineno); // Only used by EXTRA macro |
16580 | int _end_col_offset = _token->end_col_offset; |
16581 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16582 | _res = _PyAST_Starred ( a , Load , EXTRA ); |
16583 | if (_res == NULL && PyErr_Occurred()) { |
16584 | p->error_indicator = 1; |
16585 | p->level--; |
16586 | return NULL; |
16587 | } |
16588 | goto done; |
16589 | } |
16590 | p->mark = _mark; |
16591 | D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
16592 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' expression" )); |
16593 | } |
16594 | _res = NULL; |
16595 | done: |
16596 | p->level--; |
16597 | return _res; |
16598 | } |
16599 | |
16600 | // kwarg_or_starred: invalid_kwarg | NAME '=' expression | starred_expression |
16601 | static KeywordOrStarred* |
16602 | kwarg_or_starred_rule(Parser *p) |
16603 | { |
16604 | if (p->level++ == MAXSTACK) { |
16605 | p->error_indicator = 1; |
16606 | PyErr_NoMemory(); |
16607 | } |
16608 | if (p->error_indicator) { |
16609 | p->level--; |
16610 | return NULL; |
16611 | } |
16612 | KeywordOrStarred* _res = NULL; |
16613 | int _mark = p->mark; |
16614 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
16615 | p->error_indicator = 1; |
16616 | p->level--; |
16617 | return NULL; |
16618 | } |
16619 | int _start_lineno = p->tokens[_mark]->lineno; |
16620 | UNUSED(_start_lineno); // Only used by EXTRA macro |
16621 | int _start_col_offset = p->tokens[_mark]->col_offset; |
16622 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
16623 | if (p->call_invalid_rules) { // invalid_kwarg |
16624 | if (p->error_indicator) { |
16625 | p->level--; |
16626 | return NULL; |
16627 | } |
16628 | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_kwarg" )); |
16629 | void *invalid_kwarg_var; |
16630 | if ( |
16631 | (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg |
16632 | ) |
16633 | { |
16634 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_kwarg" )); |
16635 | _res = invalid_kwarg_var; |
16636 | goto done; |
16637 | } |
16638 | p->mark = _mark; |
16639 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n" , p->level, ' ', |
16640 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_kwarg" )); |
16641 | } |
16642 | { // NAME '=' expression |
16643 | if (p->error_indicator) { |
16644 | p->level--; |
16645 | return NULL; |
16646 | } |
16647 | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME '=' expression" )); |
16648 | Token * _literal; |
16649 | expr_ty a; |
16650 | expr_ty b; |
16651 | if ( |
16652 | (a = _PyPegen_name_token(p)) // NAME |
16653 | && |
16654 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
16655 | && |
16656 | (b = expression_rule(p)) // expression |
16657 | ) |
16658 | { |
16659 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME '=' expression" )); |
16660 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16661 | if (_token == NULL) { |
16662 | p->level--; |
16663 | return NULL; |
16664 | } |
16665 | int _end_lineno = _token->end_lineno; |
16666 | UNUSED(_end_lineno); // Only used by EXTRA macro |
16667 | int _end_col_offset = _token->end_col_offset; |
16668 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16669 | _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); |
16670 | if (_res == NULL && PyErr_Occurred()) { |
16671 | p->error_indicator = 1; |
16672 | p->level--; |
16673 | return NULL; |
16674 | } |
16675 | goto done; |
16676 | } |
16677 | p->mark = _mark; |
16678 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n" , p->level, ' ', |
16679 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME '=' expression" )); |
16680 | } |
16681 | { // starred_expression |
16682 | if (p->error_indicator) { |
16683 | p->level--; |
16684 | return NULL; |
16685 | } |
16686 | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "starred_expression" )); |
16687 | expr_ty a; |
16688 | if ( |
16689 | (a = starred_expression_rule(p)) // starred_expression |
16690 | ) |
16691 | { |
16692 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "starred_expression" )); |
16693 | _res = _PyPegen_keyword_or_starred ( p , a , 0 ); |
16694 | if (_res == NULL && PyErr_Occurred()) { |
16695 | p->error_indicator = 1; |
16696 | p->level--; |
16697 | return NULL; |
16698 | } |
16699 | goto done; |
16700 | } |
16701 | p->mark = _mark; |
16702 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n" , p->level, ' ', |
16703 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "starred_expression" )); |
16704 | } |
16705 | _res = NULL; |
16706 | done: |
16707 | p->level--; |
16708 | return _res; |
16709 | } |
16710 | |
16711 | // kwarg_or_double_starred: invalid_kwarg | NAME '=' expression | '**' expression |
16712 | static KeywordOrStarred* |
16713 | kwarg_or_double_starred_rule(Parser *p) |
16714 | { |
16715 | if (p->level++ == MAXSTACK) { |
16716 | p->error_indicator = 1; |
16717 | PyErr_NoMemory(); |
16718 | } |
16719 | if (p->error_indicator) { |
16720 | p->level--; |
16721 | return NULL; |
16722 | } |
16723 | KeywordOrStarred* _res = NULL; |
16724 | int _mark = p->mark; |
16725 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
16726 | p->error_indicator = 1; |
16727 | p->level--; |
16728 | return NULL; |
16729 | } |
16730 | int _start_lineno = p->tokens[_mark]->lineno; |
16731 | UNUSED(_start_lineno); // Only used by EXTRA macro |
16732 | int _start_col_offset = p->tokens[_mark]->col_offset; |
16733 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
16734 | if (p->call_invalid_rules) { // invalid_kwarg |
16735 | if (p->error_indicator) { |
16736 | p->level--; |
16737 | return NULL; |
16738 | } |
16739 | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_kwarg" )); |
16740 | void *invalid_kwarg_var; |
16741 | if ( |
16742 | (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg |
16743 | ) |
16744 | { |
16745 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_kwarg" )); |
16746 | _res = invalid_kwarg_var; |
16747 | goto done; |
16748 | } |
16749 | p->mark = _mark; |
16750 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n" , p->level, ' ', |
16751 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_kwarg" )); |
16752 | } |
16753 | { // NAME '=' expression |
16754 | if (p->error_indicator) { |
16755 | p->level--; |
16756 | return NULL; |
16757 | } |
16758 | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME '=' expression" )); |
16759 | Token * _literal; |
16760 | expr_ty a; |
16761 | expr_ty b; |
16762 | if ( |
16763 | (a = _PyPegen_name_token(p)) // NAME |
16764 | && |
16765 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
16766 | && |
16767 | (b = expression_rule(p)) // expression |
16768 | ) |
16769 | { |
16770 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME '=' expression" )); |
16771 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16772 | if (_token == NULL) { |
16773 | p->level--; |
16774 | return NULL; |
16775 | } |
16776 | int _end_lineno = _token->end_lineno; |
16777 | UNUSED(_end_lineno); // Only used by EXTRA macro |
16778 | int _end_col_offset = _token->end_col_offset; |
16779 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16780 | _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); |
16781 | if (_res == NULL && PyErr_Occurred()) { |
16782 | p->error_indicator = 1; |
16783 | p->level--; |
16784 | return NULL; |
16785 | } |
16786 | goto done; |
16787 | } |
16788 | p->mark = _mark; |
16789 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n" , p->level, ' ', |
16790 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME '=' expression" )); |
16791 | } |
16792 | { // '**' expression |
16793 | if (p->error_indicator) { |
16794 | p->level--; |
16795 | return NULL; |
16796 | } |
16797 | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'**' expression" )); |
16798 | Token * _literal; |
16799 | expr_ty a; |
16800 | if ( |
16801 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
16802 | && |
16803 | (a = expression_rule(p)) // expression |
16804 | ) |
16805 | { |
16806 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'**' expression" )); |
16807 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16808 | if (_token == NULL) { |
16809 | p->level--; |
16810 | return NULL; |
16811 | } |
16812 | int _end_lineno = _token->end_lineno; |
16813 | UNUSED(_end_lineno); // Only used by EXTRA macro |
16814 | int _end_col_offset = _token->end_col_offset; |
16815 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16816 | _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( NULL , a , EXTRA ) ) , 1 ); |
16817 | if (_res == NULL && PyErr_Occurred()) { |
16818 | p->error_indicator = 1; |
16819 | p->level--; |
16820 | return NULL; |
16821 | } |
16822 | goto done; |
16823 | } |
16824 | p->mark = _mark; |
16825 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n" , p->level, ' ', |
16826 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'**' expression" )); |
16827 | } |
16828 | _res = NULL; |
16829 | done: |
16830 | p->level--; |
16831 | return _res; |
16832 | } |
16833 | |
16834 | // star_targets: star_target !',' | star_target ((',' star_target))* ','? |
16835 | static expr_ty |
16836 | star_targets_rule(Parser *p) |
16837 | { |
16838 | if (p->level++ == MAXSTACK) { |
16839 | p->error_indicator = 1; |
16840 | PyErr_NoMemory(); |
16841 | } |
16842 | if (p->error_indicator) { |
16843 | p->level--; |
16844 | return NULL; |
16845 | } |
16846 | expr_ty _res = NULL; |
16847 | int _mark = p->mark; |
16848 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
16849 | p->error_indicator = 1; |
16850 | p->level--; |
16851 | return NULL; |
16852 | } |
16853 | int _start_lineno = p->tokens[_mark]->lineno; |
16854 | UNUSED(_start_lineno); // Only used by EXTRA macro |
16855 | int _start_col_offset = p->tokens[_mark]->col_offset; |
16856 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
16857 | { // star_target !',' |
16858 | if (p->error_indicator) { |
16859 | p->level--; |
16860 | return NULL; |
16861 | } |
16862 | D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_target !','" )); |
16863 | expr_ty a; |
16864 | if ( |
16865 | (a = star_target_rule(p)) // star_target |
16866 | && |
16867 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
16868 | ) |
16869 | { |
16870 | D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_target !','" )); |
16871 | _res = a; |
16872 | if (_res == NULL && PyErr_Occurred()) { |
16873 | p->error_indicator = 1; |
16874 | p->level--; |
16875 | return NULL; |
16876 | } |
16877 | goto done; |
16878 | } |
16879 | p->mark = _mark; |
16880 | D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n" , p->level, ' ', |
16881 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_target !','" )); |
16882 | } |
16883 | { // star_target ((',' star_target))* ','? |
16884 | if (p->error_indicator) { |
16885 | p->level--; |
16886 | return NULL; |
16887 | } |
16888 | D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?" )); |
16889 | void *_opt_var; |
16890 | UNUSED(_opt_var); // Silence compiler warnings |
16891 | expr_ty a; |
16892 | asdl_seq * b; |
16893 | if ( |
16894 | (a = star_target_rule(p)) // star_target |
16895 | && |
16896 | (b = _loop0_134_rule(p)) // ((',' star_target))* |
16897 | && |
16898 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
16899 | ) |
16900 | { |
16901 | D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?" )); |
16902 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16903 | if (_token == NULL) { |
16904 | p->level--; |
16905 | return NULL; |
16906 | } |
16907 | int _end_lineno = _token->end_lineno; |
16908 | UNUSED(_end_lineno); // Only used by EXTRA macro |
16909 | int _end_col_offset = _token->end_col_offset; |
16910 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16911 | _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA ); |
16912 | if (_res == NULL && PyErr_Occurred()) { |
16913 | p->error_indicator = 1; |
16914 | p->level--; |
16915 | return NULL; |
16916 | } |
16917 | goto done; |
16918 | } |
16919 | p->mark = _mark; |
16920 | D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n" , p->level, ' ', |
16921 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_target ((',' star_target))* ','?" )); |
16922 | } |
16923 | _res = NULL; |
16924 | done: |
16925 | p->level--; |
16926 | return _res; |
16927 | } |
16928 | |
16929 | // star_targets_list_seq: ','.star_target+ ','? |
16930 | static asdl_expr_seq* |
16931 | star_targets_list_seq_rule(Parser *p) |
16932 | { |
16933 | if (p->level++ == MAXSTACK) { |
16934 | p->error_indicator = 1; |
16935 | PyErr_NoMemory(); |
16936 | } |
16937 | if (p->error_indicator) { |
16938 | p->level--; |
16939 | return NULL; |
16940 | } |
16941 | asdl_expr_seq* _res = NULL; |
16942 | int _mark = p->mark; |
16943 | { // ','.star_target+ ','? |
16944 | if (p->error_indicator) { |
16945 | p->level--; |
16946 | return NULL; |
16947 | } |
16948 | D(fprintf(stderr, "%*c> star_targets_list_seq[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.star_target+ ','?" )); |
16949 | void *_opt_var; |
16950 | UNUSED(_opt_var); // Silence compiler warnings |
16951 | asdl_expr_seq* a; |
16952 | if ( |
16953 | (a = (asdl_expr_seq*)_gather_135_rule(p)) // ','.star_target+ |
16954 | && |
16955 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
16956 | ) |
16957 | { |
16958 | D(fprintf(stderr, "%*c+ star_targets_list_seq[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.star_target+ ','?" )); |
16959 | _res = a; |
16960 | if (_res == NULL && PyErr_Occurred()) { |
16961 | p->error_indicator = 1; |
16962 | p->level--; |
16963 | return NULL; |
16964 | } |
16965 | goto done; |
16966 | } |
16967 | p->mark = _mark; |
16968 | D(fprintf(stderr, "%*c%s star_targets_list_seq[%d-%d]: %s failed!\n" , p->level, ' ', |
16969 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.star_target+ ','?" )); |
16970 | } |
16971 | _res = NULL; |
16972 | done: |
16973 | p->level--; |
16974 | return _res; |
16975 | } |
16976 | |
16977 | // star_targets_tuple_seq: star_target ((',' star_target))+ ','? | star_target ',' |
16978 | static asdl_expr_seq* |
16979 | star_targets_tuple_seq_rule(Parser *p) |
16980 | { |
16981 | if (p->level++ == MAXSTACK) { |
16982 | p->error_indicator = 1; |
16983 | PyErr_NoMemory(); |
16984 | } |
16985 | if (p->error_indicator) { |
16986 | p->level--; |
16987 | return NULL; |
16988 | } |
16989 | asdl_expr_seq* _res = NULL; |
16990 | int _mark = p->mark; |
16991 | { // star_target ((',' star_target))+ ','? |
16992 | if (p->error_indicator) { |
16993 | p->level--; |
16994 | return NULL; |
16995 | } |
16996 | D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?" )); |
16997 | void *_opt_var; |
16998 | UNUSED(_opt_var); // Silence compiler warnings |
16999 | expr_ty a; |
17000 | asdl_seq * b; |
17001 | if ( |
17002 | (a = star_target_rule(p)) // star_target |
17003 | && |
17004 | (b = _loop1_137_rule(p)) // ((',' star_target))+ |
17005 | && |
17006 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
17007 | ) |
17008 | { |
17009 | D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?" )); |
17010 | _res = ( asdl_expr_seq * ) _PyPegen_seq_insert_in_front ( p , a , b ); |
17011 | if (_res == NULL && PyErr_Occurred()) { |
17012 | p->error_indicator = 1; |
17013 | p->level--; |
17014 | return NULL; |
17015 | } |
17016 | goto done; |
17017 | } |
17018 | p->mark = _mark; |
17019 | D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n" , p->level, ' ', |
17020 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_target ((',' star_target))+ ','?" )); |
17021 | } |
17022 | { // star_target ',' |
17023 | if (p->error_indicator) { |
17024 | p->level--; |
17025 | return NULL; |
17026 | } |
17027 | D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_target ','" )); |
17028 | Token * _literal; |
17029 | expr_ty a; |
17030 | if ( |
17031 | (a = star_target_rule(p)) // star_target |
17032 | && |
17033 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
17034 | ) |
17035 | { |
17036 | D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_target ','" )); |
17037 | _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a ); |
17038 | if (_res == NULL && PyErr_Occurred()) { |
17039 | p->error_indicator = 1; |
17040 | p->level--; |
17041 | return NULL; |
17042 | } |
17043 | goto done; |
17044 | } |
17045 | p->mark = _mark; |
17046 | D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n" , p->level, ' ', |
17047 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_target ','" )); |
17048 | } |
17049 | _res = NULL; |
17050 | done: |
17051 | p->level--; |
17052 | return _res; |
17053 | } |
17054 | |
17055 | // star_target: '*' (!'*' star_target) | target_with_star_atom |
17056 | static expr_ty |
17057 | star_target_rule(Parser *p) |
17058 | { |
17059 | if (p->level++ == MAXSTACK) { |
17060 | p->error_indicator = 1; |
17061 | PyErr_NoMemory(); |
17062 | } |
17063 | if (p->error_indicator) { |
17064 | p->level--; |
17065 | return NULL; |
17066 | } |
17067 | expr_ty _res = NULL; |
17068 | if (_PyPegen_is_memoized(p, star_target_type, &_res)) { |
17069 | p->level--; |
17070 | return _res; |
17071 | } |
17072 | int _mark = p->mark; |
17073 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
17074 | p->error_indicator = 1; |
17075 | p->level--; |
17076 | return NULL; |
17077 | } |
17078 | int _start_lineno = p->tokens[_mark]->lineno; |
17079 | UNUSED(_start_lineno); // Only used by EXTRA macro |
17080 | int _start_col_offset = p->tokens[_mark]->col_offset; |
17081 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
17082 | { // '*' (!'*' star_target) |
17083 | if (p->error_indicator) { |
17084 | p->level--; |
17085 | return NULL; |
17086 | } |
17087 | D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)" )); |
17088 | Token * _literal; |
17089 | void *a; |
17090 | if ( |
17091 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
17092 | && |
17093 | (a = _tmp_138_rule(p)) // !'*' star_target |
17094 | ) |
17095 | { |
17096 | D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)" )); |
17097 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17098 | if (_token == NULL) { |
17099 | p->level--; |
17100 | return NULL; |
17101 | } |
17102 | int _end_lineno = _token->end_lineno; |
17103 | UNUSED(_end_lineno); // Only used by EXTRA macro |
17104 | int _end_col_offset = _token->end_col_offset; |
17105 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17106 | _res = _PyAST_Starred ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA ); |
17107 | if (_res == NULL && PyErr_Occurred()) { |
17108 | p->error_indicator = 1; |
17109 | p->level--; |
17110 | return NULL; |
17111 | } |
17112 | goto done; |
17113 | } |
17114 | p->mark = _mark; |
17115 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n" , p->level, ' ', |
17116 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' (!'*' star_target)" )); |
17117 | } |
17118 | { // target_with_star_atom |
17119 | if (p->error_indicator) { |
17120 | p->level--; |
17121 | return NULL; |
17122 | } |
17123 | D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "target_with_star_atom" )); |
17124 | expr_ty target_with_star_atom_var; |
17125 | if ( |
17126 | (target_with_star_atom_var = target_with_star_atom_rule(p)) // target_with_star_atom |
17127 | ) |
17128 | { |
17129 | D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "target_with_star_atom" )); |
17130 | _res = target_with_star_atom_var; |
17131 | goto done; |
17132 | } |
17133 | p->mark = _mark; |
17134 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n" , p->level, ' ', |
17135 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "target_with_star_atom" )); |
17136 | } |
17137 | _res = NULL; |
17138 | done: |
17139 | _PyPegen_insert_memo(p, _mark, star_target_type, _res); |
17140 | p->level--; |
17141 | return _res; |
17142 | } |
17143 | |
17144 | // target_with_star_atom: |
17145 | // | t_primary '.' NAME !t_lookahead |
17146 | // | t_primary '[' slices ']' !t_lookahead |
17147 | // | star_atom |
17148 | static expr_ty |
17149 | target_with_star_atom_rule(Parser *p) |
17150 | { |
17151 | if (p->level++ == MAXSTACK) { |
17152 | p->error_indicator = 1; |
17153 | PyErr_NoMemory(); |
17154 | } |
17155 | if (p->error_indicator) { |
17156 | p->level--; |
17157 | return NULL; |
17158 | } |
17159 | expr_ty _res = NULL; |
17160 | if (_PyPegen_is_memoized(p, target_with_star_atom_type, &_res)) { |
17161 | p->level--; |
17162 | return _res; |
17163 | } |
17164 | int _mark = p->mark; |
17165 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
17166 | p->error_indicator = 1; |
17167 | p->level--; |
17168 | return NULL; |
17169 | } |
17170 | int _start_lineno = p->tokens[_mark]->lineno; |
17171 | UNUSED(_start_lineno); // Only used by EXTRA macro |
17172 | int _start_col_offset = p->tokens[_mark]->col_offset; |
17173 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
17174 | { // t_primary '.' NAME !t_lookahead |
17175 | if (p->error_indicator) { |
17176 | p->level--; |
17177 | return NULL; |
17178 | } |
17179 | D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead" )); |
17180 | Token * _literal; |
17181 | expr_ty a; |
17182 | expr_ty b; |
17183 | if ( |
17184 | (a = t_primary_rule(p)) // t_primary |
17185 | && |
17186 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
17187 | && |
17188 | (b = _PyPegen_name_token(p)) // NAME |
17189 | && |
17190 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
17191 | ) |
17192 | { |
17193 | D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead" )); |
17194 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17195 | if (_token == NULL) { |
17196 | p->level--; |
17197 | return NULL; |
17198 | } |
17199 | int _end_lineno = _token->end_lineno; |
17200 | UNUSED(_end_lineno); // Only used by EXTRA macro |
17201 | int _end_col_offset = _token->end_col_offset; |
17202 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17203 | _res = _PyAST_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
17204 | if (_res == NULL && PyErr_Occurred()) { |
17205 | p->error_indicator = 1; |
17206 | p->level--; |
17207 | return NULL; |
17208 | } |
17209 | goto done; |
17210 | } |
17211 | p->mark = _mark; |
17212 | D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n" , p->level, ' ', |
17213 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "t_primary '.' NAME !t_lookahead" )); |
17214 | } |
17215 | { // t_primary '[' slices ']' !t_lookahead |
17216 | if (p->error_indicator) { |
17217 | p->level--; |
17218 | return NULL; |
17219 | } |
17220 | D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead" )); |
17221 | Token * _literal; |
17222 | Token * _literal_1; |
17223 | expr_ty a; |
17224 | expr_ty b; |
17225 | if ( |
17226 | (a = t_primary_rule(p)) // t_primary |
17227 | && |
17228 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
17229 | && |
17230 | (b = slices_rule(p)) // slices |
17231 | && |
17232 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
17233 | && |
17234 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
17235 | ) |
17236 | { |
17237 | D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead" )); |
17238 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17239 | if (_token == NULL) { |
17240 | p->level--; |
17241 | return NULL; |
17242 | } |
17243 | int _end_lineno = _token->end_lineno; |
17244 | UNUSED(_end_lineno); // Only used by EXTRA macro |
17245 | int _end_col_offset = _token->end_col_offset; |
17246 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17247 | _res = _PyAST_Subscript ( a , b , Store , EXTRA ); |
17248 | if (_res == NULL && PyErr_Occurred()) { |
17249 | p->error_indicator = 1; |
17250 | p->level--; |
17251 | return NULL; |
17252 | } |
17253 | goto done; |
17254 | } |
17255 | p->mark = _mark; |
17256 | D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n" , p->level, ' ', |
17257 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "t_primary '[' slices ']' !t_lookahead" )); |
17258 | } |
17259 | { // star_atom |
17260 | if (p->error_indicator) { |
17261 | p->level--; |
17262 | return NULL; |
17263 | } |
17264 | D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_atom" )); |
17265 | expr_ty star_atom_var; |
17266 | if ( |
17267 | (star_atom_var = star_atom_rule(p)) // star_atom |
17268 | ) |
17269 | { |
17270 | D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_atom" )); |
17271 | _res = star_atom_var; |
17272 | goto done; |
17273 | } |
17274 | p->mark = _mark; |
17275 | D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n" , p->level, ' ', |
17276 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_atom" )); |
17277 | } |
17278 | _res = NULL; |
17279 | done: |
17280 | _PyPegen_insert_memo(p, _mark, target_with_star_atom_type, _res); |
17281 | p->level--; |
17282 | return _res; |
17283 | } |
17284 | |
17285 | // star_atom: |
17286 | // | NAME |
17287 | // | '(' target_with_star_atom ')' |
17288 | // | '(' star_targets_tuple_seq? ')' |
17289 | // | '[' star_targets_list_seq? ']' |
17290 | static expr_ty |
17291 | star_atom_rule(Parser *p) |
17292 | { |
17293 | if (p->level++ == MAXSTACK) { |
17294 | p->error_indicator = 1; |
17295 | PyErr_NoMemory(); |
17296 | } |
17297 | if (p->error_indicator) { |
17298 | p->level--; |
17299 | return NULL; |
17300 | } |
17301 | expr_ty _res = NULL; |
17302 | int _mark = p->mark; |
17303 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
17304 | p->error_indicator = 1; |
17305 | p->level--; |
17306 | return NULL; |
17307 | } |
17308 | int _start_lineno = p->tokens[_mark]->lineno; |
17309 | UNUSED(_start_lineno); // Only used by EXTRA macro |
17310 | int _start_col_offset = p->tokens[_mark]->col_offset; |
17311 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
17312 | { // NAME |
17313 | if (p->error_indicator) { |
17314 | p->level--; |
17315 | return NULL; |
17316 | } |
17317 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
17318 | expr_ty a; |
17319 | if ( |
17320 | (a = _PyPegen_name_token(p)) // NAME |
17321 | ) |
17322 | { |
17323 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
17324 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
17325 | if (_res == NULL && PyErr_Occurred()) { |
17326 | p->error_indicator = 1; |
17327 | p->level--; |
17328 | return NULL; |
17329 | } |
17330 | goto done; |
17331 | } |
17332 | p->mark = _mark; |
17333 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n" , p->level, ' ', |
17334 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME" )); |
17335 | } |
17336 | { // '(' target_with_star_atom ')' |
17337 | if (p->error_indicator) { |
17338 | p->level--; |
17339 | return NULL; |
17340 | } |
17341 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'" )); |
17342 | Token * _literal; |
17343 | Token * _literal_1; |
17344 | expr_ty a; |
17345 | if ( |
17346 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
17347 | && |
17348 | (a = target_with_star_atom_rule(p)) // target_with_star_atom |
17349 | && |
17350 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
17351 | ) |
17352 | { |
17353 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'" )); |
17354 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
17355 | if (_res == NULL && PyErr_Occurred()) { |
17356 | p->error_indicator = 1; |
17357 | p->level--; |
17358 | return NULL; |
17359 | } |
17360 | goto done; |
17361 | } |
17362 | p->mark = _mark; |
17363 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n" , p->level, ' ', |
17364 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' target_with_star_atom ')'" )); |
17365 | } |
17366 | { // '(' star_targets_tuple_seq? ')' |
17367 | if (p->error_indicator) { |
17368 | p->level--; |
17369 | return NULL; |
17370 | } |
17371 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' star_targets_tuple_seq? ')'" )); |
17372 | Token * _literal; |
17373 | Token * _literal_1; |
17374 | void *a; |
17375 | if ( |
17376 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
17377 | && |
17378 | (a = star_targets_tuple_seq_rule(p), !p->error_indicator) // star_targets_tuple_seq? |
17379 | && |
17380 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
17381 | ) |
17382 | { |
17383 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' star_targets_tuple_seq? ')'" )); |
17384 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17385 | if (_token == NULL) { |
17386 | p->level--; |
17387 | return NULL; |
17388 | } |
17389 | int _end_lineno = _token->end_lineno; |
17390 | UNUSED(_end_lineno); // Only used by EXTRA macro |
17391 | int _end_col_offset = _token->end_col_offset; |
17392 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17393 | _res = _PyAST_Tuple ( a , Store , EXTRA ); |
17394 | if (_res == NULL && PyErr_Occurred()) { |
17395 | p->error_indicator = 1; |
17396 | p->level--; |
17397 | return NULL; |
17398 | } |
17399 | goto done; |
17400 | } |
17401 | p->mark = _mark; |
17402 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n" , p->level, ' ', |
17403 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' star_targets_tuple_seq? ')'" )); |
17404 | } |
17405 | { // '[' star_targets_list_seq? ']' |
17406 | if (p->error_indicator) { |
17407 | p->level--; |
17408 | return NULL; |
17409 | } |
17410 | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'[' star_targets_list_seq? ']'" )); |
17411 | Token * _literal; |
17412 | Token * _literal_1; |
17413 | void *a; |
17414 | if ( |
17415 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
17416 | && |
17417 | (a = star_targets_list_seq_rule(p), !p->error_indicator) // star_targets_list_seq? |
17418 | && |
17419 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
17420 | ) |
17421 | { |
17422 | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'[' star_targets_list_seq? ']'" )); |
17423 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17424 | if (_token == NULL) { |
17425 | p->level--; |
17426 | return NULL; |
17427 | } |
17428 | int _end_lineno = _token->end_lineno; |
17429 | UNUSED(_end_lineno); // Only used by EXTRA macro |
17430 | int _end_col_offset = _token->end_col_offset; |
17431 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17432 | _res = _PyAST_List ( a , Store , EXTRA ); |
17433 | if (_res == NULL && PyErr_Occurred()) { |
17434 | p->error_indicator = 1; |
17435 | p->level--; |
17436 | return NULL; |
17437 | } |
17438 | goto done; |
17439 | } |
17440 | p->mark = _mark; |
17441 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n" , p->level, ' ', |
17442 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'[' star_targets_list_seq? ']'" )); |
17443 | } |
17444 | _res = NULL; |
17445 | done: |
17446 | p->level--; |
17447 | return _res; |
17448 | } |
17449 | |
17450 | // single_target: single_subscript_attribute_target | NAME | '(' single_target ')' |
17451 | static expr_ty |
17452 | single_target_rule(Parser *p) |
17453 | { |
17454 | if (p->level++ == MAXSTACK) { |
17455 | p->error_indicator = 1; |
17456 | PyErr_NoMemory(); |
17457 | } |
17458 | if (p->error_indicator) { |
17459 | p->level--; |
17460 | return NULL; |
17461 | } |
17462 | expr_ty _res = NULL; |
17463 | int _mark = p->mark; |
17464 | { // single_subscript_attribute_target |
17465 | if (p->error_indicator) { |
17466 | p->level--; |
17467 | return NULL; |
17468 | } |
17469 | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "single_subscript_attribute_target" )); |
17470 | expr_ty single_subscript_attribute_target_var; |
17471 | if ( |
17472 | (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target |
17473 | ) |
17474 | { |
17475 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "single_subscript_attribute_target" )); |
17476 | _res = single_subscript_attribute_target_var; |
17477 | goto done; |
17478 | } |
17479 | p->mark = _mark; |
17480 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n" , p->level, ' ', |
17481 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "single_subscript_attribute_target" )); |
17482 | } |
17483 | { // NAME |
17484 | if (p->error_indicator) { |
17485 | p->level--; |
17486 | return NULL; |
17487 | } |
17488 | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
17489 | expr_ty a; |
17490 | if ( |
17491 | (a = _PyPegen_name_token(p)) // NAME |
17492 | ) |
17493 | { |
17494 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
17495 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
17496 | if (_res == NULL && PyErr_Occurred()) { |
17497 | p->error_indicator = 1; |
17498 | p->level--; |
17499 | return NULL; |
17500 | } |
17501 | goto done; |
17502 | } |
17503 | p->mark = _mark; |
17504 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n" , p->level, ' ', |
17505 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME" )); |
17506 | } |
17507 | { // '(' single_target ')' |
17508 | if (p->error_indicator) { |
17509 | p->level--; |
17510 | return NULL; |
17511 | } |
17512 | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' single_target ')'" )); |
17513 | Token * _literal; |
17514 | Token * _literal_1; |
17515 | expr_ty a; |
17516 | if ( |
17517 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
17518 | && |
17519 | (a = single_target_rule(p)) // single_target |
17520 | && |
17521 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
17522 | ) |
17523 | { |
17524 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' single_target ')'" )); |
17525 | _res = a; |
17526 | if (_res == NULL && PyErr_Occurred()) { |
17527 | p->error_indicator = 1; |
17528 | p->level--; |
17529 | return NULL; |
17530 | } |
17531 | goto done; |
17532 | } |
17533 | p->mark = _mark; |
17534 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n" , p->level, ' ', |
17535 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' single_target ')'" )); |
17536 | } |
17537 | _res = NULL; |
17538 | done: |
17539 | p->level--; |
17540 | return _res; |
17541 | } |
17542 | |
17543 | // single_subscript_attribute_target: |
17544 | // | t_primary '.' NAME !t_lookahead |
17545 | // | t_primary '[' slices ']' !t_lookahead |
17546 | static expr_ty |
17547 | single_subscript_attribute_target_rule(Parser *p) |
17548 | { |
17549 | if (p->level++ == MAXSTACK) { |
17550 | p->error_indicator = 1; |
17551 | PyErr_NoMemory(); |
17552 | } |
17553 | if (p->error_indicator) { |
17554 | p->level--; |
17555 | return NULL; |
17556 | } |
17557 | expr_ty _res = NULL; |
17558 | int _mark = p->mark; |
17559 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
17560 | p->error_indicator = 1; |
17561 | p->level--; |
17562 | return NULL; |
17563 | } |
17564 | int _start_lineno = p->tokens[_mark]->lineno; |
17565 | UNUSED(_start_lineno); // Only used by EXTRA macro |
17566 | int _start_col_offset = p->tokens[_mark]->col_offset; |
17567 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
17568 | { // t_primary '.' NAME !t_lookahead |
17569 | if (p->error_indicator) { |
17570 | p->level--; |
17571 | return NULL; |
17572 | } |
17573 | D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead" )); |
17574 | Token * _literal; |
17575 | expr_ty a; |
17576 | expr_ty b; |
17577 | if ( |
17578 | (a = t_primary_rule(p)) // t_primary |
17579 | && |
17580 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
17581 | && |
17582 | (b = _PyPegen_name_token(p)) // NAME |
17583 | && |
17584 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
17585 | ) |
17586 | { |
17587 | D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead" )); |
17588 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17589 | if (_token == NULL) { |
17590 | p->level--; |
17591 | return NULL; |
17592 | } |
17593 | int _end_lineno = _token->end_lineno; |
17594 | UNUSED(_end_lineno); // Only used by EXTRA macro |
17595 | int _end_col_offset = _token->end_col_offset; |
17596 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17597 | _res = _PyAST_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
17598 | if (_res == NULL && PyErr_Occurred()) { |
17599 | p->error_indicator = 1; |
17600 | p->level--; |
17601 | return NULL; |
17602 | } |
17603 | goto done; |
17604 | } |
17605 | p->mark = _mark; |
17606 | D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n" , p->level, ' ', |
17607 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "t_primary '.' NAME !t_lookahead" )); |
17608 | } |
17609 | { // t_primary '[' slices ']' !t_lookahead |
17610 | if (p->error_indicator) { |
17611 | p->level--; |
17612 | return NULL; |
17613 | } |
17614 | D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead" )); |
17615 | Token * _literal; |
17616 | Token * _literal_1; |
17617 | expr_ty a; |
17618 | expr_ty b; |
17619 | if ( |
17620 | (a = t_primary_rule(p)) // t_primary |
17621 | && |
17622 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
17623 | && |
17624 | (b = slices_rule(p)) // slices |
17625 | && |
17626 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
17627 | && |
17628 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
17629 | ) |
17630 | { |
17631 | D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead" )); |
17632 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17633 | if (_token == NULL) { |
17634 | p->level--; |
17635 | return NULL; |
17636 | } |
17637 | int _end_lineno = _token->end_lineno; |
17638 | UNUSED(_end_lineno); // Only used by EXTRA macro |
17639 | int _end_col_offset = _token->end_col_offset; |
17640 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17641 | _res = _PyAST_Subscript ( a , b , Store , EXTRA ); |
17642 | if (_res == NULL && PyErr_Occurred()) { |
17643 | p->error_indicator = 1; |
17644 | p->level--; |
17645 | return NULL; |
17646 | } |
17647 | goto done; |
17648 | } |
17649 | p->mark = _mark; |
17650 | D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n" , p->level, ' ', |
17651 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "t_primary '[' slices ']' !t_lookahead" )); |
17652 | } |
17653 | _res = NULL; |
17654 | done: |
17655 | p->level--; |
17656 | return _res; |
17657 | } |
17658 | |
17659 | // del_targets: ','.del_target+ ','? |
17660 | static asdl_expr_seq* |
17661 | del_targets_rule(Parser *p) |
17662 | { |
17663 | if (p->level++ == MAXSTACK) { |
17664 | p->error_indicator = 1; |
17665 | PyErr_NoMemory(); |
17666 | } |
17667 | if (p->error_indicator) { |
17668 | p->level--; |
17669 | return NULL; |
17670 | } |
17671 | asdl_expr_seq* _res = NULL; |
17672 | int _mark = p->mark; |
17673 | { // ','.del_target+ ','? |
17674 | if (p->error_indicator) { |
17675 | p->level--; |
17676 | return NULL; |
17677 | } |
17678 | D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.del_target+ ','?" )); |
17679 | void *_opt_var; |
17680 | UNUSED(_opt_var); // Silence compiler warnings |
17681 | asdl_expr_seq* a; |
17682 | if ( |
17683 | (a = (asdl_expr_seq*)_gather_139_rule(p)) // ','.del_target+ |
17684 | && |
17685 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
17686 | ) |
17687 | { |
17688 | D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.del_target+ ','?" )); |
17689 | _res = a; |
17690 | if (_res == NULL && PyErr_Occurred()) { |
17691 | p->error_indicator = 1; |
17692 | p->level--; |
17693 | return NULL; |
17694 | } |
17695 | goto done; |
17696 | } |
17697 | p->mark = _mark; |
17698 | D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n" , p->level, ' ', |
17699 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.del_target+ ','?" )); |
17700 | } |
17701 | _res = NULL; |
17702 | done: |
17703 | p->level--; |
17704 | return _res; |
17705 | } |
17706 | |
17707 | // del_target: |
17708 | // | t_primary '.' NAME !t_lookahead |
17709 | // | t_primary '[' slices ']' !t_lookahead |
17710 | // | del_t_atom |
17711 | static expr_ty |
17712 | del_target_rule(Parser *p) |
17713 | { |
17714 | if (p->level++ == MAXSTACK) { |
17715 | p->error_indicator = 1; |
17716 | PyErr_NoMemory(); |
17717 | } |
17718 | if (p->error_indicator) { |
17719 | p->level--; |
17720 | return NULL; |
17721 | } |
17722 | expr_ty _res = NULL; |
17723 | if (_PyPegen_is_memoized(p, del_target_type, &_res)) { |
17724 | p->level--; |
17725 | return _res; |
17726 | } |
17727 | int _mark = p->mark; |
17728 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
17729 | p->error_indicator = 1; |
17730 | p->level--; |
17731 | return NULL; |
17732 | } |
17733 | int _start_lineno = p->tokens[_mark]->lineno; |
17734 | UNUSED(_start_lineno); // Only used by EXTRA macro |
17735 | int _start_col_offset = p->tokens[_mark]->col_offset; |
17736 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
17737 | { // t_primary '.' NAME !t_lookahead |
17738 | if (p->error_indicator) { |
17739 | p->level--; |
17740 | return NULL; |
17741 | } |
17742 | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead" )); |
17743 | Token * _literal; |
17744 | expr_ty a; |
17745 | expr_ty b; |
17746 | if ( |
17747 | (a = t_primary_rule(p)) // t_primary |
17748 | && |
17749 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
17750 | && |
17751 | (b = _PyPegen_name_token(p)) // NAME |
17752 | && |
17753 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
17754 | ) |
17755 | { |
17756 | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead" )); |
17757 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17758 | if (_token == NULL) { |
17759 | p->level--; |
17760 | return NULL; |
17761 | } |
17762 | int _end_lineno = _token->end_lineno; |
17763 | UNUSED(_end_lineno); // Only used by EXTRA macro |
17764 | int _end_col_offset = _token->end_col_offset; |
17765 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17766 | _res = _PyAST_Attribute ( a , b -> v . Name . id , Del , EXTRA ); |
17767 | if (_res == NULL && PyErr_Occurred()) { |
17768 | p->error_indicator = 1; |
17769 | p->level--; |
17770 | return NULL; |
17771 | } |
17772 | goto done; |
17773 | } |
17774 | p->mark = _mark; |
17775 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n" , p->level, ' ', |
17776 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "t_primary '.' NAME !t_lookahead" )); |
17777 | } |
17778 | { // t_primary '[' slices ']' !t_lookahead |
17779 | if (p->error_indicator) { |
17780 | p->level--; |
17781 | return NULL; |
17782 | } |
17783 | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead" )); |
17784 | Token * _literal; |
17785 | Token * _literal_1; |
17786 | expr_ty a; |
17787 | expr_ty b; |
17788 | if ( |
17789 | (a = t_primary_rule(p)) // t_primary |
17790 | && |
17791 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
17792 | && |
17793 | (b = slices_rule(p)) // slices |
17794 | && |
17795 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
17796 | && |
17797 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
17798 | ) |
17799 | { |
17800 | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead" )); |
17801 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17802 | if (_token == NULL) { |
17803 | p->level--; |
17804 | return NULL; |
17805 | } |
17806 | int _end_lineno = _token->end_lineno; |
17807 | UNUSED(_end_lineno); // Only used by EXTRA macro |
17808 | int _end_col_offset = _token->end_col_offset; |
17809 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17810 | _res = _PyAST_Subscript ( a , b , Del , EXTRA ); |
17811 | if (_res == NULL && PyErr_Occurred()) { |
17812 | p->error_indicator = 1; |
17813 | p->level--; |
17814 | return NULL; |
17815 | } |
17816 | goto done; |
17817 | } |
17818 | p->mark = _mark; |
17819 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n" , p->level, ' ', |
17820 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "t_primary '[' slices ']' !t_lookahead" )); |
17821 | } |
17822 | { // del_t_atom |
17823 | if (p->error_indicator) { |
17824 | p->level--; |
17825 | return NULL; |
17826 | } |
17827 | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "del_t_atom" )); |
17828 | expr_ty del_t_atom_var; |
17829 | if ( |
17830 | (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom |
17831 | ) |
17832 | { |
17833 | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "del_t_atom" )); |
17834 | _res = del_t_atom_var; |
17835 | goto done; |
17836 | } |
17837 | p->mark = _mark; |
17838 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n" , p->level, ' ', |
17839 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "del_t_atom" )); |
17840 | } |
17841 | _res = NULL; |
17842 | done: |
17843 | _PyPegen_insert_memo(p, _mark, del_target_type, _res); |
17844 | p->level--; |
17845 | return _res; |
17846 | } |
17847 | |
17848 | // del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']' |
17849 | static expr_ty |
17850 | del_t_atom_rule(Parser *p) |
17851 | { |
17852 | if (p->level++ == MAXSTACK) { |
17853 | p->error_indicator = 1; |
17854 | PyErr_NoMemory(); |
17855 | } |
17856 | if (p->error_indicator) { |
17857 | p->level--; |
17858 | return NULL; |
17859 | } |
17860 | expr_ty _res = NULL; |
17861 | int _mark = p->mark; |
17862 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
17863 | p->error_indicator = 1; |
17864 | p->level--; |
17865 | return NULL; |
17866 | } |
17867 | int _start_lineno = p->tokens[_mark]->lineno; |
17868 | UNUSED(_start_lineno); // Only used by EXTRA macro |
17869 | int _start_col_offset = p->tokens[_mark]->col_offset; |
17870 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
17871 | { // NAME |
17872 | if (p->error_indicator) { |
17873 | p->level--; |
17874 | return NULL; |
17875 | } |
17876 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
17877 | expr_ty a; |
17878 | if ( |
17879 | (a = _PyPegen_name_token(p)) // NAME |
17880 | ) |
17881 | { |
17882 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME" )); |
17883 | _res = _PyPegen_set_expr_context ( p , a , Del ); |
17884 | if (_res == NULL && PyErr_Occurred()) { |
17885 | p->error_indicator = 1; |
17886 | p->level--; |
17887 | return NULL; |
17888 | } |
17889 | goto done; |
17890 | } |
17891 | p->mark = _mark; |
17892 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n" , p->level, ' ', |
17893 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME" )); |
17894 | } |
17895 | { // '(' del_target ')' |
17896 | if (p->error_indicator) { |
17897 | p->level--; |
17898 | return NULL; |
17899 | } |
17900 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' del_target ')'" )); |
17901 | Token * _literal; |
17902 | Token * _literal_1; |
17903 | expr_ty a; |
17904 | if ( |
17905 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
17906 | && |
17907 | (a = del_target_rule(p)) // del_target |
17908 | && |
17909 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
17910 | ) |
17911 | { |
17912 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' del_target ')'" )); |
17913 | _res = _PyPegen_set_expr_context ( p , a , Del ); |
17914 | if (_res == NULL && PyErr_Occurred()) { |
17915 | p->error_indicator = 1; |
17916 | p->level--; |
17917 | return NULL; |
17918 | } |
17919 | goto done; |
17920 | } |
17921 | p->mark = _mark; |
17922 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n" , p->level, ' ', |
17923 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' del_target ')'" )); |
17924 | } |
17925 | { // '(' del_targets? ')' |
17926 | if (p->error_indicator) { |
17927 | p->level--; |
17928 | return NULL; |
17929 | } |
17930 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' del_targets? ')'" )); |
17931 | Token * _literal; |
17932 | Token * _literal_1; |
17933 | void *a; |
17934 | if ( |
17935 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
17936 | && |
17937 | (a = del_targets_rule(p), !p->error_indicator) // del_targets? |
17938 | && |
17939 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
17940 | ) |
17941 | { |
17942 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' del_targets? ')'" )); |
17943 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17944 | if (_token == NULL) { |
17945 | p->level--; |
17946 | return NULL; |
17947 | } |
17948 | int _end_lineno = _token->end_lineno; |
17949 | UNUSED(_end_lineno); // Only used by EXTRA macro |
17950 | int _end_col_offset = _token->end_col_offset; |
17951 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17952 | _res = _PyAST_Tuple ( a , Del , EXTRA ); |
17953 | if (_res == NULL && PyErr_Occurred()) { |
17954 | p->error_indicator = 1; |
17955 | p->level--; |
17956 | return NULL; |
17957 | } |
17958 | goto done; |
17959 | } |
17960 | p->mark = _mark; |
17961 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n" , p->level, ' ', |
17962 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' del_targets? ')'" )); |
17963 | } |
17964 | { // '[' del_targets? ']' |
17965 | if (p->error_indicator) { |
17966 | p->level--; |
17967 | return NULL; |
17968 | } |
17969 | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'[' del_targets? ']'" )); |
17970 | Token * _literal; |
17971 | Token * _literal_1; |
17972 | void *a; |
17973 | if ( |
17974 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
17975 | && |
17976 | (a = del_targets_rule(p), !p->error_indicator) // del_targets? |
17977 | && |
17978 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
17979 | ) |
17980 | { |
17981 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'[' del_targets? ']'" )); |
17982 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17983 | if (_token == NULL) { |
17984 | p->level--; |
17985 | return NULL; |
17986 | } |
17987 | int _end_lineno = _token->end_lineno; |
17988 | UNUSED(_end_lineno); // Only used by EXTRA macro |
17989 | int _end_col_offset = _token->end_col_offset; |
17990 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17991 | _res = _PyAST_List ( a , Del , EXTRA ); |
17992 | if (_res == NULL && PyErr_Occurred()) { |
17993 | p->error_indicator = 1; |
17994 | p->level--; |
17995 | return NULL; |
17996 | } |
17997 | goto done; |
17998 | } |
17999 | p->mark = _mark; |
18000 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n" , p->level, ' ', |
18001 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'[' del_targets? ']'" )); |
18002 | } |
18003 | _res = NULL; |
18004 | done: |
18005 | p->level--; |
18006 | return _res; |
18007 | } |
18008 | |
18009 | // Left-recursive |
18010 | // t_primary: |
18011 | // | t_primary '.' NAME &t_lookahead |
18012 | // | t_primary '[' slices ']' &t_lookahead |
18013 | // | t_primary genexp &t_lookahead |
18014 | // | t_primary '(' arguments? ')' &t_lookahead |
18015 | // | atom &t_lookahead |
18016 | static expr_ty t_primary_raw(Parser *); |
18017 | static expr_ty |
18018 | t_primary_rule(Parser *p) |
18019 | { |
18020 | if (p->level++ == MAXSTACK) { |
18021 | p->error_indicator = 1; |
18022 | PyErr_NoMemory(); |
18023 | } |
18024 | expr_ty _res = NULL; |
18025 | if (_PyPegen_is_memoized(p, t_primary_type, &_res)) { |
18026 | p->level--; |
18027 | return _res; |
18028 | } |
18029 | int _mark = p->mark; |
18030 | int _resmark = p->mark; |
18031 | while (1) { |
18032 | int tmpvar_9 = _PyPegen_update_memo(p, _mark, t_primary_type, _res); |
18033 | if (tmpvar_9) { |
18034 | p->level--; |
18035 | return _res; |
18036 | } |
18037 | p->mark = _mark; |
18038 | void *_raw = t_primary_raw(p); |
18039 | if (p->error_indicator) { |
18040 | p->level--; |
18041 | return NULL; |
18042 | } |
18043 | if (_raw == NULL || p->mark <= _resmark) |
18044 | break; |
18045 | _resmark = p->mark; |
18046 | _res = _raw; |
18047 | } |
18048 | p->mark = _resmark; |
18049 | p->level--; |
18050 | return _res; |
18051 | } |
18052 | static expr_ty |
18053 | t_primary_raw(Parser *p) |
18054 | { |
18055 | if (p->level++ == MAXSTACK) { |
18056 | p->error_indicator = 1; |
18057 | PyErr_NoMemory(); |
18058 | } |
18059 | if (p->error_indicator) { |
18060 | p->level--; |
18061 | return NULL; |
18062 | } |
18063 | expr_ty _res = NULL; |
18064 | int _mark = p->mark; |
18065 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
18066 | p->error_indicator = 1; |
18067 | p->level--; |
18068 | return NULL; |
18069 | } |
18070 | int _start_lineno = p->tokens[_mark]->lineno; |
18071 | UNUSED(_start_lineno); // Only used by EXTRA macro |
18072 | int _start_col_offset = p->tokens[_mark]->col_offset; |
18073 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
18074 | { // t_primary '.' NAME &t_lookahead |
18075 | if (p->error_indicator) { |
18076 | p->level--; |
18077 | return NULL; |
18078 | } |
18079 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead" )); |
18080 | Token * _literal; |
18081 | expr_ty a; |
18082 | expr_ty b; |
18083 | if ( |
18084 | (a = t_primary_rule(p)) // t_primary |
18085 | && |
18086 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
18087 | && |
18088 | (b = _PyPegen_name_token(p)) // NAME |
18089 | && |
18090 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
18091 | ) |
18092 | { |
18093 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead" )); |
18094 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18095 | if (_token == NULL) { |
18096 | p->level--; |
18097 | return NULL; |
18098 | } |
18099 | int _end_lineno = _token->end_lineno; |
18100 | UNUSED(_end_lineno); // Only used by EXTRA macro |
18101 | int _end_col_offset = _token->end_col_offset; |
18102 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18103 | _res = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA ); |
18104 | if (_res == NULL && PyErr_Occurred()) { |
18105 | p->error_indicator = 1; |
18106 | p->level--; |
18107 | return NULL; |
18108 | } |
18109 | goto done; |
18110 | } |
18111 | p->mark = _mark; |
18112 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n" , p->level, ' ', |
18113 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "t_primary '.' NAME &t_lookahead" )); |
18114 | } |
18115 | { // t_primary '[' slices ']' &t_lookahead |
18116 | if (p->error_indicator) { |
18117 | p->level--; |
18118 | return NULL; |
18119 | } |
18120 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead" )); |
18121 | Token * _literal; |
18122 | Token * _literal_1; |
18123 | expr_ty a; |
18124 | expr_ty b; |
18125 | if ( |
18126 | (a = t_primary_rule(p)) // t_primary |
18127 | && |
18128 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
18129 | && |
18130 | (b = slices_rule(p)) // slices |
18131 | && |
18132 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
18133 | && |
18134 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
18135 | ) |
18136 | { |
18137 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead" )); |
18138 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18139 | if (_token == NULL) { |
18140 | p->level--; |
18141 | return NULL; |
18142 | } |
18143 | int _end_lineno = _token->end_lineno; |
18144 | UNUSED(_end_lineno); // Only used by EXTRA macro |
18145 | int _end_col_offset = _token->end_col_offset; |
18146 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18147 | _res = _PyAST_Subscript ( a , b , Load , EXTRA ); |
18148 | if (_res == NULL && PyErr_Occurred()) { |
18149 | p->error_indicator = 1; |
18150 | p->level--; |
18151 | return NULL; |
18152 | } |
18153 | goto done; |
18154 | } |
18155 | p->mark = _mark; |
18156 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n" , p->level, ' ', |
18157 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "t_primary '[' slices ']' &t_lookahead" )); |
18158 | } |
18159 | { // t_primary genexp &t_lookahead |
18160 | if (p->error_indicator) { |
18161 | p->level--; |
18162 | return NULL; |
18163 | } |
18164 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead" )); |
18165 | expr_ty a; |
18166 | expr_ty b; |
18167 | if ( |
18168 | (a = t_primary_rule(p)) // t_primary |
18169 | && |
18170 | (b = genexp_rule(p)) // genexp |
18171 | && |
18172 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
18173 | ) |
18174 | { |
18175 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead" )); |
18176 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18177 | if (_token == NULL) { |
18178 | p->level--; |
18179 | return NULL; |
18180 | } |
18181 | int _end_lineno = _token->end_lineno; |
18182 | UNUSED(_end_lineno); // Only used by EXTRA macro |
18183 | int _end_col_offset = _token->end_col_offset; |
18184 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18185 | _res = _PyAST_Call ( a , CHECK ( asdl_expr_seq * , ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); |
18186 | if (_res == NULL && PyErr_Occurred()) { |
18187 | p->error_indicator = 1; |
18188 | p->level--; |
18189 | return NULL; |
18190 | } |
18191 | goto done; |
18192 | } |
18193 | p->mark = _mark; |
18194 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n" , p->level, ' ', |
18195 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "t_primary genexp &t_lookahead" )); |
18196 | } |
18197 | { // t_primary '(' arguments? ')' &t_lookahead |
18198 | if (p->error_indicator) { |
18199 | p->level--; |
18200 | return NULL; |
18201 | } |
18202 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead" )); |
18203 | Token * _literal; |
18204 | Token * _literal_1; |
18205 | expr_ty a; |
18206 | void *b; |
18207 | if ( |
18208 | (a = t_primary_rule(p)) // t_primary |
18209 | && |
18210 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
18211 | && |
18212 | (b = arguments_rule(p), !p->error_indicator) // arguments? |
18213 | && |
18214 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
18215 | && |
18216 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
18217 | ) |
18218 | { |
18219 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead" )); |
18220 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18221 | if (_token == NULL) { |
18222 | p->level--; |
18223 | return NULL; |
18224 | } |
18225 | int _end_lineno = _token->end_lineno; |
18226 | UNUSED(_end_lineno); // Only used by EXTRA macro |
18227 | int _end_col_offset = _token->end_col_offset; |
18228 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18229 | _res = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
18230 | if (_res == NULL && PyErr_Occurred()) { |
18231 | p->error_indicator = 1; |
18232 | p->level--; |
18233 | return NULL; |
18234 | } |
18235 | goto done; |
18236 | } |
18237 | p->mark = _mark; |
18238 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n" , p->level, ' ', |
18239 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead" )); |
18240 | } |
18241 | { // atom &t_lookahead |
18242 | if (p->error_indicator) { |
18243 | p->level--; |
18244 | return NULL; |
18245 | } |
18246 | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "atom &t_lookahead" )); |
18247 | expr_ty a; |
18248 | if ( |
18249 | (a = atom_rule(p)) // atom |
18250 | && |
18251 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
18252 | ) |
18253 | { |
18254 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "atom &t_lookahead" )); |
18255 | _res = a; |
18256 | if (_res == NULL && PyErr_Occurred()) { |
18257 | p->error_indicator = 1; |
18258 | p->level--; |
18259 | return NULL; |
18260 | } |
18261 | goto done; |
18262 | } |
18263 | p->mark = _mark; |
18264 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n" , p->level, ' ', |
18265 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "atom &t_lookahead" )); |
18266 | } |
18267 | _res = NULL; |
18268 | done: |
18269 | p->level--; |
18270 | return _res; |
18271 | } |
18272 | |
18273 | // t_lookahead: '(' | '[' | '.' |
18274 | static void * |
18275 | t_lookahead_rule(Parser *p) |
18276 | { |
18277 | if (p->level++ == MAXSTACK) { |
18278 | p->error_indicator = 1; |
18279 | PyErr_NoMemory(); |
18280 | } |
18281 | if (p->error_indicator) { |
18282 | p->level--; |
18283 | return NULL; |
18284 | } |
18285 | void * _res = NULL; |
18286 | int _mark = p->mark; |
18287 | { // '(' |
18288 | if (p->error_indicator) { |
18289 | p->level--; |
18290 | return NULL; |
18291 | } |
18292 | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'('" )); |
18293 | Token * _literal; |
18294 | if ( |
18295 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
18296 | ) |
18297 | { |
18298 | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'('" )); |
18299 | _res = _literal; |
18300 | goto done; |
18301 | } |
18302 | p->mark = _mark; |
18303 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n" , p->level, ' ', |
18304 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'('" )); |
18305 | } |
18306 | { // '[' |
18307 | if (p->error_indicator) { |
18308 | p->level--; |
18309 | return NULL; |
18310 | } |
18311 | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'['" )); |
18312 | Token * _literal; |
18313 | if ( |
18314 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
18315 | ) |
18316 | { |
18317 | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'['" )); |
18318 | _res = _literal; |
18319 | goto done; |
18320 | } |
18321 | p->mark = _mark; |
18322 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n" , p->level, ' ', |
18323 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'['" )); |
18324 | } |
18325 | { // '.' |
18326 | if (p->error_indicator) { |
18327 | p->level--; |
18328 | return NULL; |
18329 | } |
18330 | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'.'" )); |
18331 | Token * _literal; |
18332 | if ( |
18333 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
18334 | ) |
18335 | { |
18336 | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'.'" )); |
18337 | _res = _literal; |
18338 | goto done; |
18339 | } |
18340 | p->mark = _mark; |
18341 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n" , p->level, ' ', |
18342 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'.'" )); |
18343 | } |
18344 | _res = NULL; |
18345 | done: |
18346 | p->level--; |
18347 | return _res; |
18348 | } |
18349 | |
18350 | // invalid_arguments: |
18351 | // | args ',' '*' |
18352 | // | expression for_if_clauses ',' [args | expression for_if_clauses] |
18353 | // | NAME '=' expression for_if_clauses |
18354 | // | args for_if_clauses |
18355 | // | args ',' expression for_if_clauses |
18356 | // | args ',' args |
18357 | static void * |
18358 | invalid_arguments_rule(Parser *p) |
18359 | { |
18360 | if (p->level++ == MAXSTACK) { |
18361 | p->error_indicator = 1; |
18362 | PyErr_NoMemory(); |
18363 | } |
18364 | if (p->error_indicator) { |
18365 | p->level--; |
18366 | return NULL; |
18367 | } |
18368 | void * _res = NULL; |
18369 | int _mark = p->mark; |
18370 | { // args ',' '*' |
18371 | if (p->error_indicator) { |
18372 | p->level--; |
18373 | return NULL; |
18374 | } |
18375 | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "args ',' '*'" )); |
18376 | Token * _literal; |
18377 | Token * _literal_1; |
18378 | expr_ty a; |
18379 | if ( |
18380 | (a = args_rule(p)) // args |
18381 | && |
18382 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
18383 | && |
18384 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
18385 | ) |
18386 | { |
18387 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "args ',' '*'" )); |
18388 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable argument unpacking follows keyword argument unpacking" ); |
18389 | if (_res == NULL && PyErr_Occurred()) { |
18390 | p->error_indicator = 1; |
18391 | p->level--; |
18392 | return NULL; |
18393 | } |
18394 | goto done; |
18395 | } |
18396 | p->mark = _mark; |
18397 | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n" , p->level, ' ', |
18398 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "args ',' '*'" )); |
18399 | } |
18400 | { // expression for_if_clauses ',' [args | expression for_if_clauses] |
18401 | if (p->error_indicator) { |
18402 | p->level--; |
18403 | return NULL; |
18404 | } |
18405 | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]" )); |
18406 | Token * _literal; |
18407 | void *_opt_var; |
18408 | UNUSED(_opt_var); // Silence compiler warnings |
18409 | expr_ty a; |
18410 | asdl_comprehension_seq* b; |
18411 | if ( |
18412 | (a = expression_rule(p)) // expression |
18413 | && |
18414 | (b = for_if_clauses_rule(p)) // for_if_clauses |
18415 | && |
18416 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
18417 | && |
18418 | (_opt_var = _tmp_141_rule(p), !p->error_indicator) // [args | expression for_if_clauses] |
18419 | ) |
18420 | { |
18421 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]" )); |
18422 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , _PyPegen_get_last_comprehension_item ( PyPegen_last_item ( b , comprehension_ty ) ) , "Generator expression must be parenthesized" ); |
18423 | if (_res == NULL && PyErr_Occurred()) { |
18424 | p->error_indicator = 1; |
18425 | p->level--; |
18426 | return NULL; |
18427 | } |
18428 | goto done; |
18429 | } |
18430 | p->mark = _mark; |
18431 | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n" , p->level, ' ', |
18432 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]" )); |
18433 | } |
18434 | { // NAME '=' expression for_if_clauses |
18435 | if (p->error_indicator) { |
18436 | p->level--; |
18437 | return NULL; |
18438 | } |
18439 | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses" )); |
18440 | expr_ty a; |
18441 | Token * b; |
18442 | expr_ty expression_var; |
18443 | asdl_comprehension_seq* for_if_clauses_var; |
18444 | if ( |
18445 | (a = _PyPegen_name_token(p)) // NAME |
18446 | && |
18447 | (b = _PyPegen_expect_token(p, 22)) // token='=' |
18448 | && |
18449 | (expression_var = expression_rule(p)) // expression |
18450 | && |
18451 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
18452 | ) |
18453 | { |
18454 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses" )); |
18455 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" ); |
18456 | if (_res == NULL && PyErr_Occurred()) { |
18457 | p->error_indicator = 1; |
18458 | p->level--; |
18459 | return NULL; |
18460 | } |
18461 | goto done; |
18462 | } |
18463 | p->mark = _mark; |
18464 | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n" , p->level, ' ', |
18465 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME '=' expression for_if_clauses" )); |
18466 | } |
18467 | { // args for_if_clauses |
18468 | if (p->error_indicator) { |
18469 | p->level--; |
18470 | return NULL; |
18471 | } |
18472 | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "args for_if_clauses" )); |
18473 | expr_ty a; |
18474 | asdl_comprehension_seq* b; |
18475 | if ( |
18476 | (a = args_rule(p)) // args |
18477 | && |
18478 | (b = for_if_clauses_rule(p)) // for_if_clauses |
18479 | ) |
18480 | { |
18481 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "args for_if_clauses" )); |
18482 | _res = _PyPegen_nonparen_genexp_in_call ( p , a , b ); |
18483 | if (_res == NULL && PyErr_Occurred()) { |
18484 | p->error_indicator = 1; |
18485 | p->level--; |
18486 | return NULL; |
18487 | } |
18488 | goto done; |
18489 | } |
18490 | p->mark = _mark; |
18491 | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n" , p->level, ' ', |
18492 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "args for_if_clauses" )); |
18493 | } |
18494 | { // args ',' expression for_if_clauses |
18495 | if (p->error_indicator) { |
18496 | p->level--; |
18497 | return NULL; |
18498 | } |
18499 | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses" )); |
18500 | Token * _literal; |
18501 | expr_ty a; |
18502 | expr_ty args_var; |
18503 | asdl_comprehension_seq* b; |
18504 | if ( |
18505 | (args_var = args_rule(p)) // args |
18506 | && |
18507 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
18508 | && |
18509 | (a = expression_rule(p)) // expression |
18510 | && |
18511 | (b = for_if_clauses_rule(p)) // for_if_clauses |
18512 | ) |
18513 | { |
18514 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses" )); |
18515 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , _PyPegen_get_last_comprehension_item ( PyPegen_last_item ( b , comprehension_ty ) ) , "Generator expression must be parenthesized" ); |
18516 | if (_res == NULL && PyErr_Occurred()) { |
18517 | p->error_indicator = 1; |
18518 | p->level--; |
18519 | return NULL; |
18520 | } |
18521 | goto done; |
18522 | } |
18523 | p->mark = _mark; |
18524 | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n" , p->level, ' ', |
18525 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "args ',' expression for_if_clauses" )); |
18526 | } |
18527 | { // args ',' args |
18528 | if (p->error_indicator) { |
18529 | p->level--; |
18530 | return NULL; |
18531 | } |
18532 | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "args ',' args" )); |
18533 | Token * _literal; |
18534 | expr_ty a; |
18535 | expr_ty args_var; |
18536 | if ( |
18537 | (a = args_rule(p)) // args |
18538 | && |
18539 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
18540 | && |
18541 | (args_var = args_rule(p)) // args |
18542 | ) |
18543 | { |
18544 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "args ',' args" )); |
18545 | _res = _PyPegen_arguments_parsing_error ( p , a ); |
18546 | if (_res == NULL && PyErr_Occurred()) { |
18547 | p->error_indicator = 1; |
18548 | p->level--; |
18549 | return NULL; |
18550 | } |
18551 | goto done; |
18552 | } |
18553 | p->mark = _mark; |
18554 | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n" , p->level, ' ', |
18555 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "args ',' args" )); |
18556 | } |
18557 | _res = NULL; |
18558 | done: |
18559 | p->level--; |
18560 | return _res; |
18561 | } |
18562 | |
18563 | // invalid_kwarg: |
18564 | // | ('True' | 'False' | 'None') '=' |
18565 | // | NAME '=' expression for_if_clauses |
18566 | // | !(NAME '=') expression '=' |
18567 | static void * |
18568 | invalid_kwarg_rule(Parser *p) |
18569 | { |
18570 | if (p->level++ == MAXSTACK) { |
18571 | p->error_indicator = 1; |
18572 | PyErr_NoMemory(); |
18573 | } |
18574 | if (p->error_indicator) { |
18575 | p->level--; |
18576 | return NULL; |
18577 | } |
18578 | void * _res = NULL; |
18579 | int _mark = p->mark; |
18580 | { // ('True' | 'False' | 'None') '=' |
18581 | if (p->error_indicator) { |
18582 | p->level--; |
18583 | return NULL; |
18584 | } |
18585 | D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('True' | 'False' | 'None') '='" )); |
18586 | Token* a; |
18587 | Token * b; |
18588 | if ( |
18589 | (a = (Token*)_tmp_142_rule(p)) // 'True' | 'False' | 'None' |
18590 | && |
18591 | (b = _PyPegen_expect_token(p, 22)) // token='=' |
18592 | ) |
18593 | { |
18594 | D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "('True' | 'False' | 'None') '='" )); |
18595 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to %s" , PyBytes_AS_STRING ( a -> bytes ) ); |
18596 | if (_res == NULL && PyErr_Occurred()) { |
18597 | p->error_indicator = 1; |
18598 | p->level--; |
18599 | return NULL; |
18600 | } |
18601 | goto done; |
18602 | } |
18603 | p->mark = _mark; |
18604 | D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n" , p->level, ' ', |
18605 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('True' | 'False' | 'None') '='" )); |
18606 | } |
18607 | { // NAME '=' expression for_if_clauses |
18608 | if (p->error_indicator) { |
18609 | p->level--; |
18610 | return NULL; |
18611 | } |
18612 | D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses" )); |
18613 | expr_ty a; |
18614 | Token * b; |
18615 | expr_ty expression_var; |
18616 | asdl_comprehension_seq* for_if_clauses_var; |
18617 | if ( |
18618 | (a = _PyPegen_name_token(p)) // NAME |
18619 | && |
18620 | (b = _PyPegen_expect_token(p, 22)) // token='=' |
18621 | && |
18622 | (expression_var = expression_rule(p)) // expression |
18623 | && |
18624 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
18625 | ) |
18626 | { |
18627 | D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses" )); |
18628 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" ); |
18629 | if (_res == NULL && PyErr_Occurred()) { |
18630 | p->error_indicator = 1; |
18631 | p->level--; |
18632 | return NULL; |
18633 | } |
18634 | goto done; |
18635 | } |
18636 | p->mark = _mark; |
18637 | D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n" , p->level, ' ', |
18638 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME '=' expression for_if_clauses" )); |
18639 | } |
18640 | { // !(NAME '=') expression '=' |
18641 | if (p->error_indicator) { |
18642 | p->level--; |
18643 | return NULL; |
18644 | } |
18645 | D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "!(NAME '=') expression '='" )); |
18646 | expr_ty a; |
18647 | Token * b; |
18648 | if ( |
18649 | _PyPegen_lookahead(0, _tmp_143_rule, p) |
18650 | && |
18651 | (a = expression_rule(p)) // expression |
18652 | && |
18653 | (b = _PyPegen_expect_token(p, 22)) // token='=' |
18654 | ) |
18655 | { |
18656 | D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "!(NAME '=') expression '='" )); |
18657 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expression cannot contain assignment, perhaps you meant \"==\"?" ); |
18658 | if (_res == NULL && PyErr_Occurred()) { |
18659 | p->error_indicator = 1; |
18660 | p->level--; |
18661 | return NULL; |
18662 | } |
18663 | goto done; |
18664 | } |
18665 | p->mark = _mark; |
18666 | D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n" , p->level, ' ', |
18667 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "!(NAME '=') expression '='" )); |
18668 | } |
18669 | _res = NULL; |
18670 | done: |
18671 | p->level--; |
18672 | return _res; |
18673 | } |
18674 | |
18675 | // expression_without_invalid: |
18676 | // | disjunction 'if' disjunction 'else' expression |
18677 | // | disjunction |
18678 | // | lambdef |
18679 | static expr_ty |
18680 | expression_without_invalid_rule(Parser *p) |
18681 | { |
18682 | int _prev_call_invalid = p->call_invalid_rules; |
18683 | p->call_invalid_rules = 0; |
18684 | if (p->level++ == MAXSTACK) { |
18685 | p->error_indicator = 1; |
18686 | PyErr_NoMemory(); |
18687 | } |
18688 | if (p->error_indicator) { |
18689 | p->call_invalid_rules = _prev_call_invalid; |
18690 | p->level--; |
18691 | return NULL; |
18692 | } |
18693 | expr_ty _res = NULL; |
18694 | int _mark = p->mark; |
18695 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
18696 | p->error_indicator = 1; |
18697 | p->call_invalid_rules = _prev_call_invalid; |
18698 | p->level--; |
18699 | return NULL; |
18700 | } |
18701 | int _start_lineno = p->tokens[_mark]->lineno; |
18702 | UNUSED(_start_lineno); // Only used by EXTRA macro |
18703 | int _start_col_offset = p->tokens[_mark]->col_offset; |
18704 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
18705 | { // disjunction 'if' disjunction 'else' expression |
18706 | if (p->error_indicator) { |
18707 | p->call_invalid_rules = _prev_call_invalid; |
18708 | p->level--; |
18709 | return NULL; |
18710 | } |
18711 | D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression" )); |
18712 | Token * _keyword; |
18713 | Token * _keyword_1; |
18714 | expr_ty a; |
18715 | expr_ty b; |
18716 | expr_ty c; |
18717 | if ( |
18718 | (a = disjunction_rule(p)) // disjunction |
18719 | && |
18720 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
18721 | && |
18722 | (b = disjunction_rule(p)) // disjunction |
18723 | && |
18724 | (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else' |
18725 | && |
18726 | (c = expression_rule(p)) // expression |
18727 | ) |
18728 | { |
18729 | D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression" )); |
18730 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18731 | if (_token == NULL) { |
18732 | p->call_invalid_rules = _prev_call_invalid; |
18733 | p->level--; |
18734 | return NULL; |
18735 | } |
18736 | int _end_lineno = _token->end_lineno; |
18737 | UNUSED(_end_lineno); // Only used by EXTRA macro |
18738 | int _end_col_offset = _token->end_col_offset; |
18739 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18740 | _res = _PyAST_IfExp ( b , a , c , EXTRA ); |
18741 | if (_res == NULL && PyErr_Occurred()) { |
18742 | p->error_indicator = 1; |
18743 | p->call_invalid_rules = _prev_call_invalid; |
18744 | p->level--; |
18745 | return NULL; |
18746 | } |
18747 | goto done; |
18748 | } |
18749 | p->mark = _mark; |
18750 | D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n" , p->level, ' ', |
18751 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "disjunction 'if' disjunction 'else' expression" )); |
18752 | } |
18753 | { // disjunction |
18754 | if (p->error_indicator) { |
18755 | p->call_invalid_rules = _prev_call_invalid; |
18756 | p->level--; |
18757 | return NULL; |
18758 | } |
18759 | D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "disjunction" )); |
18760 | expr_ty disjunction_var; |
18761 | if ( |
18762 | (disjunction_var = disjunction_rule(p)) // disjunction |
18763 | ) |
18764 | { |
18765 | D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "disjunction" )); |
18766 | _res = disjunction_var; |
18767 | goto done; |
18768 | } |
18769 | p->mark = _mark; |
18770 | D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n" , p->level, ' ', |
18771 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "disjunction" )); |
18772 | } |
18773 | { // lambdef |
18774 | if (p->error_indicator) { |
18775 | p->call_invalid_rules = _prev_call_invalid; |
18776 | p->level--; |
18777 | return NULL; |
18778 | } |
18779 | D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambdef" )); |
18780 | expr_ty lambdef_var; |
18781 | if ( |
18782 | (lambdef_var = lambdef_rule(p)) // lambdef |
18783 | ) |
18784 | { |
18785 | D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambdef" )); |
18786 | _res = lambdef_var; |
18787 | goto done; |
18788 | } |
18789 | p->mark = _mark; |
18790 | D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n" , p->level, ' ', |
18791 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambdef" )); |
18792 | } |
18793 | _res = NULL; |
18794 | done: |
18795 | p->call_invalid_rules = _prev_call_invalid; |
18796 | p->level--; |
18797 | return _res; |
18798 | } |
18799 | |
18800 | // invalid_legacy_expression: NAME !'(' star_expressions |
18801 | static void * |
18802 | invalid_legacy_expression_rule(Parser *p) |
18803 | { |
18804 | if (p->level++ == MAXSTACK) { |
18805 | p->error_indicator = 1; |
18806 | PyErr_NoMemory(); |
18807 | } |
18808 | if (p->error_indicator) { |
18809 | p->level--; |
18810 | return NULL; |
18811 | } |
18812 | void * _res = NULL; |
18813 | int _mark = p->mark; |
18814 | { // NAME !'(' star_expressions |
18815 | if (p->error_indicator) { |
18816 | p->level--; |
18817 | return NULL; |
18818 | } |
18819 | D(fprintf(stderr, "%*c> invalid_legacy_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME !'(' star_expressions" )); |
18820 | expr_ty a; |
18821 | expr_ty b; |
18822 | if ( |
18823 | (a = _PyPegen_name_token(p)) // NAME |
18824 | && |
18825 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 7) // token='(' |
18826 | && |
18827 | (b = star_expressions_rule(p)) // star_expressions |
18828 | ) |
18829 | { |
18830 | D(fprintf(stderr, "%*c+ invalid_legacy_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME !'(' star_expressions" )); |
18831 | _res = _PyPegen_check_legacy_stmt ( p , a ) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Missing parentheses in call to '%U'. Did you mean %U(...)?" , a -> v . Name . id , a -> v . Name . id ) : NULL; |
18832 | if (_res == NULL && PyErr_Occurred()) { |
18833 | p->error_indicator = 1; |
18834 | p->level--; |
18835 | return NULL; |
18836 | } |
18837 | goto done; |
18838 | } |
18839 | p->mark = _mark; |
18840 | D(fprintf(stderr, "%*c%s invalid_legacy_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
18841 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME !'(' star_expressions" )); |
18842 | } |
18843 | _res = NULL; |
18844 | done: |
18845 | p->level--; |
18846 | return _res; |
18847 | } |
18848 | |
18849 | // invalid_expression: |
18850 | // | !(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid |
18851 | // | disjunction 'if' disjunction !('else' | ':') |
18852 | static void * |
18853 | invalid_expression_rule(Parser *p) |
18854 | { |
18855 | if (p->level++ == MAXSTACK) { |
18856 | p->error_indicator = 1; |
18857 | PyErr_NoMemory(); |
18858 | } |
18859 | if (p->error_indicator) { |
18860 | p->level--; |
18861 | return NULL; |
18862 | } |
18863 | void * _res = NULL; |
18864 | int _mark = p->mark; |
18865 | { // !(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid |
18866 | if (p->error_indicator) { |
18867 | p->level--; |
18868 | return NULL; |
18869 | } |
18870 | D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid" )); |
18871 | expr_ty a; |
18872 | expr_ty b; |
18873 | if ( |
18874 | _PyPegen_lookahead(0, _tmp_144_rule, p) |
18875 | && |
18876 | (a = disjunction_rule(p)) // disjunction |
18877 | && |
18878 | (b = expression_without_invalid_rule(p)) // expression_without_invalid |
18879 | ) |
18880 | { |
18881 | D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid" )); |
18882 | _res = _PyPegen_check_legacy_stmt ( p , a ) ? NULL : p -> tokens [ p -> mark - 1 ] -> level == 0 ? NULL : RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Perhaps you forgot a comma?" ); |
18883 | if (_res == NULL && PyErr_Occurred()) { |
18884 | p->error_indicator = 1; |
18885 | p->level--; |
18886 | return NULL; |
18887 | } |
18888 | goto done; |
18889 | } |
18890 | p->mark = _mark; |
18891 | D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
18892 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid" )); |
18893 | } |
18894 | { // disjunction 'if' disjunction !('else' | ':') |
18895 | if (p->error_indicator) { |
18896 | p->level--; |
18897 | return NULL; |
18898 | } |
18899 | D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')" )); |
18900 | Token * _keyword; |
18901 | expr_ty a; |
18902 | expr_ty b; |
18903 | if ( |
18904 | (a = disjunction_rule(p)) // disjunction |
18905 | && |
18906 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
18907 | && |
18908 | (b = disjunction_rule(p)) // disjunction |
18909 | && |
18910 | _PyPegen_lookahead(0, _tmp_145_rule, p) |
18911 | ) |
18912 | { |
18913 | D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')" )); |
18914 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expected 'else' after 'if' expression" ); |
18915 | if (_res == NULL && PyErr_Occurred()) { |
18916 | p->error_indicator = 1; |
18917 | p->level--; |
18918 | return NULL; |
18919 | } |
18920 | goto done; |
18921 | } |
18922 | p->mark = _mark; |
18923 | D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
18924 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')" )); |
18925 | } |
18926 | _res = NULL; |
18927 | done: |
18928 | p->level--; |
18929 | return _res; |
18930 | } |
18931 | |
18932 | // invalid_named_expression: |
18933 | // | expression ':=' expression |
18934 | // | NAME '=' bitwise_or !('=' | ':=') |
18935 | // | !(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=') |
18936 | static void * |
18937 | invalid_named_expression_rule(Parser *p) |
18938 | { |
18939 | if (p->level++ == MAXSTACK) { |
18940 | p->error_indicator = 1; |
18941 | PyErr_NoMemory(); |
18942 | } |
18943 | if (p->error_indicator) { |
18944 | p->level--; |
18945 | return NULL; |
18946 | } |
18947 | void * _res = NULL; |
18948 | if (_PyPegen_is_memoized(p, invalid_named_expression_type, &_res)) { |
18949 | p->level--; |
18950 | return _res; |
18951 | } |
18952 | int _mark = p->mark; |
18953 | { // expression ':=' expression |
18954 | if (p->error_indicator) { |
18955 | p->level--; |
18956 | return NULL; |
18957 | } |
18958 | D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression ':=' expression" )); |
18959 | Token * _literal; |
18960 | expr_ty a; |
18961 | expr_ty expression_var; |
18962 | if ( |
18963 | (a = expression_rule(p)) // expression |
18964 | && |
18965 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
18966 | && |
18967 | (expression_var = expression_rule(p)) // expression |
18968 | ) |
18969 | { |
18970 | D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression ':=' expression" )); |
18971 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) ); |
18972 | if (_res == NULL && PyErr_Occurred()) { |
18973 | p->error_indicator = 1; |
18974 | p->level--; |
18975 | return NULL; |
18976 | } |
18977 | goto done; |
18978 | } |
18979 | p->mark = _mark; |
18980 | D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
18981 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression ':=' expression" )); |
18982 | } |
18983 | { // NAME '=' bitwise_or !('=' | ':=') |
18984 | if (p->error_indicator) { |
18985 | p->level--; |
18986 | return NULL; |
18987 | } |
18988 | D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')" )); |
18989 | Token * _literal; |
18990 | expr_ty a; |
18991 | expr_ty b; |
18992 | if ( |
18993 | (a = _PyPegen_name_token(p)) // NAME |
18994 | && |
18995 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
18996 | && |
18997 | (b = bitwise_or_rule(p)) // bitwise_or |
18998 | && |
18999 | _PyPegen_lookahead(0, _tmp_146_rule, p) |
19000 | ) |
19001 | { |
19002 | D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')" )); |
19003 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" ); |
19004 | if (_res == NULL && PyErr_Occurred()) { |
19005 | p->error_indicator = 1; |
19006 | p->level--; |
19007 | return NULL; |
19008 | } |
19009 | goto done; |
19010 | } |
19011 | p->mark = _mark; |
19012 | D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
19013 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')" )); |
19014 | } |
19015 | { // !(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=') |
19016 | if (p->error_indicator) { |
19017 | p->level--; |
19018 | return NULL; |
19019 | } |
19020 | D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')" )); |
19021 | expr_ty a; |
19022 | Token * b; |
19023 | expr_ty bitwise_or_var; |
19024 | if ( |
19025 | _PyPegen_lookahead(0, _tmp_147_rule, p) |
19026 | && |
19027 | (a = bitwise_or_rule(p)) // bitwise_or |
19028 | && |
19029 | (b = _PyPegen_expect_token(p, 22)) // token='=' |
19030 | && |
19031 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
19032 | && |
19033 | _PyPegen_lookahead(0, _tmp_148_rule, p) |
19034 | ) |
19035 | { |
19036 | D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')" )); |
19037 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot assign to %s here. Maybe you meant '==' instead of '='?" , _PyPegen_get_expr_name ( a ) ); |
19038 | if (_res == NULL && PyErr_Occurred()) { |
19039 | p->error_indicator = 1; |
19040 | p->level--; |
19041 | return NULL; |
19042 | } |
19043 | goto done; |
19044 | } |
19045 | p->mark = _mark; |
19046 | D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n" , p->level, ' ', |
19047 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')" )); |
19048 | } |
19049 | _res = NULL; |
19050 | done: |
19051 | _PyPegen_insert_memo(p, _mark, invalid_named_expression_type, _res); |
19052 | p->level--; |
19053 | return _res; |
19054 | } |
19055 | |
19056 | // invalid_assignment: |
19057 | // | invalid_ann_assign_target ':' expression |
19058 | // | star_named_expression ',' star_named_expressions* ':' expression |
19059 | // | expression ':' expression |
19060 | // | ((star_targets '='))* star_expressions '=' |
19061 | // | ((star_targets '='))* yield_expr '=' |
19062 | // | star_expressions augassign (yield_expr | star_expressions) |
19063 | static void * |
19064 | invalid_assignment_rule(Parser *p) |
19065 | { |
19066 | if (p->level++ == MAXSTACK) { |
19067 | p->error_indicator = 1; |
19068 | PyErr_NoMemory(); |
19069 | } |
19070 | if (p->error_indicator) { |
19071 | p->level--; |
19072 | return NULL; |
19073 | } |
19074 | void * _res = NULL; |
19075 | int _mark = p->mark; |
19076 | { // invalid_ann_assign_target ':' expression |
19077 | if (p->error_indicator) { |
19078 | p->level--; |
19079 | return NULL; |
19080 | } |
19081 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression" )); |
19082 | Token * _literal; |
19083 | expr_ty a; |
19084 | expr_ty expression_var; |
19085 | if ( |
19086 | (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target |
19087 | && |
19088 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
19089 | && |
19090 | (expression_var = expression_rule(p)) // expression |
19091 | ) |
19092 | { |
19093 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression" )); |
19094 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not %s) can be annotated" , _PyPegen_get_expr_name ( a ) ); |
19095 | if (_res == NULL && PyErr_Occurred()) { |
19096 | p->error_indicator = 1; |
19097 | p->level--; |
19098 | return NULL; |
19099 | } |
19100 | goto done; |
19101 | } |
19102 | p->mark = _mark; |
19103 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n" , p->level, ' ', |
19104 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "invalid_ann_assign_target ':' expression" )); |
19105 | } |
19106 | { // star_named_expression ',' star_named_expressions* ':' expression |
19107 | if (p->error_indicator) { |
19108 | p->level--; |
19109 | return NULL; |
19110 | } |
19111 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression" )); |
19112 | Token * _literal; |
19113 | Token * _literal_1; |
19114 | asdl_seq * _loop0_149_var; |
19115 | expr_ty a; |
19116 | expr_ty expression_var; |
19117 | if ( |
19118 | (a = star_named_expression_rule(p)) // star_named_expression |
19119 | && |
19120 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
19121 | && |
19122 | (_loop0_149_var = _loop0_149_rule(p)) // star_named_expressions* |
19123 | && |
19124 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
19125 | && |
19126 | (expression_var = expression_rule(p)) // expression |
19127 | ) |
19128 | { |
19129 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression" )); |
19130 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" ); |
19131 | if (_res == NULL && PyErr_Occurred()) { |
19132 | p->error_indicator = 1; |
19133 | p->level--; |
19134 | return NULL; |
19135 | } |
19136 | goto done; |
19137 | } |
19138 | p->mark = _mark; |
19139 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n" , p->level, ' ', |
19140 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression" )); |
19141 | } |
19142 | { // expression ':' expression |
19143 | if (p->error_indicator) { |
19144 | p->level--; |
19145 | return NULL; |
19146 | } |
19147 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression ':' expression" )); |
19148 | Token * _literal; |
19149 | expr_ty a; |
19150 | expr_ty expression_var; |
19151 | if ( |
19152 | (a = expression_rule(p)) // expression |
19153 | && |
19154 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
19155 | && |
19156 | (expression_var = expression_rule(p)) // expression |
19157 | ) |
19158 | { |
19159 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression ':' expression" )); |
19160 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" ); |
19161 | if (_res == NULL && PyErr_Occurred()) { |
19162 | p->error_indicator = 1; |
19163 | p->level--; |
19164 | return NULL; |
19165 | } |
19166 | goto done; |
19167 | } |
19168 | p->mark = _mark; |
19169 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n" , p->level, ' ', |
19170 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression ':' expression" )); |
19171 | } |
19172 | { // ((star_targets '='))* star_expressions '=' |
19173 | if (p->error_indicator) { |
19174 | p->level--; |
19175 | return NULL; |
19176 | } |
19177 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='" )); |
19178 | Token * _literal; |
19179 | asdl_seq * _loop0_150_var; |
19180 | expr_ty a; |
19181 | if ( |
19182 | (_loop0_150_var = _loop0_150_rule(p)) // ((star_targets '='))* |
19183 | && |
19184 | (a = star_expressions_rule(p)) // star_expressions |
19185 | && |
19186 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
19187 | ) |
19188 | { |
19189 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='" )); |
19190 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a ); |
19191 | if (_res == NULL && PyErr_Occurred()) { |
19192 | p->error_indicator = 1; |
19193 | p->level--; |
19194 | return NULL; |
19195 | } |
19196 | goto done; |
19197 | } |
19198 | p->mark = _mark; |
19199 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n" , p->level, ' ', |
19200 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "((star_targets '='))* star_expressions '='" )); |
19201 | } |
19202 | { // ((star_targets '='))* yield_expr '=' |
19203 | if (p->error_indicator) { |
19204 | p->level--; |
19205 | return NULL; |
19206 | } |
19207 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='" )); |
19208 | Token * _literal; |
19209 | asdl_seq * _loop0_151_var; |
19210 | expr_ty a; |
19211 | if ( |
19212 | (_loop0_151_var = _loop0_151_rule(p)) // ((star_targets '='))* |
19213 | && |
19214 | (a = yield_expr_rule(p)) // yield_expr |
19215 | && |
19216 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
19217 | ) |
19218 | { |
19219 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='" )); |
19220 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" ); |
19221 | if (_res == NULL && PyErr_Occurred()) { |
19222 | p->error_indicator = 1; |
19223 | p->level--; |
19224 | return NULL; |
19225 | } |
19226 | goto done; |
19227 | } |
19228 | p->mark = _mark; |
19229 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n" , p->level, ' ', |
19230 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "((star_targets '='))* yield_expr '='" )); |
19231 | } |
19232 | { // star_expressions augassign (yield_expr | star_expressions) |
19233 | if (p->error_indicator) { |
19234 | p->level--; |
19235 | return NULL; |
19236 | } |
19237 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)" )); |
19238 | void *_tmp_152_var; |
19239 | expr_ty a; |
19240 | AugOperator* augassign_var; |
19241 | if ( |
19242 | (a = star_expressions_rule(p)) // star_expressions |
19243 | && |
19244 | (augassign_var = augassign_rule(p)) // augassign |
19245 | && |
19246 | (_tmp_152_var = _tmp_152_rule(p)) // yield_expr | star_expressions |
19247 | ) |
19248 | { |
19249 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)" )); |
19250 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) ); |
19251 | if (_res == NULL && PyErr_Occurred()) { |
19252 | p->error_indicator = 1; |
19253 | p->level--; |
19254 | return NULL; |
19255 | } |
19256 | goto done; |
19257 | } |
19258 | p->mark = _mark; |
19259 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n" , p->level, ' ', |
19260 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)" )); |
19261 | } |
19262 | _res = NULL; |
19263 | done: |
19264 | p->level--; |
19265 | return _res; |
19266 | } |
19267 | |
19268 | // invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')' |
19269 | static expr_ty |
19270 | invalid_ann_assign_target_rule(Parser *p) |
19271 | { |
19272 | if (p->level++ == MAXSTACK) { |
19273 | p->error_indicator = 1; |
19274 | PyErr_NoMemory(); |
19275 | } |
19276 | if (p->error_indicator) { |
19277 | p->level--; |
19278 | return NULL; |
19279 | } |
19280 | expr_ty _res = NULL; |
19281 | int _mark = p->mark; |
19282 | { // list |
19283 | if (p->error_indicator) { |
19284 | p->level--; |
19285 | return NULL; |
19286 | } |
19287 | D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "list" )); |
19288 | expr_ty list_var; |
19289 | if ( |
19290 | (list_var = list_rule(p)) // list |
19291 | ) |
19292 | { |
19293 | D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "list" )); |
19294 | _res = list_var; |
19295 | goto done; |
19296 | } |
19297 | p->mark = _mark; |
19298 | D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n" , p->level, ' ', |
19299 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "list" )); |
19300 | } |
19301 | { // tuple |
19302 | if (p->error_indicator) { |
19303 | p->level--; |
19304 | return NULL; |
19305 | } |
19306 | D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "tuple" )); |
19307 | expr_ty tuple_var; |
19308 | if ( |
19309 | (tuple_var = tuple_rule(p)) // tuple |
19310 | ) |
19311 | { |
19312 | D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "tuple" )); |
19313 | _res = tuple_var; |
19314 | goto done; |
19315 | } |
19316 | p->mark = _mark; |
19317 | D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n" , p->level, ' ', |
19318 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "tuple" )); |
19319 | } |
19320 | { // '(' invalid_ann_assign_target ')' |
19321 | if (p->error_indicator) { |
19322 | p->level--; |
19323 | return NULL; |
19324 | } |
19325 | D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'" )); |
19326 | Token * _literal; |
19327 | Token * _literal_1; |
19328 | expr_ty a; |
19329 | if ( |
19330 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
19331 | && |
19332 | (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target |
19333 | && |
19334 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
19335 | ) |
19336 | { |
19337 | D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'" )); |
19338 | _res = a; |
19339 | if (_res == NULL && PyErr_Occurred()) { |
19340 | p->error_indicator = 1; |
19341 | p->level--; |
19342 | return NULL; |
19343 | } |
19344 | goto done; |
19345 | } |
19346 | p->mark = _mark; |
19347 | D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n" , p->level, ' ', |
19348 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' invalid_ann_assign_target ')'" )); |
19349 | } |
19350 | _res = NULL; |
19351 | done: |
19352 | p->level--; |
19353 | return _res; |
19354 | } |
19355 | |
19356 | // invalid_del_stmt: 'del' star_expressions |
19357 | static void * |
19358 | invalid_del_stmt_rule(Parser *p) |
19359 | { |
19360 | if (p->level++ == MAXSTACK) { |
19361 | p->error_indicator = 1; |
19362 | PyErr_NoMemory(); |
19363 | } |
19364 | if (p->error_indicator) { |
19365 | p->level--; |
19366 | return NULL; |
19367 | } |
19368 | void * _res = NULL; |
19369 | int _mark = p->mark; |
19370 | { // 'del' star_expressions |
19371 | if (p->error_indicator) { |
19372 | p->level--; |
19373 | return NULL; |
19374 | } |
19375 | D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'del' star_expressions" )); |
19376 | Token * _keyword; |
19377 | expr_ty a; |
19378 | if ( |
19379 | (_keyword = _PyPegen_expect_token(p, 503)) // token='del' |
19380 | && |
19381 | (a = star_expressions_rule(p)) // star_expressions |
19382 | ) |
19383 | { |
19384 | D(fprintf(stderr, "%*c+ invalid_del_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'del' star_expressions" )); |
19385 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a ); |
19386 | if (_res == NULL && PyErr_Occurred()) { |
19387 | p->error_indicator = 1; |
19388 | p->level--; |
19389 | return NULL; |
19390 | } |
19391 | goto done; |
19392 | } |
19393 | p->mark = _mark; |
19394 | D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
19395 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'del' star_expressions" )); |
19396 | } |
19397 | _res = NULL; |
19398 | done: |
19399 | p->level--; |
19400 | return _res; |
19401 | } |
19402 | |
19403 | // invalid_block: NEWLINE !INDENT |
19404 | static void * |
19405 | invalid_block_rule(Parser *p) |
19406 | { |
19407 | if (p->level++ == MAXSTACK) { |
19408 | p->error_indicator = 1; |
19409 | PyErr_NoMemory(); |
19410 | } |
19411 | if (p->error_indicator) { |
19412 | p->level--; |
19413 | return NULL; |
19414 | } |
19415 | void * _res = NULL; |
19416 | int _mark = p->mark; |
19417 | { // NEWLINE !INDENT |
19418 | if (p->error_indicator) { |
19419 | p->level--; |
19420 | return NULL; |
19421 | } |
19422 | D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NEWLINE !INDENT" )); |
19423 | Token * newline_var; |
19424 | if ( |
19425 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
19426 | && |
19427 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
19428 | ) |
19429 | { |
19430 | D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NEWLINE !INDENT" )); |
19431 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block" ); |
19432 | if (_res == NULL && PyErr_Occurred()) { |
19433 | p->error_indicator = 1; |
19434 | p->level--; |
19435 | return NULL; |
19436 | } |
19437 | goto done; |
19438 | } |
19439 | p->mark = _mark; |
19440 | D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n" , p->level, ' ', |
19441 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NEWLINE !INDENT" )); |
19442 | } |
19443 | _res = NULL; |
19444 | done: |
19445 | p->level--; |
19446 | return _res; |
19447 | } |
19448 | |
19449 | // invalid_comprehension: |
19450 | // | ('[' | '(' | '{') starred_expression for_if_clauses |
19451 | // | ('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses |
19452 | // | ('[' | '{') star_named_expression ',' for_if_clauses |
19453 | static void * |
19454 | invalid_comprehension_rule(Parser *p) |
19455 | { |
19456 | if (p->level++ == MAXSTACK) { |
19457 | p->error_indicator = 1; |
19458 | PyErr_NoMemory(); |
19459 | } |
19460 | if (p->error_indicator) { |
19461 | p->level--; |
19462 | return NULL; |
19463 | } |
19464 | void * _res = NULL; |
19465 | int _mark = p->mark; |
19466 | { // ('[' | '(' | '{') starred_expression for_if_clauses |
19467 | if (p->error_indicator) { |
19468 | p->level--; |
19469 | return NULL; |
19470 | } |
19471 | D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses" )); |
19472 | void *_tmp_153_var; |
19473 | expr_ty a; |
19474 | asdl_comprehension_seq* for_if_clauses_var; |
19475 | if ( |
19476 | (_tmp_153_var = _tmp_153_rule(p)) // '[' | '(' | '{' |
19477 | && |
19478 | (a = starred_expression_rule(p)) // starred_expression |
19479 | && |
19480 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
19481 | ) |
19482 | { |
19483 | D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses" )); |
19484 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" ); |
19485 | if (_res == NULL && PyErr_Occurred()) { |
19486 | p->error_indicator = 1; |
19487 | p->level--; |
19488 | return NULL; |
19489 | } |
19490 | goto done; |
19491 | } |
19492 | p->mark = _mark; |
19493 | D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n" , p->level, ' ', |
19494 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses" )); |
19495 | } |
19496 | { // ('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses |
19497 | if (p->error_indicator) { |
19498 | p->level--; |
19499 | return NULL; |
19500 | } |
19501 | D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses" )); |
19502 | Token * _literal; |
19503 | void *_tmp_154_var; |
19504 | expr_ty a; |
19505 | asdl_expr_seq* b; |
19506 | asdl_comprehension_seq* for_if_clauses_var; |
19507 | if ( |
19508 | (_tmp_154_var = _tmp_154_rule(p)) // '[' | '{' |
19509 | && |
19510 | (a = star_named_expression_rule(p)) // star_named_expression |
19511 | && |
19512 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
19513 | && |
19514 | (b = star_named_expressions_rule(p)) // star_named_expressions |
19515 | && |
19516 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
19517 | ) |
19518 | { |
19519 | D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses" )); |
19520 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , PyPegen_last_item ( b , expr_ty ) , "did you forget parentheses around the comprehension target?" ); |
19521 | if (_res == NULL && PyErr_Occurred()) { |
19522 | p->error_indicator = 1; |
19523 | p->level--; |
19524 | return NULL; |
19525 | } |
19526 | goto done; |
19527 | } |
19528 | p->mark = _mark; |
19529 | D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n" , p->level, ' ', |
19530 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses" )); |
19531 | } |
19532 | { // ('[' | '{') star_named_expression ',' for_if_clauses |
19533 | if (p->error_indicator) { |
19534 | p->level--; |
19535 | return NULL; |
19536 | } |
19537 | D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses" )); |
19538 | void *_tmp_155_var; |
19539 | expr_ty a; |
19540 | Token * b; |
19541 | asdl_comprehension_seq* for_if_clauses_var; |
19542 | if ( |
19543 | (_tmp_155_var = _tmp_155_rule(p)) // '[' | '{' |
19544 | && |
19545 | (a = star_named_expression_rule(p)) // star_named_expression |
19546 | && |
19547 | (b = _PyPegen_expect_token(p, 12)) // token=',' |
19548 | && |
19549 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
19550 | ) |
19551 | { |
19552 | D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses" )); |
19553 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "did you forget parentheses around the comprehension target?" ); |
19554 | if (_res == NULL && PyErr_Occurred()) { |
19555 | p->error_indicator = 1; |
19556 | p->level--; |
19557 | return NULL; |
19558 | } |
19559 | goto done; |
19560 | } |
19561 | p->mark = _mark; |
19562 | D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n" , p->level, ' ', |
19563 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses" )); |
19564 | } |
19565 | _res = NULL; |
19566 | done: |
19567 | p->level--; |
19568 | return _res; |
19569 | } |
19570 | |
19571 | // invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}' |
19572 | static void * |
19573 | invalid_dict_comprehension_rule(Parser *p) |
19574 | { |
19575 | if (p->level++ == MAXSTACK) { |
19576 | p->error_indicator = 1; |
19577 | PyErr_NoMemory(); |
19578 | } |
19579 | if (p->error_indicator) { |
19580 | p->level--; |
19581 | return NULL; |
19582 | } |
19583 | void * _res = NULL; |
19584 | int _mark = p->mark; |
19585 | { // '{' '**' bitwise_or for_if_clauses '}' |
19586 | if (p->error_indicator) { |
19587 | p->level--; |
19588 | return NULL; |
19589 | } |
19590 | D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'" )); |
19591 | Token * _literal; |
19592 | Token * _literal_1; |
19593 | Token * a; |
19594 | expr_ty bitwise_or_var; |
19595 | asdl_comprehension_seq* for_if_clauses_var; |
19596 | if ( |
19597 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
19598 | && |
19599 | (a = _PyPegen_expect_token(p, 35)) // token='**' |
19600 | && |
19601 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
19602 | && |
19603 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
19604 | && |
19605 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
19606 | ) |
19607 | { |
19608 | D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'" )); |
19609 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" ); |
19610 | if (_res == NULL && PyErr_Occurred()) { |
19611 | p->error_indicator = 1; |
19612 | p->level--; |
19613 | return NULL; |
19614 | } |
19615 | goto done; |
19616 | } |
19617 | p->mark = _mark; |
19618 | D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n" , p->level, ' ', |
19619 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'" )); |
19620 | } |
19621 | _res = NULL; |
19622 | done: |
19623 | p->level--; |
19624 | return _res; |
19625 | } |
19626 | |
19627 | // invalid_parameters: param_no_default* invalid_parameters_helper param_no_default |
19628 | static void * |
19629 | invalid_parameters_rule(Parser *p) |
19630 | { |
19631 | if (p->level++ == MAXSTACK) { |
19632 | p->error_indicator = 1; |
19633 | PyErr_NoMemory(); |
19634 | } |
19635 | if (p->error_indicator) { |
19636 | p->level--; |
19637 | return NULL; |
19638 | } |
19639 | void * _res = NULL; |
19640 | int _mark = p->mark; |
19641 | { // param_no_default* invalid_parameters_helper param_no_default |
19642 | if (p->error_indicator) { |
19643 | p->level--; |
19644 | return NULL; |
19645 | } |
19646 | D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default* invalid_parameters_helper param_no_default" )); |
19647 | asdl_seq * _loop0_156_var; |
19648 | arg_ty a; |
19649 | void *invalid_parameters_helper_var; |
19650 | if ( |
19651 | (_loop0_156_var = _loop0_156_rule(p)) // param_no_default* |
19652 | && |
19653 | (invalid_parameters_helper_var = invalid_parameters_helper_rule(p)) // invalid_parameters_helper |
19654 | && |
19655 | (a = param_no_default_rule(p)) // param_no_default |
19656 | ) |
19657 | { |
19658 | D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param_no_default* invalid_parameters_helper param_no_default" )); |
19659 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "non-default argument follows default argument" ); |
19660 | if (_res == NULL && PyErr_Occurred()) { |
19661 | p->error_indicator = 1; |
19662 | p->level--; |
19663 | return NULL; |
19664 | } |
19665 | goto done; |
19666 | } |
19667 | p->mark = _mark; |
19668 | D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n" , p->level, ' ', |
19669 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default* invalid_parameters_helper param_no_default" )); |
19670 | } |
19671 | _res = NULL; |
19672 | done: |
19673 | p->level--; |
19674 | return _res; |
19675 | } |
19676 | |
19677 | // invalid_parameters_helper: slash_with_default | param_with_default+ |
19678 | static void * |
19679 | invalid_parameters_helper_rule(Parser *p) |
19680 | { |
19681 | if (p->level++ == MAXSTACK) { |
19682 | p->error_indicator = 1; |
19683 | PyErr_NoMemory(); |
19684 | } |
19685 | if (p->error_indicator) { |
19686 | p->level--; |
19687 | return NULL; |
19688 | } |
19689 | void * _res = NULL; |
19690 | int _mark = p->mark; |
19691 | { // slash_with_default |
19692 | if (p->error_indicator) { |
19693 | p->level--; |
19694 | return NULL; |
19695 | } |
19696 | D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "slash_with_default" )); |
19697 | SlashWithDefault* a; |
19698 | if ( |
19699 | (a = slash_with_default_rule(p)) // slash_with_default |
19700 | ) |
19701 | { |
19702 | D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "slash_with_default" )); |
19703 | _res = _PyPegen_singleton_seq ( p , a ); |
19704 | if (_res == NULL && PyErr_Occurred()) { |
19705 | p->error_indicator = 1; |
19706 | p->level--; |
19707 | return NULL; |
19708 | } |
19709 | goto done; |
19710 | } |
19711 | p->mark = _mark; |
19712 | D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n" , p->level, ' ', |
19713 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "slash_with_default" )); |
19714 | } |
19715 | { // param_with_default+ |
19716 | if (p->error_indicator) { |
19717 | p->level--; |
19718 | return NULL; |
19719 | } |
19720 | D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_with_default+" )); |
19721 | asdl_seq * _loop1_157_var; |
19722 | if ( |
19723 | (_loop1_157_var = _loop1_157_rule(p)) // param_with_default+ |
19724 | ) |
19725 | { |
19726 | D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "param_with_default+" )); |
19727 | _res = _loop1_157_var; |
19728 | goto done; |
19729 | } |
19730 | p->mark = _mark; |
19731 | D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n" , p->level, ' ', |
19732 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_with_default+" )); |
19733 | } |
19734 | _res = NULL; |
19735 | done: |
19736 | p->level--; |
19737 | return _res; |
19738 | } |
19739 | |
19740 | // invalid_lambda_parameters: |
19741 | // | lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default |
19742 | static void * |
19743 | invalid_lambda_parameters_rule(Parser *p) |
19744 | { |
19745 | if (p->level++ == MAXSTACK) { |
19746 | p->error_indicator = 1; |
19747 | PyErr_NoMemory(); |
19748 | } |
19749 | if (p->error_indicator) { |
19750 | p->level--; |
19751 | return NULL; |
19752 | } |
19753 | void * _res = NULL; |
19754 | int _mark = p->mark; |
19755 | { // lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default |
19756 | if (p->error_indicator) { |
19757 | p->level--; |
19758 | return NULL; |
19759 | } |
19760 | D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default" )); |
19761 | asdl_seq * _loop0_158_var; |
19762 | arg_ty a; |
19763 | void *invalid_lambda_parameters_helper_var; |
19764 | if ( |
19765 | (_loop0_158_var = _loop0_158_rule(p)) // lambda_param_no_default* |
19766 | && |
19767 | (invalid_lambda_parameters_helper_var = invalid_lambda_parameters_helper_rule(p)) // invalid_lambda_parameters_helper |
19768 | && |
19769 | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
19770 | ) |
19771 | { |
19772 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default" )); |
19773 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "non-default argument follows default argument" ); |
19774 | if (_res == NULL && PyErr_Occurred()) { |
19775 | p->error_indicator = 1; |
19776 | p->level--; |
19777 | return NULL; |
19778 | } |
19779 | goto done; |
19780 | } |
19781 | p->mark = _mark; |
19782 | D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n" , p->level, ' ', |
19783 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default" )); |
19784 | } |
19785 | _res = NULL; |
19786 | done: |
19787 | p->level--; |
19788 | return _res; |
19789 | } |
19790 | |
19791 | // invalid_lambda_parameters_helper: |
19792 | // | lambda_slash_with_default |
19793 | // | lambda_param_with_default+ |
19794 | static void * |
19795 | invalid_lambda_parameters_helper_rule(Parser *p) |
19796 | { |
19797 | if (p->level++ == MAXSTACK) { |
19798 | p->error_indicator = 1; |
19799 | PyErr_NoMemory(); |
19800 | } |
19801 | if (p->error_indicator) { |
19802 | p->level--; |
19803 | return NULL; |
19804 | } |
19805 | void * _res = NULL; |
19806 | int _mark = p->mark; |
19807 | { // lambda_slash_with_default |
19808 | if (p->error_indicator) { |
19809 | p->level--; |
19810 | return NULL; |
19811 | } |
19812 | D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_slash_with_default" )); |
19813 | SlashWithDefault* a; |
19814 | if ( |
19815 | (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default |
19816 | ) |
19817 | { |
19818 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_slash_with_default" )); |
19819 | _res = _PyPegen_singleton_seq ( p , a ); |
19820 | if (_res == NULL && PyErr_Occurred()) { |
19821 | p->error_indicator = 1; |
19822 | p->level--; |
19823 | return NULL; |
19824 | } |
19825 | goto done; |
19826 | } |
19827 | p->mark = _mark; |
19828 | D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n" , p->level, ' ', |
19829 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_slash_with_default" )); |
19830 | } |
19831 | { // lambda_param_with_default+ |
19832 | if (p->error_indicator) { |
19833 | p->level--; |
19834 | return NULL; |
19835 | } |
19836 | D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_with_default+" )); |
19837 | asdl_seq * _loop1_159_var; |
19838 | if ( |
19839 | (_loop1_159_var = _loop1_159_rule(p)) // lambda_param_with_default+ |
19840 | ) |
19841 | { |
19842 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "lambda_param_with_default+" )); |
19843 | _res = _loop1_159_var; |
19844 | goto done; |
19845 | } |
19846 | p->mark = _mark; |
19847 | D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n" , p->level, ' ', |
19848 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_with_default+" )); |
19849 | } |
19850 | _res = NULL; |
19851 | done: |
19852 | p->level--; |
19853 | return _res; |
19854 | } |
19855 | |
19856 | // invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT |
19857 | static void * |
19858 | invalid_star_etc_rule(Parser *p) |
19859 | { |
19860 | if (p->level++ == MAXSTACK) { |
19861 | p->error_indicator = 1; |
19862 | PyErr_NoMemory(); |
19863 | } |
19864 | if (p->error_indicator) { |
19865 | p->level--; |
19866 | return NULL; |
19867 | } |
19868 | void * _res = NULL; |
19869 | int _mark = p->mark; |
19870 | { // '*' (')' | ',' (')' | '**')) |
19871 | if (p->error_indicator) { |
19872 | p->level--; |
19873 | return NULL; |
19874 | } |
19875 | D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))" )); |
19876 | void *_tmp_160_var; |
19877 | Token * a; |
19878 | if ( |
19879 | (a = _PyPegen_expect_token(p, 16)) // token='*' |
19880 | && |
19881 | (_tmp_160_var = _tmp_160_rule(p)) // ')' | ',' (')' | '**') |
19882 | ) |
19883 | { |
19884 | D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))" )); |
19885 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "named arguments must follow bare *" ); |
19886 | if (_res == NULL && PyErr_Occurred()) { |
19887 | p->error_indicator = 1; |
19888 | p->level--; |
19889 | return NULL; |
19890 | } |
19891 | goto done; |
19892 | } |
19893 | p->mark = _mark; |
19894 | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n" , p->level, ' ', |
19895 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' (')' | ',' (')' | '**'))" )); |
19896 | } |
19897 | { // '*' ',' TYPE_COMMENT |
19898 | if (p->error_indicator) { |
19899 | p->level--; |
19900 | return NULL; |
19901 | } |
19902 | D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT" )); |
19903 | Token * _literal; |
19904 | Token * _literal_1; |
19905 | Token * ; |
19906 | if ( |
19907 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
19908 | && |
19909 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
19910 | && |
19911 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
19912 | ) |
19913 | { |
19914 | D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT" )); |
19915 | _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" ); |
19916 | if (_res == NULL && PyErr_Occurred()) { |
19917 | p->error_indicator = 1; |
19918 | p->level--; |
19919 | return NULL; |
19920 | } |
19921 | goto done; |
19922 | } |
19923 | p->mark = _mark; |
19924 | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n" , p->level, ' ', |
19925 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' ',' TYPE_COMMENT" )); |
19926 | } |
19927 | _res = NULL; |
19928 | done: |
19929 | p->level--; |
19930 | return _res; |
19931 | } |
19932 | |
19933 | // invalid_lambda_star_etc: '*' (':' | ',' (':' | '**')) |
19934 | static void * |
19935 | invalid_lambda_star_etc_rule(Parser *p) |
19936 | { |
19937 | if (p->level++ == MAXSTACK) { |
19938 | p->error_indicator = 1; |
19939 | PyErr_NoMemory(); |
19940 | } |
19941 | if (p->error_indicator) { |
19942 | p->level--; |
19943 | return NULL; |
19944 | } |
19945 | void * _res = NULL; |
19946 | int _mark = p->mark; |
19947 | { // '*' (':' | ',' (':' | '**')) |
19948 | if (p->error_indicator) { |
19949 | p->level--; |
19950 | return NULL; |
19951 | } |
19952 | D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))" )); |
19953 | Token * _literal; |
19954 | void *_tmp_161_var; |
19955 | if ( |
19956 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
19957 | && |
19958 | (_tmp_161_var = _tmp_161_rule(p)) // ':' | ',' (':' | '**') |
19959 | ) |
19960 | { |
19961 | D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))" )); |
19962 | _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); |
19963 | if (_res == NULL && PyErr_Occurred()) { |
19964 | p->error_indicator = 1; |
19965 | p->level--; |
19966 | return NULL; |
19967 | } |
19968 | goto done; |
19969 | } |
19970 | p->mark = _mark; |
19971 | D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n" , p->level, ' ', |
19972 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'*' (':' | ',' (':' | '**'))" )); |
19973 | } |
19974 | _res = NULL; |
19975 | done: |
19976 | p->level--; |
19977 | return _res; |
19978 | } |
19979 | |
19980 | // invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT |
19981 | static void * |
19982 | (Parser *p) |
19983 | { |
19984 | if (p->level++ == MAXSTACK) { |
19985 | p->error_indicator = 1; |
19986 | PyErr_NoMemory(); |
19987 | } |
19988 | if (p->error_indicator) { |
19989 | p->level--; |
19990 | return NULL; |
19991 | } |
19992 | void * _res = NULL; |
19993 | int _mark = p->mark; |
19994 | { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT |
19995 | if (p->error_indicator) { |
19996 | p->level--; |
19997 | return NULL; |
19998 | } |
19999 | D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT" )); |
20000 | Token * indent_var; |
20001 | Token * newline_var; |
20002 | Token * newline_var_1; |
20003 | Token * ; |
20004 | Token * ; |
20005 | if ( |
20006 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
20007 | && |
20008 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20009 | && |
20010 | (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
20011 | && |
20012 | (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20013 | && |
20014 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
20015 | ) |
20016 | { |
20017 | D(fprintf(stderr, "%*c+ invalid_double_type_comments[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT" )); |
20018 | _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" ); |
20019 | if (_res == NULL && PyErr_Occurred()) { |
20020 | p->error_indicator = 1; |
20021 | p->level--; |
20022 | return NULL; |
20023 | } |
20024 | goto done; |
20025 | } |
20026 | p->mark = _mark; |
20027 | D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n" , p->level, ' ', |
20028 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT" )); |
20029 | } |
20030 | _res = NULL; |
20031 | done: |
20032 | p->level--; |
20033 | return _res; |
20034 | } |
20035 | |
20036 | // invalid_with_item: expression 'as' expression &(',' | ')' | ':') |
20037 | static void * |
20038 | invalid_with_item_rule(Parser *p) |
20039 | { |
20040 | if (p->level++ == MAXSTACK) { |
20041 | p->error_indicator = 1; |
20042 | PyErr_NoMemory(); |
20043 | } |
20044 | if (p->error_indicator) { |
20045 | p->level--; |
20046 | return NULL; |
20047 | } |
20048 | void * _res = NULL; |
20049 | int _mark = p->mark; |
20050 | { // expression 'as' expression &(',' | ')' | ':') |
20051 | if (p->error_indicator) { |
20052 | p->level--; |
20053 | return NULL; |
20054 | } |
20055 | D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')" )); |
20056 | Token * _keyword; |
20057 | expr_ty a; |
20058 | expr_ty expression_var; |
20059 | if ( |
20060 | (expression_var = expression_rule(p)) // expression |
20061 | && |
20062 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
20063 | && |
20064 | (a = expression_rule(p)) // expression |
20065 | && |
20066 | _PyPegen_lookahead(1, _tmp_162_rule, p) |
20067 | ) |
20068 | { |
20069 | D(fprintf(stderr, "%*c+ invalid_with_item[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')" )); |
20070 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a ); |
20071 | if (_res == NULL && PyErr_Occurred()) { |
20072 | p->error_indicator = 1; |
20073 | p->level--; |
20074 | return NULL; |
20075 | } |
20076 | goto done; |
20077 | } |
20078 | p->mark = _mark; |
20079 | D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n" , p->level, ' ', |
20080 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')" )); |
20081 | } |
20082 | _res = NULL; |
20083 | done: |
20084 | p->level--; |
20085 | return _res; |
20086 | } |
20087 | |
20088 | // invalid_for_target: ASYNC? 'for' star_expressions |
20089 | static void * |
20090 | invalid_for_target_rule(Parser *p) |
20091 | { |
20092 | if (p->level++ == MAXSTACK) { |
20093 | p->error_indicator = 1; |
20094 | PyErr_NoMemory(); |
20095 | } |
20096 | if (p->error_indicator) { |
20097 | p->level--; |
20098 | return NULL; |
20099 | } |
20100 | void * _res = NULL; |
20101 | int _mark = p->mark; |
20102 | { // ASYNC? 'for' star_expressions |
20103 | if (p->error_indicator) { |
20104 | p->level--; |
20105 | return NULL; |
20106 | } |
20107 | D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions" )); |
20108 | Token * _keyword; |
20109 | void *_opt_var; |
20110 | UNUSED(_opt_var); // Silence compiler warnings |
20111 | expr_ty a; |
20112 | if ( |
20113 | (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? |
20114 | && |
20115 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
20116 | && |
20117 | (a = star_expressions_rule(p)) // star_expressions |
20118 | ) |
20119 | { |
20120 | D(fprintf(stderr, "%*c+ invalid_for_target[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions" )); |
20121 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a ); |
20122 | if (_res == NULL && PyErr_Occurred()) { |
20123 | p->error_indicator = 1; |
20124 | p->level--; |
20125 | return NULL; |
20126 | } |
20127 | goto done; |
20128 | } |
20129 | p->mark = _mark; |
20130 | D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n" , p->level, ' ', |
20131 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC? 'for' star_expressions" )); |
20132 | } |
20133 | _res = NULL; |
20134 | done: |
20135 | p->level--; |
20136 | return _res; |
20137 | } |
20138 | |
20139 | // invalid_group: '(' starred_expression ')' | '(' '**' expression ')' |
20140 | static void * |
20141 | invalid_group_rule(Parser *p) |
20142 | { |
20143 | if (p->level++ == MAXSTACK) { |
20144 | p->error_indicator = 1; |
20145 | PyErr_NoMemory(); |
20146 | } |
20147 | if (p->error_indicator) { |
20148 | p->level--; |
20149 | return NULL; |
20150 | } |
20151 | void * _res = NULL; |
20152 | int _mark = p->mark; |
20153 | { // '(' starred_expression ')' |
20154 | if (p->error_indicator) { |
20155 | p->level--; |
20156 | return NULL; |
20157 | } |
20158 | D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' starred_expression ')'" )); |
20159 | Token * _literal; |
20160 | Token * _literal_1; |
20161 | expr_ty a; |
20162 | if ( |
20163 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
20164 | && |
20165 | (a = starred_expression_rule(p)) // starred_expression |
20166 | && |
20167 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
20168 | ) |
20169 | { |
20170 | D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' starred_expression ')'" )); |
20171 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use starred expression here" ); |
20172 | if (_res == NULL && PyErr_Occurred()) { |
20173 | p->error_indicator = 1; |
20174 | p->level--; |
20175 | return NULL; |
20176 | } |
20177 | goto done; |
20178 | } |
20179 | p->mark = _mark; |
20180 | D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n" , p->level, ' ', |
20181 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' starred_expression ')'" )); |
20182 | } |
20183 | { // '(' '**' expression ')' |
20184 | if (p->error_indicator) { |
20185 | p->level--; |
20186 | return NULL; |
20187 | } |
20188 | D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' '**' expression ')'" )); |
20189 | Token * _literal; |
20190 | Token * _literal_1; |
20191 | Token * a; |
20192 | expr_ty expression_var; |
20193 | if ( |
20194 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
20195 | && |
20196 | (a = _PyPegen_expect_token(p, 35)) // token='**' |
20197 | && |
20198 | (expression_var = expression_rule(p)) // expression |
20199 | && |
20200 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
20201 | ) |
20202 | { |
20203 | D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' '**' expression ')'" )); |
20204 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use double starred expression here" ); |
20205 | if (_res == NULL && PyErr_Occurred()) { |
20206 | p->error_indicator = 1; |
20207 | p->level--; |
20208 | return NULL; |
20209 | } |
20210 | goto done; |
20211 | } |
20212 | p->mark = _mark; |
20213 | D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n" , p->level, ' ', |
20214 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' '**' expression ')'" )); |
20215 | } |
20216 | _res = NULL; |
20217 | done: |
20218 | p->level--; |
20219 | return _res; |
20220 | } |
20221 | |
20222 | // invalid_import_from_targets: import_from_as_names ',' NEWLINE |
20223 | static void * |
20224 | invalid_import_from_targets_rule(Parser *p) |
20225 | { |
20226 | if (p->level++ == MAXSTACK) { |
20227 | p->error_indicator = 1; |
20228 | PyErr_NoMemory(); |
20229 | } |
20230 | if (p->error_indicator) { |
20231 | p->level--; |
20232 | return NULL; |
20233 | } |
20234 | void * _res = NULL; |
20235 | int _mark = p->mark; |
20236 | { // import_from_as_names ',' NEWLINE |
20237 | if (p->error_indicator) { |
20238 | p->level--; |
20239 | return NULL; |
20240 | } |
20241 | D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE" )); |
20242 | Token * _literal; |
20243 | asdl_alias_seq* import_from_as_names_var; |
20244 | Token * newline_var; |
20245 | if ( |
20246 | (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names |
20247 | && |
20248 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
20249 | && |
20250 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20251 | ) |
20252 | { |
20253 | D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE" )); |
20254 | _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" ); |
20255 | if (_res == NULL && PyErr_Occurred()) { |
20256 | p->error_indicator = 1; |
20257 | p->level--; |
20258 | return NULL; |
20259 | } |
20260 | goto done; |
20261 | } |
20262 | p->mark = _mark; |
20263 | D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n" , p->level, ' ', |
20264 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "import_from_as_names ',' NEWLINE" )); |
20265 | } |
20266 | _res = NULL; |
20267 | done: |
20268 | p->level--; |
20269 | return _res; |
20270 | } |
20271 | |
20272 | // invalid_with_stmt: |
20273 | // | ASYNC? 'with' ','.(expression ['as' star_target])+ &&':' |
20274 | // | ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':' |
20275 | static void * |
20276 | invalid_with_stmt_rule(Parser *p) |
20277 | { |
20278 | if (p->level++ == MAXSTACK) { |
20279 | p->error_indicator = 1; |
20280 | PyErr_NoMemory(); |
20281 | } |
20282 | if (p->error_indicator) { |
20283 | p->level--; |
20284 | return NULL; |
20285 | } |
20286 | void * _res = NULL; |
20287 | int _mark = p->mark; |
20288 | { // ASYNC? 'with' ','.(expression ['as' star_target])+ &&':' |
20289 | if (p->error_indicator) { |
20290 | p->level--; |
20291 | return NULL; |
20292 | } |
20293 | D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'" )); |
20294 | asdl_seq * _gather_163_var; |
20295 | Token * _keyword; |
20296 | Token * _literal; |
20297 | void *_opt_var; |
20298 | UNUSED(_opt_var); // Silence compiler warnings |
20299 | if ( |
20300 | (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? |
20301 | && |
20302 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
20303 | && |
20304 | (_gather_163_var = _gather_163_rule(p)) // ','.(expression ['as' star_target])+ |
20305 | && |
20306 | (_literal = _PyPegen_expect_forced_token(p, 11, ":" )) // forced_token=':' |
20307 | ) |
20308 | { |
20309 | D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'" )); |
20310 | _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _gather_163_var, _literal); |
20311 | goto done; |
20312 | } |
20313 | p->mark = _mark; |
20314 | D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
20315 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'" )); |
20316 | } |
20317 | { // ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':' |
20318 | if (p->error_indicator) { |
20319 | p->level--; |
20320 | return NULL; |
20321 | } |
20322 | D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'" )); |
20323 | asdl_seq * _gather_165_var; |
20324 | Token * _keyword; |
20325 | Token * _literal; |
20326 | Token * _literal_1; |
20327 | Token * _literal_2; |
20328 | void *_opt_var; |
20329 | UNUSED(_opt_var); // Silence compiler warnings |
20330 | void *_opt_var_1; |
20331 | UNUSED(_opt_var_1); // Silence compiler warnings |
20332 | if ( |
20333 | (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? |
20334 | && |
20335 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
20336 | && |
20337 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
20338 | && |
20339 | (_gather_165_var = _gather_165_rule(p)) // ','.(expressions ['as' star_target])+ |
20340 | && |
20341 | (_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
20342 | && |
20343 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
20344 | && |
20345 | (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":" )) // forced_token=':' |
20346 | ) |
20347 | { |
20348 | D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'" )); |
20349 | _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _literal, _gather_165_var, _opt_var_1, _literal_1, _literal_2); |
20350 | goto done; |
20351 | } |
20352 | p->mark = _mark; |
20353 | D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
20354 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'" )); |
20355 | } |
20356 | _res = NULL; |
20357 | done: |
20358 | p->level--; |
20359 | return _res; |
20360 | } |
20361 | |
20362 | // invalid_with_stmt_indent: |
20363 | // | ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT |
20364 | // | ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT |
20365 | static void * |
20366 | invalid_with_stmt_indent_rule(Parser *p) |
20367 | { |
20368 | if (p->level++ == MAXSTACK) { |
20369 | p->error_indicator = 1; |
20370 | PyErr_NoMemory(); |
20371 | } |
20372 | if (p->error_indicator) { |
20373 | p->level--; |
20374 | return NULL; |
20375 | } |
20376 | void * _res = NULL; |
20377 | int _mark = p->mark; |
20378 | { // ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT |
20379 | if (p->error_indicator) { |
20380 | p->level--; |
20381 | return NULL; |
20382 | } |
20383 | D(fprintf(stderr, "%*c> invalid_with_stmt_indent[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT" )); |
20384 | asdl_seq * _gather_167_var; |
20385 | Token * _literal; |
20386 | void *_opt_var; |
20387 | UNUSED(_opt_var); // Silence compiler warnings |
20388 | Token * a; |
20389 | Token * newline_var; |
20390 | if ( |
20391 | (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? |
20392 | && |
20393 | (a = _PyPegen_expect_token(p, 519)) // token='with' |
20394 | && |
20395 | (_gather_167_var = _gather_167_rule(p)) // ','.(expression ['as' star_target])+ |
20396 | && |
20397 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
20398 | && |
20399 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20400 | && |
20401 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
20402 | ) |
20403 | { |
20404 | D(fprintf(stderr, "%*c+ invalid_with_stmt_indent[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT" )); |
20405 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'with' statement on line %d" , a -> lineno ); |
20406 | if (_res == NULL && PyErr_Occurred()) { |
20407 | p->error_indicator = 1; |
20408 | p->level--; |
20409 | return NULL; |
20410 | } |
20411 | goto done; |
20412 | } |
20413 | p->mark = _mark; |
20414 | D(fprintf(stderr, "%*c%s invalid_with_stmt_indent[%d-%d]: %s failed!\n" , p->level, ' ', |
20415 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT" )); |
20416 | } |
20417 | { // ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT |
20418 | if (p->error_indicator) { |
20419 | p->level--; |
20420 | return NULL; |
20421 | } |
20422 | D(fprintf(stderr, "%*c> invalid_with_stmt_indent[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT" )); |
20423 | asdl_seq * _gather_169_var; |
20424 | Token * _literal; |
20425 | Token * _literal_1; |
20426 | Token * _literal_2; |
20427 | void *_opt_var; |
20428 | UNUSED(_opt_var); // Silence compiler warnings |
20429 | void *_opt_var_1; |
20430 | UNUSED(_opt_var_1); // Silence compiler warnings |
20431 | Token * a; |
20432 | Token * newline_var; |
20433 | if ( |
20434 | (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? |
20435 | && |
20436 | (a = _PyPegen_expect_token(p, 519)) // token='with' |
20437 | && |
20438 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
20439 | && |
20440 | (_gather_169_var = _gather_169_rule(p)) // ','.(expressions ['as' star_target])+ |
20441 | && |
20442 | (_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
20443 | && |
20444 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
20445 | && |
20446 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
20447 | && |
20448 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20449 | && |
20450 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
20451 | ) |
20452 | { |
20453 | D(fprintf(stderr, "%*c+ invalid_with_stmt_indent[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT" )); |
20454 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'with' statement on line %d" , a -> lineno ); |
20455 | if (_res == NULL && PyErr_Occurred()) { |
20456 | p->error_indicator = 1; |
20457 | p->level--; |
20458 | return NULL; |
20459 | } |
20460 | goto done; |
20461 | } |
20462 | p->mark = _mark; |
20463 | D(fprintf(stderr, "%*c%s invalid_with_stmt_indent[%d-%d]: %s failed!\n" , p->level, ' ', |
20464 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT" )); |
20465 | } |
20466 | _res = NULL; |
20467 | done: |
20468 | p->level--; |
20469 | return _res; |
20470 | } |
20471 | |
20472 | // invalid_try_stmt: 'try' ':' NEWLINE !INDENT | 'try' ':' block !('except' | 'finally') |
20473 | static void * |
20474 | invalid_try_stmt_rule(Parser *p) |
20475 | { |
20476 | if (p->level++ == MAXSTACK) { |
20477 | p->error_indicator = 1; |
20478 | PyErr_NoMemory(); |
20479 | } |
20480 | if (p->error_indicator) { |
20481 | p->level--; |
20482 | return NULL; |
20483 | } |
20484 | void * _res = NULL; |
20485 | int _mark = p->mark; |
20486 | { // 'try' ':' NEWLINE !INDENT |
20487 | if (p->error_indicator) { |
20488 | p->level--; |
20489 | return NULL; |
20490 | } |
20491 | D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'try' ':' NEWLINE !INDENT" )); |
20492 | Token * _literal; |
20493 | Token * a; |
20494 | Token * newline_var; |
20495 | if ( |
20496 | (a = _PyPegen_expect_token(p, 511)) // token='try' |
20497 | && |
20498 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
20499 | && |
20500 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20501 | && |
20502 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
20503 | ) |
20504 | { |
20505 | D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'try' ':' NEWLINE !INDENT" )); |
20506 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'try' statement on line %d" , a -> lineno ); |
20507 | if (_res == NULL && PyErr_Occurred()) { |
20508 | p->error_indicator = 1; |
20509 | p->level--; |
20510 | return NULL; |
20511 | } |
20512 | goto done; |
20513 | } |
20514 | p->mark = _mark; |
20515 | D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
20516 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'try' ':' NEWLINE !INDENT" )); |
20517 | } |
20518 | { // 'try' ':' block !('except' | 'finally') |
20519 | if (p->error_indicator) { |
20520 | p->level--; |
20521 | return NULL; |
20522 | } |
20523 | D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'try' ':' block !('except' | 'finally')" )); |
20524 | Token * _keyword; |
20525 | Token * _literal; |
20526 | asdl_stmt_seq* block_var; |
20527 | if ( |
20528 | (_keyword = _PyPegen_expect_token(p, 511)) // token='try' |
20529 | && |
20530 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
20531 | && |
20532 | (block_var = block_rule(p)) // block |
20533 | && |
20534 | _PyPegen_lookahead(0, _tmp_171_rule, p) |
20535 | ) |
20536 | { |
20537 | D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'try' ':' block !('except' | 'finally')" )); |
20538 | _res = RAISE_SYNTAX_ERROR ( "expected 'except' or 'finally' block" ); |
20539 | if (_res == NULL && PyErr_Occurred()) { |
20540 | p->error_indicator = 1; |
20541 | p->level--; |
20542 | return NULL; |
20543 | } |
20544 | goto done; |
20545 | } |
20546 | p->mark = _mark; |
20547 | D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
20548 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'try' ':' block !('except' | 'finally')" )); |
20549 | } |
20550 | _res = NULL; |
20551 | done: |
20552 | p->level--; |
20553 | return _res; |
20554 | } |
20555 | |
20556 | // invalid_except_stmt: |
20557 | // | 'except' expression ',' expressions ['as' NAME] ':' |
20558 | // | 'except' expression ['as' NAME] NEWLINE |
20559 | // | 'except' NEWLINE |
20560 | static void * |
20561 | invalid_except_stmt_rule(Parser *p) |
20562 | { |
20563 | if (p->level++ == MAXSTACK) { |
20564 | p->error_indicator = 1; |
20565 | PyErr_NoMemory(); |
20566 | } |
20567 | if (p->error_indicator) { |
20568 | p->level--; |
20569 | return NULL; |
20570 | } |
20571 | void * _res = NULL; |
20572 | int _mark = p->mark; |
20573 | { // 'except' expression ',' expressions ['as' NAME] ':' |
20574 | if (p->error_indicator) { |
20575 | p->level--; |
20576 | return NULL; |
20577 | } |
20578 | D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'" )); |
20579 | Token * _keyword; |
20580 | Token * _literal; |
20581 | Token * _literal_1; |
20582 | void *_opt_var; |
20583 | UNUSED(_opt_var); // Silence compiler warnings |
20584 | expr_ty a; |
20585 | expr_ty expressions_var; |
20586 | if ( |
20587 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
20588 | && |
20589 | (a = expression_rule(p)) // expression |
20590 | && |
20591 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
20592 | && |
20593 | (expressions_var = expressions_rule(p)) // expressions |
20594 | && |
20595 | (_opt_var = _tmp_172_rule(p), !p->error_indicator) // ['as' NAME] |
20596 | && |
20597 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
20598 | ) |
20599 | { |
20600 | D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'" )); |
20601 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "multiple exception types must be parenthesized" ); |
20602 | if (_res == NULL && PyErr_Occurred()) { |
20603 | p->error_indicator = 1; |
20604 | p->level--; |
20605 | return NULL; |
20606 | } |
20607 | goto done; |
20608 | } |
20609 | p->mark = _mark; |
20610 | D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
20611 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'" )); |
20612 | } |
20613 | { // 'except' expression ['as' NAME] NEWLINE |
20614 | if (p->error_indicator) { |
20615 | p->level--; |
20616 | return NULL; |
20617 | } |
20618 | D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] NEWLINE" )); |
20619 | void *_opt_var; |
20620 | UNUSED(_opt_var); // Silence compiler warnings |
20621 | Token * a; |
20622 | expr_ty expression_var; |
20623 | Token * newline_var; |
20624 | if ( |
20625 | (a = _PyPegen_expect_token(p, 521)) // token='except' |
20626 | && |
20627 | (expression_var = expression_rule(p)) // expression |
20628 | && |
20629 | (_opt_var = _tmp_173_rule(p), !p->error_indicator) // ['as' NAME] |
20630 | && |
20631 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20632 | ) |
20633 | { |
20634 | D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] NEWLINE" )); |
20635 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
20636 | if (_res == NULL && PyErr_Occurred()) { |
20637 | p->error_indicator = 1; |
20638 | p->level--; |
20639 | return NULL; |
20640 | } |
20641 | goto done; |
20642 | } |
20643 | p->mark = _mark; |
20644 | D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
20645 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'except' expression ['as' NAME] NEWLINE" )); |
20646 | } |
20647 | { // 'except' NEWLINE |
20648 | if (p->error_indicator) { |
20649 | p->level--; |
20650 | return NULL; |
20651 | } |
20652 | D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'except' NEWLINE" )); |
20653 | Token * a; |
20654 | Token * newline_var; |
20655 | if ( |
20656 | (a = _PyPegen_expect_token(p, 521)) // token='except' |
20657 | && |
20658 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20659 | ) |
20660 | { |
20661 | D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'except' NEWLINE" )); |
20662 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
20663 | if (_res == NULL && PyErr_Occurred()) { |
20664 | p->error_indicator = 1; |
20665 | p->level--; |
20666 | return NULL; |
20667 | } |
20668 | goto done; |
20669 | } |
20670 | p->mark = _mark; |
20671 | D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
20672 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'except' NEWLINE" )); |
20673 | } |
20674 | _res = NULL; |
20675 | done: |
20676 | p->level--; |
20677 | return _res; |
20678 | } |
20679 | |
20680 | // invalid_finally_stmt: 'finally' ':' NEWLINE !INDENT |
20681 | static void * |
20682 | invalid_finally_stmt_rule(Parser *p) |
20683 | { |
20684 | if (p->level++ == MAXSTACK) { |
20685 | p->error_indicator = 1; |
20686 | PyErr_NoMemory(); |
20687 | } |
20688 | if (p->error_indicator) { |
20689 | p->level--; |
20690 | return NULL; |
20691 | } |
20692 | void * _res = NULL; |
20693 | int _mark = p->mark; |
20694 | { // 'finally' ':' NEWLINE !INDENT |
20695 | if (p->error_indicator) { |
20696 | p->level--; |
20697 | return NULL; |
20698 | } |
20699 | D(fprintf(stderr, "%*c> invalid_finally_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT" )); |
20700 | Token * _literal; |
20701 | Token * a; |
20702 | Token * newline_var; |
20703 | if ( |
20704 | (a = _PyPegen_expect_token(p, 522)) // token='finally' |
20705 | && |
20706 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
20707 | && |
20708 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20709 | && |
20710 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
20711 | ) |
20712 | { |
20713 | D(fprintf(stderr, "%*c+ invalid_finally_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT" )); |
20714 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'finally' statement on line %d" , a -> lineno ); |
20715 | if (_res == NULL && PyErr_Occurred()) { |
20716 | p->error_indicator = 1; |
20717 | p->level--; |
20718 | return NULL; |
20719 | } |
20720 | goto done; |
20721 | } |
20722 | p->mark = _mark; |
20723 | D(fprintf(stderr, "%*c%s invalid_finally_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
20724 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'finally' ':' NEWLINE !INDENT" )); |
20725 | } |
20726 | _res = NULL; |
20727 | done: |
20728 | p->level--; |
20729 | return _res; |
20730 | } |
20731 | |
20732 | // invalid_except_stmt_indent: |
20733 | // | 'except' expression ['as' NAME] ':' NEWLINE !INDENT |
20734 | // | 'except' ':' NEWLINE !INDENT |
20735 | static void * |
20736 | invalid_except_stmt_indent_rule(Parser *p) |
20737 | { |
20738 | if (p->level++ == MAXSTACK) { |
20739 | p->error_indicator = 1; |
20740 | PyErr_NoMemory(); |
20741 | } |
20742 | if (p->error_indicator) { |
20743 | p->level--; |
20744 | return NULL; |
20745 | } |
20746 | void * _res = NULL; |
20747 | int _mark = p->mark; |
20748 | { // 'except' expression ['as' NAME] ':' NEWLINE !INDENT |
20749 | if (p->error_indicator) { |
20750 | p->level--; |
20751 | return NULL; |
20752 | } |
20753 | D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT" )); |
20754 | Token * _literal; |
20755 | void *_opt_var; |
20756 | UNUSED(_opt_var); // Silence compiler warnings |
20757 | Token * a; |
20758 | expr_ty expression_var; |
20759 | Token * newline_var; |
20760 | if ( |
20761 | (a = _PyPegen_expect_token(p, 521)) // token='except' |
20762 | && |
20763 | (expression_var = expression_rule(p)) // expression |
20764 | && |
20765 | (_opt_var = _tmp_174_rule(p), !p->error_indicator) // ['as' NAME] |
20766 | && |
20767 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
20768 | && |
20769 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20770 | && |
20771 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
20772 | ) |
20773 | { |
20774 | D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT" )); |
20775 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno ); |
20776 | if (_res == NULL && PyErr_Occurred()) { |
20777 | p->error_indicator = 1; |
20778 | p->level--; |
20779 | return NULL; |
20780 | } |
20781 | goto done; |
20782 | } |
20783 | p->mark = _mark; |
20784 | D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n" , p->level, ' ', |
20785 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT" )); |
20786 | } |
20787 | { // 'except' ':' NEWLINE !INDENT |
20788 | if (p->error_indicator) { |
20789 | p->level--; |
20790 | return NULL; |
20791 | } |
20792 | D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT" )); |
20793 | Token * _literal; |
20794 | Token * a; |
20795 | Token * newline_var; |
20796 | if ( |
20797 | (a = _PyPegen_expect_token(p, 521)) // token='except' |
20798 | && |
20799 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
20800 | && |
20801 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20802 | && |
20803 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
20804 | ) |
20805 | { |
20806 | D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT" )); |
20807 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno ); |
20808 | if (_res == NULL && PyErr_Occurred()) { |
20809 | p->error_indicator = 1; |
20810 | p->level--; |
20811 | return NULL; |
20812 | } |
20813 | goto done; |
20814 | } |
20815 | p->mark = _mark; |
20816 | D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n" , p->level, ' ', |
20817 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'except' ':' NEWLINE !INDENT" )); |
20818 | } |
20819 | _res = NULL; |
20820 | done: |
20821 | p->level--; |
20822 | return _res; |
20823 | } |
20824 | |
20825 | // invalid_match_stmt: |
20826 | // | "match" subject_expr !':' |
20827 | // | "match" subject_expr ':' NEWLINE !INDENT |
20828 | static void * |
20829 | invalid_match_stmt_rule(Parser *p) |
20830 | { |
20831 | if (p->level++ == MAXSTACK) { |
20832 | p->error_indicator = 1; |
20833 | PyErr_NoMemory(); |
20834 | } |
20835 | if (p->error_indicator) { |
20836 | p->level--; |
20837 | return NULL; |
20838 | } |
20839 | void * _res = NULL; |
20840 | int _mark = p->mark; |
20841 | { // "match" subject_expr !':' |
20842 | if (p->error_indicator) { |
20843 | p->level--; |
20844 | return NULL; |
20845 | } |
20846 | D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "\"match\" subject_expr !':'" )); |
20847 | expr_ty _keyword; |
20848 | expr_ty subject_expr_var; |
20849 | if ( |
20850 | (_keyword = _PyPegen_expect_soft_keyword(p, "match" )) // soft_keyword='"match"' |
20851 | && |
20852 | (subject_expr_var = subject_expr_rule(p)) // subject_expr |
20853 | && |
20854 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11) // token=':' |
20855 | ) |
20856 | { |
20857 | D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "\"match\" subject_expr !':'" )); |
20858 | _res = CHECK_VERSION ( void * , 10 , "Pattern matching is" , RAISE_SYNTAX_ERROR ( "expected ':'" ) ); |
20859 | if (_res == NULL && PyErr_Occurred()) { |
20860 | p->error_indicator = 1; |
20861 | p->level--; |
20862 | return NULL; |
20863 | } |
20864 | goto done; |
20865 | } |
20866 | p->mark = _mark; |
20867 | D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
20868 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "\"match\" subject_expr !':'" )); |
20869 | } |
20870 | { // "match" subject_expr ':' NEWLINE !INDENT |
20871 | if (p->error_indicator) { |
20872 | p->level--; |
20873 | return NULL; |
20874 | } |
20875 | D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT" )); |
20876 | Token * _literal; |
20877 | expr_ty a; |
20878 | Token * newline_var; |
20879 | expr_ty subject; |
20880 | if ( |
20881 | (a = _PyPegen_expect_soft_keyword(p, "match" )) // soft_keyword='"match"' |
20882 | && |
20883 | (subject = subject_expr_rule(p)) // subject_expr |
20884 | && |
20885 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
20886 | && |
20887 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20888 | && |
20889 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
20890 | ) |
20891 | { |
20892 | D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT" )); |
20893 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'match' statement on line %d" , a -> lineno ); |
20894 | if (_res == NULL && PyErr_Occurred()) { |
20895 | p->error_indicator = 1; |
20896 | p->level--; |
20897 | return NULL; |
20898 | } |
20899 | goto done; |
20900 | } |
20901 | p->mark = _mark; |
20902 | D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
20903 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT" )); |
20904 | } |
20905 | _res = NULL; |
20906 | done: |
20907 | p->level--; |
20908 | return _res; |
20909 | } |
20910 | |
20911 | // invalid_case_block: |
20912 | // | "case" patterns guard? !':' |
20913 | // | "case" patterns guard? ':' NEWLINE !INDENT |
20914 | static void * |
20915 | invalid_case_block_rule(Parser *p) |
20916 | { |
20917 | if (p->level++ == MAXSTACK) { |
20918 | p->error_indicator = 1; |
20919 | PyErr_NoMemory(); |
20920 | } |
20921 | if (p->error_indicator) { |
20922 | p->level--; |
20923 | return NULL; |
20924 | } |
20925 | void * _res = NULL; |
20926 | int _mark = p->mark; |
20927 | { // "case" patterns guard? !':' |
20928 | if (p->error_indicator) { |
20929 | p->level--; |
20930 | return NULL; |
20931 | } |
20932 | D(fprintf(stderr, "%*c> invalid_case_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "\"case\" patterns guard? !':'" )); |
20933 | expr_ty _keyword; |
20934 | void *_opt_var; |
20935 | UNUSED(_opt_var); // Silence compiler warnings |
20936 | pattern_ty patterns_var; |
20937 | if ( |
20938 | (_keyword = _PyPegen_expect_soft_keyword(p, "case" )) // soft_keyword='"case"' |
20939 | && |
20940 | (patterns_var = patterns_rule(p)) // patterns |
20941 | && |
20942 | (_opt_var = guard_rule(p), !p->error_indicator) // guard? |
20943 | && |
20944 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11) // token=':' |
20945 | ) |
20946 | { |
20947 | D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "\"case\" patterns guard? !':'" )); |
20948 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
20949 | if (_res == NULL && PyErr_Occurred()) { |
20950 | p->error_indicator = 1; |
20951 | p->level--; |
20952 | return NULL; |
20953 | } |
20954 | goto done; |
20955 | } |
20956 | p->mark = _mark; |
20957 | D(fprintf(stderr, "%*c%s invalid_case_block[%d-%d]: %s failed!\n" , p->level, ' ', |
20958 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "\"case\" patterns guard? !':'" )); |
20959 | } |
20960 | { // "case" patterns guard? ':' NEWLINE !INDENT |
20961 | if (p->error_indicator) { |
20962 | p->level--; |
20963 | return NULL; |
20964 | } |
20965 | D(fprintf(stderr, "%*c> invalid_case_block[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT" )); |
20966 | Token * _literal; |
20967 | void *_opt_var; |
20968 | UNUSED(_opt_var); // Silence compiler warnings |
20969 | expr_ty a; |
20970 | Token * newline_var; |
20971 | pattern_ty patterns_var; |
20972 | if ( |
20973 | (a = _PyPegen_expect_soft_keyword(p, "case" )) // soft_keyword='"case"' |
20974 | && |
20975 | (patterns_var = patterns_rule(p)) // patterns |
20976 | && |
20977 | (_opt_var = guard_rule(p), !p->error_indicator) // guard? |
20978 | && |
20979 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
20980 | && |
20981 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20982 | && |
20983 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
20984 | ) |
20985 | { |
20986 | D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT" )); |
20987 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'case' statement on line %d" , a -> lineno ); |
20988 | if (_res == NULL && PyErr_Occurred()) { |
20989 | p->error_indicator = 1; |
20990 | p->level--; |
20991 | return NULL; |
20992 | } |
20993 | goto done; |
20994 | } |
20995 | p->mark = _mark; |
20996 | D(fprintf(stderr, "%*c%s invalid_case_block[%d-%d]: %s failed!\n" , p->level, ' ', |
20997 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT" )); |
20998 | } |
20999 | _res = NULL; |
21000 | done: |
21001 | p->level--; |
21002 | return _res; |
21003 | } |
21004 | |
21005 | // invalid_as_pattern: or_pattern 'as' "_" | or_pattern 'as' !NAME expression |
21006 | static void * |
21007 | invalid_as_pattern_rule(Parser *p) |
21008 | { |
21009 | if (p->level++ == MAXSTACK) { |
21010 | p->error_indicator = 1; |
21011 | PyErr_NoMemory(); |
21012 | } |
21013 | if (p->error_indicator) { |
21014 | p->level--; |
21015 | return NULL; |
21016 | } |
21017 | void * _res = NULL; |
21018 | int _mark = p->mark; |
21019 | { // or_pattern 'as' "_" |
21020 | if (p->error_indicator) { |
21021 | p->level--; |
21022 | return NULL; |
21023 | } |
21024 | D(fprintf(stderr, "%*c> invalid_as_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "or_pattern 'as' \"_\"" )); |
21025 | Token * _keyword; |
21026 | expr_ty a; |
21027 | pattern_ty or_pattern_var; |
21028 | if ( |
21029 | (or_pattern_var = or_pattern_rule(p)) // or_pattern |
21030 | && |
21031 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
21032 | && |
21033 | (a = _PyPegen_expect_soft_keyword(p, "_" )) // soft_keyword='"_"' |
21034 | ) |
21035 | { |
21036 | D(fprintf(stderr, "%*c+ invalid_as_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "or_pattern 'as' \"_\"" )); |
21037 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use '_' as a target" ); |
21038 | if (_res == NULL && PyErr_Occurred()) { |
21039 | p->error_indicator = 1; |
21040 | p->level--; |
21041 | return NULL; |
21042 | } |
21043 | goto done; |
21044 | } |
21045 | p->mark = _mark; |
21046 | D(fprintf(stderr, "%*c%s invalid_as_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
21047 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "or_pattern 'as' \"_\"" )); |
21048 | } |
21049 | { // or_pattern 'as' !NAME expression |
21050 | if (p->error_indicator) { |
21051 | p->level--; |
21052 | return NULL; |
21053 | } |
21054 | D(fprintf(stderr, "%*c> invalid_as_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "or_pattern 'as' !NAME expression" )); |
21055 | Token * _keyword; |
21056 | expr_ty a; |
21057 | pattern_ty or_pattern_var; |
21058 | if ( |
21059 | (or_pattern_var = or_pattern_rule(p)) // or_pattern |
21060 | && |
21061 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
21062 | && |
21063 | _PyPegen_lookahead_with_name(0, _PyPegen_name_token, p) |
21064 | && |
21065 | (a = expression_rule(p)) // expression |
21066 | ) |
21067 | { |
21068 | D(fprintf(stderr, "%*c+ invalid_as_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "or_pattern 'as' !NAME expression" )); |
21069 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "invalid pattern target" ); |
21070 | if (_res == NULL && PyErr_Occurred()) { |
21071 | p->error_indicator = 1; |
21072 | p->level--; |
21073 | return NULL; |
21074 | } |
21075 | goto done; |
21076 | } |
21077 | p->mark = _mark; |
21078 | D(fprintf(stderr, "%*c%s invalid_as_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
21079 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "or_pattern 'as' !NAME expression" )); |
21080 | } |
21081 | _res = NULL; |
21082 | done: |
21083 | p->level--; |
21084 | return _res; |
21085 | } |
21086 | |
21087 | // invalid_class_pattern: name_or_attr '(' invalid_class_argument_pattern |
21088 | static void * |
21089 | invalid_class_pattern_rule(Parser *p) |
21090 | { |
21091 | if (p->level++ == MAXSTACK) { |
21092 | p->error_indicator = 1; |
21093 | PyErr_NoMemory(); |
21094 | } |
21095 | if (p->error_indicator) { |
21096 | p->level--; |
21097 | return NULL; |
21098 | } |
21099 | void * _res = NULL; |
21100 | int _mark = p->mark; |
21101 | { // name_or_attr '(' invalid_class_argument_pattern |
21102 | if (p->error_indicator) { |
21103 | p->level--; |
21104 | return NULL; |
21105 | } |
21106 | D(fprintf(stderr, "%*c> invalid_class_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern" )); |
21107 | Token * _literal; |
21108 | asdl_pattern_seq* a; |
21109 | expr_ty name_or_attr_var; |
21110 | if ( |
21111 | (name_or_attr_var = name_or_attr_rule(p)) // name_or_attr |
21112 | && |
21113 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
21114 | && |
21115 | (a = invalid_class_argument_pattern_rule(p)) // invalid_class_argument_pattern |
21116 | ) |
21117 | { |
21118 | D(fprintf(stderr, "%*c+ invalid_class_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern" )); |
21119 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( PyPegen_first_item ( a , pattern_ty ) , PyPegen_last_item ( a , pattern_ty ) , "positional patterns follow keyword patterns" ); |
21120 | if (_res == NULL && PyErr_Occurred()) { |
21121 | p->error_indicator = 1; |
21122 | p->level--; |
21123 | return NULL; |
21124 | } |
21125 | goto done; |
21126 | } |
21127 | p->mark = _mark; |
21128 | D(fprintf(stderr, "%*c%s invalid_class_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
21129 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern" )); |
21130 | } |
21131 | _res = NULL; |
21132 | done: |
21133 | p->level--; |
21134 | return _res; |
21135 | } |
21136 | |
21137 | // invalid_class_argument_pattern: |
21138 | // | [positional_patterns ','] keyword_patterns ',' positional_patterns |
21139 | static asdl_pattern_seq* |
21140 | invalid_class_argument_pattern_rule(Parser *p) |
21141 | { |
21142 | if (p->level++ == MAXSTACK) { |
21143 | p->error_indicator = 1; |
21144 | PyErr_NoMemory(); |
21145 | } |
21146 | if (p->error_indicator) { |
21147 | p->level--; |
21148 | return NULL; |
21149 | } |
21150 | asdl_pattern_seq* _res = NULL; |
21151 | int _mark = p->mark; |
21152 | { // [positional_patterns ','] keyword_patterns ',' positional_patterns |
21153 | if (p->error_indicator) { |
21154 | p->level--; |
21155 | return NULL; |
21156 | } |
21157 | D(fprintf(stderr, "%*c> invalid_class_argument_pattern[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns" )); |
21158 | Token * _literal; |
21159 | void *_opt_var; |
21160 | UNUSED(_opt_var); // Silence compiler warnings |
21161 | asdl_pattern_seq* a; |
21162 | asdl_seq* keyword_patterns_var; |
21163 | if ( |
21164 | (_opt_var = _tmp_175_rule(p), !p->error_indicator) // [positional_patterns ','] |
21165 | && |
21166 | (keyword_patterns_var = keyword_patterns_rule(p)) // keyword_patterns |
21167 | && |
21168 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
21169 | && |
21170 | (a = positional_patterns_rule(p)) // positional_patterns |
21171 | ) |
21172 | { |
21173 | D(fprintf(stderr, "%*c+ invalid_class_argument_pattern[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns" )); |
21174 | _res = a; |
21175 | if (_res == NULL && PyErr_Occurred()) { |
21176 | p->error_indicator = 1; |
21177 | p->level--; |
21178 | return NULL; |
21179 | } |
21180 | goto done; |
21181 | } |
21182 | p->mark = _mark; |
21183 | D(fprintf(stderr, "%*c%s invalid_class_argument_pattern[%d-%d]: %s failed!\n" , p->level, ' ', |
21184 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns" )); |
21185 | } |
21186 | _res = NULL; |
21187 | done: |
21188 | p->level--; |
21189 | return _res; |
21190 | } |
21191 | |
21192 | // invalid_if_stmt: |
21193 | // | 'if' named_expression NEWLINE |
21194 | // | 'if' named_expression ':' NEWLINE !INDENT |
21195 | static void * |
21196 | invalid_if_stmt_rule(Parser *p) |
21197 | { |
21198 | if (p->level++ == MAXSTACK) { |
21199 | p->error_indicator = 1; |
21200 | PyErr_NoMemory(); |
21201 | } |
21202 | if (p->error_indicator) { |
21203 | p->level--; |
21204 | return NULL; |
21205 | } |
21206 | void * _res = NULL; |
21207 | int _mark = p->mark; |
21208 | { // 'if' named_expression NEWLINE |
21209 | if (p->error_indicator) { |
21210 | p->level--; |
21211 | return NULL; |
21212 | } |
21213 | D(fprintf(stderr, "%*c> invalid_if_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'if' named_expression NEWLINE" )); |
21214 | Token * _keyword; |
21215 | expr_ty named_expression_var; |
21216 | Token * newline_var; |
21217 | if ( |
21218 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
21219 | && |
21220 | (named_expression_var = named_expression_rule(p)) // named_expression |
21221 | && |
21222 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
21223 | ) |
21224 | { |
21225 | D(fprintf(stderr, "%*c+ invalid_if_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'if' named_expression NEWLINE" )); |
21226 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
21227 | if (_res == NULL && PyErr_Occurred()) { |
21228 | p->error_indicator = 1; |
21229 | p->level--; |
21230 | return NULL; |
21231 | } |
21232 | goto done; |
21233 | } |
21234 | p->mark = _mark; |
21235 | D(fprintf(stderr, "%*c%s invalid_if_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
21236 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'if' named_expression NEWLINE" )); |
21237 | } |
21238 | { // 'if' named_expression ':' NEWLINE !INDENT |
21239 | if (p->error_indicator) { |
21240 | p->level--; |
21241 | return NULL; |
21242 | } |
21243 | D(fprintf(stderr, "%*c> invalid_if_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT" )); |
21244 | Token * _literal; |
21245 | Token * a; |
21246 | expr_ty a_1; |
21247 | Token * newline_var; |
21248 | if ( |
21249 | (a = _PyPegen_expect_token(p, 510)) // token='if' |
21250 | && |
21251 | (a_1 = named_expression_rule(p)) // named_expression |
21252 | && |
21253 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
21254 | && |
21255 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
21256 | && |
21257 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
21258 | ) |
21259 | { |
21260 | D(fprintf(stderr, "%*c+ invalid_if_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT" )); |
21261 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'if' statement on line %d" , a -> lineno ); |
21262 | if (_res == NULL && PyErr_Occurred()) { |
21263 | p->error_indicator = 1; |
21264 | p->level--; |
21265 | return NULL; |
21266 | } |
21267 | goto done; |
21268 | } |
21269 | p->mark = _mark; |
21270 | D(fprintf(stderr, "%*c%s invalid_if_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
21271 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT" )); |
21272 | } |
21273 | _res = NULL; |
21274 | done: |
21275 | p->level--; |
21276 | return _res; |
21277 | } |
21278 | |
21279 | // invalid_elif_stmt: |
21280 | // | 'elif' named_expression NEWLINE |
21281 | // | 'elif' named_expression ':' NEWLINE !INDENT |
21282 | static void * |
21283 | invalid_elif_stmt_rule(Parser *p) |
21284 | { |
21285 | if (p->level++ == MAXSTACK) { |
21286 | p->error_indicator = 1; |
21287 | PyErr_NoMemory(); |
21288 | } |
21289 | if (p->error_indicator) { |
21290 | p->level--; |
21291 | return NULL; |
21292 | } |
21293 | void * _res = NULL; |
21294 | int _mark = p->mark; |
21295 | { // 'elif' named_expression NEWLINE |
21296 | if (p->error_indicator) { |
21297 | p->level--; |
21298 | return NULL; |
21299 | } |
21300 | D(fprintf(stderr, "%*c> invalid_elif_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'elif' named_expression NEWLINE" )); |
21301 | Token * _keyword; |
21302 | expr_ty named_expression_var; |
21303 | Token * newline_var; |
21304 | if ( |
21305 | (_keyword = _PyPegen_expect_token(p, 515)) // token='elif' |
21306 | && |
21307 | (named_expression_var = named_expression_rule(p)) // named_expression |
21308 | && |
21309 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
21310 | ) |
21311 | { |
21312 | D(fprintf(stderr, "%*c+ invalid_elif_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'elif' named_expression NEWLINE" )); |
21313 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
21314 | if (_res == NULL && PyErr_Occurred()) { |
21315 | p->error_indicator = 1; |
21316 | p->level--; |
21317 | return NULL; |
21318 | } |
21319 | goto done; |
21320 | } |
21321 | p->mark = _mark; |
21322 | D(fprintf(stderr, "%*c%s invalid_elif_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
21323 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'elif' named_expression NEWLINE" )); |
21324 | } |
21325 | { // 'elif' named_expression ':' NEWLINE !INDENT |
21326 | if (p->error_indicator) { |
21327 | p->level--; |
21328 | return NULL; |
21329 | } |
21330 | D(fprintf(stderr, "%*c> invalid_elif_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT" )); |
21331 | Token * _literal; |
21332 | Token * a; |
21333 | expr_ty named_expression_var; |
21334 | Token * newline_var; |
21335 | if ( |
21336 | (a = _PyPegen_expect_token(p, 515)) // token='elif' |
21337 | && |
21338 | (named_expression_var = named_expression_rule(p)) // named_expression |
21339 | && |
21340 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
21341 | && |
21342 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
21343 | && |
21344 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
21345 | ) |
21346 | { |
21347 | D(fprintf(stderr, "%*c+ invalid_elif_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT" )); |
21348 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'elif' statement on line %d" , a -> lineno ); |
21349 | if (_res == NULL && PyErr_Occurred()) { |
21350 | p->error_indicator = 1; |
21351 | p->level--; |
21352 | return NULL; |
21353 | } |
21354 | goto done; |
21355 | } |
21356 | p->mark = _mark; |
21357 | D(fprintf(stderr, "%*c%s invalid_elif_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
21358 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT" )); |
21359 | } |
21360 | _res = NULL; |
21361 | done: |
21362 | p->level--; |
21363 | return _res; |
21364 | } |
21365 | |
21366 | // invalid_else_stmt: 'else' ':' NEWLINE !INDENT |
21367 | static void * |
21368 | invalid_else_stmt_rule(Parser *p) |
21369 | { |
21370 | if (p->level++ == MAXSTACK) { |
21371 | p->error_indicator = 1; |
21372 | PyErr_NoMemory(); |
21373 | } |
21374 | if (p->error_indicator) { |
21375 | p->level--; |
21376 | return NULL; |
21377 | } |
21378 | void * _res = NULL; |
21379 | int _mark = p->mark; |
21380 | { // 'else' ':' NEWLINE !INDENT |
21381 | if (p->error_indicator) { |
21382 | p->level--; |
21383 | return NULL; |
21384 | } |
21385 | D(fprintf(stderr, "%*c> invalid_else_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'else' ':' NEWLINE !INDENT" )); |
21386 | Token * _literal; |
21387 | Token * a; |
21388 | Token * newline_var; |
21389 | if ( |
21390 | (a = _PyPegen_expect_token(p, 516)) // token='else' |
21391 | && |
21392 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
21393 | && |
21394 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
21395 | && |
21396 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
21397 | ) |
21398 | { |
21399 | D(fprintf(stderr, "%*c+ invalid_else_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'else' ':' NEWLINE !INDENT" )); |
21400 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'else' statement on line %d" , a -> lineno ); |
21401 | if (_res == NULL && PyErr_Occurred()) { |
21402 | p->error_indicator = 1; |
21403 | p->level--; |
21404 | return NULL; |
21405 | } |
21406 | goto done; |
21407 | } |
21408 | p->mark = _mark; |
21409 | D(fprintf(stderr, "%*c%s invalid_else_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
21410 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'else' ':' NEWLINE !INDENT" )); |
21411 | } |
21412 | _res = NULL; |
21413 | done: |
21414 | p->level--; |
21415 | return _res; |
21416 | } |
21417 | |
21418 | // invalid_while_stmt: |
21419 | // | 'while' named_expression NEWLINE |
21420 | // | 'while' named_expression ':' NEWLINE !INDENT |
21421 | static void * |
21422 | invalid_while_stmt_rule(Parser *p) |
21423 | { |
21424 | if (p->level++ == MAXSTACK) { |
21425 | p->error_indicator = 1; |
21426 | PyErr_NoMemory(); |
21427 | } |
21428 | if (p->error_indicator) { |
21429 | p->level--; |
21430 | return NULL; |
21431 | } |
21432 | void * _res = NULL; |
21433 | int _mark = p->mark; |
21434 | { // 'while' named_expression NEWLINE |
21435 | if (p->error_indicator) { |
21436 | p->level--; |
21437 | return NULL; |
21438 | } |
21439 | D(fprintf(stderr, "%*c> invalid_while_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'while' named_expression NEWLINE" )); |
21440 | Token * _keyword; |
21441 | expr_ty named_expression_var; |
21442 | Token * newline_var; |
21443 | if ( |
21444 | (_keyword = _PyPegen_expect_token(p, 512)) // token='while' |
21445 | && |
21446 | (named_expression_var = named_expression_rule(p)) // named_expression |
21447 | && |
21448 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
21449 | ) |
21450 | { |
21451 | D(fprintf(stderr, "%*c+ invalid_while_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'while' named_expression NEWLINE" )); |
21452 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
21453 | if (_res == NULL && PyErr_Occurred()) { |
21454 | p->error_indicator = 1; |
21455 | p->level--; |
21456 | return NULL; |
21457 | } |
21458 | goto done; |
21459 | } |
21460 | p->mark = _mark; |
21461 | D(fprintf(stderr, "%*c%s invalid_while_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
21462 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'while' named_expression NEWLINE" )); |
21463 | } |
21464 | { // 'while' named_expression ':' NEWLINE !INDENT |
21465 | if (p->error_indicator) { |
21466 | p->level--; |
21467 | return NULL; |
21468 | } |
21469 | D(fprintf(stderr, "%*c> invalid_while_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT" )); |
21470 | Token * _literal; |
21471 | Token * a; |
21472 | expr_ty named_expression_var; |
21473 | Token * newline_var; |
21474 | if ( |
21475 | (a = _PyPegen_expect_token(p, 512)) // token='while' |
21476 | && |
21477 | (named_expression_var = named_expression_rule(p)) // named_expression |
21478 | && |
21479 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
21480 | && |
21481 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
21482 | && |
21483 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
21484 | ) |
21485 | { |
21486 | D(fprintf(stderr, "%*c+ invalid_while_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT" )); |
21487 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'while' statement on line %d" , a -> lineno ); |
21488 | if (_res == NULL && PyErr_Occurred()) { |
21489 | p->error_indicator = 1; |
21490 | p->level--; |
21491 | return NULL; |
21492 | } |
21493 | goto done; |
21494 | } |
21495 | p->mark = _mark; |
21496 | D(fprintf(stderr, "%*c%s invalid_while_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
21497 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT" )); |
21498 | } |
21499 | _res = NULL; |
21500 | done: |
21501 | p->level--; |
21502 | return _res; |
21503 | } |
21504 | |
21505 | // invalid_for_stmt: ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT |
21506 | static void * |
21507 | invalid_for_stmt_rule(Parser *p) |
21508 | { |
21509 | if (p->level++ == MAXSTACK) { |
21510 | p->error_indicator = 1; |
21511 | PyErr_NoMemory(); |
21512 | } |
21513 | if (p->error_indicator) { |
21514 | p->level--; |
21515 | return NULL; |
21516 | } |
21517 | void * _res = NULL; |
21518 | int _mark = p->mark; |
21519 | { // ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT |
21520 | if (p->error_indicator) { |
21521 | p->level--; |
21522 | return NULL; |
21523 | } |
21524 | D(fprintf(stderr, "%*c> invalid_for_stmt[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT" )); |
21525 | Token * _keyword; |
21526 | Token * _literal; |
21527 | void *_opt_var; |
21528 | UNUSED(_opt_var); // Silence compiler warnings |
21529 | Token * a; |
21530 | Token * newline_var; |
21531 | expr_ty star_expressions_var; |
21532 | expr_ty star_targets_var; |
21533 | if ( |
21534 | (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? |
21535 | && |
21536 | (a = _PyPegen_expect_token(p, 517)) // token='for' |
21537 | && |
21538 | (star_targets_var = star_targets_rule(p)) // star_targets |
21539 | && |
21540 | (_keyword = _PyPegen_expect_token(p, 518)) // token='in' |
21541 | && |
21542 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
21543 | && |
21544 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
21545 | && |
21546 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
21547 | && |
21548 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
21549 | ) |
21550 | { |
21551 | D(fprintf(stderr, "%*c+ invalid_for_stmt[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT" )); |
21552 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'for' statement on line %d" , a -> lineno ); |
21553 | if (_res == NULL && PyErr_Occurred()) { |
21554 | p->error_indicator = 1; |
21555 | p->level--; |
21556 | return NULL; |
21557 | } |
21558 | goto done; |
21559 | } |
21560 | p->mark = _mark; |
21561 | D(fprintf(stderr, "%*c%s invalid_for_stmt[%d-%d]: %s failed!\n" , p->level, ' ', |
21562 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT" )); |
21563 | } |
21564 | _res = NULL; |
21565 | done: |
21566 | p->level--; |
21567 | return _res; |
21568 | } |
21569 | |
21570 | // invalid_def_raw: |
21571 | // | ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' NEWLINE !INDENT |
21572 | static void * |
21573 | invalid_def_raw_rule(Parser *p) |
21574 | { |
21575 | if (p->level++ == MAXSTACK) { |
21576 | p->error_indicator = 1; |
21577 | PyErr_NoMemory(); |
21578 | } |
21579 | if (p->error_indicator) { |
21580 | p->level--; |
21581 | return NULL; |
21582 | } |
21583 | void * _res = NULL; |
21584 | int _mark = p->mark; |
21585 | { // ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' NEWLINE !INDENT |
21586 | if (p->error_indicator) { |
21587 | p->level--; |
21588 | return NULL; |
21589 | } |
21590 | D(fprintf(stderr, "%*c> invalid_def_raw[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' NEWLINE !INDENT" )); |
21591 | Token * _literal; |
21592 | Token * _literal_1; |
21593 | Token * _literal_2; |
21594 | void *_opt_var; |
21595 | UNUSED(_opt_var); // Silence compiler warnings |
21596 | void *_opt_var_1; |
21597 | UNUSED(_opt_var_1); // Silence compiler warnings |
21598 | void *_opt_var_2; |
21599 | UNUSED(_opt_var_2); // Silence compiler warnings |
21600 | Token * a; |
21601 | expr_ty name_var; |
21602 | Token * newline_var; |
21603 | if ( |
21604 | (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? |
21605 | && |
21606 | (a = _PyPegen_expect_token(p, 526)) // token='def' |
21607 | && |
21608 | (name_var = _PyPegen_name_token(p)) // NAME |
21609 | && |
21610 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
21611 | && |
21612 | (_opt_var_1 = params_rule(p), !p->error_indicator) // params? |
21613 | && |
21614 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
21615 | && |
21616 | (_opt_var_2 = _tmp_176_rule(p), !p->error_indicator) // ['->' expression] |
21617 | && |
21618 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
21619 | && |
21620 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
21621 | && |
21622 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
21623 | ) |
21624 | { |
21625 | D(fprintf(stderr, "%*c+ invalid_def_raw[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' NEWLINE !INDENT" )); |
21626 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after function definition on line %d" , a -> lineno ); |
21627 | if (_res == NULL && PyErr_Occurred()) { |
21628 | p->error_indicator = 1; |
21629 | p->level--; |
21630 | return NULL; |
21631 | } |
21632 | goto done; |
21633 | } |
21634 | p->mark = _mark; |
21635 | D(fprintf(stderr, "%*c%s invalid_def_raw[%d-%d]: %s failed!\n" , p->level, ' ', |
21636 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' NEWLINE !INDENT" )); |
21637 | } |
21638 | _res = NULL; |
21639 | done: |
21640 | p->level--; |
21641 | return _res; |
21642 | } |
21643 | |
21644 | // invalid_class_def_raw: 'class' NAME ['(' arguments? ')'] ':' NEWLINE !INDENT |
21645 | static void * |
21646 | invalid_class_def_raw_rule(Parser *p) |
21647 | { |
21648 | if (p->level++ == MAXSTACK) { |
21649 | p->error_indicator = 1; |
21650 | PyErr_NoMemory(); |
21651 | } |
21652 | if (p->error_indicator) { |
21653 | p->level--; |
21654 | return NULL; |
21655 | } |
21656 | void * _res = NULL; |
21657 | int _mark = p->mark; |
21658 | { // 'class' NAME ['(' arguments? ')'] ':' NEWLINE !INDENT |
21659 | if (p->error_indicator) { |
21660 | p->level--; |
21661 | return NULL; |
21662 | } |
21663 | D(fprintf(stderr, "%*c> invalid_class_def_raw[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' NEWLINE !INDENT" )); |
21664 | Token * _literal; |
21665 | void *_opt_var; |
21666 | UNUSED(_opt_var); // Silence compiler warnings |
21667 | Token * a; |
21668 | expr_ty name_var; |
21669 | Token * newline_var; |
21670 | if ( |
21671 | (a = _PyPegen_expect_token(p, 527)) // token='class' |
21672 | && |
21673 | (name_var = _PyPegen_name_token(p)) // NAME |
21674 | && |
21675 | (_opt_var = _tmp_177_rule(p), !p->error_indicator) // ['(' arguments? ')'] |
21676 | && |
21677 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
21678 | && |
21679 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
21680 | && |
21681 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
21682 | ) |
21683 | { |
21684 | D(fprintf(stderr, "%*c+ invalid_class_def_raw[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' NEWLINE !INDENT" )); |
21685 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after class definition on line %d" , a -> lineno ); |
21686 | if (_res == NULL && PyErr_Occurred()) { |
21687 | p->error_indicator = 1; |
21688 | p->level--; |
21689 | return NULL; |
21690 | } |
21691 | goto done; |
21692 | } |
21693 | p->mark = _mark; |
21694 | D(fprintf(stderr, "%*c%s invalid_class_def_raw[%d-%d]: %s failed!\n" , p->level, ' ', |
21695 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' NEWLINE !INDENT" )); |
21696 | } |
21697 | _res = NULL; |
21698 | done: |
21699 | p->level--; |
21700 | return _res; |
21701 | } |
21702 | |
21703 | // invalid_double_starred_kvpairs: |
21704 | // | ','.double_starred_kvpair+ ',' invalid_kvpair |
21705 | // | expression ':' '*' bitwise_or |
21706 | // | expression ':' &('}' | ',') |
21707 | static void * |
21708 | invalid_double_starred_kvpairs_rule(Parser *p) |
21709 | { |
21710 | if (p->level++ == MAXSTACK) { |
21711 | p->error_indicator = 1; |
21712 | PyErr_NoMemory(); |
21713 | } |
21714 | if (p->error_indicator) { |
21715 | p->level--; |
21716 | return NULL; |
21717 | } |
21718 | void * _res = NULL; |
21719 | int _mark = p->mark; |
21720 | { // ','.double_starred_kvpair+ ',' invalid_kvpair |
21721 | if (p->error_indicator) { |
21722 | p->level--; |
21723 | return NULL; |
21724 | } |
21725 | D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair" )); |
21726 | asdl_seq * _gather_178_var; |
21727 | Token * _literal; |
21728 | void *invalid_kvpair_var; |
21729 | if ( |
21730 | (_gather_178_var = _gather_178_rule(p)) // ','.double_starred_kvpair+ |
21731 | && |
21732 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
21733 | && |
21734 | (invalid_kvpair_var = invalid_kvpair_rule(p)) // invalid_kvpair |
21735 | ) |
21736 | { |
21737 | D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair" )); |
21738 | _res = _PyPegen_dummy_name(p, _gather_178_var, _literal, invalid_kvpair_var); |
21739 | goto done; |
21740 | } |
21741 | p->mark = _mark; |
21742 | D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n" , p->level, ' ', |
21743 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair" )); |
21744 | } |
21745 | { // expression ':' '*' bitwise_or |
21746 | if (p->error_indicator) { |
21747 | p->level--; |
21748 | return NULL; |
21749 | } |
21750 | D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or" )); |
21751 | Token * _literal; |
21752 | Token * a; |
21753 | expr_ty bitwise_or_var; |
21754 | expr_ty expression_var; |
21755 | if ( |
21756 | (expression_var = expression_rule(p)) // expression |
21757 | && |
21758 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
21759 | && |
21760 | (a = _PyPegen_expect_token(p, 16)) // token='*' |
21761 | && |
21762 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
21763 | ) |
21764 | { |
21765 | D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or" )); |
21766 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "cannot use a starred expression in a dictionary value" ); |
21767 | if (_res == NULL && PyErr_Occurred()) { |
21768 | p->error_indicator = 1; |
21769 | p->level--; |
21770 | return NULL; |
21771 | } |
21772 | goto done; |
21773 | } |
21774 | p->mark = _mark; |
21775 | D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n" , p->level, ' ', |
21776 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression ':' '*' bitwise_or" )); |
21777 | } |
21778 | { // expression ':' &('}' | ',') |
21779 | if (p->error_indicator) { |
21780 | p->level--; |
21781 | return NULL; |
21782 | } |
21783 | D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')" )); |
21784 | Token * a; |
21785 | expr_ty expression_var; |
21786 | if ( |
21787 | (expression_var = expression_rule(p)) // expression |
21788 | && |
21789 | (a = _PyPegen_expect_token(p, 11)) // token=':' |
21790 | && |
21791 | _PyPegen_lookahead(1, _tmp_180_rule, p) |
21792 | ) |
21793 | { |
21794 | D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')" )); |
21795 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression expected after dictionary key and ':'" ); |
21796 | if (_res == NULL && PyErr_Occurred()) { |
21797 | p->error_indicator = 1; |
21798 | p->level--; |
21799 | return NULL; |
21800 | } |
21801 | goto done; |
21802 | } |
21803 | p->mark = _mark; |
21804 | D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n" , p->level, ' ', |
21805 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression ':' &('}' | ',')" )); |
21806 | } |
21807 | _res = NULL; |
21808 | done: |
21809 | p->level--; |
21810 | return _res; |
21811 | } |
21812 | |
21813 | // invalid_kvpair: expression !(':') | expression ':' '*' bitwise_or | expression ':' |
21814 | static void * |
21815 | invalid_kvpair_rule(Parser *p) |
21816 | { |
21817 | if (p->level++ == MAXSTACK) { |
21818 | p->error_indicator = 1; |
21819 | PyErr_NoMemory(); |
21820 | } |
21821 | if (p->error_indicator) { |
21822 | p->level--; |
21823 | return NULL; |
21824 | } |
21825 | void * _res = NULL; |
21826 | int _mark = p->mark; |
21827 | { // expression !(':') |
21828 | if (p->error_indicator) { |
21829 | p->level--; |
21830 | return NULL; |
21831 | } |
21832 | D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression !(':')" )); |
21833 | expr_ty a; |
21834 | if ( |
21835 | (a = expression_rule(p)) // expression |
21836 | && |
21837 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11) // token=(':') |
21838 | ) |
21839 | { |
21840 | D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression !(':')" )); |
21841 | _res = RAISE_ERROR_KNOWN_LOCATION ( p , PyExc_SyntaxError , a -> lineno , a -> end_col_offset - 1 , a -> end_lineno , - 1 , "':' expected after dictionary key" ); |
21842 | if (_res == NULL && PyErr_Occurred()) { |
21843 | p->error_indicator = 1; |
21844 | p->level--; |
21845 | return NULL; |
21846 | } |
21847 | goto done; |
21848 | } |
21849 | p->mark = _mark; |
21850 | D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n" , p->level, ' ', |
21851 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression !(':')" )); |
21852 | } |
21853 | { // expression ':' '*' bitwise_or |
21854 | if (p->error_indicator) { |
21855 | p->level--; |
21856 | return NULL; |
21857 | } |
21858 | D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or" )); |
21859 | Token * _literal; |
21860 | Token * a; |
21861 | expr_ty bitwise_or_var; |
21862 | expr_ty expression_var; |
21863 | if ( |
21864 | (expression_var = expression_rule(p)) // expression |
21865 | && |
21866 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
21867 | && |
21868 | (a = _PyPegen_expect_token(p, 16)) // token='*' |
21869 | && |
21870 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
21871 | ) |
21872 | { |
21873 | D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or" )); |
21874 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "cannot use a starred expression in a dictionary value" ); |
21875 | if (_res == NULL && PyErr_Occurred()) { |
21876 | p->error_indicator = 1; |
21877 | p->level--; |
21878 | return NULL; |
21879 | } |
21880 | goto done; |
21881 | } |
21882 | p->mark = _mark; |
21883 | D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n" , p->level, ' ', |
21884 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression ':' '*' bitwise_or" )); |
21885 | } |
21886 | { // expression ':' |
21887 | if (p->error_indicator) { |
21888 | p->level--; |
21889 | return NULL; |
21890 | } |
21891 | D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression ':'" )); |
21892 | Token * a; |
21893 | expr_ty expression_var; |
21894 | if ( |
21895 | (expression_var = expression_rule(p)) // expression |
21896 | && |
21897 | (a = _PyPegen_expect_token(p, 11)) // token=':' |
21898 | ) |
21899 | { |
21900 | D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression ':'" )); |
21901 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression expected after dictionary key and ':'" ); |
21902 | if (_res == NULL && PyErr_Occurred()) { |
21903 | p->error_indicator = 1; |
21904 | p->level--; |
21905 | return NULL; |
21906 | } |
21907 | goto done; |
21908 | } |
21909 | p->mark = _mark; |
21910 | D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n" , p->level, ' ', |
21911 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression ':'" )); |
21912 | } |
21913 | _res = NULL; |
21914 | done: |
21915 | p->level--; |
21916 | return _res; |
21917 | } |
21918 | |
21919 | // _loop0_1: NEWLINE |
21920 | static asdl_seq * |
21921 | _loop0_1_rule(Parser *p) |
21922 | { |
21923 | if (p->level++ == MAXSTACK) { |
21924 | p->error_indicator = 1; |
21925 | PyErr_NoMemory(); |
21926 | } |
21927 | if (p->error_indicator) { |
21928 | p->level--; |
21929 | return NULL; |
21930 | } |
21931 | void *_res = NULL; |
21932 | int _mark = p->mark; |
21933 | int _start_mark = p->mark; |
21934 | void **_children = PyMem_Malloc(sizeof(void *)); |
21935 | if (!_children) { |
21936 | p->error_indicator = 1; |
21937 | PyErr_NoMemory(); |
21938 | p->level--; |
21939 | return NULL; |
21940 | } |
21941 | Py_ssize_t _children_capacity = 1; |
21942 | Py_ssize_t _n = 0; |
21943 | { // NEWLINE |
21944 | if (p->error_indicator) { |
21945 | p->level--; |
21946 | return NULL; |
21947 | } |
21948 | D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NEWLINE" )); |
21949 | Token * newline_var; |
21950 | while ( |
21951 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
21952 | ) |
21953 | { |
21954 | _res = newline_var; |
21955 | if (_n == _children_capacity) { |
21956 | _children_capacity *= 2; |
21957 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
21958 | if (!_new_children) { |
21959 | p->error_indicator = 1; |
21960 | PyErr_NoMemory(); |
21961 | p->level--; |
21962 | return NULL; |
21963 | } |
21964 | _children = _new_children; |
21965 | } |
21966 | _children[_n++] = _res; |
21967 | _mark = p->mark; |
21968 | } |
21969 | p->mark = _mark; |
21970 | D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n" , p->level, ' ', |
21971 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NEWLINE" )); |
21972 | } |
21973 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
21974 | if (!_seq) { |
21975 | PyMem_Free(_children); |
21976 | p->error_indicator = 1; |
21977 | PyErr_NoMemory(); |
21978 | p->level--; |
21979 | return NULL; |
21980 | } |
21981 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
21982 | PyMem_Free(_children); |
21983 | _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq); |
21984 | p->level--; |
21985 | return _seq; |
21986 | } |
21987 | |
21988 | // _loop0_2: NEWLINE |
21989 | static asdl_seq * |
21990 | _loop0_2_rule(Parser *p) |
21991 | { |
21992 | if (p->level++ == MAXSTACK) { |
21993 | p->error_indicator = 1; |
21994 | PyErr_NoMemory(); |
21995 | } |
21996 | if (p->error_indicator) { |
21997 | p->level--; |
21998 | return NULL; |
21999 | } |
22000 | void *_res = NULL; |
22001 | int _mark = p->mark; |
22002 | int _start_mark = p->mark; |
22003 | void **_children = PyMem_Malloc(sizeof(void *)); |
22004 | if (!_children) { |
22005 | p->error_indicator = 1; |
22006 | PyErr_NoMemory(); |
22007 | p->level--; |
22008 | return NULL; |
22009 | } |
22010 | Py_ssize_t _children_capacity = 1; |
22011 | Py_ssize_t _n = 0; |
22012 | { // NEWLINE |
22013 | if (p->error_indicator) { |
22014 | p->level--; |
22015 | return NULL; |
22016 | } |
22017 | D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NEWLINE" )); |
22018 | Token * newline_var; |
22019 | while ( |
22020 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
22021 | ) |
22022 | { |
22023 | _res = newline_var; |
22024 | if (_n == _children_capacity) { |
22025 | _children_capacity *= 2; |
22026 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
22027 | if (!_new_children) { |
22028 | p->error_indicator = 1; |
22029 | PyErr_NoMemory(); |
22030 | p->level--; |
22031 | return NULL; |
22032 | } |
22033 | _children = _new_children; |
22034 | } |
22035 | _children[_n++] = _res; |
22036 | _mark = p->mark; |
22037 | } |
22038 | p->mark = _mark; |
22039 | D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n" , p->level, ' ', |
22040 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NEWLINE" )); |
22041 | } |
22042 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
22043 | if (!_seq) { |
22044 | PyMem_Free(_children); |
22045 | p->error_indicator = 1; |
22046 | PyErr_NoMemory(); |
22047 | p->level--; |
22048 | return NULL; |
22049 | } |
22050 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
22051 | PyMem_Free(_children); |
22052 | _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq); |
22053 | p->level--; |
22054 | return _seq; |
22055 | } |
22056 | |
22057 | // _loop0_4: ',' expression |
22058 | static asdl_seq * |
22059 | _loop0_4_rule(Parser *p) |
22060 | { |
22061 | if (p->level++ == MAXSTACK) { |
22062 | p->error_indicator = 1; |
22063 | PyErr_NoMemory(); |
22064 | } |
22065 | if (p->error_indicator) { |
22066 | p->level--; |
22067 | return NULL; |
22068 | } |
22069 | void *_res = NULL; |
22070 | int _mark = p->mark; |
22071 | int _start_mark = p->mark; |
22072 | void **_children = PyMem_Malloc(sizeof(void *)); |
22073 | if (!_children) { |
22074 | p->error_indicator = 1; |
22075 | PyErr_NoMemory(); |
22076 | p->level--; |
22077 | return NULL; |
22078 | } |
22079 | Py_ssize_t _children_capacity = 1; |
22080 | Py_ssize_t _n = 0; |
22081 | { // ',' expression |
22082 | if (p->error_indicator) { |
22083 | p->level--; |
22084 | return NULL; |
22085 | } |
22086 | D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' expression" )); |
22087 | Token * _literal; |
22088 | expr_ty elem; |
22089 | while ( |
22090 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
22091 | && |
22092 | (elem = expression_rule(p)) // expression |
22093 | ) |
22094 | { |
22095 | _res = elem; |
22096 | if (_res == NULL && PyErr_Occurred()) { |
22097 | p->error_indicator = 1; |
22098 | PyMem_Free(_children); |
22099 | p->level--; |
22100 | return NULL; |
22101 | } |
22102 | if (_n == _children_capacity) { |
22103 | _children_capacity *= 2; |
22104 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
22105 | if (!_new_children) { |
22106 | p->error_indicator = 1; |
22107 | PyErr_NoMemory(); |
22108 | p->level--; |
22109 | return NULL; |
22110 | } |
22111 | _children = _new_children; |
22112 | } |
22113 | _children[_n++] = _res; |
22114 | _mark = p->mark; |
22115 | } |
22116 | p->mark = _mark; |
22117 | D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n" , p->level, ' ', |
22118 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' expression" )); |
22119 | } |
22120 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
22121 | if (!_seq) { |
22122 | PyMem_Free(_children); |
22123 | p->error_indicator = 1; |
22124 | PyErr_NoMemory(); |
22125 | p->level--; |
22126 | return NULL; |
22127 | } |
22128 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
22129 | PyMem_Free(_children); |
22130 | _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq); |
22131 | p->level--; |
22132 | return _seq; |
22133 | } |
22134 | |
22135 | // _gather_3: expression _loop0_4 |
22136 | static asdl_seq * |
22137 | _gather_3_rule(Parser *p) |
22138 | { |
22139 | if (p->level++ == MAXSTACK) { |
22140 | p->error_indicator = 1; |
22141 | PyErr_NoMemory(); |
22142 | } |
22143 | if (p->error_indicator) { |
22144 | p->level--; |
22145 | return NULL; |
22146 | } |
22147 | asdl_seq * _res = NULL; |
22148 | int _mark = p->mark; |
22149 | { // expression _loop0_4 |
22150 | if (p->error_indicator) { |
22151 | p->level--; |
22152 | return NULL; |
22153 | } |
22154 | D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression _loop0_4" )); |
22155 | expr_ty elem; |
22156 | asdl_seq * seq; |
22157 | if ( |
22158 | (elem = expression_rule(p)) // expression |
22159 | && |
22160 | (seq = _loop0_4_rule(p)) // _loop0_4 |
22161 | ) |
22162 | { |
22163 | D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression _loop0_4" )); |
22164 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
22165 | goto done; |
22166 | } |
22167 | p->mark = _mark; |
22168 | D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n" , p->level, ' ', |
22169 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression _loop0_4" )); |
22170 | } |
22171 | _res = NULL; |
22172 | done: |
22173 | p->level--; |
22174 | return _res; |
22175 | } |
22176 | |
22177 | // _loop0_6: ',' expression |
22178 | static asdl_seq * |
22179 | _loop0_6_rule(Parser *p) |
22180 | { |
22181 | if (p->level++ == MAXSTACK) { |
22182 | p->error_indicator = 1; |
22183 | PyErr_NoMemory(); |
22184 | } |
22185 | if (p->error_indicator) { |
22186 | p->level--; |
22187 | return NULL; |
22188 | } |
22189 | void *_res = NULL; |
22190 | int _mark = p->mark; |
22191 | int _start_mark = p->mark; |
22192 | void **_children = PyMem_Malloc(sizeof(void *)); |
22193 | if (!_children) { |
22194 | p->error_indicator = 1; |
22195 | PyErr_NoMemory(); |
22196 | p->level--; |
22197 | return NULL; |
22198 | } |
22199 | Py_ssize_t _children_capacity = 1; |
22200 | Py_ssize_t _n = 0; |
22201 | { // ',' expression |
22202 | if (p->error_indicator) { |
22203 | p->level--; |
22204 | return NULL; |
22205 | } |
22206 | D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' expression" )); |
22207 | Token * _literal; |
22208 | expr_ty elem; |
22209 | while ( |
22210 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
22211 | && |
22212 | (elem = expression_rule(p)) // expression |
22213 | ) |
22214 | { |
22215 | _res = elem; |
22216 | if (_res == NULL && PyErr_Occurred()) { |
22217 | p->error_indicator = 1; |
22218 | PyMem_Free(_children); |
22219 | p->level--; |
22220 | return NULL; |
22221 | } |
22222 | if (_n == _children_capacity) { |
22223 | _children_capacity *= 2; |
22224 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
22225 | if (!_new_children) { |
22226 | p->error_indicator = 1; |
22227 | PyErr_NoMemory(); |
22228 | p->level--; |
22229 | return NULL; |
22230 | } |
22231 | _children = _new_children; |
22232 | } |
22233 | _children[_n++] = _res; |
22234 | _mark = p->mark; |
22235 | } |
22236 | p->mark = _mark; |
22237 | D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n" , p->level, ' ', |
22238 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' expression" )); |
22239 | } |
22240 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
22241 | if (!_seq) { |
22242 | PyMem_Free(_children); |
22243 | p->error_indicator = 1; |
22244 | PyErr_NoMemory(); |
22245 | p->level--; |
22246 | return NULL; |
22247 | } |
22248 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
22249 | PyMem_Free(_children); |
22250 | _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq); |
22251 | p->level--; |
22252 | return _seq; |
22253 | } |
22254 | |
22255 | // _gather_5: expression _loop0_6 |
22256 | static asdl_seq * |
22257 | _gather_5_rule(Parser *p) |
22258 | { |
22259 | if (p->level++ == MAXSTACK) { |
22260 | p->error_indicator = 1; |
22261 | PyErr_NoMemory(); |
22262 | } |
22263 | if (p->error_indicator) { |
22264 | p->level--; |
22265 | return NULL; |
22266 | } |
22267 | asdl_seq * _res = NULL; |
22268 | int _mark = p->mark; |
22269 | { // expression _loop0_6 |
22270 | if (p->error_indicator) { |
22271 | p->level--; |
22272 | return NULL; |
22273 | } |
22274 | D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression _loop0_6" )); |
22275 | expr_ty elem; |
22276 | asdl_seq * seq; |
22277 | if ( |
22278 | (elem = expression_rule(p)) // expression |
22279 | && |
22280 | (seq = _loop0_6_rule(p)) // _loop0_6 |
22281 | ) |
22282 | { |
22283 | D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression _loop0_6" )); |
22284 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
22285 | goto done; |
22286 | } |
22287 | p->mark = _mark; |
22288 | D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n" , p->level, ' ', |
22289 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression _loop0_6" )); |
22290 | } |
22291 | _res = NULL; |
22292 | done: |
22293 | p->level--; |
22294 | return _res; |
22295 | } |
22296 | |
22297 | // _loop0_8: ',' expression |
22298 | static asdl_seq * |
22299 | _loop0_8_rule(Parser *p) |
22300 | { |
22301 | if (p->level++ == MAXSTACK) { |
22302 | p->error_indicator = 1; |
22303 | PyErr_NoMemory(); |
22304 | } |
22305 | if (p->error_indicator) { |
22306 | p->level--; |
22307 | return NULL; |
22308 | } |
22309 | void *_res = NULL; |
22310 | int _mark = p->mark; |
22311 | int _start_mark = p->mark; |
22312 | void **_children = PyMem_Malloc(sizeof(void *)); |
22313 | if (!_children) { |
22314 | p->error_indicator = 1; |
22315 | PyErr_NoMemory(); |
22316 | p->level--; |
22317 | return NULL; |
22318 | } |
22319 | Py_ssize_t _children_capacity = 1; |
22320 | Py_ssize_t _n = 0; |
22321 | { // ',' expression |
22322 | if (p->error_indicator) { |
22323 | p->level--; |
22324 | return NULL; |
22325 | } |
22326 | D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' expression" )); |
22327 | Token * _literal; |
22328 | expr_ty elem; |
22329 | while ( |
22330 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
22331 | && |
22332 | (elem = expression_rule(p)) // expression |
22333 | ) |
22334 | { |
22335 | _res = elem; |
22336 | if (_res == NULL && PyErr_Occurred()) { |
22337 | p->error_indicator = 1; |
22338 | PyMem_Free(_children); |
22339 | p->level--; |
22340 | return NULL; |
22341 | } |
22342 | if (_n == _children_capacity) { |
22343 | _children_capacity *= 2; |
22344 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
22345 | if (!_new_children) { |
22346 | p->error_indicator = 1; |
22347 | PyErr_NoMemory(); |
22348 | p->level--; |
22349 | return NULL; |
22350 | } |
22351 | _children = _new_children; |
22352 | } |
22353 | _children[_n++] = _res; |
22354 | _mark = p->mark; |
22355 | } |
22356 | p->mark = _mark; |
22357 | D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n" , p->level, ' ', |
22358 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' expression" )); |
22359 | } |
22360 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
22361 | if (!_seq) { |
22362 | PyMem_Free(_children); |
22363 | p->error_indicator = 1; |
22364 | PyErr_NoMemory(); |
22365 | p->level--; |
22366 | return NULL; |
22367 | } |
22368 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
22369 | PyMem_Free(_children); |
22370 | _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq); |
22371 | p->level--; |
22372 | return _seq; |
22373 | } |
22374 | |
22375 | // _gather_7: expression _loop0_8 |
22376 | static asdl_seq * |
22377 | _gather_7_rule(Parser *p) |
22378 | { |
22379 | if (p->level++ == MAXSTACK) { |
22380 | p->error_indicator = 1; |
22381 | PyErr_NoMemory(); |
22382 | } |
22383 | if (p->error_indicator) { |
22384 | p->level--; |
22385 | return NULL; |
22386 | } |
22387 | asdl_seq * _res = NULL; |
22388 | int _mark = p->mark; |
22389 | { // expression _loop0_8 |
22390 | if (p->error_indicator) { |
22391 | p->level--; |
22392 | return NULL; |
22393 | } |
22394 | D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression _loop0_8" )); |
22395 | expr_ty elem; |
22396 | asdl_seq * seq; |
22397 | if ( |
22398 | (elem = expression_rule(p)) // expression |
22399 | && |
22400 | (seq = _loop0_8_rule(p)) // _loop0_8 |
22401 | ) |
22402 | { |
22403 | D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression _loop0_8" )); |
22404 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
22405 | goto done; |
22406 | } |
22407 | p->mark = _mark; |
22408 | D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n" , p->level, ' ', |
22409 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression _loop0_8" )); |
22410 | } |
22411 | _res = NULL; |
22412 | done: |
22413 | p->level--; |
22414 | return _res; |
22415 | } |
22416 | |
22417 | // _loop0_10: ',' expression |
22418 | static asdl_seq * |
22419 | _loop0_10_rule(Parser *p) |
22420 | { |
22421 | if (p->level++ == MAXSTACK) { |
22422 | p->error_indicator = 1; |
22423 | PyErr_NoMemory(); |
22424 | } |
22425 | if (p->error_indicator) { |
22426 | p->level--; |
22427 | return NULL; |
22428 | } |
22429 | void *_res = NULL; |
22430 | int _mark = p->mark; |
22431 | int _start_mark = p->mark; |
22432 | void **_children = PyMem_Malloc(sizeof(void *)); |
22433 | if (!_children) { |
22434 | p->error_indicator = 1; |
22435 | PyErr_NoMemory(); |
22436 | p->level--; |
22437 | return NULL; |
22438 | } |
22439 | Py_ssize_t _children_capacity = 1; |
22440 | Py_ssize_t _n = 0; |
22441 | { // ',' expression |
22442 | if (p->error_indicator) { |
22443 | p->level--; |
22444 | return NULL; |
22445 | } |
22446 | D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' expression" )); |
22447 | Token * _literal; |
22448 | expr_ty elem; |
22449 | while ( |
22450 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
22451 | && |
22452 | (elem = expression_rule(p)) // expression |
22453 | ) |
22454 | { |
22455 | _res = elem; |
22456 | if (_res == NULL && PyErr_Occurred()) { |
22457 | p->error_indicator = 1; |
22458 | PyMem_Free(_children); |
22459 | p->level--; |
22460 | return NULL; |
22461 | } |
22462 | if (_n == _children_capacity) { |
22463 | _children_capacity *= 2; |
22464 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
22465 | if (!_new_children) { |
22466 | p->error_indicator = 1; |
22467 | PyErr_NoMemory(); |
22468 | p->level--; |
22469 | return NULL; |
22470 | } |
22471 | _children = _new_children; |
22472 | } |
22473 | _children[_n++] = _res; |
22474 | _mark = p->mark; |
22475 | } |
22476 | p->mark = _mark; |
22477 | D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n" , p->level, ' ', |
22478 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' expression" )); |
22479 | } |
22480 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
22481 | if (!_seq) { |
22482 | PyMem_Free(_children); |
22483 | p->error_indicator = 1; |
22484 | PyErr_NoMemory(); |
22485 | p->level--; |
22486 | return NULL; |
22487 | } |
22488 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
22489 | PyMem_Free(_children); |
22490 | _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq); |
22491 | p->level--; |
22492 | return _seq; |
22493 | } |
22494 | |
22495 | // _gather_9: expression _loop0_10 |
22496 | static asdl_seq * |
22497 | _gather_9_rule(Parser *p) |
22498 | { |
22499 | if (p->level++ == MAXSTACK) { |
22500 | p->error_indicator = 1; |
22501 | PyErr_NoMemory(); |
22502 | } |
22503 | if (p->error_indicator) { |
22504 | p->level--; |
22505 | return NULL; |
22506 | } |
22507 | asdl_seq * _res = NULL; |
22508 | int _mark = p->mark; |
22509 | { // expression _loop0_10 |
22510 | if (p->error_indicator) { |
22511 | p->level--; |
22512 | return NULL; |
22513 | } |
22514 | D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression _loop0_10" )); |
22515 | expr_ty elem; |
22516 | asdl_seq * seq; |
22517 | if ( |
22518 | (elem = expression_rule(p)) // expression |
22519 | && |
22520 | (seq = _loop0_10_rule(p)) // _loop0_10 |
22521 | ) |
22522 | { |
22523 | D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression _loop0_10" )); |
22524 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
22525 | goto done; |
22526 | } |
22527 | p->mark = _mark; |
22528 | D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n" , p->level, ' ', |
22529 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression _loop0_10" )); |
22530 | } |
22531 | _res = NULL; |
22532 | done: |
22533 | p->level--; |
22534 | return _res; |
22535 | } |
22536 | |
22537 | // _loop1_11: statement |
22538 | static asdl_seq * |
22539 | _loop1_11_rule(Parser *p) |
22540 | { |
22541 | if (p->level++ == MAXSTACK) { |
22542 | p->error_indicator = 1; |
22543 | PyErr_NoMemory(); |
22544 | } |
22545 | if (p->error_indicator) { |
22546 | p->level--; |
22547 | return NULL; |
22548 | } |
22549 | void *_res = NULL; |
22550 | int _mark = p->mark; |
22551 | int _start_mark = p->mark; |
22552 | void **_children = PyMem_Malloc(sizeof(void *)); |
22553 | if (!_children) { |
22554 | p->error_indicator = 1; |
22555 | PyErr_NoMemory(); |
22556 | p->level--; |
22557 | return NULL; |
22558 | } |
22559 | Py_ssize_t _children_capacity = 1; |
22560 | Py_ssize_t _n = 0; |
22561 | { // statement |
22562 | if (p->error_indicator) { |
22563 | p->level--; |
22564 | return NULL; |
22565 | } |
22566 | D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "statement" )); |
22567 | asdl_stmt_seq* statement_var; |
22568 | while ( |
22569 | (statement_var = statement_rule(p)) // statement |
22570 | ) |
22571 | { |
22572 | _res = statement_var; |
22573 | if (_n == _children_capacity) { |
22574 | _children_capacity *= 2; |
22575 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
22576 | if (!_new_children) { |
22577 | p->error_indicator = 1; |
22578 | PyErr_NoMemory(); |
22579 | p->level--; |
22580 | return NULL; |
22581 | } |
22582 | _children = _new_children; |
22583 | } |
22584 | _children[_n++] = _res; |
22585 | _mark = p->mark; |
22586 | } |
22587 | p->mark = _mark; |
22588 | D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n" , p->level, ' ', |
22589 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "statement" )); |
22590 | } |
22591 | if (_n == 0 || p->error_indicator) { |
22592 | PyMem_Free(_children); |
22593 | p->level--; |
22594 | return NULL; |
22595 | } |
22596 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
22597 | if (!_seq) { |
22598 | PyMem_Free(_children); |
22599 | p->error_indicator = 1; |
22600 | PyErr_NoMemory(); |
22601 | p->level--; |
22602 | return NULL; |
22603 | } |
22604 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
22605 | PyMem_Free(_children); |
22606 | _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq); |
22607 | p->level--; |
22608 | return _seq; |
22609 | } |
22610 | |
22611 | // _loop0_13: ';' simple_stmt |
22612 | static asdl_seq * |
22613 | _loop0_13_rule(Parser *p) |
22614 | { |
22615 | if (p->level++ == MAXSTACK) { |
22616 | p->error_indicator = 1; |
22617 | PyErr_NoMemory(); |
22618 | } |
22619 | if (p->error_indicator) { |
22620 | p->level--; |
22621 | return NULL; |
22622 | } |
22623 | void *_res = NULL; |
22624 | int _mark = p->mark; |
22625 | int _start_mark = p->mark; |
22626 | void **_children = PyMem_Malloc(sizeof(void *)); |
22627 | if (!_children) { |
22628 | p->error_indicator = 1; |
22629 | PyErr_NoMemory(); |
22630 | p->level--; |
22631 | return NULL; |
22632 | } |
22633 | Py_ssize_t _children_capacity = 1; |
22634 | Py_ssize_t _n = 0; |
22635 | { // ';' simple_stmt |
22636 | if (p->error_indicator) { |
22637 | p->level--; |
22638 | return NULL; |
22639 | } |
22640 | D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "';' simple_stmt" )); |
22641 | Token * _literal; |
22642 | stmt_ty elem; |
22643 | while ( |
22644 | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
22645 | && |
22646 | (elem = simple_stmt_rule(p)) // simple_stmt |
22647 | ) |
22648 | { |
22649 | _res = elem; |
22650 | if (_res == NULL && PyErr_Occurred()) { |
22651 | p->error_indicator = 1; |
22652 | PyMem_Free(_children); |
22653 | p->level--; |
22654 | return NULL; |
22655 | } |
22656 | if (_n == _children_capacity) { |
22657 | _children_capacity *= 2; |
22658 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
22659 | if (!_new_children) { |
22660 | p->error_indicator = 1; |
22661 | PyErr_NoMemory(); |
22662 | p->level--; |
22663 | return NULL; |
22664 | } |
22665 | _children = _new_children; |
22666 | } |
22667 | _children[_n++] = _res; |
22668 | _mark = p->mark; |
22669 | } |
22670 | p->mark = _mark; |
22671 | D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n" , p->level, ' ', |
22672 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "';' simple_stmt" )); |
22673 | } |
22674 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
22675 | if (!_seq) { |
22676 | PyMem_Free(_children); |
22677 | p->error_indicator = 1; |
22678 | PyErr_NoMemory(); |
22679 | p->level--; |
22680 | return NULL; |
22681 | } |
22682 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
22683 | PyMem_Free(_children); |
22684 | _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq); |
22685 | p->level--; |
22686 | return _seq; |
22687 | } |
22688 | |
22689 | // _gather_12: simple_stmt _loop0_13 |
22690 | static asdl_seq * |
22691 | _gather_12_rule(Parser *p) |
22692 | { |
22693 | if (p->level++ == MAXSTACK) { |
22694 | p->error_indicator = 1; |
22695 | PyErr_NoMemory(); |
22696 | } |
22697 | if (p->error_indicator) { |
22698 | p->level--; |
22699 | return NULL; |
22700 | } |
22701 | asdl_seq * _res = NULL; |
22702 | int _mark = p->mark; |
22703 | { // simple_stmt _loop0_13 |
22704 | if (p->error_indicator) { |
22705 | p->level--; |
22706 | return NULL; |
22707 | } |
22708 | D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "simple_stmt _loop0_13" )); |
22709 | stmt_ty elem; |
22710 | asdl_seq * seq; |
22711 | if ( |
22712 | (elem = simple_stmt_rule(p)) // simple_stmt |
22713 | && |
22714 | (seq = _loop0_13_rule(p)) // _loop0_13 |
22715 | ) |
22716 | { |
22717 | D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "simple_stmt _loop0_13" )); |
22718 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
22719 | goto done; |
22720 | } |
22721 | p->mark = _mark; |
22722 | D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n" , p->level, ' ', |
22723 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "simple_stmt _loop0_13" )); |
22724 | } |
22725 | _res = NULL; |
22726 | done: |
22727 | p->level--; |
22728 | return _res; |
22729 | } |
22730 | |
22731 | // _tmp_14: 'import' | 'from' |
22732 | static void * |
22733 | _tmp_14_rule(Parser *p) |
22734 | { |
22735 | if (p->level++ == MAXSTACK) { |
22736 | p->error_indicator = 1; |
22737 | PyErr_NoMemory(); |
22738 | } |
22739 | if (p->error_indicator) { |
22740 | p->level--; |
22741 | return NULL; |
22742 | } |
22743 | void * _res = NULL; |
22744 | int _mark = p->mark; |
22745 | { // 'import' |
22746 | if (p->error_indicator) { |
22747 | p->level--; |
22748 | return NULL; |
22749 | } |
22750 | D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'import'" )); |
22751 | Token * _keyword; |
22752 | if ( |
22753 | (_keyword = _PyPegen_expect_token(p, 513)) // token='import' |
22754 | ) |
22755 | { |
22756 | D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'import'" )); |
22757 | _res = _keyword; |
22758 | goto done; |
22759 | } |
22760 | p->mark = _mark; |
22761 | D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n" , p->level, ' ', |
22762 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'import'" )); |
22763 | } |
22764 | { // 'from' |
22765 | if (p->error_indicator) { |
22766 | p->level--; |
22767 | return NULL; |
22768 | } |
22769 | D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'from'" )); |
22770 | Token * _keyword; |
22771 | if ( |
22772 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
22773 | ) |
22774 | { |
22775 | D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'from'" )); |
22776 | _res = _keyword; |
22777 | goto done; |
22778 | } |
22779 | p->mark = _mark; |
22780 | D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n" , p->level, ' ', |
22781 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'from'" )); |
22782 | } |
22783 | _res = NULL; |
22784 | done: |
22785 | p->level--; |
22786 | return _res; |
22787 | } |
22788 | |
22789 | // _tmp_15: 'def' | '@' | ASYNC |
22790 | static void * |
22791 | _tmp_15_rule(Parser *p) |
22792 | { |
22793 | if (p->level++ == MAXSTACK) { |
22794 | p->error_indicator = 1; |
22795 | PyErr_NoMemory(); |
22796 | } |
22797 | if (p->error_indicator) { |
22798 | p->level--; |
22799 | return NULL; |
22800 | } |
22801 | void * _res = NULL; |
22802 | int _mark = p->mark; |
22803 | { // 'def' |
22804 | if (p->error_indicator) { |
22805 | p->level--; |
22806 | return NULL; |
22807 | } |
22808 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'def'" )); |
22809 | Token * _keyword; |
22810 | if ( |
22811 | (_keyword = _PyPegen_expect_token(p, 526)) // token='def' |
22812 | ) |
22813 | { |
22814 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'def'" )); |
22815 | _res = _keyword; |
22816 | goto done; |
22817 | } |
22818 | p->mark = _mark; |
22819 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n" , p->level, ' ', |
22820 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'def'" )); |
22821 | } |
22822 | { // '@' |
22823 | if (p->error_indicator) { |
22824 | p->level--; |
22825 | return NULL; |
22826 | } |
22827 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'@'" )); |
22828 | Token * _literal; |
22829 | if ( |
22830 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
22831 | ) |
22832 | { |
22833 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'@'" )); |
22834 | _res = _literal; |
22835 | goto done; |
22836 | } |
22837 | p->mark = _mark; |
22838 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n" , p->level, ' ', |
22839 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'@'" )); |
22840 | } |
22841 | { // ASYNC |
22842 | if (p->error_indicator) { |
22843 | p->level--; |
22844 | return NULL; |
22845 | } |
22846 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC" )); |
22847 | Token * async_var; |
22848 | if ( |
22849 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
22850 | ) |
22851 | { |
22852 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC" )); |
22853 | _res = async_var; |
22854 | goto done; |
22855 | } |
22856 | p->mark = _mark; |
22857 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n" , p->level, ' ', |
22858 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC" )); |
22859 | } |
22860 | _res = NULL; |
22861 | done: |
22862 | p->level--; |
22863 | return _res; |
22864 | } |
22865 | |
22866 | // _tmp_16: 'class' | '@' |
22867 | static void * |
22868 | _tmp_16_rule(Parser *p) |
22869 | { |
22870 | if (p->level++ == MAXSTACK) { |
22871 | p->error_indicator = 1; |
22872 | PyErr_NoMemory(); |
22873 | } |
22874 | if (p->error_indicator) { |
22875 | p->level--; |
22876 | return NULL; |
22877 | } |
22878 | void * _res = NULL; |
22879 | int _mark = p->mark; |
22880 | { // 'class' |
22881 | if (p->error_indicator) { |
22882 | p->level--; |
22883 | return NULL; |
22884 | } |
22885 | D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'class'" )); |
22886 | Token * _keyword; |
22887 | if ( |
22888 | (_keyword = _PyPegen_expect_token(p, 527)) // token='class' |
22889 | ) |
22890 | { |
22891 | D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'class'" )); |
22892 | _res = _keyword; |
22893 | goto done; |
22894 | } |
22895 | p->mark = _mark; |
22896 | D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n" , p->level, ' ', |
22897 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'class'" )); |
22898 | } |
22899 | { // '@' |
22900 | if (p->error_indicator) { |
22901 | p->level--; |
22902 | return NULL; |
22903 | } |
22904 | D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'@'" )); |
22905 | Token * _literal; |
22906 | if ( |
22907 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
22908 | ) |
22909 | { |
22910 | D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'@'" )); |
22911 | _res = _literal; |
22912 | goto done; |
22913 | } |
22914 | p->mark = _mark; |
22915 | D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n" , p->level, ' ', |
22916 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'@'" )); |
22917 | } |
22918 | _res = NULL; |
22919 | done: |
22920 | p->level--; |
22921 | return _res; |
22922 | } |
22923 | |
22924 | // _tmp_17: 'with' | ASYNC |
22925 | static void * |
22926 | _tmp_17_rule(Parser *p) |
22927 | { |
22928 | if (p->level++ == MAXSTACK) { |
22929 | p->error_indicator = 1; |
22930 | PyErr_NoMemory(); |
22931 | } |
22932 | if (p->error_indicator) { |
22933 | p->level--; |
22934 | return NULL; |
22935 | } |
22936 | void * _res = NULL; |
22937 | int _mark = p->mark; |
22938 | { // 'with' |
22939 | if (p->error_indicator) { |
22940 | p->level--; |
22941 | return NULL; |
22942 | } |
22943 | D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'with'" )); |
22944 | Token * _keyword; |
22945 | if ( |
22946 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
22947 | ) |
22948 | { |
22949 | D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'with'" )); |
22950 | _res = _keyword; |
22951 | goto done; |
22952 | } |
22953 | p->mark = _mark; |
22954 | D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n" , p->level, ' ', |
22955 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'with'" )); |
22956 | } |
22957 | { // ASYNC |
22958 | if (p->error_indicator) { |
22959 | p->level--; |
22960 | return NULL; |
22961 | } |
22962 | D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC" )); |
22963 | Token * async_var; |
22964 | if ( |
22965 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
22966 | ) |
22967 | { |
22968 | D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC" )); |
22969 | _res = async_var; |
22970 | goto done; |
22971 | } |
22972 | p->mark = _mark; |
22973 | D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n" , p->level, ' ', |
22974 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC" )); |
22975 | } |
22976 | _res = NULL; |
22977 | done: |
22978 | p->level--; |
22979 | return _res; |
22980 | } |
22981 | |
22982 | // _tmp_18: 'for' | ASYNC |
22983 | static void * |
22984 | _tmp_18_rule(Parser *p) |
22985 | { |
22986 | if (p->level++ == MAXSTACK) { |
22987 | p->error_indicator = 1; |
22988 | PyErr_NoMemory(); |
22989 | } |
22990 | if (p->error_indicator) { |
22991 | p->level--; |
22992 | return NULL; |
22993 | } |
22994 | void * _res = NULL; |
22995 | int _mark = p->mark; |
22996 | { // 'for' |
22997 | if (p->error_indicator) { |
22998 | p->level--; |
22999 | return NULL; |
23000 | } |
23001 | D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'for'" )); |
23002 | Token * _keyword; |
23003 | if ( |
23004 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
23005 | ) |
23006 | { |
23007 | D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'for'" )); |
23008 | _res = _keyword; |
23009 | goto done; |
23010 | } |
23011 | p->mark = _mark; |
23012 | D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n" , p->level, ' ', |
23013 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'for'" )); |
23014 | } |
23015 | { // ASYNC |
23016 | if (p->error_indicator) { |
23017 | p->level--; |
23018 | return NULL; |
23019 | } |
23020 | D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "ASYNC" )); |
23021 | Token * async_var; |
23022 | if ( |
23023 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
23024 | ) |
23025 | { |
23026 | D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "ASYNC" )); |
23027 | _res = async_var; |
23028 | goto done; |
23029 | } |
23030 | p->mark = _mark; |
23031 | D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n" , p->level, ' ', |
23032 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "ASYNC" )); |
23033 | } |
23034 | _res = NULL; |
23035 | done: |
23036 | p->level--; |
23037 | return _res; |
23038 | } |
23039 | |
23040 | // _tmp_19: '=' annotated_rhs |
23041 | static void * |
23042 | _tmp_19_rule(Parser *p) |
23043 | { |
23044 | if (p->level++ == MAXSTACK) { |
23045 | p->error_indicator = 1; |
23046 | PyErr_NoMemory(); |
23047 | } |
23048 | if (p->error_indicator) { |
23049 | p->level--; |
23050 | return NULL; |
23051 | } |
23052 | void * _res = NULL; |
23053 | int _mark = p->mark; |
23054 | { // '=' annotated_rhs |
23055 | if (p->error_indicator) { |
23056 | p->level--; |
23057 | return NULL; |
23058 | } |
23059 | D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'=' annotated_rhs" )); |
23060 | Token * _literal; |
23061 | expr_ty d; |
23062 | if ( |
23063 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
23064 | && |
23065 | (d = annotated_rhs_rule(p)) // annotated_rhs |
23066 | ) |
23067 | { |
23068 | D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'=' annotated_rhs" )); |
23069 | _res = d; |
23070 | if (_res == NULL && PyErr_Occurred()) { |
23071 | p->error_indicator = 1; |
23072 | p->level--; |
23073 | return NULL; |
23074 | } |
23075 | goto done; |
23076 | } |
23077 | p->mark = _mark; |
23078 | D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n" , p->level, ' ', |
23079 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'=' annotated_rhs" )); |
23080 | } |
23081 | _res = NULL; |
23082 | done: |
23083 | p->level--; |
23084 | return _res; |
23085 | } |
23086 | |
23087 | // _tmp_20: '(' single_target ')' | single_subscript_attribute_target |
23088 | static void * |
23089 | _tmp_20_rule(Parser *p) |
23090 | { |
23091 | if (p->level++ == MAXSTACK) { |
23092 | p->error_indicator = 1; |
23093 | PyErr_NoMemory(); |
23094 | } |
23095 | if (p->error_indicator) { |
23096 | p->level--; |
23097 | return NULL; |
23098 | } |
23099 | void * _res = NULL; |
23100 | int _mark = p->mark; |
23101 | { // '(' single_target ')' |
23102 | if (p->error_indicator) { |
23103 | p->level--; |
23104 | return NULL; |
23105 | } |
23106 | D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' single_target ')'" )); |
23107 | Token * _literal; |
23108 | Token * _literal_1; |
23109 | expr_ty b; |
23110 | if ( |
23111 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
23112 | && |
23113 | (b = single_target_rule(p)) // single_target |
23114 | && |
23115 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
23116 | ) |
23117 | { |
23118 | D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' single_target ')'" )); |
23119 | _res = b; |
23120 | if (_res == NULL && PyErr_Occurred()) { |
23121 | p->error_indicator = 1; |
23122 | p->level--; |
23123 | return NULL; |
23124 | } |
23125 | goto done; |
23126 | } |
23127 | p->mark = _mark; |
23128 | D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n" , p->level, ' ', |
23129 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' single_target ')'" )); |
23130 | } |
23131 | { // single_subscript_attribute_target |
23132 | if (p->error_indicator) { |
23133 | p->level--; |
23134 | return NULL; |
23135 | } |
23136 | D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "single_subscript_attribute_target" )); |
23137 | expr_ty single_subscript_attribute_target_var; |
23138 | if ( |
23139 | (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target |
23140 | ) |
23141 | { |
23142 | D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "single_subscript_attribute_target" )); |
23143 | _res = single_subscript_attribute_target_var; |
23144 | goto done; |
23145 | } |
23146 | p->mark = _mark; |
23147 | D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n" , p->level, ' ', |
23148 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "single_subscript_attribute_target" )); |
23149 | } |
23150 | _res = NULL; |
23151 | done: |
23152 | p->level--; |
23153 | return _res; |
23154 | } |
23155 | |
23156 | // _tmp_21: '=' annotated_rhs |
23157 | static void * |
23158 | _tmp_21_rule(Parser *p) |
23159 | { |
23160 | if (p->level++ == MAXSTACK) { |
23161 | p->error_indicator = 1; |
23162 | PyErr_NoMemory(); |
23163 | } |
23164 | if (p->error_indicator) { |
23165 | p->level--; |
23166 | return NULL; |
23167 | } |
23168 | void * _res = NULL; |
23169 | int _mark = p->mark; |
23170 | { // '=' annotated_rhs |
23171 | if (p->error_indicator) { |
23172 | p->level--; |
23173 | return NULL; |
23174 | } |
23175 | D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'=' annotated_rhs" )); |
23176 | Token * _literal; |
23177 | expr_ty d; |
23178 | if ( |
23179 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
23180 | && |
23181 | (d = annotated_rhs_rule(p)) // annotated_rhs |
23182 | ) |
23183 | { |
23184 | D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'=' annotated_rhs" )); |
23185 | _res = d; |
23186 | if (_res == NULL && PyErr_Occurred()) { |
23187 | p->error_indicator = 1; |
23188 | p->level--; |
23189 | return NULL; |
23190 | } |
23191 | goto done; |
23192 | } |
23193 | p->mark = _mark; |
23194 | D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n" , p->level, ' ', |
23195 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'=' annotated_rhs" )); |
23196 | } |
23197 | _res = NULL; |
23198 | done: |
23199 | p->level--; |
23200 | return _res; |
23201 | } |
23202 | |
23203 | // _loop1_22: (star_targets '=') |
23204 | static asdl_seq * |
23205 | _loop1_22_rule(Parser *p) |
23206 | { |
23207 | if (p->level++ == MAXSTACK) { |
23208 | p->error_indicator = 1; |
23209 | PyErr_NoMemory(); |
23210 | } |
23211 | if (p->error_indicator) { |
23212 | p->level--; |
23213 | return NULL; |
23214 | } |
23215 | void *_res = NULL; |
23216 | int _mark = p->mark; |
23217 | int _start_mark = p->mark; |
23218 | void **_children = PyMem_Malloc(sizeof(void *)); |
23219 | if (!_children) { |
23220 | p->error_indicator = 1; |
23221 | PyErr_NoMemory(); |
23222 | p->level--; |
23223 | return NULL; |
23224 | } |
23225 | Py_ssize_t _children_capacity = 1; |
23226 | Py_ssize_t _n = 0; |
23227 | { // (star_targets '=') |
23228 | if (p->error_indicator) { |
23229 | p->level--; |
23230 | return NULL; |
23231 | } |
23232 | D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(star_targets '=')" )); |
23233 | void *_tmp_181_var; |
23234 | while ( |
23235 | (_tmp_181_var = _tmp_181_rule(p)) // star_targets '=' |
23236 | ) |
23237 | { |
23238 | _res = _tmp_181_var; |
23239 | if (_n == _children_capacity) { |
23240 | _children_capacity *= 2; |
23241 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
23242 | if (!_new_children) { |
23243 | p->error_indicator = 1; |
23244 | PyErr_NoMemory(); |
23245 | p->level--; |
23246 | return NULL; |
23247 | } |
23248 | _children = _new_children; |
23249 | } |
23250 | _children[_n++] = _res; |
23251 | _mark = p->mark; |
23252 | } |
23253 | p->mark = _mark; |
23254 | D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n" , p->level, ' ', |
23255 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(star_targets '=')" )); |
23256 | } |
23257 | if (_n == 0 || p->error_indicator) { |
23258 | PyMem_Free(_children); |
23259 | p->level--; |
23260 | return NULL; |
23261 | } |
23262 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
23263 | if (!_seq) { |
23264 | PyMem_Free(_children); |
23265 | p->error_indicator = 1; |
23266 | PyErr_NoMemory(); |
23267 | p->level--; |
23268 | return NULL; |
23269 | } |
23270 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
23271 | PyMem_Free(_children); |
23272 | _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq); |
23273 | p->level--; |
23274 | return _seq; |
23275 | } |
23276 | |
23277 | // _tmp_23: yield_expr | star_expressions |
23278 | static void * |
23279 | _tmp_23_rule(Parser *p) |
23280 | { |
23281 | if (p->level++ == MAXSTACK) { |
23282 | p->error_indicator = 1; |
23283 | PyErr_NoMemory(); |
23284 | } |
23285 | if (p->error_indicator) { |
23286 | p->level--; |
23287 | return NULL; |
23288 | } |
23289 | void * _res = NULL; |
23290 | int _mark = p->mark; |
23291 | { // yield_expr |
23292 | if (p->error_indicator) { |
23293 | p->level--; |
23294 | return NULL; |
23295 | } |
23296 | D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "yield_expr" )); |
23297 | expr_ty yield_expr_var; |
23298 | if ( |
23299 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
23300 | ) |
23301 | { |
23302 | D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "yield_expr" )); |
23303 | _res = yield_expr_var; |
23304 | goto done; |
23305 | } |
23306 | p->mark = _mark; |
23307 | D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n" , p->level, ' ', |
23308 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "yield_expr" )); |
23309 | } |
23310 | { // star_expressions |
23311 | if (p->error_indicator) { |
23312 | p->level--; |
23313 | return NULL; |
23314 | } |
23315 | D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_expressions" )); |
23316 | expr_ty star_expressions_var; |
23317 | if ( |
23318 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
23319 | ) |
23320 | { |
23321 | D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_expressions" )); |
23322 | _res = star_expressions_var; |
23323 | goto done; |
23324 | } |
23325 | p->mark = _mark; |
23326 | D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n" , p->level, ' ', |
23327 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_expressions" )); |
23328 | } |
23329 | _res = NULL; |
23330 | done: |
23331 | p->level--; |
23332 | return _res; |
23333 | } |
23334 | |
23335 | // _tmp_24: yield_expr | star_expressions |
23336 | static void * |
23337 | _tmp_24_rule(Parser *p) |
23338 | { |
23339 | if (p->level++ == MAXSTACK) { |
23340 | p->error_indicator = 1; |
23341 | PyErr_NoMemory(); |
23342 | } |
23343 | if (p->error_indicator) { |
23344 | p->level--; |
23345 | return NULL; |
23346 | } |
23347 | void * _res = NULL; |
23348 | int _mark = p->mark; |
23349 | { // yield_expr |
23350 | if (p->error_indicator) { |
23351 | p->level--; |
23352 | return NULL; |
23353 | } |
23354 | D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "yield_expr" )); |
23355 | expr_ty yield_expr_var; |
23356 | if ( |
23357 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
23358 | ) |
23359 | { |
23360 | D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "yield_expr" )); |
23361 | _res = yield_expr_var; |
23362 | goto done; |
23363 | } |
23364 | p->mark = _mark; |
23365 | D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n" , p->level, ' ', |
23366 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "yield_expr" )); |
23367 | } |
23368 | { // star_expressions |
23369 | if (p->error_indicator) { |
23370 | p->level--; |
23371 | return NULL; |
23372 | } |
23373 | D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_expressions" )); |
23374 | expr_ty star_expressions_var; |
23375 | if ( |
23376 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
23377 | ) |
23378 | { |
23379 | D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_expressions" )); |
23380 | _res = star_expressions_var; |
23381 | goto done; |
23382 | } |
23383 | p->mark = _mark; |
23384 | D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n" , p->level, ' ', |
23385 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_expressions" )); |
23386 | } |
23387 | _res = NULL; |
23388 | done: |
23389 | p->level--; |
23390 | return _res; |
23391 | } |
23392 | |
23393 | // _loop0_26: ',' NAME |
23394 | static asdl_seq * |
23395 | _loop0_26_rule(Parser *p) |
23396 | { |
23397 | if (p->level++ == MAXSTACK) { |
23398 | p->error_indicator = 1; |
23399 | PyErr_NoMemory(); |
23400 | } |
23401 | if (p->error_indicator) { |
23402 | p->level--; |
23403 | return NULL; |
23404 | } |
23405 | void *_res = NULL; |
23406 | int _mark = p->mark; |
23407 | int _start_mark = p->mark; |
23408 | void **_children = PyMem_Malloc(sizeof(void *)); |
23409 | if (!_children) { |
23410 | p->error_indicator = 1; |
23411 | PyErr_NoMemory(); |
23412 | p->level--; |
23413 | return NULL; |
23414 | } |
23415 | Py_ssize_t _children_capacity = 1; |
23416 | Py_ssize_t _n = 0; |
23417 | { // ',' NAME |
23418 | if (p->error_indicator) { |
23419 | p->level--; |
23420 | return NULL; |
23421 | } |
23422 | D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' NAME" )); |
23423 | Token * _literal; |
23424 | expr_ty elem; |
23425 | while ( |
23426 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
23427 | && |
23428 | (elem = _PyPegen_name_token(p)) // NAME |
23429 | ) |
23430 | { |
23431 | _res = elem; |
23432 | if (_res == NULL && PyErr_Occurred()) { |
23433 | p->error_indicator = 1; |
23434 | PyMem_Free(_children); |
23435 | p->level--; |
23436 | return NULL; |
23437 | } |
23438 | if (_n == _children_capacity) { |
23439 | _children_capacity *= 2; |
23440 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
23441 | if (!_new_children) { |
23442 | p->error_indicator = 1; |
23443 | PyErr_NoMemory(); |
23444 | p->level--; |
23445 | return NULL; |
23446 | } |
23447 | _children = _new_children; |
23448 | } |
23449 | _children[_n++] = _res; |
23450 | _mark = p->mark; |
23451 | } |
23452 | p->mark = _mark; |
23453 | D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n" , p->level, ' ', |
23454 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' NAME" )); |
23455 | } |
23456 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
23457 | if (!_seq) { |
23458 | PyMem_Free(_children); |
23459 | p->error_indicator = 1; |
23460 | PyErr_NoMemory(); |
23461 | p->level--; |
23462 | return NULL; |
23463 | } |
23464 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
23465 | PyMem_Free(_children); |
23466 | _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq); |
23467 | p->level--; |
23468 | return _seq; |
23469 | } |
23470 | |
23471 | // _gather_25: NAME _loop0_26 |
23472 | static asdl_seq * |
23473 | _gather_25_rule(Parser *p) |
23474 | { |
23475 | if (p->level++ == MAXSTACK) { |
23476 | p->error_indicator = 1; |
23477 | PyErr_NoMemory(); |
23478 | } |
23479 | if (p->error_indicator) { |
23480 | p->level--; |
23481 | return NULL; |
23482 | } |
23483 | asdl_seq * _res = NULL; |
23484 | int _mark = p->mark; |
23485 | { // NAME _loop0_26 |
23486 | if (p->error_indicator) { |
23487 | p->level--; |
23488 | return NULL; |
23489 | } |
23490 | D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME _loop0_26" )); |
23491 | expr_ty elem; |
23492 | asdl_seq * seq; |
23493 | if ( |
23494 | (elem = _PyPegen_name_token(p)) // NAME |
23495 | && |
23496 | (seq = _loop0_26_rule(p)) // _loop0_26 |
23497 | ) |
23498 | { |
23499 | D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME _loop0_26" )); |
23500 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
23501 | goto done; |
23502 | } |
23503 | p->mark = _mark; |
23504 | D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n" , p->level, ' ', |
23505 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME _loop0_26" )); |
23506 | } |
23507 | _res = NULL; |
23508 | done: |
23509 | p->level--; |
23510 | return _res; |
23511 | } |
23512 | |
23513 | // _loop0_28: ',' NAME |
23514 | static asdl_seq * |
23515 | _loop0_28_rule(Parser *p) |
23516 | { |
23517 | if (p->level++ == MAXSTACK) { |
23518 | p->error_indicator = 1; |
23519 | PyErr_NoMemory(); |
23520 | } |
23521 | if (p->error_indicator) { |
23522 | p->level--; |
23523 | return NULL; |
23524 | } |
23525 | void *_res = NULL; |
23526 | int _mark = p->mark; |
23527 | int _start_mark = p->mark; |
23528 | void **_children = PyMem_Malloc(sizeof(void *)); |
23529 | if (!_children) { |
23530 | p->error_indicator = 1; |
23531 | PyErr_NoMemory(); |
23532 | p->level--; |
23533 | return NULL; |
23534 | } |
23535 | Py_ssize_t _children_capacity = 1; |
23536 | Py_ssize_t _n = 0; |
23537 | { // ',' NAME |
23538 | if (p->error_indicator) { |
23539 | p->level--; |
23540 | return NULL; |
23541 | } |
23542 | D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' NAME" )); |
23543 | Token * _literal; |
23544 | expr_ty elem; |
23545 | while ( |
23546 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
23547 | && |
23548 | (elem = _PyPegen_name_token(p)) // NAME |
23549 | ) |
23550 | { |
23551 | _res = elem; |
23552 | if (_res == NULL && PyErr_Occurred()) { |
23553 | p->error_indicator = 1; |
23554 | PyMem_Free(_children); |
23555 | p->level--; |
23556 | return NULL; |
23557 | } |
23558 | if (_n == _children_capacity) { |
23559 | _children_capacity *= 2; |
23560 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
23561 | if (!_new_children) { |
23562 | p->error_indicator = 1; |
23563 | PyErr_NoMemory(); |
23564 | p->level--; |
23565 | return NULL; |
23566 | } |
23567 | _children = _new_children; |
23568 | } |
23569 | _children[_n++] = _res; |
23570 | _mark = p->mark; |
23571 | } |
23572 | p->mark = _mark; |
23573 | D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n" , p->level, ' ', |
23574 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' NAME" )); |
23575 | } |
23576 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
23577 | if (!_seq) { |
23578 | PyMem_Free(_children); |
23579 | p->error_indicator = 1; |
23580 | PyErr_NoMemory(); |
23581 | p->level--; |
23582 | return NULL; |
23583 | } |
23584 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
23585 | PyMem_Free(_children); |
23586 | _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq); |
23587 | p->level--; |
23588 | return _seq; |
23589 | } |
23590 | |
23591 | // _gather_27: NAME _loop0_28 |
23592 | static asdl_seq * |
23593 | _gather_27_rule(Parser *p) |
23594 | { |
23595 | if (p->level++ == MAXSTACK) { |
23596 | p->error_indicator = 1; |
23597 | PyErr_NoMemory(); |
23598 | } |
23599 | if (p->error_indicator) { |
23600 | p->level--; |
23601 | return NULL; |
23602 | } |
23603 | asdl_seq * _res = NULL; |
23604 | int _mark = p->mark; |
23605 | { // NAME _loop0_28 |
23606 | if (p->error_indicator) { |
23607 | p->level--; |
23608 | return NULL; |
23609 | } |
23610 | D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME _loop0_28" )); |
23611 | expr_ty elem; |
23612 | asdl_seq * seq; |
23613 | if ( |
23614 | (elem = _PyPegen_name_token(p)) // NAME |
23615 | && |
23616 | (seq = _loop0_28_rule(p)) // _loop0_28 |
23617 | ) |
23618 | { |
23619 | D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME _loop0_28" )); |
23620 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
23621 | goto done; |
23622 | } |
23623 | p->mark = _mark; |
23624 | D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n" , p->level, ' ', |
23625 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME _loop0_28" )); |
23626 | } |
23627 | _res = NULL; |
23628 | done: |
23629 | p->level--; |
23630 | return _res; |
23631 | } |
23632 | |
23633 | // _tmp_29: ',' expression |
23634 | static void * |
23635 | _tmp_29_rule(Parser *p) |
23636 | { |
23637 | if (p->level++ == MAXSTACK) { |
23638 | p->error_indicator = 1; |
23639 | PyErr_NoMemory(); |
23640 | } |
23641 | if (p->error_indicator) { |
23642 | p->level--; |
23643 | return NULL; |
23644 | } |
23645 | void * _res = NULL; |
23646 | int _mark = p->mark; |
23647 | { // ',' expression |
23648 | if (p->error_indicator) { |
23649 | p->level--; |
23650 | return NULL; |
23651 | } |
23652 | D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' expression" )); |
23653 | Token * _literal; |
23654 | expr_ty z; |
23655 | if ( |
23656 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
23657 | && |
23658 | (z = expression_rule(p)) // expression |
23659 | ) |
23660 | { |
23661 | D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "',' expression" )); |
23662 | _res = z; |
23663 | if (_res == NULL && PyErr_Occurred()) { |
23664 | p->error_indicator = 1; |
23665 | p->level--; |
23666 | return NULL; |
23667 | } |
23668 | goto done; |
23669 | } |
23670 | p->mark = _mark; |
23671 | D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n" , p->level, ' ', |
23672 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' expression" )); |
23673 | } |
23674 | _res = NULL; |
23675 | done: |
23676 | p->level--; |
23677 | return _res; |
23678 | } |
23679 | |
23680 | // _tmp_30: ';' | NEWLINE |
23681 | static void * |
23682 | _tmp_30_rule(Parser *p) |
23683 | { |
23684 | if (p->level++ == MAXSTACK) { |
23685 | p->error_indicator = 1; |
23686 | PyErr_NoMemory(); |
23687 | } |
23688 | if (p->error_indicator) { |
23689 | p->level--; |
23690 | return NULL; |
23691 | } |
23692 | void * _res = NULL; |
23693 | int _mark = p->mark; |
23694 | { // ';' |
23695 | if (p->error_indicator) { |
23696 | p->level--; |
23697 | return NULL; |
23698 | } |
23699 | D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "';'" )); |
23700 | Token * _literal; |
23701 | if ( |
23702 | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
23703 | ) |
23704 | { |
23705 | D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "';'" )); |
23706 | _res = _literal; |
23707 | goto done; |
23708 | } |
23709 | p->mark = _mark; |
23710 | D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n" , p->level, ' ', |
23711 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "';'" )); |
23712 | } |
23713 | { // NEWLINE |
23714 | if (p->error_indicator) { |
23715 | p->level--; |
23716 | return NULL; |
23717 | } |
23718 | D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NEWLINE" )); |
23719 | Token * newline_var; |
23720 | if ( |
23721 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
23722 | ) |
23723 | { |
23724 | D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NEWLINE" )); |
23725 | _res = newline_var; |
23726 | goto done; |
23727 | } |
23728 | p->mark = _mark; |
23729 | D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n" , p->level, ' ', |
23730 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NEWLINE" )); |
23731 | } |
23732 | _res = NULL; |
23733 | done: |
23734 | p->level--; |
23735 | return _res; |
23736 | } |
23737 | |
23738 | // _loop0_31: ('.' | '...') |
23739 | static asdl_seq * |
23740 | _loop0_31_rule(Parser *p) |
23741 | { |
23742 | if (p->level++ == MAXSTACK) { |
23743 | p->error_indicator = 1; |
23744 | PyErr_NoMemory(); |
23745 | } |
23746 | if (p->error_indicator) { |
23747 | p->level--; |
23748 | return NULL; |
23749 | } |
23750 | void *_res = NULL; |
23751 | int _mark = p->mark; |
23752 | int _start_mark = p->mark; |
23753 | void **_children = PyMem_Malloc(sizeof(void *)); |
23754 | if (!_children) { |
23755 | p->error_indicator = 1; |
23756 | PyErr_NoMemory(); |
23757 | p->level--; |
23758 | return NULL; |
23759 | } |
23760 | Py_ssize_t _children_capacity = 1; |
23761 | Py_ssize_t _n = 0; |
23762 | { // ('.' | '...') |
23763 | if (p->error_indicator) { |
23764 | p->level--; |
23765 | return NULL; |
23766 | } |
23767 | D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('.' | '...')" )); |
23768 | void *_tmp_182_var; |
23769 | while ( |
23770 | (_tmp_182_var = _tmp_182_rule(p)) // '.' | '...' |
23771 | ) |
23772 | { |
23773 | _res = _tmp_182_var; |
23774 | if (_n == _children_capacity) { |
23775 | _children_capacity *= 2; |
23776 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
23777 | if (!_new_children) { |
23778 | p->error_indicator = 1; |
23779 | PyErr_NoMemory(); |
23780 | p->level--; |
23781 | return NULL; |
23782 | } |
23783 | _children = _new_children; |
23784 | } |
23785 | _children[_n++] = _res; |
23786 | _mark = p->mark; |
23787 | } |
23788 | p->mark = _mark; |
23789 | D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n" , p->level, ' ', |
23790 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('.' | '...')" )); |
23791 | } |
23792 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
23793 | if (!_seq) { |
23794 | PyMem_Free(_children); |
23795 | p->error_indicator = 1; |
23796 | PyErr_NoMemory(); |
23797 | p->level--; |
23798 | return NULL; |
23799 | } |
23800 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
23801 | PyMem_Free(_children); |
23802 | _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq); |
23803 | p->level--; |
23804 | return _seq; |
23805 | } |
23806 | |
23807 | // _loop1_32: ('.' | '...') |
23808 | static asdl_seq * |
23809 | _loop1_32_rule(Parser *p) |
23810 | { |
23811 | if (p->level++ == MAXSTACK) { |
23812 | p->error_indicator = 1; |
23813 | PyErr_NoMemory(); |
23814 | } |
23815 | if (p->error_indicator) { |
23816 | p->level--; |
23817 | return NULL; |
23818 | } |
23819 | void *_res = NULL; |
23820 | int _mark = p->mark; |
23821 | int _start_mark = p->mark; |
23822 | void **_children = PyMem_Malloc(sizeof(void *)); |
23823 | if (!_children) { |
23824 | p->error_indicator = 1; |
23825 | PyErr_NoMemory(); |
23826 | p->level--; |
23827 | return NULL; |
23828 | } |
23829 | Py_ssize_t _children_capacity = 1; |
23830 | Py_ssize_t _n = 0; |
23831 | { // ('.' | '...') |
23832 | if (p->error_indicator) { |
23833 | p->level--; |
23834 | return NULL; |
23835 | } |
23836 | D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('.' | '...')" )); |
23837 | void *_tmp_183_var; |
23838 | while ( |
23839 | (_tmp_183_var = _tmp_183_rule(p)) // '.' | '...' |
23840 | ) |
23841 | { |
23842 | _res = _tmp_183_var; |
23843 | if (_n == _children_capacity) { |
23844 | _children_capacity *= 2; |
23845 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
23846 | if (!_new_children) { |
23847 | p->error_indicator = 1; |
23848 | PyErr_NoMemory(); |
23849 | p->level--; |
23850 | return NULL; |
23851 | } |
23852 | _children = _new_children; |
23853 | } |
23854 | _children[_n++] = _res; |
23855 | _mark = p->mark; |
23856 | } |
23857 | p->mark = _mark; |
23858 | D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n" , p->level, ' ', |
23859 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('.' | '...')" )); |
23860 | } |
23861 | if (_n == 0 || p->error_indicator) { |
23862 | PyMem_Free(_children); |
23863 | p->level--; |
23864 | return NULL; |
23865 | } |
23866 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
23867 | if (!_seq) { |
23868 | PyMem_Free(_children); |
23869 | p->error_indicator = 1; |
23870 | PyErr_NoMemory(); |
23871 | p->level--; |
23872 | return NULL; |
23873 | } |
23874 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
23875 | PyMem_Free(_children); |
23876 | _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq); |
23877 | p->level--; |
23878 | return _seq; |
23879 | } |
23880 | |
23881 | // _loop0_34: ',' import_from_as_name |
23882 | static asdl_seq * |
23883 | _loop0_34_rule(Parser *p) |
23884 | { |
23885 | if (p->level++ == MAXSTACK) { |
23886 | p->error_indicator = 1; |
23887 | PyErr_NoMemory(); |
23888 | } |
23889 | if (p->error_indicator) { |
23890 | p->level--; |
23891 | return NULL; |
23892 | } |
23893 | void *_res = NULL; |
23894 | int _mark = p->mark; |
23895 | int _start_mark = p->mark; |
23896 | void **_children = PyMem_Malloc(sizeof(void *)); |
23897 | if (!_children) { |
23898 | p->error_indicator = 1; |
23899 | PyErr_NoMemory(); |
23900 | p->level--; |
23901 | return NULL; |
23902 | } |
23903 | Py_ssize_t _children_capacity = 1; |
23904 | Py_ssize_t _n = 0; |
23905 | { // ',' import_from_as_name |
23906 | if (p->error_indicator) { |
23907 | p->level--; |
23908 | return NULL; |
23909 | } |
23910 | D(fprintf(stderr, "%*c> _loop0_34[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' import_from_as_name" )); |
23911 | Token * _literal; |
23912 | alias_ty elem; |
23913 | while ( |
23914 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
23915 | && |
23916 | (elem = import_from_as_name_rule(p)) // import_from_as_name |
23917 | ) |
23918 | { |
23919 | _res = elem; |
23920 | if (_res == NULL && PyErr_Occurred()) { |
23921 | p->error_indicator = 1; |
23922 | PyMem_Free(_children); |
23923 | p->level--; |
23924 | return NULL; |
23925 | } |
23926 | if (_n == _children_capacity) { |
23927 | _children_capacity *= 2; |
23928 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
23929 | if (!_new_children) { |
23930 | p->error_indicator = 1; |
23931 | PyErr_NoMemory(); |
23932 | p->level--; |
23933 | return NULL; |
23934 | } |
23935 | _children = _new_children; |
23936 | } |
23937 | _children[_n++] = _res; |
23938 | _mark = p->mark; |
23939 | } |
23940 | p->mark = _mark; |
23941 | D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n" , p->level, ' ', |
23942 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' import_from_as_name" )); |
23943 | } |
23944 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
23945 | if (!_seq) { |
23946 | PyMem_Free(_children); |
23947 | p->error_indicator = 1; |
23948 | PyErr_NoMemory(); |
23949 | p->level--; |
23950 | return NULL; |
23951 | } |
23952 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
23953 | PyMem_Free(_children); |
23954 | _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq); |
23955 | p->level--; |
23956 | return _seq; |
23957 | } |
23958 | |
23959 | // _gather_33: import_from_as_name _loop0_34 |
23960 | static asdl_seq * |
23961 | _gather_33_rule(Parser *p) |
23962 | { |
23963 | if (p->level++ == MAXSTACK) { |
23964 | p->error_indicator = 1; |
23965 | PyErr_NoMemory(); |
23966 | } |
23967 | if (p->error_indicator) { |
23968 | p->level--; |
23969 | return NULL; |
23970 | } |
23971 | asdl_seq * _res = NULL; |
23972 | int _mark = p->mark; |
23973 | { // import_from_as_name _loop0_34 |
23974 | if (p->error_indicator) { |
23975 | p->level--; |
23976 | return NULL; |
23977 | } |
23978 | D(fprintf(stderr, "%*c> _gather_33[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_34" )); |
23979 | alias_ty elem; |
23980 | asdl_seq * seq; |
23981 | if ( |
23982 | (elem = import_from_as_name_rule(p)) // import_from_as_name |
23983 | && |
23984 | (seq = _loop0_34_rule(p)) // _loop0_34 |
23985 | ) |
23986 | { |
23987 | D(fprintf(stderr, "%*c+ _gather_33[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_34" )); |
23988 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
23989 | goto done; |
23990 | } |
23991 | p->mark = _mark; |
23992 | D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n" , p->level, ' ', |
23993 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "import_from_as_name _loop0_34" )); |
23994 | } |
23995 | _res = NULL; |
23996 | done: |
23997 | p->level--; |
23998 | return _res; |
23999 | } |
24000 | |
24001 | // _tmp_35: 'as' NAME |
24002 | static void * |
24003 | _tmp_35_rule(Parser *p) |
24004 | { |
24005 | if (p->level++ == MAXSTACK) { |
24006 | p->error_indicator = 1; |
24007 | PyErr_NoMemory(); |
24008 | } |
24009 | if (p->error_indicator) { |
24010 | p->level--; |
24011 | return NULL; |
24012 | } |
24013 | void * _res = NULL; |
24014 | int _mark = p->mark; |
24015 | { // 'as' NAME |
24016 | if (p->error_indicator) { |
24017 | p->level--; |
24018 | return NULL; |
24019 | } |
24020 | D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'as' NAME" )); |
24021 | Token * _keyword; |
24022 | expr_ty z; |
24023 | if ( |
24024 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
24025 | && |
24026 | (z = _PyPegen_name_token(p)) // NAME |
24027 | ) |
24028 | { |
24029 | D(fprintf(stderr, "%*c+ _tmp_35[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'as' NAME" )); |
24030 | _res = z; |
24031 | if (_res == NULL && PyErr_Occurred()) { |
24032 | p->error_indicator = 1; |
24033 | p->level--; |
24034 | return NULL; |
24035 | } |
24036 | goto done; |
24037 | } |
24038 | p->mark = _mark; |
24039 | D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n" , p->level, ' ', |
24040 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'as' NAME" )); |
24041 | } |
24042 | _res = NULL; |
24043 | done: |
24044 | p->level--; |
24045 | return _res; |
24046 | } |
24047 | |
24048 | // _loop0_37: ',' dotted_as_name |
24049 | static asdl_seq * |
24050 | _loop0_37_rule(Parser *p) |
24051 | { |
24052 | if (p->level++ == MAXSTACK) { |
24053 | p->error_indicator = 1; |
24054 | PyErr_NoMemory(); |
24055 | } |
24056 | if (p->error_indicator) { |
24057 | p->level--; |
24058 | return NULL; |
24059 | } |
24060 | void *_res = NULL; |
24061 | int _mark = p->mark; |
24062 | int _start_mark = p->mark; |
24063 | void **_children = PyMem_Malloc(sizeof(void *)); |
24064 | if (!_children) { |
24065 | p->error_indicator = 1; |
24066 | PyErr_NoMemory(); |
24067 | p->level--; |
24068 | return NULL; |
24069 | } |
24070 | Py_ssize_t _children_capacity = 1; |
24071 | Py_ssize_t _n = 0; |
24072 | { // ',' dotted_as_name |
24073 | if (p->error_indicator) { |
24074 | p->level--; |
24075 | return NULL; |
24076 | } |
24077 | D(fprintf(stderr, "%*c> _loop0_37[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' dotted_as_name" )); |
24078 | Token * _literal; |
24079 | alias_ty elem; |
24080 | while ( |
24081 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
24082 | && |
24083 | (elem = dotted_as_name_rule(p)) // dotted_as_name |
24084 | ) |
24085 | { |
24086 | _res = elem; |
24087 | if (_res == NULL && PyErr_Occurred()) { |
24088 | p->error_indicator = 1; |
24089 | PyMem_Free(_children); |
24090 | p->level--; |
24091 | return NULL; |
24092 | } |
24093 | if (_n == _children_capacity) { |
24094 | _children_capacity *= 2; |
24095 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
24096 | if (!_new_children) { |
24097 | p->error_indicator = 1; |
24098 | PyErr_NoMemory(); |
24099 | p->level--; |
24100 | return NULL; |
24101 | } |
24102 | _children = _new_children; |
24103 | } |
24104 | _children[_n++] = _res; |
24105 | _mark = p->mark; |
24106 | } |
24107 | p->mark = _mark; |
24108 | D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n" , p->level, ' ', |
24109 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' dotted_as_name" )); |
24110 | } |
24111 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
24112 | if (!_seq) { |
24113 | PyMem_Free(_children); |
24114 | p->error_indicator = 1; |
24115 | PyErr_NoMemory(); |
24116 | p->level--; |
24117 | return NULL; |
24118 | } |
24119 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
24120 | PyMem_Free(_children); |
24121 | _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq); |
24122 | p->level--; |
24123 | return _seq; |
24124 | } |
24125 | |
24126 | // _gather_36: dotted_as_name _loop0_37 |
24127 | static asdl_seq * |
24128 | _gather_36_rule(Parser *p) |
24129 | { |
24130 | if (p->level++ == MAXSTACK) { |
24131 | p->error_indicator = 1; |
24132 | PyErr_NoMemory(); |
24133 | } |
24134 | if (p->error_indicator) { |
24135 | p->level--; |
24136 | return NULL; |
24137 | } |
24138 | asdl_seq * _res = NULL; |
24139 | int _mark = p->mark; |
24140 | { // dotted_as_name _loop0_37 |
24141 | if (p->error_indicator) { |
24142 | p->level--; |
24143 | return NULL; |
24144 | } |
24145 | D(fprintf(stderr, "%*c> _gather_36[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_37" )); |
24146 | alias_ty elem; |
24147 | asdl_seq * seq; |
24148 | if ( |
24149 | (elem = dotted_as_name_rule(p)) // dotted_as_name |
24150 | && |
24151 | (seq = _loop0_37_rule(p)) // _loop0_37 |
24152 | ) |
24153 | { |
24154 | D(fprintf(stderr, "%*c+ _gather_36[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_37" )); |
24155 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
24156 | goto done; |
24157 | } |
24158 | p->mark = _mark; |
24159 | D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n" , p->level, ' ', |
24160 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "dotted_as_name _loop0_37" )); |
24161 | } |
24162 | _res = NULL; |
24163 | done: |
24164 | p->level--; |
24165 | return _res; |
24166 | } |
24167 | |
24168 | // _tmp_38: 'as' NAME |
24169 | static void * |
24170 | _tmp_38_rule(Parser *p) |
24171 | { |
24172 | if (p->level++ == MAXSTACK) { |
24173 | p->error_indicator = 1; |
24174 | PyErr_NoMemory(); |
24175 | } |
24176 | if (p->error_indicator) { |
24177 | p->level--; |
24178 | return NULL; |
24179 | } |
24180 | void * _res = NULL; |
24181 | int _mark = p->mark; |
24182 | { // 'as' NAME |
24183 | if (p->error_indicator) { |
24184 | p->level--; |
24185 | return NULL; |
24186 | } |
24187 | D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'as' NAME" )); |
24188 | Token * _keyword; |
24189 | expr_ty z; |
24190 | if ( |
24191 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
24192 | && |
24193 | (z = _PyPegen_name_token(p)) // NAME |
24194 | ) |
24195 | { |
24196 | D(fprintf(stderr, "%*c+ _tmp_38[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'as' NAME" )); |
24197 | _res = z; |
24198 | if (_res == NULL && PyErr_Occurred()) { |
24199 | p->error_indicator = 1; |
24200 | p->level--; |
24201 | return NULL; |
24202 | } |
24203 | goto done; |
24204 | } |
24205 | p->mark = _mark; |
24206 | D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n" , p->level, ' ', |
24207 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'as' NAME" )); |
24208 | } |
24209 | _res = NULL; |
24210 | done: |
24211 | p->level--; |
24212 | return _res; |
24213 | } |
24214 | |
24215 | // _loop0_40: ',' with_item |
24216 | static asdl_seq * |
24217 | _loop0_40_rule(Parser *p) |
24218 | { |
24219 | if (p->level++ == MAXSTACK) { |
24220 | p->error_indicator = 1; |
24221 | PyErr_NoMemory(); |
24222 | } |
24223 | if (p->error_indicator) { |
24224 | p->level--; |
24225 | return NULL; |
24226 | } |
24227 | void *_res = NULL; |
24228 | int _mark = p->mark; |
24229 | int _start_mark = p->mark; |
24230 | void **_children = PyMem_Malloc(sizeof(void *)); |
24231 | if (!_children) { |
24232 | p->error_indicator = 1; |
24233 | PyErr_NoMemory(); |
24234 | p->level--; |
24235 | return NULL; |
24236 | } |
24237 | Py_ssize_t _children_capacity = 1; |
24238 | Py_ssize_t _n = 0; |
24239 | { // ',' with_item |
24240 | if (p->error_indicator) { |
24241 | p->level--; |
24242 | return NULL; |
24243 | } |
24244 | D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' with_item" )); |
24245 | Token * _literal; |
24246 | withitem_ty elem; |
24247 | while ( |
24248 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
24249 | && |
24250 | (elem = with_item_rule(p)) // with_item |
24251 | ) |
24252 | { |
24253 | _res = elem; |
24254 | if (_res == NULL && PyErr_Occurred()) { |
24255 | p->error_indicator = 1; |
24256 | PyMem_Free(_children); |
24257 | p->level--; |
24258 | return NULL; |
24259 | } |
24260 | if (_n == _children_capacity) { |
24261 | _children_capacity *= 2; |
24262 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
24263 | if (!_new_children) { |
24264 | p->error_indicator = 1; |
24265 | PyErr_NoMemory(); |
24266 | p->level--; |
24267 | return NULL; |
24268 | } |
24269 | _children = _new_children; |
24270 | } |
24271 | _children[_n++] = _res; |
24272 | _mark = p->mark; |
24273 | } |
24274 | p->mark = _mark; |
24275 | D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n" , p->level, ' ', |
24276 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' with_item" )); |
24277 | } |
24278 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
24279 | if (!_seq) { |
24280 | PyMem_Free(_children); |
24281 | p->error_indicator = 1; |
24282 | PyErr_NoMemory(); |
24283 | p->level--; |
24284 | return NULL; |
24285 | } |
24286 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
24287 | PyMem_Free(_children); |
24288 | _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq); |
24289 | p->level--; |
24290 | return _seq; |
24291 | } |
24292 | |
24293 | // _gather_39: with_item _loop0_40 |
24294 | static asdl_seq * |
24295 | _gather_39_rule(Parser *p) |
24296 | { |
24297 | if (p->level++ == MAXSTACK) { |
24298 | p->error_indicator = 1; |
24299 | PyErr_NoMemory(); |
24300 | } |
24301 | if (p->error_indicator) { |
24302 | p->level--; |
24303 | return NULL; |
24304 | } |
24305 | asdl_seq * _res = NULL; |
24306 | int _mark = p->mark; |
24307 | { // with_item _loop0_40 |
24308 | if (p->error_indicator) { |
24309 | p->level--; |
24310 | return NULL; |
24311 | } |
24312 | D(fprintf(stderr, "%*c> _gather_39[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "with_item _loop0_40" )); |
24313 | withitem_ty elem; |
24314 | asdl_seq * seq; |
24315 | if ( |
24316 | (elem = with_item_rule(p)) // with_item |
24317 | && |
24318 | (seq = _loop0_40_rule(p)) // _loop0_40 |
24319 | ) |
24320 | { |
24321 | D(fprintf(stderr, "%*c+ _gather_39[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "with_item _loop0_40" )); |
24322 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
24323 | goto done; |
24324 | } |
24325 | p->mark = _mark; |
24326 | D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n" , p->level, ' ', |
24327 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "with_item _loop0_40" )); |
24328 | } |
24329 | _res = NULL; |
24330 | done: |
24331 | p->level--; |
24332 | return _res; |
24333 | } |
24334 | |
24335 | // _loop0_42: ',' with_item |
24336 | static asdl_seq * |
24337 | _loop0_42_rule(Parser *p) |
24338 | { |
24339 | if (p->level++ == MAXSTACK) { |
24340 | p->error_indicator = 1; |
24341 | PyErr_NoMemory(); |
24342 | } |
24343 | if (p->error_indicator) { |
24344 | p->level--; |
24345 | return NULL; |
24346 | } |
24347 | void *_res = NULL; |
24348 | int _mark = p->mark; |
24349 | int _start_mark = p->mark; |
24350 | void **_children = PyMem_Malloc(sizeof(void *)); |
24351 | if (!_children) { |
24352 | p->error_indicator = 1; |
24353 | PyErr_NoMemory(); |
24354 | p->level--; |
24355 | return NULL; |
24356 | } |
24357 | Py_ssize_t _children_capacity = 1; |
24358 | Py_ssize_t _n = 0; |
24359 | { // ',' with_item |
24360 | if (p->error_indicator) { |
24361 | p->level--; |
24362 | return NULL; |
24363 | } |
24364 | D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' with_item" )); |
24365 | Token * _literal; |
24366 | withitem_ty elem; |
24367 | while ( |
24368 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
24369 | && |
24370 | (elem = with_item_rule(p)) // with_item |
24371 | ) |
24372 | { |
24373 | _res = elem; |
24374 | if (_res == NULL && PyErr_Occurred()) { |
24375 | p->error_indicator = 1; |
24376 | PyMem_Free(_children); |
24377 | p->level--; |
24378 | return NULL; |
24379 | } |
24380 | if (_n == _children_capacity) { |
24381 | _children_capacity *= 2; |
24382 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
24383 | if (!_new_children) { |
24384 | p->error_indicator = 1; |
24385 | PyErr_NoMemory(); |
24386 | p->level--; |
24387 | return NULL; |
24388 | } |
24389 | _children = _new_children; |
24390 | } |
24391 | _children[_n++] = _res; |
24392 | _mark = p->mark; |
24393 | } |
24394 | p->mark = _mark; |
24395 | D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n" , p->level, ' ', |
24396 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' with_item" )); |
24397 | } |
24398 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
24399 | if (!_seq) { |
24400 | PyMem_Free(_children); |
24401 | p->error_indicator = 1; |
24402 | PyErr_NoMemory(); |
24403 | p->level--; |
24404 | return NULL; |
24405 | } |
24406 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
24407 | PyMem_Free(_children); |
24408 | _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq); |
24409 | p->level--; |
24410 | return _seq; |
24411 | } |
24412 | |
24413 | // _gather_41: with_item _loop0_42 |
24414 | static asdl_seq * |
24415 | _gather_41_rule(Parser *p) |
24416 | { |
24417 | if (p->level++ == MAXSTACK) { |
24418 | p->error_indicator = 1; |
24419 | PyErr_NoMemory(); |
24420 | } |
24421 | if (p->error_indicator) { |
24422 | p->level--; |
24423 | return NULL; |
24424 | } |
24425 | asdl_seq * _res = NULL; |
24426 | int _mark = p->mark; |
24427 | { // with_item _loop0_42 |
24428 | if (p->error_indicator) { |
24429 | p->level--; |
24430 | return NULL; |
24431 | } |
24432 | D(fprintf(stderr, "%*c> _gather_41[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "with_item _loop0_42" )); |
24433 | withitem_ty elem; |
24434 | asdl_seq * seq; |
24435 | if ( |
24436 | (elem = with_item_rule(p)) // with_item |
24437 | && |
24438 | (seq = _loop0_42_rule(p)) // _loop0_42 |
24439 | ) |
24440 | { |
24441 | D(fprintf(stderr, "%*c+ _gather_41[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "with_item _loop0_42" )); |
24442 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
24443 | goto done; |
24444 | } |
24445 | p->mark = _mark; |
24446 | D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n" , p->level, ' ', |
24447 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "with_item _loop0_42" )); |
24448 | } |
24449 | _res = NULL; |
24450 | done: |
24451 | p->level--; |
24452 | return _res; |
24453 | } |
24454 | |
24455 | // _loop0_44: ',' with_item |
24456 | static asdl_seq * |
24457 | _loop0_44_rule(Parser *p) |
24458 | { |
24459 | if (p->level++ == MAXSTACK) { |
24460 | p->error_indicator = 1; |
24461 | PyErr_NoMemory(); |
24462 | } |
24463 | if (p->error_indicator) { |
24464 | p->level--; |
24465 | return NULL; |
24466 | } |
24467 | void *_res = NULL; |
24468 | int _mark = p->mark; |
24469 | int _start_mark = p->mark; |
24470 | void **_children = PyMem_Malloc(sizeof(void *)); |
24471 | if (!_children) { |
24472 | p->error_indicator = 1; |
24473 | PyErr_NoMemory(); |
24474 | p->level--; |
24475 | return NULL; |
24476 | } |
24477 | Py_ssize_t _children_capacity = 1; |
24478 | Py_ssize_t _n = 0; |
24479 | { // ',' with_item |
24480 | if (p->error_indicator) { |
24481 | p->level--; |
24482 | return NULL; |
24483 | } |
24484 | D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' with_item" )); |
24485 | Token * _literal; |
24486 | withitem_ty elem; |
24487 | while ( |
24488 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
24489 | && |
24490 | (elem = with_item_rule(p)) // with_item |
24491 | ) |
24492 | { |
24493 | _res = elem; |
24494 | if (_res == NULL && PyErr_Occurred()) { |
24495 | p->error_indicator = 1; |
24496 | PyMem_Free(_children); |
24497 | p->level--; |
24498 | return NULL; |
24499 | } |
24500 | if (_n == _children_capacity) { |
24501 | _children_capacity *= 2; |
24502 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
24503 | if (!_new_children) { |
24504 | p->error_indicator = 1; |
24505 | PyErr_NoMemory(); |
24506 | p->level--; |
24507 | return NULL; |
24508 | } |
24509 | _children = _new_children; |
24510 | } |
24511 | _children[_n++] = _res; |
24512 | _mark = p->mark; |
24513 | } |
24514 | p->mark = _mark; |
24515 | D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n" , p->level, ' ', |
24516 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' with_item" )); |
24517 | } |
24518 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
24519 | if (!_seq) { |
24520 | PyMem_Free(_children); |
24521 | p->error_indicator = 1; |
24522 | PyErr_NoMemory(); |
24523 | p->level--; |
24524 | return NULL; |
24525 | } |
24526 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
24527 | PyMem_Free(_children); |
24528 | _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq); |
24529 | p->level--; |
24530 | return _seq; |
24531 | } |
24532 | |
24533 | // _gather_43: with_item _loop0_44 |
24534 | static asdl_seq * |
24535 | _gather_43_rule(Parser *p) |
24536 | { |
24537 | if (p->level++ == MAXSTACK) { |
24538 | p->error_indicator = 1; |
24539 | PyErr_NoMemory(); |
24540 | } |
24541 | if (p->error_indicator) { |
24542 | p->level--; |
24543 | return NULL; |
24544 | } |
24545 | asdl_seq * _res = NULL; |
24546 | int _mark = p->mark; |
24547 | { // with_item _loop0_44 |
24548 | if (p->error_indicator) { |
24549 | p->level--; |
24550 | return NULL; |
24551 | } |
24552 | D(fprintf(stderr, "%*c> _gather_43[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "with_item _loop0_44" )); |
24553 | withitem_ty elem; |
24554 | asdl_seq * seq; |
24555 | if ( |
24556 | (elem = with_item_rule(p)) // with_item |
24557 | && |
24558 | (seq = _loop0_44_rule(p)) // _loop0_44 |
24559 | ) |
24560 | { |
24561 | D(fprintf(stderr, "%*c+ _gather_43[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "with_item _loop0_44" )); |
24562 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
24563 | goto done; |
24564 | } |
24565 | p->mark = _mark; |
24566 | D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n" , p->level, ' ', |
24567 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "with_item _loop0_44" )); |
24568 | } |
24569 | _res = NULL; |
24570 | done: |
24571 | p->level--; |
24572 | return _res; |
24573 | } |
24574 | |
24575 | // _loop0_46: ',' with_item |
24576 | static asdl_seq * |
24577 | _loop0_46_rule(Parser *p) |
24578 | { |
24579 | if (p->level++ == MAXSTACK) { |
24580 | p->error_indicator = 1; |
24581 | PyErr_NoMemory(); |
24582 | } |
24583 | if (p->error_indicator) { |
24584 | p->level--; |
24585 | return NULL; |
24586 | } |
24587 | void *_res = NULL; |
24588 | int _mark = p->mark; |
24589 | int _start_mark = p->mark; |
24590 | void **_children = PyMem_Malloc(sizeof(void *)); |
24591 | if (!_children) { |
24592 | p->error_indicator = 1; |
24593 | PyErr_NoMemory(); |
24594 | p->level--; |
24595 | return NULL; |
24596 | } |
24597 | Py_ssize_t _children_capacity = 1; |
24598 | Py_ssize_t _n = 0; |
24599 | { // ',' with_item |
24600 | if (p->error_indicator) { |
24601 | p->level--; |
24602 | return NULL; |
24603 | } |
24604 | D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' with_item" )); |
24605 | Token * _literal; |
24606 | withitem_ty elem; |
24607 | while ( |
24608 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
24609 | && |
24610 | (elem = with_item_rule(p)) // with_item |
24611 | ) |
24612 | { |
24613 | _res = elem; |
24614 | if (_res == NULL && PyErr_Occurred()) { |
24615 | p->error_indicator = 1; |
24616 | PyMem_Free(_children); |
24617 | p->level--; |
24618 | return NULL; |
24619 | } |
24620 | if (_n == _children_capacity) { |
24621 | _children_capacity *= 2; |
24622 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
24623 | if (!_new_children) { |
24624 | p->error_indicator = 1; |
24625 | PyErr_NoMemory(); |
24626 | p->level--; |
24627 | return NULL; |
24628 | } |
24629 | _children = _new_children; |
24630 | } |
24631 | _children[_n++] = _res; |
24632 | _mark = p->mark; |
24633 | } |
24634 | p->mark = _mark; |
24635 | D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n" , p->level, ' ', |
24636 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' with_item" )); |
24637 | } |
24638 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
24639 | if (!_seq) { |
24640 | PyMem_Free(_children); |
24641 | p->error_indicator = 1; |
24642 | PyErr_NoMemory(); |
24643 | p->level--; |
24644 | return NULL; |
24645 | } |
24646 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
24647 | PyMem_Free(_children); |
24648 | _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq); |
24649 | p->level--; |
24650 | return _seq; |
24651 | } |
24652 | |
24653 | // _gather_45: with_item _loop0_46 |
24654 | static asdl_seq * |
24655 | _gather_45_rule(Parser *p) |
24656 | { |
24657 | if (p->level++ == MAXSTACK) { |
24658 | p->error_indicator = 1; |
24659 | PyErr_NoMemory(); |
24660 | } |
24661 | if (p->error_indicator) { |
24662 | p->level--; |
24663 | return NULL; |
24664 | } |
24665 | asdl_seq * _res = NULL; |
24666 | int _mark = p->mark; |
24667 | { // with_item _loop0_46 |
24668 | if (p->error_indicator) { |
24669 | p->level--; |
24670 | return NULL; |
24671 | } |
24672 | D(fprintf(stderr, "%*c> _gather_45[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "with_item _loop0_46" )); |
24673 | withitem_ty elem; |
24674 | asdl_seq * seq; |
24675 | if ( |
24676 | (elem = with_item_rule(p)) // with_item |
24677 | && |
24678 | (seq = _loop0_46_rule(p)) // _loop0_46 |
24679 | ) |
24680 | { |
24681 | D(fprintf(stderr, "%*c+ _gather_45[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "with_item _loop0_46" )); |
24682 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
24683 | goto done; |
24684 | } |
24685 | p->mark = _mark; |
24686 | D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n" , p->level, ' ', |
24687 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "with_item _loop0_46" )); |
24688 | } |
24689 | _res = NULL; |
24690 | done: |
24691 | p->level--; |
24692 | return _res; |
24693 | } |
24694 | |
24695 | // _tmp_47: ',' | ')' | ':' |
24696 | static void * |
24697 | _tmp_47_rule(Parser *p) |
24698 | { |
24699 | if (p->level++ == MAXSTACK) { |
24700 | p->error_indicator = 1; |
24701 | PyErr_NoMemory(); |
24702 | } |
24703 | if (p->error_indicator) { |
24704 | p->level--; |
24705 | return NULL; |
24706 | } |
24707 | void * _res = NULL; |
24708 | int _mark = p->mark; |
24709 | { // ',' |
24710 | if (p->error_indicator) { |
24711 | p->level--; |
24712 | return NULL; |
24713 | } |
24714 | D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','" )); |
24715 | Token * _literal; |
24716 | if ( |
24717 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
24718 | ) |
24719 | { |
24720 | D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','" )); |
24721 | _res = _literal; |
24722 | goto done; |
24723 | } |
24724 | p->mark = _mark; |
24725 | D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n" , p->level, ' ', |
24726 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','" )); |
24727 | } |
24728 | { // ')' |
24729 | if (p->error_indicator) { |
24730 | p->level--; |
24731 | return NULL; |
24732 | } |
24733 | D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "')'" )); |
24734 | Token * _literal; |
24735 | if ( |
24736 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
24737 | ) |
24738 | { |
24739 | D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "')'" )); |
24740 | _res = _literal; |
24741 | goto done; |
24742 | } |
24743 | p->mark = _mark; |
24744 | D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n" , p->level, ' ', |
24745 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "')'" )); |
24746 | } |
24747 | { // ':' |
24748 | if (p->error_indicator) { |
24749 | p->level--; |
24750 | return NULL; |
24751 | } |
24752 | D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "':'" )); |
24753 | Token * _literal; |
24754 | if ( |
24755 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
24756 | ) |
24757 | { |
24758 | D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "':'" )); |
24759 | _res = _literal; |
24760 | goto done; |
24761 | } |
24762 | p->mark = _mark; |
24763 | D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n" , p->level, ' ', |
24764 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "':'" )); |
24765 | } |
24766 | _res = NULL; |
24767 | done: |
24768 | p->level--; |
24769 | return _res; |
24770 | } |
24771 | |
24772 | // _loop1_48: except_block |
24773 | static asdl_seq * |
24774 | _loop1_48_rule(Parser *p) |
24775 | { |
24776 | if (p->level++ == MAXSTACK) { |
24777 | p->error_indicator = 1; |
24778 | PyErr_NoMemory(); |
24779 | } |
24780 | if (p->error_indicator) { |
24781 | p->level--; |
24782 | return NULL; |
24783 | } |
24784 | void *_res = NULL; |
24785 | int _mark = p->mark; |
24786 | int _start_mark = p->mark; |
24787 | void **_children = PyMem_Malloc(sizeof(void *)); |
24788 | if (!_children) { |
24789 | p->error_indicator = 1; |
24790 | PyErr_NoMemory(); |
24791 | p->level--; |
24792 | return NULL; |
24793 | } |
24794 | Py_ssize_t _children_capacity = 1; |
24795 | Py_ssize_t _n = 0; |
24796 | { // except_block |
24797 | if (p->error_indicator) { |
24798 | p->level--; |
24799 | return NULL; |
24800 | } |
24801 | D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "except_block" )); |
24802 | excepthandler_ty except_block_var; |
24803 | while ( |
24804 | (except_block_var = except_block_rule(p)) // except_block |
24805 | ) |
24806 | { |
24807 | _res = except_block_var; |
24808 | if (_n == _children_capacity) { |
24809 | _children_capacity *= 2; |
24810 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
24811 | if (!_new_children) { |
24812 | p->error_indicator = 1; |
24813 | PyErr_NoMemory(); |
24814 | p->level--; |
24815 | return NULL; |
24816 | } |
24817 | _children = _new_children; |
24818 | } |
24819 | _children[_n++] = _res; |
24820 | _mark = p->mark; |
24821 | } |
24822 | p->mark = _mark; |
24823 | D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n" , p->level, ' ', |
24824 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "except_block" )); |
24825 | } |
24826 | if (_n == 0 || p->error_indicator) { |
24827 | PyMem_Free(_children); |
24828 | p->level--; |
24829 | return NULL; |
24830 | } |
24831 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
24832 | if (!_seq) { |
24833 | PyMem_Free(_children); |
24834 | p->error_indicator = 1; |
24835 | PyErr_NoMemory(); |
24836 | p->level--; |
24837 | return NULL; |
24838 | } |
24839 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
24840 | PyMem_Free(_children); |
24841 | _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq); |
24842 | p->level--; |
24843 | return _seq; |
24844 | } |
24845 | |
24846 | // _tmp_49: 'as' NAME |
24847 | static void * |
24848 | _tmp_49_rule(Parser *p) |
24849 | { |
24850 | if (p->level++ == MAXSTACK) { |
24851 | p->error_indicator = 1; |
24852 | PyErr_NoMemory(); |
24853 | } |
24854 | if (p->error_indicator) { |
24855 | p->level--; |
24856 | return NULL; |
24857 | } |
24858 | void * _res = NULL; |
24859 | int _mark = p->mark; |
24860 | { // 'as' NAME |
24861 | if (p->error_indicator) { |
24862 | p->level--; |
24863 | return NULL; |
24864 | } |
24865 | D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'as' NAME" )); |
24866 | Token * _keyword; |
24867 | expr_ty z; |
24868 | if ( |
24869 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
24870 | && |
24871 | (z = _PyPegen_name_token(p)) // NAME |
24872 | ) |
24873 | { |
24874 | D(fprintf(stderr, "%*c+ _tmp_49[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'as' NAME" )); |
24875 | _res = z; |
24876 | if (_res == NULL && PyErr_Occurred()) { |
24877 | p->error_indicator = 1; |
24878 | p->level--; |
24879 | return NULL; |
24880 | } |
24881 | goto done; |
24882 | } |
24883 | p->mark = _mark; |
24884 | D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n" , p->level, ' ', |
24885 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'as' NAME" )); |
24886 | } |
24887 | _res = NULL; |
24888 | done: |
24889 | p->level--; |
24890 | return _res; |
24891 | } |
24892 | |
24893 | // _loop1_50: case_block |
24894 | static asdl_seq * |
24895 | _loop1_50_rule(Parser *p) |
24896 | { |
24897 | if (p->level++ == MAXSTACK) { |
24898 | p->error_indicator = 1; |
24899 | PyErr_NoMemory(); |
24900 | } |
24901 | if (p->error_indicator) { |
24902 | p->level--; |
24903 | return NULL; |
24904 | } |
24905 | void *_res = NULL; |
24906 | int _mark = p->mark; |
24907 | int _start_mark = p->mark; |
24908 | void **_children = PyMem_Malloc(sizeof(void *)); |
24909 | if (!_children) { |
24910 | p->error_indicator = 1; |
24911 | PyErr_NoMemory(); |
24912 | p->level--; |
24913 | return NULL; |
24914 | } |
24915 | Py_ssize_t _children_capacity = 1; |
24916 | Py_ssize_t _n = 0; |
24917 | { // case_block |
24918 | if (p->error_indicator) { |
24919 | p->level--; |
24920 | return NULL; |
24921 | } |
24922 | D(fprintf(stderr, "%*c> _loop1_50[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "case_block" )); |
24923 | match_case_ty case_block_var; |
24924 | while ( |
24925 | (case_block_var = case_block_rule(p)) // case_block |
24926 | ) |
24927 | { |
24928 | _res = case_block_var; |
24929 | if (_n == _children_capacity) { |
24930 | _children_capacity *= 2; |
24931 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
24932 | if (!_new_children) { |
24933 | p->error_indicator = 1; |
24934 | PyErr_NoMemory(); |
24935 | p->level--; |
24936 | return NULL; |
24937 | } |
24938 | _children = _new_children; |
24939 | } |
24940 | _children[_n++] = _res; |
24941 | _mark = p->mark; |
24942 | } |
24943 | p->mark = _mark; |
24944 | D(fprintf(stderr, "%*c%s _loop1_50[%d-%d]: %s failed!\n" , p->level, ' ', |
24945 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "case_block" )); |
24946 | } |
24947 | if (_n == 0 || p->error_indicator) { |
24948 | PyMem_Free(_children); |
24949 | p->level--; |
24950 | return NULL; |
24951 | } |
24952 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
24953 | if (!_seq) { |
24954 | PyMem_Free(_children); |
24955 | p->error_indicator = 1; |
24956 | PyErr_NoMemory(); |
24957 | p->level--; |
24958 | return NULL; |
24959 | } |
24960 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
24961 | PyMem_Free(_children); |
24962 | _PyPegen_insert_memo(p, _start_mark, _loop1_50_type, _seq); |
24963 | p->level--; |
24964 | return _seq; |
24965 | } |
24966 | |
24967 | // _loop0_52: '|' closed_pattern |
24968 | static asdl_seq * |
24969 | _loop0_52_rule(Parser *p) |
24970 | { |
24971 | if (p->level++ == MAXSTACK) { |
24972 | p->error_indicator = 1; |
24973 | PyErr_NoMemory(); |
24974 | } |
24975 | if (p->error_indicator) { |
24976 | p->level--; |
24977 | return NULL; |
24978 | } |
24979 | void *_res = NULL; |
24980 | int _mark = p->mark; |
24981 | int _start_mark = p->mark; |
24982 | void **_children = PyMem_Malloc(sizeof(void *)); |
24983 | if (!_children) { |
24984 | p->error_indicator = 1; |
24985 | PyErr_NoMemory(); |
24986 | p->level--; |
24987 | return NULL; |
24988 | } |
24989 | Py_ssize_t _children_capacity = 1; |
24990 | Py_ssize_t _n = 0; |
24991 | { // '|' closed_pattern |
24992 | if (p->error_indicator) { |
24993 | p->level--; |
24994 | return NULL; |
24995 | } |
24996 | D(fprintf(stderr, "%*c> _loop0_52[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'|' closed_pattern" )); |
24997 | Token * _literal; |
24998 | pattern_ty elem; |
24999 | while ( |
25000 | (_literal = _PyPegen_expect_token(p, 18)) // token='|' |
25001 | && |
25002 | (elem = closed_pattern_rule(p)) // closed_pattern |
25003 | ) |
25004 | { |
25005 | _res = elem; |
25006 | if (_res == NULL && PyErr_Occurred()) { |
25007 | p->error_indicator = 1; |
25008 | PyMem_Free(_children); |
25009 | p->level--; |
25010 | return NULL; |
25011 | } |
25012 | if (_n == _children_capacity) { |
25013 | _children_capacity *= 2; |
25014 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
25015 | if (!_new_children) { |
25016 | p->error_indicator = 1; |
25017 | PyErr_NoMemory(); |
25018 | p->level--; |
25019 | return NULL; |
25020 | } |
25021 | _children = _new_children; |
25022 | } |
25023 | _children[_n++] = _res; |
25024 | _mark = p->mark; |
25025 | } |
25026 | p->mark = _mark; |
25027 | D(fprintf(stderr, "%*c%s _loop0_52[%d-%d]: %s failed!\n" , p->level, ' ', |
25028 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'|' closed_pattern" )); |
25029 | } |
25030 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
25031 | if (!_seq) { |
25032 | PyMem_Free(_children); |
25033 | p->error_indicator = 1; |
25034 | PyErr_NoMemory(); |
25035 | p->level--; |
25036 | return NULL; |
25037 | } |
25038 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
25039 | PyMem_Free(_children); |
25040 | _PyPegen_insert_memo(p, _start_mark, _loop0_52_type, _seq); |
25041 | p->level--; |
25042 | return _seq; |
25043 | } |
25044 | |
25045 | // _gather_51: closed_pattern _loop0_52 |
25046 | static asdl_seq * |
25047 | _gather_51_rule(Parser *p) |
25048 | { |
25049 | if (p->level++ == MAXSTACK) { |
25050 | p->error_indicator = 1; |
25051 | PyErr_NoMemory(); |
25052 | } |
25053 | if (p->error_indicator) { |
25054 | p->level--; |
25055 | return NULL; |
25056 | } |
25057 | asdl_seq * _res = NULL; |
25058 | int _mark = p->mark; |
25059 | { // closed_pattern _loop0_52 |
25060 | if (p->error_indicator) { |
25061 | p->level--; |
25062 | return NULL; |
25063 | } |
25064 | D(fprintf(stderr, "%*c> _gather_51[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52" )); |
25065 | pattern_ty elem; |
25066 | asdl_seq * seq; |
25067 | if ( |
25068 | (elem = closed_pattern_rule(p)) // closed_pattern |
25069 | && |
25070 | (seq = _loop0_52_rule(p)) // _loop0_52 |
25071 | ) |
25072 | { |
25073 | D(fprintf(stderr, "%*c+ _gather_51[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52" )); |
25074 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
25075 | goto done; |
25076 | } |
25077 | p->mark = _mark; |
25078 | D(fprintf(stderr, "%*c%s _gather_51[%d-%d]: %s failed!\n" , p->level, ' ', |
25079 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "closed_pattern _loop0_52" )); |
25080 | } |
25081 | _res = NULL; |
25082 | done: |
25083 | p->level--; |
25084 | return _res; |
25085 | } |
25086 | |
25087 | // _tmp_53: '+' | '-' |
25088 | static void * |
25089 | _tmp_53_rule(Parser *p) |
25090 | { |
25091 | if (p->level++ == MAXSTACK) { |
25092 | p->error_indicator = 1; |
25093 | PyErr_NoMemory(); |
25094 | } |
25095 | if (p->error_indicator) { |
25096 | p->level--; |
25097 | return NULL; |
25098 | } |
25099 | void * _res = NULL; |
25100 | int _mark = p->mark; |
25101 | { // '+' |
25102 | if (p->error_indicator) { |
25103 | p->level--; |
25104 | return NULL; |
25105 | } |
25106 | D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'+'" )); |
25107 | Token * _literal; |
25108 | if ( |
25109 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
25110 | ) |
25111 | { |
25112 | D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'+'" )); |
25113 | _res = _literal; |
25114 | goto done; |
25115 | } |
25116 | p->mark = _mark; |
25117 | D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n" , p->level, ' ', |
25118 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'+'" )); |
25119 | } |
25120 | { // '-' |
25121 | if (p->error_indicator) { |
25122 | p->level--; |
25123 | return NULL; |
25124 | } |
25125 | D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'-'" )); |
25126 | Token * _literal; |
25127 | if ( |
25128 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
25129 | ) |
25130 | { |
25131 | D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'-'" )); |
25132 | _res = _literal; |
25133 | goto done; |
25134 | } |
25135 | p->mark = _mark; |
25136 | D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n" , p->level, ' ', |
25137 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'-'" )); |
25138 | } |
25139 | _res = NULL; |
25140 | done: |
25141 | p->level--; |
25142 | return _res; |
25143 | } |
25144 | |
25145 | // _tmp_54: '+' | '-' |
25146 | static void * |
25147 | _tmp_54_rule(Parser *p) |
25148 | { |
25149 | if (p->level++ == MAXSTACK) { |
25150 | p->error_indicator = 1; |
25151 | PyErr_NoMemory(); |
25152 | } |
25153 | if (p->error_indicator) { |
25154 | p->level--; |
25155 | return NULL; |
25156 | } |
25157 | void * _res = NULL; |
25158 | int _mark = p->mark; |
25159 | { // '+' |
25160 | if (p->error_indicator) { |
25161 | p->level--; |
25162 | return NULL; |
25163 | } |
25164 | D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'+'" )); |
25165 | Token * _literal; |
25166 | if ( |
25167 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
25168 | ) |
25169 | { |
25170 | D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'+'" )); |
25171 | _res = _literal; |
25172 | goto done; |
25173 | } |
25174 | p->mark = _mark; |
25175 | D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n" , p->level, ' ', |
25176 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'+'" )); |
25177 | } |
25178 | { // '-' |
25179 | if (p->error_indicator) { |
25180 | p->level--; |
25181 | return NULL; |
25182 | } |
25183 | D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'-'" )); |
25184 | Token * _literal; |
25185 | if ( |
25186 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
25187 | ) |
25188 | { |
25189 | D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'-'" )); |
25190 | _res = _literal; |
25191 | goto done; |
25192 | } |
25193 | p->mark = _mark; |
25194 | D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n" , p->level, ' ', |
25195 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'-'" )); |
25196 | } |
25197 | _res = NULL; |
25198 | done: |
25199 | p->level--; |
25200 | return _res; |
25201 | } |
25202 | |
25203 | // _tmp_55: '.' | '(' | '=' |
25204 | static void * |
25205 | _tmp_55_rule(Parser *p) |
25206 | { |
25207 | if (p->level++ == MAXSTACK) { |
25208 | p->error_indicator = 1; |
25209 | PyErr_NoMemory(); |
25210 | } |
25211 | if (p->error_indicator) { |
25212 | p->level--; |
25213 | return NULL; |
25214 | } |
25215 | void * _res = NULL; |
25216 | int _mark = p->mark; |
25217 | { // '.' |
25218 | if (p->error_indicator) { |
25219 | p->level--; |
25220 | return NULL; |
25221 | } |
25222 | D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'.'" )); |
25223 | Token * _literal; |
25224 | if ( |
25225 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
25226 | ) |
25227 | { |
25228 | D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'.'" )); |
25229 | _res = _literal; |
25230 | goto done; |
25231 | } |
25232 | p->mark = _mark; |
25233 | D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n" , p->level, ' ', |
25234 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'.'" )); |
25235 | } |
25236 | { // '(' |
25237 | if (p->error_indicator) { |
25238 | p->level--; |
25239 | return NULL; |
25240 | } |
25241 | D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'('" )); |
25242 | Token * _literal; |
25243 | if ( |
25244 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
25245 | ) |
25246 | { |
25247 | D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'('" )); |
25248 | _res = _literal; |
25249 | goto done; |
25250 | } |
25251 | p->mark = _mark; |
25252 | D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n" , p->level, ' ', |
25253 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'('" )); |
25254 | } |
25255 | { // '=' |
25256 | if (p->error_indicator) { |
25257 | p->level--; |
25258 | return NULL; |
25259 | } |
25260 | D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'='" )); |
25261 | Token * _literal; |
25262 | if ( |
25263 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
25264 | ) |
25265 | { |
25266 | D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'='" )); |
25267 | _res = _literal; |
25268 | goto done; |
25269 | } |
25270 | p->mark = _mark; |
25271 | D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n" , p->level, ' ', |
25272 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'='" )); |
25273 | } |
25274 | _res = NULL; |
25275 | done: |
25276 | p->level--; |
25277 | return _res; |
25278 | } |
25279 | |
25280 | // _tmp_56: '.' | '(' | '=' |
25281 | static void * |
25282 | _tmp_56_rule(Parser *p) |
25283 | { |
25284 | if (p->level++ == MAXSTACK) { |
25285 | p->error_indicator = 1; |
25286 | PyErr_NoMemory(); |
25287 | } |
25288 | if (p->error_indicator) { |
25289 | p->level--; |
25290 | return NULL; |
25291 | } |
25292 | void * _res = NULL; |
25293 | int _mark = p->mark; |
25294 | { // '.' |
25295 | if (p->error_indicator) { |
25296 | p->level--; |
25297 | return NULL; |
25298 | } |
25299 | D(fprintf(stderr, "%*c> _tmp_56[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'.'" )); |
25300 | Token * _literal; |
25301 | if ( |
25302 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
25303 | ) |
25304 | { |
25305 | D(fprintf(stderr, "%*c+ _tmp_56[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'.'" )); |
25306 | _res = _literal; |
25307 | goto done; |
25308 | } |
25309 | p->mark = _mark; |
25310 | D(fprintf(stderr, "%*c%s _tmp_56[%d-%d]: %s failed!\n" , p->level, ' ', |
25311 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'.'" )); |
25312 | } |
25313 | { // '(' |
25314 | if (p->error_indicator) { |
25315 | p->level--; |
25316 | return NULL; |
25317 | } |
25318 | D(fprintf(stderr, "%*c> _tmp_56[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'('" )); |
25319 | Token * _literal; |
25320 | if ( |
25321 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
25322 | ) |
25323 | { |
25324 | D(fprintf(stderr, "%*c+ _tmp_56[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'('" )); |
25325 | _res = _literal; |
25326 | goto done; |
25327 | } |
25328 | p->mark = _mark; |
25329 | D(fprintf(stderr, "%*c%s _tmp_56[%d-%d]: %s failed!\n" , p->level, ' ', |
25330 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'('" )); |
25331 | } |
25332 | { // '=' |
25333 | if (p->error_indicator) { |
25334 | p->level--; |
25335 | return NULL; |
25336 | } |
25337 | D(fprintf(stderr, "%*c> _tmp_56[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'='" )); |
25338 | Token * _literal; |
25339 | if ( |
25340 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
25341 | ) |
25342 | { |
25343 | D(fprintf(stderr, "%*c+ _tmp_56[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'='" )); |
25344 | _res = _literal; |
25345 | goto done; |
25346 | } |
25347 | p->mark = _mark; |
25348 | D(fprintf(stderr, "%*c%s _tmp_56[%d-%d]: %s failed!\n" , p->level, ' ', |
25349 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'='" )); |
25350 | } |
25351 | _res = NULL; |
25352 | done: |
25353 | p->level--; |
25354 | return _res; |
25355 | } |
25356 | |
25357 | // _loop0_58: ',' maybe_star_pattern |
25358 | static asdl_seq * |
25359 | _loop0_58_rule(Parser *p) |
25360 | { |
25361 | if (p->level++ == MAXSTACK) { |
25362 | p->error_indicator = 1; |
25363 | PyErr_NoMemory(); |
25364 | } |
25365 | if (p->error_indicator) { |
25366 | p->level--; |
25367 | return NULL; |
25368 | } |
25369 | void *_res = NULL; |
25370 | int _mark = p->mark; |
25371 | int _start_mark = p->mark; |
25372 | void **_children = PyMem_Malloc(sizeof(void *)); |
25373 | if (!_children) { |
25374 | p->error_indicator = 1; |
25375 | PyErr_NoMemory(); |
25376 | p->level--; |
25377 | return NULL; |
25378 | } |
25379 | Py_ssize_t _children_capacity = 1; |
25380 | Py_ssize_t _n = 0; |
25381 | { // ',' maybe_star_pattern |
25382 | if (p->error_indicator) { |
25383 | p->level--; |
25384 | return NULL; |
25385 | } |
25386 | D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' maybe_star_pattern" )); |
25387 | Token * _literal; |
25388 | pattern_ty elem; |
25389 | while ( |
25390 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
25391 | && |
25392 | (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern |
25393 | ) |
25394 | { |
25395 | _res = elem; |
25396 | if (_res == NULL && PyErr_Occurred()) { |
25397 | p->error_indicator = 1; |
25398 | PyMem_Free(_children); |
25399 | p->level--; |
25400 | return NULL; |
25401 | } |
25402 | if (_n == _children_capacity) { |
25403 | _children_capacity *= 2; |
25404 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
25405 | if (!_new_children) { |
25406 | p->error_indicator = 1; |
25407 | PyErr_NoMemory(); |
25408 | p->level--; |
25409 | return NULL; |
25410 | } |
25411 | _children = _new_children; |
25412 | } |
25413 | _children[_n++] = _res; |
25414 | _mark = p->mark; |
25415 | } |
25416 | p->mark = _mark; |
25417 | D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n" , p->level, ' ', |
25418 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' maybe_star_pattern" )); |
25419 | } |
25420 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
25421 | if (!_seq) { |
25422 | PyMem_Free(_children); |
25423 | p->error_indicator = 1; |
25424 | PyErr_NoMemory(); |
25425 | p->level--; |
25426 | return NULL; |
25427 | } |
25428 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
25429 | PyMem_Free(_children); |
25430 | _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq); |
25431 | p->level--; |
25432 | return _seq; |
25433 | } |
25434 | |
25435 | // _gather_57: maybe_star_pattern _loop0_58 |
25436 | static asdl_seq * |
25437 | _gather_57_rule(Parser *p) |
25438 | { |
25439 | if (p->level++ == MAXSTACK) { |
25440 | p->error_indicator = 1; |
25441 | PyErr_NoMemory(); |
25442 | } |
25443 | if (p->error_indicator) { |
25444 | p->level--; |
25445 | return NULL; |
25446 | } |
25447 | asdl_seq * _res = NULL; |
25448 | int _mark = p->mark; |
25449 | { // maybe_star_pattern _loop0_58 |
25450 | if (p->error_indicator) { |
25451 | p->level--; |
25452 | return NULL; |
25453 | } |
25454 | D(fprintf(stderr, "%*c> _gather_57[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_58" )); |
25455 | pattern_ty elem; |
25456 | asdl_seq * seq; |
25457 | if ( |
25458 | (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern |
25459 | && |
25460 | (seq = _loop0_58_rule(p)) // _loop0_58 |
25461 | ) |
25462 | { |
25463 | D(fprintf(stderr, "%*c+ _gather_57[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_58" )); |
25464 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
25465 | goto done; |
25466 | } |
25467 | p->mark = _mark; |
25468 | D(fprintf(stderr, "%*c%s _gather_57[%d-%d]: %s failed!\n" , p->level, ' ', |
25469 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "maybe_star_pattern _loop0_58" )); |
25470 | } |
25471 | _res = NULL; |
25472 | done: |
25473 | p->level--; |
25474 | return _res; |
25475 | } |
25476 | |
25477 | // _loop0_60: ',' key_value_pattern |
25478 | static asdl_seq * |
25479 | _loop0_60_rule(Parser *p) |
25480 | { |
25481 | if (p->level++ == MAXSTACK) { |
25482 | p->error_indicator = 1; |
25483 | PyErr_NoMemory(); |
25484 | } |
25485 | if (p->error_indicator) { |
25486 | p->level--; |
25487 | return NULL; |
25488 | } |
25489 | void *_res = NULL; |
25490 | int _mark = p->mark; |
25491 | int _start_mark = p->mark; |
25492 | void **_children = PyMem_Malloc(sizeof(void *)); |
25493 | if (!_children) { |
25494 | p->error_indicator = 1; |
25495 | PyErr_NoMemory(); |
25496 | p->level--; |
25497 | return NULL; |
25498 | } |
25499 | Py_ssize_t _children_capacity = 1; |
25500 | Py_ssize_t _n = 0; |
25501 | { // ',' key_value_pattern |
25502 | if (p->error_indicator) { |
25503 | p->level--; |
25504 | return NULL; |
25505 | } |
25506 | D(fprintf(stderr, "%*c> _loop0_60[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' key_value_pattern" )); |
25507 | Token * _literal; |
25508 | KeyPatternPair* elem; |
25509 | while ( |
25510 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
25511 | && |
25512 | (elem = key_value_pattern_rule(p)) // key_value_pattern |
25513 | ) |
25514 | { |
25515 | _res = elem; |
25516 | if (_res == NULL && PyErr_Occurred()) { |
25517 | p->error_indicator = 1; |
25518 | PyMem_Free(_children); |
25519 | p->level--; |
25520 | return NULL; |
25521 | } |
25522 | if (_n == _children_capacity) { |
25523 | _children_capacity *= 2; |
25524 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
25525 | if (!_new_children) { |
25526 | p->error_indicator = 1; |
25527 | PyErr_NoMemory(); |
25528 | p->level--; |
25529 | return NULL; |
25530 | } |
25531 | _children = _new_children; |
25532 | } |
25533 | _children[_n++] = _res; |
25534 | _mark = p->mark; |
25535 | } |
25536 | p->mark = _mark; |
25537 | D(fprintf(stderr, "%*c%s _loop0_60[%d-%d]: %s failed!\n" , p->level, ' ', |
25538 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' key_value_pattern" )); |
25539 | } |
25540 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
25541 | if (!_seq) { |
25542 | PyMem_Free(_children); |
25543 | p->error_indicator = 1; |
25544 | PyErr_NoMemory(); |
25545 | p->level--; |
25546 | return NULL; |
25547 | } |
25548 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
25549 | PyMem_Free(_children); |
25550 | _PyPegen_insert_memo(p, _start_mark, _loop0_60_type, _seq); |
25551 | p->level--; |
25552 | return _seq; |
25553 | } |
25554 | |
25555 | // _gather_59: key_value_pattern _loop0_60 |
25556 | static asdl_seq * |
25557 | _gather_59_rule(Parser *p) |
25558 | { |
25559 | if (p->level++ == MAXSTACK) { |
25560 | p->error_indicator = 1; |
25561 | PyErr_NoMemory(); |
25562 | } |
25563 | if (p->error_indicator) { |
25564 | p->level--; |
25565 | return NULL; |
25566 | } |
25567 | asdl_seq * _res = NULL; |
25568 | int _mark = p->mark; |
25569 | { // key_value_pattern _loop0_60 |
25570 | if (p->error_indicator) { |
25571 | p->level--; |
25572 | return NULL; |
25573 | } |
25574 | D(fprintf(stderr, "%*c> _gather_59[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_60" )); |
25575 | KeyPatternPair* elem; |
25576 | asdl_seq * seq; |
25577 | if ( |
25578 | (elem = key_value_pattern_rule(p)) // key_value_pattern |
25579 | && |
25580 | (seq = _loop0_60_rule(p)) // _loop0_60 |
25581 | ) |
25582 | { |
25583 | D(fprintf(stderr, "%*c+ _gather_59[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_60" )); |
25584 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
25585 | goto done; |
25586 | } |
25587 | p->mark = _mark; |
25588 | D(fprintf(stderr, "%*c%s _gather_59[%d-%d]: %s failed!\n" , p->level, ' ', |
25589 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "key_value_pattern _loop0_60" )); |
25590 | } |
25591 | _res = NULL; |
25592 | done: |
25593 | p->level--; |
25594 | return _res; |
25595 | } |
25596 | |
25597 | // _tmp_61: literal_expr | attr |
25598 | static void * |
25599 | _tmp_61_rule(Parser *p) |
25600 | { |
25601 | if (p->level++ == MAXSTACK) { |
25602 | p->error_indicator = 1; |
25603 | PyErr_NoMemory(); |
25604 | } |
25605 | if (p->error_indicator) { |
25606 | p->level--; |
25607 | return NULL; |
25608 | } |
25609 | void * _res = NULL; |
25610 | int _mark = p->mark; |
25611 | { // literal_expr |
25612 | if (p->error_indicator) { |
25613 | p->level--; |
25614 | return NULL; |
25615 | } |
25616 | D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "literal_expr" )); |
25617 | expr_ty literal_expr_var; |
25618 | if ( |
25619 | (literal_expr_var = literal_expr_rule(p)) // literal_expr |
25620 | ) |
25621 | { |
25622 | D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "literal_expr" )); |
25623 | _res = literal_expr_var; |
25624 | goto done; |
25625 | } |
25626 | p->mark = _mark; |
25627 | D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n" , p->level, ' ', |
25628 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "literal_expr" )); |
25629 | } |
25630 | { // attr |
25631 | if (p->error_indicator) { |
25632 | p->level--; |
25633 | return NULL; |
25634 | } |
25635 | D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "attr" )); |
25636 | expr_ty attr_var; |
25637 | if ( |
25638 | (attr_var = attr_rule(p)) // attr |
25639 | ) |
25640 | { |
25641 | D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "attr" )); |
25642 | _res = attr_var; |
25643 | goto done; |
25644 | } |
25645 | p->mark = _mark; |
25646 | D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n" , p->level, ' ', |
25647 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "attr" )); |
25648 | } |
25649 | _res = NULL; |
25650 | done: |
25651 | p->level--; |
25652 | return _res; |
25653 | } |
25654 | |
25655 | // _loop0_63: ',' pattern |
25656 | static asdl_seq * |
25657 | _loop0_63_rule(Parser *p) |
25658 | { |
25659 | if (p->level++ == MAXSTACK) { |
25660 | p->error_indicator = 1; |
25661 | PyErr_NoMemory(); |
25662 | } |
25663 | if (p->error_indicator) { |
25664 | p->level--; |
25665 | return NULL; |
25666 | } |
25667 | void *_res = NULL; |
25668 | int _mark = p->mark; |
25669 | int _start_mark = p->mark; |
25670 | void **_children = PyMem_Malloc(sizeof(void *)); |
25671 | if (!_children) { |
25672 | p->error_indicator = 1; |
25673 | PyErr_NoMemory(); |
25674 | p->level--; |
25675 | return NULL; |
25676 | } |
25677 | Py_ssize_t _children_capacity = 1; |
25678 | Py_ssize_t _n = 0; |
25679 | { // ',' pattern |
25680 | if (p->error_indicator) { |
25681 | p->level--; |
25682 | return NULL; |
25683 | } |
25684 | D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' pattern" )); |
25685 | Token * _literal; |
25686 | pattern_ty elem; |
25687 | while ( |
25688 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
25689 | && |
25690 | (elem = pattern_rule(p)) // pattern |
25691 | ) |
25692 | { |
25693 | _res = elem; |
25694 | if (_res == NULL && PyErr_Occurred()) { |
25695 | p->error_indicator = 1; |
25696 | PyMem_Free(_children); |
25697 | p->level--; |
25698 | return NULL; |
25699 | } |
25700 | if (_n == _children_capacity) { |
25701 | _children_capacity *= 2; |
25702 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
25703 | if (!_new_children) { |
25704 | p->error_indicator = 1; |
25705 | PyErr_NoMemory(); |
25706 | p->level--; |
25707 | return NULL; |
25708 | } |
25709 | _children = _new_children; |
25710 | } |
25711 | _children[_n++] = _res; |
25712 | _mark = p->mark; |
25713 | } |
25714 | p->mark = _mark; |
25715 | D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n" , p->level, ' ', |
25716 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' pattern" )); |
25717 | } |
25718 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
25719 | if (!_seq) { |
25720 | PyMem_Free(_children); |
25721 | p->error_indicator = 1; |
25722 | PyErr_NoMemory(); |
25723 | p->level--; |
25724 | return NULL; |
25725 | } |
25726 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
25727 | PyMem_Free(_children); |
25728 | _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq); |
25729 | p->level--; |
25730 | return _seq; |
25731 | } |
25732 | |
25733 | // _gather_62: pattern _loop0_63 |
25734 | static asdl_seq * |
25735 | _gather_62_rule(Parser *p) |
25736 | { |
25737 | if (p->level++ == MAXSTACK) { |
25738 | p->error_indicator = 1; |
25739 | PyErr_NoMemory(); |
25740 | } |
25741 | if (p->error_indicator) { |
25742 | p->level--; |
25743 | return NULL; |
25744 | } |
25745 | asdl_seq * _res = NULL; |
25746 | int _mark = p->mark; |
25747 | { // pattern _loop0_63 |
25748 | if (p->error_indicator) { |
25749 | p->level--; |
25750 | return NULL; |
25751 | } |
25752 | D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "pattern _loop0_63" )); |
25753 | pattern_ty elem; |
25754 | asdl_seq * seq; |
25755 | if ( |
25756 | (elem = pattern_rule(p)) // pattern |
25757 | && |
25758 | (seq = _loop0_63_rule(p)) // _loop0_63 |
25759 | ) |
25760 | { |
25761 | D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "pattern _loop0_63" )); |
25762 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
25763 | goto done; |
25764 | } |
25765 | p->mark = _mark; |
25766 | D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n" , p->level, ' ', |
25767 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "pattern _loop0_63" )); |
25768 | } |
25769 | _res = NULL; |
25770 | done: |
25771 | p->level--; |
25772 | return _res; |
25773 | } |
25774 | |
25775 | // _loop0_65: ',' keyword_pattern |
25776 | static asdl_seq * |
25777 | _loop0_65_rule(Parser *p) |
25778 | { |
25779 | if (p->level++ == MAXSTACK) { |
25780 | p->error_indicator = 1; |
25781 | PyErr_NoMemory(); |
25782 | } |
25783 | if (p->error_indicator) { |
25784 | p->level--; |
25785 | return NULL; |
25786 | } |
25787 | void *_res = NULL; |
25788 | int _mark = p->mark; |
25789 | int _start_mark = p->mark; |
25790 | void **_children = PyMem_Malloc(sizeof(void *)); |
25791 | if (!_children) { |
25792 | p->error_indicator = 1; |
25793 | PyErr_NoMemory(); |
25794 | p->level--; |
25795 | return NULL; |
25796 | } |
25797 | Py_ssize_t _children_capacity = 1; |
25798 | Py_ssize_t _n = 0; |
25799 | { // ',' keyword_pattern |
25800 | if (p->error_indicator) { |
25801 | p->level--; |
25802 | return NULL; |
25803 | } |
25804 | D(fprintf(stderr, "%*c> _loop0_65[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' keyword_pattern" )); |
25805 | Token * _literal; |
25806 | KeyPatternPair* elem; |
25807 | while ( |
25808 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
25809 | && |
25810 | (elem = keyword_pattern_rule(p)) // keyword_pattern |
25811 | ) |
25812 | { |
25813 | _res = elem; |
25814 | if (_res == NULL && PyErr_Occurred()) { |
25815 | p->error_indicator = 1; |
25816 | PyMem_Free(_children); |
25817 | p->level--; |
25818 | return NULL; |
25819 | } |
25820 | if (_n == _children_capacity) { |
25821 | _children_capacity *= 2; |
25822 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
25823 | if (!_new_children) { |
25824 | p->error_indicator = 1; |
25825 | PyErr_NoMemory(); |
25826 | p->level--; |
25827 | return NULL; |
25828 | } |
25829 | _children = _new_children; |
25830 | } |
25831 | _children[_n++] = _res; |
25832 | _mark = p->mark; |
25833 | } |
25834 | p->mark = _mark; |
25835 | D(fprintf(stderr, "%*c%s _loop0_65[%d-%d]: %s failed!\n" , p->level, ' ', |
25836 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' keyword_pattern" )); |
25837 | } |
25838 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
25839 | if (!_seq) { |
25840 | PyMem_Free(_children); |
25841 | p->error_indicator = 1; |
25842 | PyErr_NoMemory(); |
25843 | p->level--; |
25844 | return NULL; |
25845 | } |
25846 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
25847 | PyMem_Free(_children); |
25848 | _PyPegen_insert_memo(p, _start_mark, _loop0_65_type, _seq); |
25849 | p->level--; |
25850 | return _seq; |
25851 | } |
25852 | |
25853 | // _gather_64: keyword_pattern _loop0_65 |
25854 | static asdl_seq * |
25855 | _gather_64_rule(Parser *p) |
25856 | { |
25857 | if (p->level++ == MAXSTACK) { |
25858 | p->error_indicator = 1; |
25859 | PyErr_NoMemory(); |
25860 | } |
25861 | if (p->error_indicator) { |
25862 | p->level--; |
25863 | return NULL; |
25864 | } |
25865 | asdl_seq * _res = NULL; |
25866 | int _mark = p->mark; |
25867 | { // keyword_pattern _loop0_65 |
25868 | if (p->error_indicator) { |
25869 | p->level--; |
25870 | return NULL; |
25871 | } |
25872 | D(fprintf(stderr, "%*c> _gather_64[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_65" )); |
25873 | KeyPatternPair* elem; |
25874 | asdl_seq * seq; |
25875 | if ( |
25876 | (elem = keyword_pattern_rule(p)) // keyword_pattern |
25877 | && |
25878 | (seq = _loop0_65_rule(p)) // _loop0_65 |
25879 | ) |
25880 | { |
25881 | D(fprintf(stderr, "%*c+ _gather_64[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_65" )); |
25882 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
25883 | goto done; |
25884 | } |
25885 | p->mark = _mark; |
25886 | D(fprintf(stderr, "%*c%s _gather_64[%d-%d]: %s failed!\n" , p->level, ' ', |
25887 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "keyword_pattern _loop0_65" )); |
25888 | } |
25889 | _res = NULL; |
25890 | done: |
25891 | p->level--; |
25892 | return _res; |
25893 | } |
25894 | |
25895 | // _tmp_66: 'from' expression |
25896 | static void * |
25897 | _tmp_66_rule(Parser *p) |
25898 | { |
25899 | if (p->level++ == MAXSTACK) { |
25900 | p->error_indicator = 1; |
25901 | PyErr_NoMemory(); |
25902 | } |
25903 | if (p->error_indicator) { |
25904 | p->level--; |
25905 | return NULL; |
25906 | } |
25907 | void * _res = NULL; |
25908 | int _mark = p->mark; |
25909 | { // 'from' expression |
25910 | if (p->error_indicator) { |
25911 | p->level--; |
25912 | return NULL; |
25913 | } |
25914 | D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'from' expression" )); |
25915 | Token * _keyword; |
25916 | expr_ty z; |
25917 | if ( |
25918 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
25919 | && |
25920 | (z = expression_rule(p)) // expression |
25921 | ) |
25922 | { |
25923 | D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'from' expression" )); |
25924 | _res = z; |
25925 | if (_res == NULL && PyErr_Occurred()) { |
25926 | p->error_indicator = 1; |
25927 | p->level--; |
25928 | return NULL; |
25929 | } |
25930 | goto done; |
25931 | } |
25932 | p->mark = _mark; |
25933 | D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n" , p->level, ' ', |
25934 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'from' expression" )); |
25935 | } |
25936 | _res = NULL; |
25937 | done: |
25938 | p->level--; |
25939 | return _res; |
25940 | } |
25941 | |
25942 | // _tmp_67: '->' expression |
25943 | static void * |
25944 | _tmp_67_rule(Parser *p) |
25945 | { |
25946 | if (p->level++ == MAXSTACK) { |
25947 | p->error_indicator = 1; |
25948 | PyErr_NoMemory(); |
25949 | } |
25950 | if (p->error_indicator) { |
25951 | p->level--; |
25952 | return NULL; |
25953 | } |
25954 | void * _res = NULL; |
25955 | int _mark = p->mark; |
25956 | { // '->' expression |
25957 | if (p->error_indicator) { |
25958 | p->level--; |
25959 | return NULL; |
25960 | } |
25961 | D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'->' expression" )); |
25962 | Token * _literal; |
25963 | expr_ty z; |
25964 | if ( |
25965 | (_literal = _PyPegen_expect_token(p, 51)) // token='->' |
25966 | && |
25967 | (z = expression_rule(p)) // expression |
25968 | ) |
25969 | { |
25970 | D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'->' expression" )); |
25971 | _res = z; |
25972 | if (_res == NULL && PyErr_Occurred()) { |
25973 | p->error_indicator = 1; |
25974 | p->level--; |
25975 | return NULL; |
25976 | } |
25977 | goto done; |
25978 | } |
25979 | p->mark = _mark; |
25980 | D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n" , p->level, ' ', |
25981 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'->' expression" )); |
25982 | } |
25983 | _res = NULL; |
25984 | done: |
25985 | p->level--; |
25986 | return _res; |
25987 | } |
25988 | |
25989 | // _tmp_68: '->' expression |
25990 | static void * |
25991 | _tmp_68_rule(Parser *p) |
25992 | { |
25993 | if (p->level++ == MAXSTACK) { |
25994 | p->error_indicator = 1; |
25995 | PyErr_NoMemory(); |
25996 | } |
25997 | if (p->error_indicator) { |
25998 | p->level--; |
25999 | return NULL; |
26000 | } |
26001 | void * _res = NULL; |
26002 | int _mark = p->mark; |
26003 | { // '->' expression |
26004 | if (p->error_indicator) { |
26005 | p->level--; |
26006 | return NULL; |
26007 | } |
26008 | D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'->' expression" )); |
26009 | Token * _literal; |
26010 | expr_ty z; |
26011 | if ( |
26012 | (_literal = _PyPegen_expect_token(p, 51)) // token='->' |
26013 | && |
26014 | (z = expression_rule(p)) // expression |
26015 | ) |
26016 | { |
26017 | D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'->' expression" )); |
26018 | _res = z; |
26019 | if (_res == NULL && PyErr_Occurred()) { |
26020 | p->error_indicator = 1; |
26021 | p->level--; |
26022 | return NULL; |
26023 | } |
26024 | goto done; |
26025 | } |
26026 | p->mark = _mark; |
26027 | D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n" , p->level, ' ', |
26028 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'->' expression" )); |
26029 | } |
26030 | _res = NULL; |
26031 | done: |
26032 | p->level--; |
26033 | return _res; |
26034 | } |
26035 | |
26036 | // _tmp_69: NEWLINE INDENT |
26037 | static void * |
26038 | _tmp_69_rule(Parser *p) |
26039 | { |
26040 | if (p->level++ == MAXSTACK) { |
26041 | p->error_indicator = 1; |
26042 | PyErr_NoMemory(); |
26043 | } |
26044 | if (p->error_indicator) { |
26045 | p->level--; |
26046 | return NULL; |
26047 | } |
26048 | void * _res = NULL; |
26049 | int _mark = p->mark; |
26050 | { // NEWLINE INDENT |
26051 | if (p->error_indicator) { |
26052 | p->level--; |
26053 | return NULL; |
26054 | } |
26055 | D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NEWLINE INDENT" )); |
26056 | Token * indent_var; |
26057 | Token * newline_var; |
26058 | if ( |
26059 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
26060 | && |
26061 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
26062 | ) |
26063 | { |
26064 | D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NEWLINE INDENT" )); |
26065 | _res = _PyPegen_dummy_name(p, newline_var, indent_var); |
26066 | goto done; |
26067 | } |
26068 | p->mark = _mark; |
26069 | D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n" , p->level, ' ', |
26070 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NEWLINE INDENT" )); |
26071 | } |
26072 | _res = NULL; |
26073 | done: |
26074 | p->level--; |
26075 | return _res; |
26076 | } |
26077 | |
26078 | // _loop0_70: param_no_default |
26079 | static asdl_seq * |
26080 | _loop0_70_rule(Parser *p) |
26081 | { |
26082 | if (p->level++ == MAXSTACK) { |
26083 | p->error_indicator = 1; |
26084 | PyErr_NoMemory(); |
26085 | } |
26086 | if (p->error_indicator) { |
26087 | p->level--; |
26088 | return NULL; |
26089 | } |
26090 | void *_res = NULL; |
26091 | int _mark = p->mark; |
26092 | int _start_mark = p->mark; |
26093 | void **_children = PyMem_Malloc(sizeof(void *)); |
26094 | if (!_children) { |
26095 | p->error_indicator = 1; |
26096 | PyErr_NoMemory(); |
26097 | p->level--; |
26098 | return NULL; |
26099 | } |
26100 | Py_ssize_t _children_capacity = 1; |
26101 | Py_ssize_t _n = 0; |
26102 | { // param_no_default |
26103 | if (p->error_indicator) { |
26104 | p->level--; |
26105 | return NULL; |
26106 | } |
26107 | D(fprintf(stderr, "%*c> _loop0_70[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default" )); |
26108 | arg_ty param_no_default_var; |
26109 | while ( |
26110 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
26111 | ) |
26112 | { |
26113 | _res = param_no_default_var; |
26114 | if (_n == _children_capacity) { |
26115 | _children_capacity *= 2; |
26116 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26117 | if (!_new_children) { |
26118 | p->error_indicator = 1; |
26119 | PyErr_NoMemory(); |
26120 | p->level--; |
26121 | return NULL; |
26122 | } |
26123 | _children = _new_children; |
26124 | } |
26125 | _children[_n++] = _res; |
26126 | _mark = p->mark; |
26127 | } |
26128 | p->mark = _mark; |
26129 | D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n" , p->level, ' ', |
26130 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default" )); |
26131 | } |
26132 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26133 | if (!_seq) { |
26134 | PyMem_Free(_children); |
26135 | p->error_indicator = 1; |
26136 | PyErr_NoMemory(); |
26137 | p->level--; |
26138 | return NULL; |
26139 | } |
26140 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26141 | PyMem_Free(_children); |
26142 | _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq); |
26143 | p->level--; |
26144 | return _seq; |
26145 | } |
26146 | |
26147 | // _loop0_71: param_with_default |
26148 | static asdl_seq * |
26149 | _loop0_71_rule(Parser *p) |
26150 | { |
26151 | if (p->level++ == MAXSTACK) { |
26152 | p->error_indicator = 1; |
26153 | PyErr_NoMemory(); |
26154 | } |
26155 | if (p->error_indicator) { |
26156 | p->level--; |
26157 | return NULL; |
26158 | } |
26159 | void *_res = NULL; |
26160 | int _mark = p->mark; |
26161 | int _start_mark = p->mark; |
26162 | void **_children = PyMem_Malloc(sizeof(void *)); |
26163 | if (!_children) { |
26164 | p->error_indicator = 1; |
26165 | PyErr_NoMemory(); |
26166 | p->level--; |
26167 | return NULL; |
26168 | } |
26169 | Py_ssize_t _children_capacity = 1; |
26170 | Py_ssize_t _n = 0; |
26171 | { // param_with_default |
26172 | if (p->error_indicator) { |
26173 | p->level--; |
26174 | return NULL; |
26175 | } |
26176 | D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_with_default" )); |
26177 | NameDefaultPair* param_with_default_var; |
26178 | while ( |
26179 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
26180 | ) |
26181 | { |
26182 | _res = param_with_default_var; |
26183 | if (_n == _children_capacity) { |
26184 | _children_capacity *= 2; |
26185 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26186 | if (!_new_children) { |
26187 | p->error_indicator = 1; |
26188 | PyErr_NoMemory(); |
26189 | p->level--; |
26190 | return NULL; |
26191 | } |
26192 | _children = _new_children; |
26193 | } |
26194 | _children[_n++] = _res; |
26195 | _mark = p->mark; |
26196 | } |
26197 | p->mark = _mark; |
26198 | D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n" , p->level, ' ', |
26199 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_with_default" )); |
26200 | } |
26201 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26202 | if (!_seq) { |
26203 | PyMem_Free(_children); |
26204 | p->error_indicator = 1; |
26205 | PyErr_NoMemory(); |
26206 | p->level--; |
26207 | return NULL; |
26208 | } |
26209 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26210 | PyMem_Free(_children); |
26211 | _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); |
26212 | p->level--; |
26213 | return _seq; |
26214 | } |
26215 | |
26216 | // _loop0_72: param_with_default |
26217 | static asdl_seq * |
26218 | _loop0_72_rule(Parser *p) |
26219 | { |
26220 | if (p->level++ == MAXSTACK) { |
26221 | p->error_indicator = 1; |
26222 | PyErr_NoMemory(); |
26223 | } |
26224 | if (p->error_indicator) { |
26225 | p->level--; |
26226 | return NULL; |
26227 | } |
26228 | void *_res = NULL; |
26229 | int _mark = p->mark; |
26230 | int _start_mark = p->mark; |
26231 | void **_children = PyMem_Malloc(sizeof(void *)); |
26232 | if (!_children) { |
26233 | p->error_indicator = 1; |
26234 | PyErr_NoMemory(); |
26235 | p->level--; |
26236 | return NULL; |
26237 | } |
26238 | Py_ssize_t _children_capacity = 1; |
26239 | Py_ssize_t _n = 0; |
26240 | { // param_with_default |
26241 | if (p->error_indicator) { |
26242 | p->level--; |
26243 | return NULL; |
26244 | } |
26245 | D(fprintf(stderr, "%*c> _loop0_72[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_with_default" )); |
26246 | NameDefaultPair* param_with_default_var; |
26247 | while ( |
26248 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
26249 | ) |
26250 | { |
26251 | _res = param_with_default_var; |
26252 | if (_n == _children_capacity) { |
26253 | _children_capacity *= 2; |
26254 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26255 | if (!_new_children) { |
26256 | p->error_indicator = 1; |
26257 | PyErr_NoMemory(); |
26258 | p->level--; |
26259 | return NULL; |
26260 | } |
26261 | _children = _new_children; |
26262 | } |
26263 | _children[_n++] = _res; |
26264 | _mark = p->mark; |
26265 | } |
26266 | p->mark = _mark; |
26267 | D(fprintf(stderr, "%*c%s _loop0_72[%d-%d]: %s failed!\n" , p->level, ' ', |
26268 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_with_default" )); |
26269 | } |
26270 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26271 | if (!_seq) { |
26272 | PyMem_Free(_children); |
26273 | p->error_indicator = 1; |
26274 | PyErr_NoMemory(); |
26275 | p->level--; |
26276 | return NULL; |
26277 | } |
26278 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26279 | PyMem_Free(_children); |
26280 | _PyPegen_insert_memo(p, _start_mark, _loop0_72_type, _seq); |
26281 | p->level--; |
26282 | return _seq; |
26283 | } |
26284 | |
26285 | // _loop1_73: param_no_default |
26286 | static asdl_seq * |
26287 | _loop1_73_rule(Parser *p) |
26288 | { |
26289 | if (p->level++ == MAXSTACK) { |
26290 | p->error_indicator = 1; |
26291 | PyErr_NoMemory(); |
26292 | } |
26293 | if (p->error_indicator) { |
26294 | p->level--; |
26295 | return NULL; |
26296 | } |
26297 | void *_res = NULL; |
26298 | int _mark = p->mark; |
26299 | int _start_mark = p->mark; |
26300 | void **_children = PyMem_Malloc(sizeof(void *)); |
26301 | if (!_children) { |
26302 | p->error_indicator = 1; |
26303 | PyErr_NoMemory(); |
26304 | p->level--; |
26305 | return NULL; |
26306 | } |
26307 | Py_ssize_t _children_capacity = 1; |
26308 | Py_ssize_t _n = 0; |
26309 | { // param_no_default |
26310 | if (p->error_indicator) { |
26311 | p->level--; |
26312 | return NULL; |
26313 | } |
26314 | D(fprintf(stderr, "%*c> _loop1_73[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default" )); |
26315 | arg_ty param_no_default_var; |
26316 | while ( |
26317 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
26318 | ) |
26319 | { |
26320 | _res = param_no_default_var; |
26321 | if (_n == _children_capacity) { |
26322 | _children_capacity *= 2; |
26323 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26324 | if (!_new_children) { |
26325 | p->error_indicator = 1; |
26326 | PyErr_NoMemory(); |
26327 | p->level--; |
26328 | return NULL; |
26329 | } |
26330 | _children = _new_children; |
26331 | } |
26332 | _children[_n++] = _res; |
26333 | _mark = p->mark; |
26334 | } |
26335 | p->mark = _mark; |
26336 | D(fprintf(stderr, "%*c%s _loop1_73[%d-%d]: %s failed!\n" , p->level, ' ', |
26337 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default" )); |
26338 | } |
26339 | if (_n == 0 || p->error_indicator) { |
26340 | PyMem_Free(_children); |
26341 | p->level--; |
26342 | return NULL; |
26343 | } |
26344 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26345 | if (!_seq) { |
26346 | PyMem_Free(_children); |
26347 | p->error_indicator = 1; |
26348 | PyErr_NoMemory(); |
26349 | p->level--; |
26350 | return NULL; |
26351 | } |
26352 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26353 | PyMem_Free(_children); |
26354 | _PyPegen_insert_memo(p, _start_mark, _loop1_73_type, _seq); |
26355 | p->level--; |
26356 | return _seq; |
26357 | } |
26358 | |
26359 | // _loop0_74: param_with_default |
26360 | static asdl_seq * |
26361 | _loop0_74_rule(Parser *p) |
26362 | { |
26363 | if (p->level++ == MAXSTACK) { |
26364 | p->error_indicator = 1; |
26365 | PyErr_NoMemory(); |
26366 | } |
26367 | if (p->error_indicator) { |
26368 | p->level--; |
26369 | return NULL; |
26370 | } |
26371 | void *_res = NULL; |
26372 | int _mark = p->mark; |
26373 | int _start_mark = p->mark; |
26374 | void **_children = PyMem_Malloc(sizeof(void *)); |
26375 | if (!_children) { |
26376 | p->error_indicator = 1; |
26377 | PyErr_NoMemory(); |
26378 | p->level--; |
26379 | return NULL; |
26380 | } |
26381 | Py_ssize_t _children_capacity = 1; |
26382 | Py_ssize_t _n = 0; |
26383 | { // param_with_default |
26384 | if (p->error_indicator) { |
26385 | p->level--; |
26386 | return NULL; |
26387 | } |
26388 | D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_with_default" )); |
26389 | NameDefaultPair* param_with_default_var; |
26390 | while ( |
26391 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
26392 | ) |
26393 | { |
26394 | _res = param_with_default_var; |
26395 | if (_n == _children_capacity) { |
26396 | _children_capacity *= 2; |
26397 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26398 | if (!_new_children) { |
26399 | p->error_indicator = 1; |
26400 | PyErr_NoMemory(); |
26401 | p->level--; |
26402 | return NULL; |
26403 | } |
26404 | _children = _new_children; |
26405 | } |
26406 | _children[_n++] = _res; |
26407 | _mark = p->mark; |
26408 | } |
26409 | p->mark = _mark; |
26410 | D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n" , p->level, ' ', |
26411 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_with_default" )); |
26412 | } |
26413 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26414 | if (!_seq) { |
26415 | PyMem_Free(_children); |
26416 | p->error_indicator = 1; |
26417 | PyErr_NoMemory(); |
26418 | p->level--; |
26419 | return NULL; |
26420 | } |
26421 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26422 | PyMem_Free(_children); |
26423 | _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq); |
26424 | p->level--; |
26425 | return _seq; |
26426 | } |
26427 | |
26428 | // _loop1_75: param_with_default |
26429 | static asdl_seq * |
26430 | _loop1_75_rule(Parser *p) |
26431 | { |
26432 | if (p->level++ == MAXSTACK) { |
26433 | p->error_indicator = 1; |
26434 | PyErr_NoMemory(); |
26435 | } |
26436 | if (p->error_indicator) { |
26437 | p->level--; |
26438 | return NULL; |
26439 | } |
26440 | void *_res = NULL; |
26441 | int _mark = p->mark; |
26442 | int _start_mark = p->mark; |
26443 | void **_children = PyMem_Malloc(sizeof(void *)); |
26444 | if (!_children) { |
26445 | p->error_indicator = 1; |
26446 | PyErr_NoMemory(); |
26447 | p->level--; |
26448 | return NULL; |
26449 | } |
26450 | Py_ssize_t _children_capacity = 1; |
26451 | Py_ssize_t _n = 0; |
26452 | { // param_with_default |
26453 | if (p->error_indicator) { |
26454 | p->level--; |
26455 | return NULL; |
26456 | } |
26457 | D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_with_default" )); |
26458 | NameDefaultPair* param_with_default_var; |
26459 | while ( |
26460 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
26461 | ) |
26462 | { |
26463 | _res = param_with_default_var; |
26464 | if (_n == _children_capacity) { |
26465 | _children_capacity *= 2; |
26466 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26467 | if (!_new_children) { |
26468 | p->error_indicator = 1; |
26469 | PyErr_NoMemory(); |
26470 | p->level--; |
26471 | return NULL; |
26472 | } |
26473 | _children = _new_children; |
26474 | } |
26475 | _children[_n++] = _res; |
26476 | _mark = p->mark; |
26477 | } |
26478 | p->mark = _mark; |
26479 | D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n" , p->level, ' ', |
26480 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_with_default" )); |
26481 | } |
26482 | if (_n == 0 || p->error_indicator) { |
26483 | PyMem_Free(_children); |
26484 | p->level--; |
26485 | return NULL; |
26486 | } |
26487 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26488 | if (!_seq) { |
26489 | PyMem_Free(_children); |
26490 | p->error_indicator = 1; |
26491 | PyErr_NoMemory(); |
26492 | p->level--; |
26493 | return NULL; |
26494 | } |
26495 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26496 | PyMem_Free(_children); |
26497 | _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq); |
26498 | p->level--; |
26499 | return _seq; |
26500 | } |
26501 | |
26502 | // _loop1_76: param_no_default |
26503 | static asdl_seq * |
26504 | _loop1_76_rule(Parser *p) |
26505 | { |
26506 | if (p->level++ == MAXSTACK) { |
26507 | p->error_indicator = 1; |
26508 | PyErr_NoMemory(); |
26509 | } |
26510 | if (p->error_indicator) { |
26511 | p->level--; |
26512 | return NULL; |
26513 | } |
26514 | void *_res = NULL; |
26515 | int _mark = p->mark; |
26516 | int _start_mark = p->mark; |
26517 | void **_children = PyMem_Malloc(sizeof(void *)); |
26518 | if (!_children) { |
26519 | p->error_indicator = 1; |
26520 | PyErr_NoMemory(); |
26521 | p->level--; |
26522 | return NULL; |
26523 | } |
26524 | Py_ssize_t _children_capacity = 1; |
26525 | Py_ssize_t _n = 0; |
26526 | { // param_no_default |
26527 | if (p->error_indicator) { |
26528 | p->level--; |
26529 | return NULL; |
26530 | } |
26531 | D(fprintf(stderr, "%*c> _loop1_76[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default" )); |
26532 | arg_ty param_no_default_var; |
26533 | while ( |
26534 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
26535 | ) |
26536 | { |
26537 | _res = param_no_default_var; |
26538 | if (_n == _children_capacity) { |
26539 | _children_capacity *= 2; |
26540 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26541 | if (!_new_children) { |
26542 | p->error_indicator = 1; |
26543 | PyErr_NoMemory(); |
26544 | p->level--; |
26545 | return NULL; |
26546 | } |
26547 | _children = _new_children; |
26548 | } |
26549 | _children[_n++] = _res; |
26550 | _mark = p->mark; |
26551 | } |
26552 | p->mark = _mark; |
26553 | D(fprintf(stderr, "%*c%s _loop1_76[%d-%d]: %s failed!\n" , p->level, ' ', |
26554 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default" )); |
26555 | } |
26556 | if (_n == 0 || p->error_indicator) { |
26557 | PyMem_Free(_children); |
26558 | p->level--; |
26559 | return NULL; |
26560 | } |
26561 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26562 | if (!_seq) { |
26563 | PyMem_Free(_children); |
26564 | p->error_indicator = 1; |
26565 | PyErr_NoMemory(); |
26566 | p->level--; |
26567 | return NULL; |
26568 | } |
26569 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26570 | PyMem_Free(_children); |
26571 | _PyPegen_insert_memo(p, _start_mark, _loop1_76_type, _seq); |
26572 | p->level--; |
26573 | return _seq; |
26574 | } |
26575 | |
26576 | // _loop1_77: param_no_default |
26577 | static asdl_seq * |
26578 | _loop1_77_rule(Parser *p) |
26579 | { |
26580 | if (p->level++ == MAXSTACK) { |
26581 | p->error_indicator = 1; |
26582 | PyErr_NoMemory(); |
26583 | } |
26584 | if (p->error_indicator) { |
26585 | p->level--; |
26586 | return NULL; |
26587 | } |
26588 | void *_res = NULL; |
26589 | int _mark = p->mark; |
26590 | int _start_mark = p->mark; |
26591 | void **_children = PyMem_Malloc(sizeof(void *)); |
26592 | if (!_children) { |
26593 | p->error_indicator = 1; |
26594 | PyErr_NoMemory(); |
26595 | p->level--; |
26596 | return NULL; |
26597 | } |
26598 | Py_ssize_t _children_capacity = 1; |
26599 | Py_ssize_t _n = 0; |
26600 | { // param_no_default |
26601 | if (p->error_indicator) { |
26602 | p->level--; |
26603 | return NULL; |
26604 | } |
26605 | D(fprintf(stderr, "%*c> _loop1_77[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default" )); |
26606 | arg_ty param_no_default_var; |
26607 | while ( |
26608 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
26609 | ) |
26610 | { |
26611 | _res = param_no_default_var; |
26612 | if (_n == _children_capacity) { |
26613 | _children_capacity *= 2; |
26614 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26615 | if (!_new_children) { |
26616 | p->error_indicator = 1; |
26617 | PyErr_NoMemory(); |
26618 | p->level--; |
26619 | return NULL; |
26620 | } |
26621 | _children = _new_children; |
26622 | } |
26623 | _children[_n++] = _res; |
26624 | _mark = p->mark; |
26625 | } |
26626 | p->mark = _mark; |
26627 | D(fprintf(stderr, "%*c%s _loop1_77[%d-%d]: %s failed!\n" , p->level, ' ', |
26628 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default" )); |
26629 | } |
26630 | if (_n == 0 || p->error_indicator) { |
26631 | PyMem_Free(_children); |
26632 | p->level--; |
26633 | return NULL; |
26634 | } |
26635 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26636 | if (!_seq) { |
26637 | PyMem_Free(_children); |
26638 | p->error_indicator = 1; |
26639 | PyErr_NoMemory(); |
26640 | p->level--; |
26641 | return NULL; |
26642 | } |
26643 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26644 | PyMem_Free(_children); |
26645 | _PyPegen_insert_memo(p, _start_mark, _loop1_77_type, _seq); |
26646 | p->level--; |
26647 | return _seq; |
26648 | } |
26649 | |
26650 | // _loop0_78: param_no_default |
26651 | static asdl_seq * |
26652 | _loop0_78_rule(Parser *p) |
26653 | { |
26654 | if (p->level++ == MAXSTACK) { |
26655 | p->error_indicator = 1; |
26656 | PyErr_NoMemory(); |
26657 | } |
26658 | if (p->error_indicator) { |
26659 | p->level--; |
26660 | return NULL; |
26661 | } |
26662 | void *_res = NULL; |
26663 | int _mark = p->mark; |
26664 | int _start_mark = p->mark; |
26665 | void **_children = PyMem_Malloc(sizeof(void *)); |
26666 | if (!_children) { |
26667 | p->error_indicator = 1; |
26668 | PyErr_NoMemory(); |
26669 | p->level--; |
26670 | return NULL; |
26671 | } |
26672 | Py_ssize_t _children_capacity = 1; |
26673 | Py_ssize_t _n = 0; |
26674 | { // param_no_default |
26675 | if (p->error_indicator) { |
26676 | p->level--; |
26677 | return NULL; |
26678 | } |
26679 | D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default" )); |
26680 | arg_ty param_no_default_var; |
26681 | while ( |
26682 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
26683 | ) |
26684 | { |
26685 | _res = param_no_default_var; |
26686 | if (_n == _children_capacity) { |
26687 | _children_capacity *= 2; |
26688 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26689 | if (!_new_children) { |
26690 | p->error_indicator = 1; |
26691 | PyErr_NoMemory(); |
26692 | p->level--; |
26693 | return NULL; |
26694 | } |
26695 | _children = _new_children; |
26696 | } |
26697 | _children[_n++] = _res; |
26698 | _mark = p->mark; |
26699 | } |
26700 | p->mark = _mark; |
26701 | D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n" , p->level, ' ', |
26702 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default" )); |
26703 | } |
26704 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26705 | if (!_seq) { |
26706 | PyMem_Free(_children); |
26707 | p->error_indicator = 1; |
26708 | PyErr_NoMemory(); |
26709 | p->level--; |
26710 | return NULL; |
26711 | } |
26712 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26713 | PyMem_Free(_children); |
26714 | _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); |
26715 | p->level--; |
26716 | return _seq; |
26717 | } |
26718 | |
26719 | // _loop1_79: param_with_default |
26720 | static asdl_seq * |
26721 | _loop1_79_rule(Parser *p) |
26722 | { |
26723 | if (p->level++ == MAXSTACK) { |
26724 | p->error_indicator = 1; |
26725 | PyErr_NoMemory(); |
26726 | } |
26727 | if (p->error_indicator) { |
26728 | p->level--; |
26729 | return NULL; |
26730 | } |
26731 | void *_res = NULL; |
26732 | int _mark = p->mark; |
26733 | int _start_mark = p->mark; |
26734 | void **_children = PyMem_Malloc(sizeof(void *)); |
26735 | if (!_children) { |
26736 | p->error_indicator = 1; |
26737 | PyErr_NoMemory(); |
26738 | p->level--; |
26739 | return NULL; |
26740 | } |
26741 | Py_ssize_t _children_capacity = 1; |
26742 | Py_ssize_t _n = 0; |
26743 | { // param_with_default |
26744 | if (p->error_indicator) { |
26745 | p->level--; |
26746 | return NULL; |
26747 | } |
26748 | D(fprintf(stderr, "%*c> _loop1_79[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_with_default" )); |
26749 | NameDefaultPair* param_with_default_var; |
26750 | while ( |
26751 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
26752 | ) |
26753 | { |
26754 | _res = param_with_default_var; |
26755 | if (_n == _children_capacity) { |
26756 | _children_capacity *= 2; |
26757 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26758 | if (!_new_children) { |
26759 | p->error_indicator = 1; |
26760 | PyErr_NoMemory(); |
26761 | p->level--; |
26762 | return NULL; |
26763 | } |
26764 | _children = _new_children; |
26765 | } |
26766 | _children[_n++] = _res; |
26767 | _mark = p->mark; |
26768 | } |
26769 | p->mark = _mark; |
26770 | D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n" , p->level, ' ', |
26771 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_with_default" )); |
26772 | } |
26773 | if (_n == 0 || p->error_indicator) { |
26774 | PyMem_Free(_children); |
26775 | p->level--; |
26776 | return NULL; |
26777 | } |
26778 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26779 | if (!_seq) { |
26780 | PyMem_Free(_children); |
26781 | p->error_indicator = 1; |
26782 | PyErr_NoMemory(); |
26783 | p->level--; |
26784 | return NULL; |
26785 | } |
26786 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26787 | PyMem_Free(_children); |
26788 | _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq); |
26789 | p->level--; |
26790 | return _seq; |
26791 | } |
26792 | |
26793 | // _loop0_80: param_no_default |
26794 | static asdl_seq * |
26795 | _loop0_80_rule(Parser *p) |
26796 | { |
26797 | if (p->level++ == MAXSTACK) { |
26798 | p->error_indicator = 1; |
26799 | PyErr_NoMemory(); |
26800 | } |
26801 | if (p->error_indicator) { |
26802 | p->level--; |
26803 | return NULL; |
26804 | } |
26805 | void *_res = NULL; |
26806 | int _mark = p->mark; |
26807 | int _start_mark = p->mark; |
26808 | void **_children = PyMem_Malloc(sizeof(void *)); |
26809 | if (!_children) { |
26810 | p->error_indicator = 1; |
26811 | PyErr_NoMemory(); |
26812 | p->level--; |
26813 | return NULL; |
26814 | } |
26815 | Py_ssize_t _children_capacity = 1; |
26816 | Py_ssize_t _n = 0; |
26817 | { // param_no_default |
26818 | if (p->error_indicator) { |
26819 | p->level--; |
26820 | return NULL; |
26821 | } |
26822 | D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default" )); |
26823 | arg_ty param_no_default_var; |
26824 | while ( |
26825 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
26826 | ) |
26827 | { |
26828 | _res = param_no_default_var; |
26829 | if (_n == _children_capacity) { |
26830 | _children_capacity *= 2; |
26831 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26832 | if (!_new_children) { |
26833 | p->error_indicator = 1; |
26834 | PyErr_NoMemory(); |
26835 | p->level--; |
26836 | return NULL; |
26837 | } |
26838 | _children = _new_children; |
26839 | } |
26840 | _children[_n++] = _res; |
26841 | _mark = p->mark; |
26842 | } |
26843 | p->mark = _mark; |
26844 | D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n" , p->level, ' ', |
26845 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default" )); |
26846 | } |
26847 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26848 | if (!_seq) { |
26849 | PyMem_Free(_children); |
26850 | p->error_indicator = 1; |
26851 | PyErr_NoMemory(); |
26852 | p->level--; |
26853 | return NULL; |
26854 | } |
26855 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26856 | PyMem_Free(_children); |
26857 | _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq); |
26858 | p->level--; |
26859 | return _seq; |
26860 | } |
26861 | |
26862 | // _loop1_81: param_with_default |
26863 | static asdl_seq * |
26864 | _loop1_81_rule(Parser *p) |
26865 | { |
26866 | if (p->level++ == MAXSTACK) { |
26867 | p->error_indicator = 1; |
26868 | PyErr_NoMemory(); |
26869 | } |
26870 | if (p->error_indicator) { |
26871 | p->level--; |
26872 | return NULL; |
26873 | } |
26874 | void *_res = NULL; |
26875 | int _mark = p->mark; |
26876 | int _start_mark = p->mark; |
26877 | void **_children = PyMem_Malloc(sizeof(void *)); |
26878 | if (!_children) { |
26879 | p->error_indicator = 1; |
26880 | PyErr_NoMemory(); |
26881 | p->level--; |
26882 | return NULL; |
26883 | } |
26884 | Py_ssize_t _children_capacity = 1; |
26885 | Py_ssize_t _n = 0; |
26886 | { // param_with_default |
26887 | if (p->error_indicator) { |
26888 | p->level--; |
26889 | return NULL; |
26890 | } |
26891 | D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_with_default" )); |
26892 | NameDefaultPair* param_with_default_var; |
26893 | while ( |
26894 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
26895 | ) |
26896 | { |
26897 | _res = param_with_default_var; |
26898 | if (_n == _children_capacity) { |
26899 | _children_capacity *= 2; |
26900 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26901 | if (!_new_children) { |
26902 | p->error_indicator = 1; |
26903 | PyErr_NoMemory(); |
26904 | p->level--; |
26905 | return NULL; |
26906 | } |
26907 | _children = _new_children; |
26908 | } |
26909 | _children[_n++] = _res; |
26910 | _mark = p->mark; |
26911 | } |
26912 | p->mark = _mark; |
26913 | D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n" , p->level, ' ', |
26914 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_with_default" )); |
26915 | } |
26916 | if (_n == 0 || p->error_indicator) { |
26917 | PyMem_Free(_children); |
26918 | p->level--; |
26919 | return NULL; |
26920 | } |
26921 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26922 | if (!_seq) { |
26923 | PyMem_Free(_children); |
26924 | p->error_indicator = 1; |
26925 | PyErr_NoMemory(); |
26926 | p->level--; |
26927 | return NULL; |
26928 | } |
26929 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26930 | PyMem_Free(_children); |
26931 | _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); |
26932 | p->level--; |
26933 | return _seq; |
26934 | } |
26935 | |
26936 | // _loop0_82: param_maybe_default |
26937 | static asdl_seq * |
26938 | _loop0_82_rule(Parser *p) |
26939 | { |
26940 | if (p->level++ == MAXSTACK) { |
26941 | p->error_indicator = 1; |
26942 | PyErr_NoMemory(); |
26943 | } |
26944 | if (p->error_indicator) { |
26945 | p->level--; |
26946 | return NULL; |
26947 | } |
26948 | void *_res = NULL; |
26949 | int _mark = p->mark; |
26950 | int _start_mark = p->mark; |
26951 | void **_children = PyMem_Malloc(sizeof(void *)); |
26952 | if (!_children) { |
26953 | p->error_indicator = 1; |
26954 | PyErr_NoMemory(); |
26955 | p->level--; |
26956 | return NULL; |
26957 | } |
26958 | Py_ssize_t _children_capacity = 1; |
26959 | Py_ssize_t _n = 0; |
26960 | { // param_maybe_default |
26961 | if (p->error_indicator) { |
26962 | p->level--; |
26963 | return NULL; |
26964 | } |
26965 | D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_maybe_default" )); |
26966 | NameDefaultPair* param_maybe_default_var; |
26967 | while ( |
26968 | (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default |
26969 | ) |
26970 | { |
26971 | _res = param_maybe_default_var; |
26972 | if (_n == _children_capacity) { |
26973 | _children_capacity *= 2; |
26974 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
26975 | if (!_new_children) { |
26976 | p->error_indicator = 1; |
26977 | PyErr_NoMemory(); |
26978 | p->level--; |
26979 | return NULL; |
26980 | } |
26981 | _children = _new_children; |
26982 | } |
26983 | _children[_n++] = _res; |
26984 | _mark = p->mark; |
26985 | } |
26986 | p->mark = _mark; |
26987 | D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n" , p->level, ' ', |
26988 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_maybe_default" )); |
26989 | } |
26990 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
26991 | if (!_seq) { |
26992 | PyMem_Free(_children); |
26993 | p->error_indicator = 1; |
26994 | PyErr_NoMemory(); |
26995 | p->level--; |
26996 | return NULL; |
26997 | } |
26998 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
26999 | PyMem_Free(_children); |
27000 | _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); |
27001 | p->level--; |
27002 | return _seq; |
27003 | } |
27004 | |
27005 | // _loop1_83: param_maybe_default |
27006 | static asdl_seq * |
27007 | _loop1_83_rule(Parser *p) |
27008 | { |
27009 | if (p->level++ == MAXSTACK) { |
27010 | p->error_indicator = 1; |
27011 | PyErr_NoMemory(); |
27012 | } |
27013 | if (p->error_indicator) { |
27014 | p->level--; |
27015 | return NULL; |
27016 | } |
27017 | void *_res = NULL; |
27018 | int _mark = p->mark; |
27019 | int _start_mark = p->mark; |
27020 | void **_children = PyMem_Malloc(sizeof(void *)); |
27021 | if (!_children) { |
27022 | p->error_indicator = 1; |
27023 | PyErr_NoMemory(); |
27024 | p->level--; |
27025 | return NULL; |
27026 | } |
27027 | Py_ssize_t _children_capacity = 1; |
27028 | Py_ssize_t _n = 0; |
27029 | { // param_maybe_default |
27030 | if (p->error_indicator) { |
27031 | p->level--; |
27032 | return NULL; |
27033 | } |
27034 | D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_maybe_default" )); |
27035 | NameDefaultPair* param_maybe_default_var; |
27036 | while ( |
27037 | (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default |
27038 | ) |
27039 | { |
27040 | _res = param_maybe_default_var; |
27041 | if (_n == _children_capacity) { |
27042 | _children_capacity *= 2; |
27043 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27044 | if (!_new_children) { |
27045 | p->error_indicator = 1; |
27046 | PyErr_NoMemory(); |
27047 | p->level--; |
27048 | return NULL; |
27049 | } |
27050 | _children = _new_children; |
27051 | } |
27052 | _children[_n++] = _res; |
27053 | _mark = p->mark; |
27054 | } |
27055 | p->mark = _mark; |
27056 | D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n" , p->level, ' ', |
27057 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_maybe_default" )); |
27058 | } |
27059 | if (_n == 0 || p->error_indicator) { |
27060 | PyMem_Free(_children); |
27061 | p->level--; |
27062 | return NULL; |
27063 | } |
27064 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27065 | if (!_seq) { |
27066 | PyMem_Free(_children); |
27067 | p->error_indicator = 1; |
27068 | PyErr_NoMemory(); |
27069 | p->level--; |
27070 | return NULL; |
27071 | } |
27072 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27073 | PyMem_Free(_children); |
27074 | _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); |
27075 | p->level--; |
27076 | return _seq; |
27077 | } |
27078 | |
27079 | // _loop1_84: ('@' named_expression NEWLINE) |
27080 | static asdl_seq * |
27081 | _loop1_84_rule(Parser *p) |
27082 | { |
27083 | if (p->level++ == MAXSTACK) { |
27084 | p->error_indicator = 1; |
27085 | PyErr_NoMemory(); |
27086 | } |
27087 | if (p->error_indicator) { |
27088 | p->level--; |
27089 | return NULL; |
27090 | } |
27091 | void *_res = NULL; |
27092 | int _mark = p->mark; |
27093 | int _start_mark = p->mark; |
27094 | void **_children = PyMem_Malloc(sizeof(void *)); |
27095 | if (!_children) { |
27096 | p->error_indicator = 1; |
27097 | PyErr_NoMemory(); |
27098 | p->level--; |
27099 | return NULL; |
27100 | } |
27101 | Py_ssize_t _children_capacity = 1; |
27102 | Py_ssize_t _n = 0; |
27103 | { // ('@' named_expression NEWLINE) |
27104 | if (p->error_indicator) { |
27105 | p->level--; |
27106 | return NULL; |
27107 | } |
27108 | D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)" )); |
27109 | void *_tmp_184_var; |
27110 | while ( |
27111 | (_tmp_184_var = _tmp_184_rule(p)) // '@' named_expression NEWLINE |
27112 | ) |
27113 | { |
27114 | _res = _tmp_184_var; |
27115 | if (_n == _children_capacity) { |
27116 | _children_capacity *= 2; |
27117 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27118 | if (!_new_children) { |
27119 | p->error_indicator = 1; |
27120 | PyErr_NoMemory(); |
27121 | p->level--; |
27122 | return NULL; |
27123 | } |
27124 | _children = _new_children; |
27125 | } |
27126 | _children[_n++] = _res; |
27127 | _mark = p->mark; |
27128 | } |
27129 | p->mark = _mark; |
27130 | D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n" , p->level, ' ', |
27131 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('@' named_expression NEWLINE)" )); |
27132 | } |
27133 | if (_n == 0 || p->error_indicator) { |
27134 | PyMem_Free(_children); |
27135 | p->level--; |
27136 | return NULL; |
27137 | } |
27138 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27139 | if (!_seq) { |
27140 | PyMem_Free(_children); |
27141 | p->error_indicator = 1; |
27142 | PyErr_NoMemory(); |
27143 | p->level--; |
27144 | return NULL; |
27145 | } |
27146 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27147 | PyMem_Free(_children); |
27148 | _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); |
27149 | p->level--; |
27150 | return _seq; |
27151 | } |
27152 | |
27153 | // _tmp_85: '(' arguments? ')' |
27154 | static void * |
27155 | _tmp_85_rule(Parser *p) |
27156 | { |
27157 | if (p->level++ == MAXSTACK) { |
27158 | p->error_indicator = 1; |
27159 | PyErr_NoMemory(); |
27160 | } |
27161 | if (p->error_indicator) { |
27162 | p->level--; |
27163 | return NULL; |
27164 | } |
27165 | void * _res = NULL; |
27166 | int _mark = p->mark; |
27167 | { // '(' arguments? ')' |
27168 | if (p->error_indicator) { |
27169 | p->level--; |
27170 | return NULL; |
27171 | } |
27172 | D(fprintf(stderr, "%*c> _tmp_85[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' arguments? ')'" )); |
27173 | Token * _literal; |
27174 | Token * _literal_1; |
27175 | void *z; |
27176 | if ( |
27177 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
27178 | && |
27179 | (z = arguments_rule(p), !p->error_indicator) // arguments? |
27180 | && |
27181 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
27182 | ) |
27183 | { |
27184 | D(fprintf(stderr, "%*c+ _tmp_85[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' arguments? ')'" )); |
27185 | _res = z; |
27186 | if (_res == NULL && PyErr_Occurred()) { |
27187 | p->error_indicator = 1; |
27188 | p->level--; |
27189 | return NULL; |
27190 | } |
27191 | goto done; |
27192 | } |
27193 | p->mark = _mark; |
27194 | D(fprintf(stderr, "%*c%s _tmp_85[%d-%d]: %s failed!\n" , p->level, ' ', |
27195 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' arguments? ')'" )); |
27196 | } |
27197 | _res = NULL; |
27198 | done: |
27199 | p->level--; |
27200 | return _res; |
27201 | } |
27202 | |
27203 | // _loop1_86: (',' star_expression) |
27204 | static asdl_seq * |
27205 | _loop1_86_rule(Parser *p) |
27206 | { |
27207 | if (p->level++ == MAXSTACK) { |
27208 | p->error_indicator = 1; |
27209 | PyErr_NoMemory(); |
27210 | } |
27211 | if (p->error_indicator) { |
27212 | p->level--; |
27213 | return NULL; |
27214 | } |
27215 | void *_res = NULL; |
27216 | int _mark = p->mark; |
27217 | int _start_mark = p->mark; |
27218 | void **_children = PyMem_Malloc(sizeof(void *)); |
27219 | if (!_children) { |
27220 | p->error_indicator = 1; |
27221 | PyErr_NoMemory(); |
27222 | p->level--; |
27223 | return NULL; |
27224 | } |
27225 | Py_ssize_t _children_capacity = 1; |
27226 | Py_ssize_t _n = 0; |
27227 | { // (',' star_expression) |
27228 | if (p->error_indicator) { |
27229 | p->level--; |
27230 | return NULL; |
27231 | } |
27232 | D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(',' star_expression)" )); |
27233 | void *_tmp_185_var; |
27234 | while ( |
27235 | (_tmp_185_var = _tmp_185_rule(p)) // ',' star_expression |
27236 | ) |
27237 | { |
27238 | _res = _tmp_185_var; |
27239 | if (_n == _children_capacity) { |
27240 | _children_capacity *= 2; |
27241 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27242 | if (!_new_children) { |
27243 | p->error_indicator = 1; |
27244 | PyErr_NoMemory(); |
27245 | p->level--; |
27246 | return NULL; |
27247 | } |
27248 | _children = _new_children; |
27249 | } |
27250 | _children[_n++] = _res; |
27251 | _mark = p->mark; |
27252 | } |
27253 | p->mark = _mark; |
27254 | D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n" , p->level, ' ', |
27255 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(',' star_expression)" )); |
27256 | } |
27257 | if (_n == 0 || p->error_indicator) { |
27258 | PyMem_Free(_children); |
27259 | p->level--; |
27260 | return NULL; |
27261 | } |
27262 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27263 | if (!_seq) { |
27264 | PyMem_Free(_children); |
27265 | p->error_indicator = 1; |
27266 | PyErr_NoMemory(); |
27267 | p->level--; |
27268 | return NULL; |
27269 | } |
27270 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27271 | PyMem_Free(_children); |
27272 | _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); |
27273 | p->level--; |
27274 | return _seq; |
27275 | } |
27276 | |
27277 | // _loop0_88: ',' star_named_expression |
27278 | static asdl_seq * |
27279 | _loop0_88_rule(Parser *p) |
27280 | { |
27281 | if (p->level++ == MAXSTACK) { |
27282 | p->error_indicator = 1; |
27283 | PyErr_NoMemory(); |
27284 | } |
27285 | if (p->error_indicator) { |
27286 | p->level--; |
27287 | return NULL; |
27288 | } |
27289 | void *_res = NULL; |
27290 | int _mark = p->mark; |
27291 | int _start_mark = p->mark; |
27292 | void **_children = PyMem_Malloc(sizeof(void *)); |
27293 | if (!_children) { |
27294 | p->error_indicator = 1; |
27295 | PyErr_NoMemory(); |
27296 | p->level--; |
27297 | return NULL; |
27298 | } |
27299 | Py_ssize_t _children_capacity = 1; |
27300 | Py_ssize_t _n = 0; |
27301 | { // ',' star_named_expression |
27302 | if (p->error_indicator) { |
27303 | p->level--; |
27304 | return NULL; |
27305 | } |
27306 | D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' star_named_expression" )); |
27307 | Token * _literal; |
27308 | expr_ty elem; |
27309 | while ( |
27310 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
27311 | && |
27312 | (elem = star_named_expression_rule(p)) // star_named_expression |
27313 | ) |
27314 | { |
27315 | _res = elem; |
27316 | if (_res == NULL && PyErr_Occurred()) { |
27317 | p->error_indicator = 1; |
27318 | PyMem_Free(_children); |
27319 | p->level--; |
27320 | return NULL; |
27321 | } |
27322 | if (_n == _children_capacity) { |
27323 | _children_capacity *= 2; |
27324 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27325 | if (!_new_children) { |
27326 | p->error_indicator = 1; |
27327 | PyErr_NoMemory(); |
27328 | p->level--; |
27329 | return NULL; |
27330 | } |
27331 | _children = _new_children; |
27332 | } |
27333 | _children[_n++] = _res; |
27334 | _mark = p->mark; |
27335 | } |
27336 | p->mark = _mark; |
27337 | D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n" , p->level, ' ', |
27338 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' star_named_expression" )); |
27339 | } |
27340 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27341 | if (!_seq) { |
27342 | PyMem_Free(_children); |
27343 | p->error_indicator = 1; |
27344 | PyErr_NoMemory(); |
27345 | p->level--; |
27346 | return NULL; |
27347 | } |
27348 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27349 | PyMem_Free(_children); |
27350 | _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq); |
27351 | p->level--; |
27352 | return _seq; |
27353 | } |
27354 | |
27355 | // _gather_87: star_named_expression _loop0_88 |
27356 | static asdl_seq * |
27357 | _gather_87_rule(Parser *p) |
27358 | { |
27359 | if (p->level++ == MAXSTACK) { |
27360 | p->error_indicator = 1; |
27361 | PyErr_NoMemory(); |
27362 | } |
27363 | if (p->error_indicator) { |
27364 | p->level--; |
27365 | return NULL; |
27366 | } |
27367 | asdl_seq * _res = NULL; |
27368 | int _mark = p->mark; |
27369 | { // star_named_expression _loop0_88 |
27370 | if (p->error_indicator) { |
27371 | p->level--; |
27372 | return NULL; |
27373 | } |
27374 | D(fprintf(stderr, "%*c> _gather_87[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_named_expression _loop0_88" )); |
27375 | expr_ty elem; |
27376 | asdl_seq * seq; |
27377 | if ( |
27378 | (elem = star_named_expression_rule(p)) // star_named_expression |
27379 | && |
27380 | (seq = _loop0_88_rule(p)) // _loop0_88 |
27381 | ) |
27382 | { |
27383 | D(fprintf(stderr, "%*c+ _gather_87[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_named_expression _loop0_88" )); |
27384 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
27385 | goto done; |
27386 | } |
27387 | p->mark = _mark; |
27388 | D(fprintf(stderr, "%*c%s _gather_87[%d-%d]: %s failed!\n" , p->level, ' ', |
27389 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_named_expression _loop0_88" )); |
27390 | } |
27391 | _res = NULL; |
27392 | done: |
27393 | p->level--; |
27394 | return _res; |
27395 | } |
27396 | |
27397 | // _loop1_89: (',' expression) |
27398 | static asdl_seq * |
27399 | _loop1_89_rule(Parser *p) |
27400 | { |
27401 | if (p->level++ == MAXSTACK) { |
27402 | p->error_indicator = 1; |
27403 | PyErr_NoMemory(); |
27404 | } |
27405 | if (p->error_indicator) { |
27406 | p->level--; |
27407 | return NULL; |
27408 | } |
27409 | void *_res = NULL; |
27410 | int _mark = p->mark; |
27411 | int _start_mark = p->mark; |
27412 | void **_children = PyMem_Malloc(sizeof(void *)); |
27413 | if (!_children) { |
27414 | p->error_indicator = 1; |
27415 | PyErr_NoMemory(); |
27416 | p->level--; |
27417 | return NULL; |
27418 | } |
27419 | Py_ssize_t _children_capacity = 1; |
27420 | Py_ssize_t _n = 0; |
27421 | { // (',' expression) |
27422 | if (p->error_indicator) { |
27423 | p->level--; |
27424 | return NULL; |
27425 | } |
27426 | D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(',' expression)" )); |
27427 | void *_tmp_186_var; |
27428 | while ( |
27429 | (_tmp_186_var = _tmp_186_rule(p)) // ',' expression |
27430 | ) |
27431 | { |
27432 | _res = _tmp_186_var; |
27433 | if (_n == _children_capacity) { |
27434 | _children_capacity *= 2; |
27435 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27436 | if (!_new_children) { |
27437 | p->error_indicator = 1; |
27438 | PyErr_NoMemory(); |
27439 | p->level--; |
27440 | return NULL; |
27441 | } |
27442 | _children = _new_children; |
27443 | } |
27444 | _children[_n++] = _res; |
27445 | _mark = p->mark; |
27446 | } |
27447 | p->mark = _mark; |
27448 | D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n" , p->level, ' ', |
27449 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(',' expression)" )); |
27450 | } |
27451 | if (_n == 0 || p->error_indicator) { |
27452 | PyMem_Free(_children); |
27453 | p->level--; |
27454 | return NULL; |
27455 | } |
27456 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27457 | if (!_seq) { |
27458 | PyMem_Free(_children); |
27459 | p->error_indicator = 1; |
27460 | PyErr_NoMemory(); |
27461 | p->level--; |
27462 | return NULL; |
27463 | } |
27464 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27465 | PyMem_Free(_children); |
27466 | _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); |
27467 | p->level--; |
27468 | return _seq; |
27469 | } |
27470 | |
27471 | // _loop0_90: lambda_param_no_default |
27472 | static asdl_seq * |
27473 | _loop0_90_rule(Parser *p) |
27474 | { |
27475 | if (p->level++ == MAXSTACK) { |
27476 | p->error_indicator = 1; |
27477 | PyErr_NoMemory(); |
27478 | } |
27479 | if (p->error_indicator) { |
27480 | p->level--; |
27481 | return NULL; |
27482 | } |
27483 | void *_res = NULL; |
27484 | int _mark = p->mark; |
27485 | int _start_mark = p->mark; |
27486 | void **_children = PyMem_Malloc(sizeof(void *)); |
27487 | if (!_children) { |
27488 | p->error_indicator = 1; |
27489 | PyErr_NoMemory(); |
27490 | p->level--; |
27491 | return NULL; |
27492 | } |
27493 | Py_ssize_t _children_capacity = 1; |
27494 | Py_ssize_t _n = 0; |
27495 | { // lambda_param_no_default |
27496 | if (p->error_indicator) { |
27497 | p->level--; |
27498 | return NULL; |
27499 | } |
27500 | D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default" )); |
27501 | arg_ty lambda_param_no_default_var; |
27502 | while ( |
27503 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
27504 | ) |
27505 | { |
27506 | _res = lambda_param_no_default_var; |
27507 | if (_n == _children_capacity) { |
27508 | _children_capacity *= 2; |
27509 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27510 | if (!_new_children) { |
27511 | p->error_indicator = 1; |
27512 | PyErr_NoMemory(); |
27513 | p->level--; |
27514 | return NULL; |
27515 | } |
27516 | _children = _new_children; |
27517 | } |
27518 | _children[_n++] = _res; |
27519 | _mark = p->mark; |
27520 | } |
27521 | p->mark = _mark; |
27522 | D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n" , p->level, ' ', |
27523 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default" )); |
27524 | } |
27525 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27526 | if (!_seq) { |
27527 | PyMem_Free(_children); |
27528 | p->error_indicator = 1; |
27529 | PyErr_NoMemory(); |
27530 | p->level--; |
27531 | return NULL; |
27532 | } |
27533 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27534 | PyMem_Free(_children); |
27535 | _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq); |
27536 | p->level--; |
27537 | return _seq; |
27538 | } |
27539 | |
27540 | // _loop0_91: lambda_param_with_default |
27541 | static asdl_seq * |
27542 | _loop0_91_rule(Parser *p) |
27543 | { |
27544 | if (p->level++ == MAXSTACK) { |
27545 | p->error_indicator = 1; |
27546 | PyErr_NoMemory(); |
27547 | } |
27548 | if (p->error_indicator) { |
27549 | p->level--; |
27550 | return NULL; |
27551 | } |
27552 | void *_res = NULL; |
27553 | int _mark = p->mark; |
27554 | int _start_mark = p->mark; |
27555 | void **_children = PyMem_Malloc(sizeof(void *)); |
27556 | if (!_children) { |
27557 | p->error_indicator = 1; |
27558 | PyErr_NoMemory(); |
27559 | p->level--; |
27560 | return NULL; |
27561 | } |
27562 | Py_ssize_t _children_capacity = 1; |
27563 | Py_ssize_t _n = 0; |
27564 | { // lambda_param_with_default |
27565 | if (p->error_indicator) { |
27566 | p->level--; |
27567 | return NULL; |
27568 | } |
27569 | D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_with_default" )); |
27570 | NameDefaultPair* lambda_param_with_default_var; |
27571 | while ( |
27572 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
27573 | ) |
27574 | { |
27575 | _res = lambda_param_with_default_var; |
27576 | if (_n == _children_capacity) { |
27577 | _children_capacity *= 2; |
27578 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27579 | if (!_new_children) { |
27580 | p->error_indicator = 1; |
27581 | PyErr_NoMemory(); |
27582 | p->level--; |
27583 | return NULL; |
27584 | } |
27585 | _children = _new_children; |
27586 | } |
27587 | _children[_n++] = _res; |
27588 | _mark = p->mark; |
27589 | } |
27590 | p->mark = _mark; |
27591 | D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n" , p->level, ' ', |
27592 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_with_default" )); |
27593 | } |
27594 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27595 | if (!_seq) { |
27596 | PyMem_Free(_children); |
27597 | p->error_indicator = 1; |
27598 | PyErr_NoMemory(); |
27599 | p->level--; |
27600 | return NULL; |
27601 | } |
27602 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27603 | PyMem_Free(_children); |
27604 | _PyPegen_insert_memo(p, _start_mark, _loop0_91_type, _seq); |
27605 | p->level--; |
27606 | return _seq; |
27607 | } |
27608 | |
27609 | // _loop0_92: lambda_param_with_default |
27610 | static asdl_seq * |
27611 | _loop0_92_rule(Parser *p) |
27612 | { |
27613 | if (p->level++ == MAXSTACK) { |
27614 | p->error_indicator = 1; |
27615 | PyErr_NoMemory(); |
27616 | } |
27617 | if (p->error_indicator) { |
27618 | p->level--; |
27619 | return NULL; |
27620 | } |
27621 | void *_res = NULL; |
27622 | int _mark = p->mark; |
27623 | int _start_mark = p->mark; |
27624 | void **_children = PyMem_Malloc(sizeof(void *)); |
27625 | if (!_children) { |
27626 | p->error_indicator = 1; |
27627 | PyErr_NoMemory(); |
27628 | p->level--; |
27629 | return NULL; |
27630 | } |
27631 | Py_ssize_t _children_capacity = 1; |
27632 | Py_ssize_t _n = 0; |
27633 | { // lambda_param_with_default |
27634 | if (p->error_indicator) { |
27635 | p->level--; |
27636 | return NULL; |
27637 | } |
27638 | D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_with_default" )); |
27639 | NameDefaultPair* lambda_param_with_default_var; |
27640 | while ( |
27641 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
27642 | ) |
27643 | { |
27644 | _res = lambda_param_with_default_var; |
27645 | if (_n == _children_capacity) { |
27646 | _children_capacity *= 2; |
27647 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27648 | if (!_new_children) { |
27649 | p->error_indicator = 1; |
27650 | PyErr_NoMemory(); |
27651 | p->level--; |
27652 | return NULL; |
27653 | } |
27654 | _children = _new_children; |
27655 | } |
27656 | _children[_n++] = _res; |
27657 | _mark = p->mark; |
27658 | } |
27659 | p->mark = _mark; |
27660 | D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n" , p->level, ' ', |
27661 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_with_default" )); |
27662 | } |
27663 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27664 | if (!_seq) { |
27665 | PyMem_Free(_children); |
27666 | p->error_indicator = 1; |
27667 | PyErr_NoMemory(); |
27668 | p->level--; |
27669 | return NULL; |
27670 | } |
27671 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27672 | PyMem_Free(_children); |
27673 | _PyPegen_insert_memo(p, _start_mark, _loop0_92_type, _seq); |
27674 | p->level--; |
27675 | return _seq; |
27676 | } |
27677 | |
27678 | // _loop1_93: lambda_param_no_default |
27679 | static asdl_seq * |
27680 | _loop1_93_rule(Parser *p) |
27681 | { |
27682 | if (p->level++ == MAXSTACK) { |
27683 | p->error_indicator = 1; |
27684 | PyErr_NoMemory(); |
27685 | } |
27686 | if (p->error_indicator) { |
27687 | p->level--; |
27688 | return NULL; |
27689 | } |
27690 | void *_res = NULL; |
27691 | int _mark = p->mark; |
27692 | int _start_mark = p->mark; |
27693 | void **_children = PyMem_Malloc(sizeof(void *)); |
27694 | if (!_children) { |
27695 | p->error_indicator = 1; |
27696 | PyErr_NoMemory(); |
27697 | p->level--; |
27698 | return NULL; |
27699 | } |
27700 | Py_ssize_t _children_capacity = 1; |
27701 | Py_ssize_t _n = 0; |
27702 | { // lambda_param_no_default |
27703 | if (p->error_indicator) { |
27704 | p->level--; |
27705 | return NULL; |
27706 | } |
27707 | D(fprintf(stderr, "%*c> _loop1_93[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default" )); |
27708 | arg_ty lambda_param_no_default_var; |
27709 | while ( |
27710 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
27711 | ) |
27712 | { |
27713 | _res = lambda_param_no_default_var; |
27714 | if (_n == _children_capacity) { |
27715 | _children_capacity *= 2; |
27716 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27717 | if (!_new_children) { |
27718 | p->error_indicator = 1; |
27719 | PyErr_NoMemory(); |
27720 | p->level--; |
27721 | return NULL; |
27722 | } |
27723 | _children = _new_children; |
27724 | } |
27725 | _children[_n++] = _res; |
27726 | _mark = p->mark; |
27727 | } |
27728 | p->mark = _mark; |
27729 | D(fprintf(stderr, "%*c%s _loop1_93[%d-%d]: %s failed!\n" , p->level, ' ', |
27730 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default" )); |
27731 | } |
27732 | if (_n == 0 || p->error_indicator) { |
27733 | PyMem_Free(_children); |
27734 | p->level--; |
27735 | return NULL; |
27736 | } |
27737 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27738 | if (!_seq) { |
27739 | PyMem_Free(_children); |
27740 | p->error_indicator = 1; |
27741 | PyErr_NoMemory(); |
27742 | p->level--; |
27743 | return NULL; |
27744 | } |
27745 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27746 | PyMem_Free(_children); |
27747 | _PyPegen_insert_memo(p, _start_mark, _loop1_93_type, _seq); |
27748 | p->level--; |
27749 | return _seq; |
27750 | } |
27751 | |
27752 | // _loop0_94: lambda_param_with_default |
27753 | static asdl_seq * |
27754 | _loop0_94_rule(Parser *p) |
27755 | { |
27756 | if (p->level++ == MAXSTACK) { |
27757 | p->error_indicator = 1; |
27758 | PyErr_NoMemory(); |
27759 | } |
27760 | if (p->error_indicator) { |
27761 | p->level--; |
27762 | return NULL; |
27763 | } |
27764 | void *_res = NULL; |
27765 | int _mark = p->mark; |
27766 | int _start_mark = p->mark; |
27767 | void **_children = PyMem_Malloc(sizeof(void *)); |
27768 | if (!_children) { |
27769 | p->error_indicator = 1; |
27770 | PyErr_NoMemory(); |
27771 | p->level--; |
27772 | return NULL; |
27773 | } |
27774 | Py_ssize_t _children_capacity = 1; |
27775 | Py_ssize_t _n = 0; |
27776 | { // lambda_param_with_default |
27777 | if (p->error_indicator) { |
27778 | p->level--; |
27779 | return NULL; |
27780 | } |
27781 | D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_with_default" )); |
27782 | NameDefaultPair* lambda_param_with_default_var; |
27783 | while ( |
27784 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
27785 | ) |
27786 | { |
27787 | _res = lambda_param_with_default_var; |
27788 | if (_n == _children_capacity) { |
27789 | _children_capacity *= 2; |
27790 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27791 | if (!_new_children) { |
27792 | p->error_indicator = 1; |
27793 | PyErr_NoMemory(); |
27794 | p->level--; |
27795 | return NULL; |
27796 | } |
27797 | _children = _new_children; |
27798 | } |
27799 | _children[_n++] = _res; |
27800 | _mark = p->mark; |
27801 | } |
27802 | p->mark = _mark; |
27803 | D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n" , p->level, ' ', |
27804 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_with_default" )); |
27805 | } |
27806 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27807 | if (!_seq) { |
27808 | PyMem_Free(_children); |
27809 | p->error_indicator = 1; |
27810 | PyErr_NoMemory(); |
27811 | p->level--; |
27812 | return NULL; |
27813 | } |
27814 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27815 | PyMem_Free(_children); |
27816 | _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); |
27817 | p->level--; |
27818 | return _seq; |
27819 | } |
27820 | |
27821 | // _loop1_95: lambda_param_with_default |
27822 | static asdl_seq * |
27823 | _loop1_95_rule(Parser *p) |
27824 | { |
27825 | if (p->level++ == MAXSTACK) { |
27826 | p->error_indicator = 1; |
27827 | PyErr_NoMemory(); |
27828 | } |
27829 | if (p->error_indicator) { |
27830 | p->level--; |
27831 | return NULL; |
27832 | } |
27833 | void *_res = NULL; |
27834 | int _mark = p->mark; |
27835 | int _start_mark = p->mark; |
27836 | void **_children = PyMem_Malloc(sizeof(void *)); |
27837 | if (!_children) { |
27838 | p->error_indicator = 1; |
27839 | PyErr_NoMemory(); |
27840 | p->level--; |
27841 | return NULL; |
27842 | } |
27843 | Py_ssize_t _children_capacity = 1; |
27844 | Py_ssize_t _n = 0; |
27845 | { // lambda_param_with_default |
27846 | if (p->error_indicator) { |
27847 | p->level--; |
27848 | return NULL; |
27849 | } |
27850 | D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_with_default" )); |
27851 | NameDefaultPair* lambda_param_with_default_var; |
27852 | while ( |
27853 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
27854 | ) |
27855 | { |
27856 | _res = lambda_param_with_default_var; |
27857 | if (_n == _children_capacity) { |
27858 | _children_capacity *= 2; |
27859 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27860 | if (!_new_children) { |
27861 | p->error_indicator = 1; |
27862 | PyErr_NoMemory(); |
27863 | p->level--; |
27864 | return NULL; |
27865 | } |
27866 | _children = _new_children; |
27867 | } |
27868 | _children[_n++] = _res; |
27869 | _mark = p->mark; |
27870 | } |
27871 | p->mark = _mark; |
27872 | D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n" , p->level, ' ', |
27873 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_with_default" )); |
27874 | } |
27875 | if (_n == 0 || p->error_indicator) { |
27876 | PyMem_Free(_children); |
27877 | p->level--; |
27878 | return NULL; |
27879 | } |
27880 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27881 | if (!_seq) { |
27882 | PyMem_Free(_children); |
27883 | p->error_indicator = 1; |
27884 | PyErr_NoMemory(); |
27885 | p->level--; |
27886 | return NULL; |
27887 | } |
27888 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27889 | PyMem_Free(_children); |
27890 | _PyPegen_insert_memo(p, _start_mark, _loop1_95_type, _seq); |
27891 | p->level--; |
27892 | return _seq; |
27893 | } |
27894 | |
27895 | // _loop1_96: lambda_param_no_default |
27896 | static asdl_seq * |
27897 | _loop1_96_rule(Parser *p) |
27898 | { |
27899 | if (p->level++ == MAXSTACK) { |
27900 | p->error_indicator = 1; |
27901 | PyErr_NoMemory(); |
27902 | } |
27903 | if (p->error_indicator) { |
27904 | p->level--; |
27905 | return NULL; |
27906 | } |
27907 | void *_res = NULL; |
27908 | int _mark = p->mark; |
27909 | int _start_mark = p->mark; |
27910 | void **_children = PyMem_Malloc(sizeof(void *)); |
27911 | if (!_children) { |
27912 | p->error_indicator = 1; |
27913 | PyErr_NoMemory(); |
27914 | p->level--; |
27915 | return NULL; |
27916 | } |
27917 | Py_ssize_t _children_capacity = 1; |
27918 | Py_ssize_t _n = 0; |
27919 | { // lambda_param_no_default |
27920 | if (p->error_indicator) { |
27921 | p->level--; |
27922 | return NULL; |
27923 | } |
27924 | D(fprintf(stderr, "%*c> _loop1_96[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default" )); |
27925 | arg_ty lambda_param_no_default_var; |
27926 | while ( |
27927 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
27928 | ) |
27929 | { |
27930 | _res = lambda_param_no_default_var; |
27931 | if (_n == _children_capacity) { |
27932 | _children_capacity *= 2; |
27933 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27934 | if (!_new_children) { |
27935 | p->error_indicator = 1; |
27936 | PyErr_NoMemory(); |
27937 | p->level--; |
27938 | return NULL; |
27939 | } |
27940 | _children = _new_children; |
27941 | } |
27942 | _children[_n++] = _res; |
27943 | _mark = p->mark; |
27944 | } |
27945 | p->mark = _mark; |
27946 | D(fprintf(stderr, "%*c%s _loop1_96[%d-%d]: %s failed!\n" , p->level, ' ', |
27947 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default" )); |
27948 | } |
27949 | if (_n == 0 || p->error_indicator) { |
27950 | PyMem_Free(_children); |
27951 | p->level--; |
27952 | return NULL; |
27953 | } |
27954 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27955 | if (!_seq) { |
27956 | PyMem_Free(_children); |
27957 | p->error_indicator = 1; |
27958 | PyErr_NoMemory(); |
27959 | p->level--; |
27960 | return NULL; |
27961 | } |
27962 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27963 | PyMem_Free(_children); |
27964 | _PyPegen_insert_memo(p, _start_mark, _loop1_96_type, _seq); |
27965 | p->level--; |
27966 | return _seq; |
27967 | } |
27968 | |
27969 | // _loop1_97: lambda_param_no_default |
27970 | static asdl_seq * |
27971 | _loop1_97_rule(Parser *p) |
27972 | { |
27973 | if (p->level++ == MAXSTACK) { |
27974 | p->error_indicator = 1; |
27975 | PyErr_NoMemory(); |
27976 | } |
27977 | if (p->error_indicator) { |
27978 | p->level--; |
27979 | return NULL; |
27980 | } |
27981 | void *_res = NULL; |
27982 | int _mark = p->mark; |
27983 | int _start_mark = p->mark; |
27984 | void **_children = PyMem_Malloc(sizeof(void *)); |
27985 | if (!_children) { |
27986 | p->error_indicator = 1; |
27987 | PyErr_NoMemory(); |
27988 | p->level--; |
27989 | return NULL; |
27990 | } |
27991 | Py_ssize_t _children_capacity = 1; |
27992 | Py_ssize_t _n = 0; |
27993 | { // lambda_param_no_default |
27994 | if (p->error_indicator) { |
27995 | p->level--; |
27996 | return NULL; |
27997 | } |
27998 | D(fprintf(stderr, "%*c> _loop1_97[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default" )); |
27999 | arg_ty lambda_param_no_default_var; |
28000 | while ( |
28001 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
28002 | ) |
28003 | { |
28004 | _res = lambda_param_no_default_var; |
28005 | if (_n == _children_capacity) { |
28006 | _children_capacity *= 2; |
28007 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28008 | if (!_new_children) { |
28009 | p->error_indicator = 1; |
28010 | PyErr_NoMemory(); |
28011 | p->level--; |
28012 | return NULL; |
28013 | } |
28014 | _children = _new_children; |
28015 | } |
28016 | _children[_n++] = _res; |
28017 | _mark = p->mark; |
28018 | } |
28019 | p->mark = _mark; |
28020 | D(fprintf(stderr, "%*c%s _loop1_97[%d-%d]: %s failed!\n" , p->level, ' ', |
28021 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default" )); |
28022 | } |
28023 | if (_n == 0 || p->error_indicator) { |
28024 | PyMem_Free(_children); |
28025 | p->level--; |
28026 | return NULL; |
28027 | } |
28028 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28029 | if (!_seq) { |
28030 | PyMem_Free(_children); |
28031 | p->error_indicator = 1; |
28032 | PyErr_NoMemory(); |
28033 | p->level--; |
28034 | return NULL; |
28035 | } |
28036 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28037 | PyMem_Free(_children); |
28038 | _PyPegen_insert_memo(p, _start_mark, _loop1_97_type, _seq); |
28039 | p->level--; |
28040 | return _seq; |
28041 | } |
28042 | |
28043 | // _loop0_98: lambda_param_no_default |
28044 | static asdl_seq * |
28045 | _loop0_98_rule(Parser *p) |
28046 | { |
28047 | if (p->level++ == MAXSTACK) { |
28048 | p->error_indicator = 1; |
28049 | PyErr_NoMemory(); |
28050 | } |
28051 | if (p->error_indicator) { |
28052 | p->level--; |
28053 | return NULL; |
28054 | } |
28055 | void *_res = NULL; |
28056 | int _mark = p->mark; |
28057 | int _start_mark = p->mark; |
28058 | void **_children = PyMem_Malloc(sizeof(void *)); |
28059 | if (!_children) { |
28060 | p->error_indicator = 1; |
28061 | PyErr_NoMemory(); |
28062 | p->level--; |
28063 | return NULL; |
28064 | } |
28065 | Py_ssize_t _children_capacity = 1; |
28066 | Py_ssize_t _n = 0; |
28067 | { // lambda_param_no_default |
28068 | if (p->error_indicator) { |
28069 | p->level--; |
28070 | return NULL; |
28071 | } |
28072 | D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default" )); |
28073 | arg_ty lambda_param_no_default_var; |
28074 | while ( |
28075 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
28076 | ) |
28077 | { |
28078 | _res = lambda_param_no_default_var; |
28079 | if (_n == _children_capacity) { |
28080 | _children_capacity *= 2; |
28081 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28082 | if (!_new_children) { |
28083 | p->error_indicator = 1; |
28084 | PyErr_NoMemory(); |
28085 | p->level--; |
28086 | return NULL; |
28087 | } |
28088 | _children = _new_children; |
28089 | } |
28090 | _children[_n++] = _res; |
28091 | _mark = p->mark; |
28092 | } |
28093 | p->mark = _mark; |
28094 | D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n" , p->level, ' ', |
28095 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default" )); |
28096 | } |
28097 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28098 | if (!_seq) { |
28099 | PyMem_Free(_children); |
28100 | p->error_indicator = 1; |
28101 | PyErr_NoMemory(); |
28102 | p->level--; |
28103 | return NULL; |
28104 | } |
28105 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28106 | PyMem_Free(_children); |
28107 | _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq); |
28108 | p->level--; |
28109 | return _seq; |
28110 | } |
28111 | |
28112 | // _loop1_99: lambda_param_with_default |
28113 | static asdl_seq * |
28114 | _loop1_99_rule(Parser *p) |
28115 | { |
28116 | if (p->level++ == MAXSTACK) { |
28117 | p->error_indicator = 1; |
28118 | PyErr_NoMemory(); |
28119 | } |
28120 | if (p->error_indicator) { |
28121 | p->level--; |
28122 | return NULL; |
28123 | } |
28124 | void *_res = NULL; |
28125 | int _mark = p->mark; |
28126 | int _start_mark = p->mark; |
28127 | void **_children = PyMem_Malloc(sizeof(void *)); |
28128 | if (!_children) { |
28129 | p->error_indicator = 1; |
28130 | PyErr_NoMemory(); |
28131 | p->level--; |
28132 | return NULL; |
28133 | } |
28134 | Py_ssize_t _children_capacity = 1; |
28135 | Py_ssize_t _n = 0; |
28136 | { // lambda_param_with_default |
28137 | if (p->error_indicator) { |
28138 | p->level--; |
28139 | return NULL; |
28140 | } |
28141 | D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_with_default" )); |
28142 | NameDefaultPair* lambda_param_with_default_var; |
28143 | while ( |
28144 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
28145 | ) |
28146 | { |
28147 | _res = lambda_param_with_default_var; |
28148 | if (_n == _children_capacity) { |
28149 | _children_capacity *= 2; |
28150 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28151 | if (!_new_children) { |
28152 | p->error_indicator = 1; |
28153 | PyErr_NoMemory(); |
28154 | p->level--; |
28155 | return NULL; |
28156 | } |
28157 | _children = _new_children; |
28158 | } |
28159 | _children[_n++] = _res; |
28160 | _mark = p->mark; |
28161 | } |
28162 | p->mark = _mark; |
28163 | D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n" , p->level, ' ', |
28164 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_with_default" )); |
28165 | } |
28166 | if (_n == 0 || p->error_indicator) { |
28167 | PyMem_Free(_children); |
28168 | p->level--; |
28169 | return NULL; |
28170 | } |
28171 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28172 | if (!_seq) { |
28173 | PyMem_Free(_children); |
28174 | p->error_indicator = 1; |
28175 | PyErr_NoMemory(); |
28176 | p->level--; |
28177 | return NULL; |
28178 | } |
28179 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28180 | PyMem_Free(_children); |
28181 | _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); |
28182 | p->level--; |
28183 | return _seq; |
28184 | } |
28185 | |
28186 | // _loop0_100: lambda_param_no_default |
28187 | static asdl_seq * |
28188 | _loop0_100_rule(Parser *p) |
28189 | { |
28190 | if (p->level++ == MAXSTACK) { |
28191 | p->error_indicator = 1; |
28192 | PyErr_NoMemory(); |
28193 | } |
28194 | if (p->error_indicator) { |
28195 | p->level--; |
28196 | return NULL; |
28197 | } |
28198 | void *_res = NULL; |
28199 | int _mark = p->mark; |
28200 | int _start_mark = p->mark; |
28201 | void **_children = PyMem_Malloc(sizeof(void *)); |
28202 | if (!_children) { |
28203 | p->error_indicator = 1; |
28204 | PyErr_NoMemory(); |
28205 | p->level--; |
28206 | return NULL; |
28207 | } |
28208 | Py_ssize_t _children_capacity = 1; |
28209 | Py_ssize_t _n = 0; |
28210 | { // lambda_param_no_default |
28211 | if (p->error_indicator) { |
28212 | p->level--; |
28213 | return NULL; |
28214 | } |
28215 | D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default" )); |
28216 | arg_ty lambda_param_no_default_var; |
28217 | while ( |
28218 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
28219 | ) |
28220 | { |
28221 | _res = lambda_param_no_default_var; |
28222 | if (_n == _children_capacity) { |
28223 | _children_capacity *= 2; |
28224 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28225 | if (!_new_children) { |
28226 | p->error_indicator = 1; |
28227 | PyErr_NoMemory(); |
28228 | p->level--; |
28229 | return NULL; |
28230 | } |
28231 | _children = _new_children; |
28232 | } |
28233 | _children[_n++] = _res; |
28234 | _mark = p->mark; |
28235 | } |
28236 | p->mark = _mark; |
28237 | D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n" , p->level, ' ', |
28238 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default" )); |
28239 | } |
28240 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28241 | if (!_seq) { |
28242 | PyMem_Free(_children); |
28243 | p->error_indicator = 1; |
28244 | PyErr_NoMemory(); |
28245 | p->level--; |
28246 | return NULL; |
28247 | } |
28248 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28249 | PyMem_Free(_children); |
28250 | _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq); |
28251 | p->level--; |
28252 | return _seq; |
28253 | } |
28254 | |
28255 | // _loop1_101: lambda_param_with_default |
28256 | static asdl_seq * |
28257 | _loop1_101_rule(Parser *p) |
28258 | { |
28259 | if (p->level++ == MAXSTACK) { |
28260 | p->error_indicator = 1; |
28261 | PyErr_NoMemory(); |
28262 | } |
28263 | if (p->error_indicator) { |
28264 | p->level--; |
28265 | return NULL; |
28266 | } |
28267 | void *_res = NULL; |
28268 | int _mark = p->mark; |
28269 | int _start_mark = p->mark; |
28270 | void **_children = PyMem_Malloc(sizeof(void *)); |
28271 | if (!_children) { |
28272 | p->error_indicator = 1; |
28273 | PyErr_NoMemory(); |
28274 | p->level--; |
28275 | return NULL; |
28276 | } |
28277 | Py_ssize_t _children_capacity = 1; |
28278 | Py_ssize_t _n = 0; |
28279 | { // lambda_param_with_default |
28280 | if (p->error_indicator) { |
28281 | p->level--; |
28282 | return NULL; |
28283 | } |
28284 | D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_with_default" )); |
28285 | NameDefaultPair* lambda_param_with_default_var; |
28286 | while ( |
28287 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
28288 | ) |
28289 | { |
28290 | _res = lambda_param_with_default_var; |
28291 | if (_n == _children_capacity) { |
28292 | _children_capacity *= 2; |
28293 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28294 | if (!_new_children) { |
28295 | p->error_indicator = 1; |
28296 | PyErr_NoMemory(); |
28297 | p->level--; |
28298 | return NULL; |
28299 | } |
28300 | _children = _new_children; |
28301 | } |
28302 | _children[_n++] = _res; |
28303 | _mark = p->mark; |
28304 | } |
28305 | p->mark = _mark; |
28306 | D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n" , p->level, ' ', |
28307 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_with_default" )); |
28308 | } |
28309 | if (_n == 0 || p->error_indicator) { |
28310 | PyMem_Free(_children); |
28311 | p->level--; |
28312 | return NULL; |
28313 | } |
28314 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28315 | if (!_seq) { |
28316 | PyMem_Free(_children); |
28317 | p->error_indicator = 1; |
28318 | PyErr_NoMemory(); |
28319 | p->level--; |
28320 | return NULL; |
28321 | } |
28322 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28323 | PyMem_Free(_children); |
28324 | _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq); |
28325 | p->level--; |
28326 | return _seq; |
28327 | } |
28328 | |
28329 | // _loop0_102: lambda_param_maybe_default |
28330 | static asdl_seq * |
28331 | _loop0_102_rule(Parser *p) |
28332 | { |
28333 | if (p->level++ == MAXSTACK) { |
28334 | p->error_indicator = 1; |
28335 | PyErr_NoMemory(); |
28336 | } |
28337 | if (p->error_indicator) { |
28338 | p->level--; |
28339 | return NULL; |
28340 | } |
28341 | void *_res = NULL; |
28342 | int _mark = p->mark; |
28343 | int _start_mark = p->mark; |
28344 | void **_children = PyMem_Malloc(sizeof(void *)); |
28345 | if (!_children) { |
28346 | p->error_indicator = 1; |
28347 | PyErr_NoMemory(); |
28348 | p->level--; |
28349 | return NULL; |
28350 | } |
28351 | Py_ssize_t _children_capacity = 1; |
28352 | Py_ssize_t _n = 0; |
28353 | { // lambda_param_maybe_default |
28354 | if (p->error_indicator) { |
28355 | p->level--; |
28356 | return NULL; |
28357 | } |
28358 | D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_maybe_default" )); |
28359 | NameDefaultPair* lambda_param_maybe_default_var; |
28360 | while ( |
28361 | (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default |
28362 | ) |
28363 | { |
28364 | _res = lambda_param_maybe_default_var; |
28365 | if (_n == _children_capacity) { |
28366 | _children_capacity *= 2; |
28367 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28368 | if (!_new_children) { |
28369 | p->error_indicator = 1; |
28370 | PyErr_NoMemory(); |
28371 | p->level--; |
28372 | return NULL; |
28373 | } |
28374 | _children = _new_children; |
28375 | } |
28376 | _children[_n++] = _res; |
28377 | _mark = p->mark; |
28378 | } |
28379 | p->mark = _mark; |
28380 | D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n" , p->level, ' ', |
28381 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_maybe_default" )); |
28382 | } |
28383 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28384 | if (!_seq) { |
28385 | PyMem_Free(_children); |
28386 | p->error_indicator = 1; |
28387 | PyErr_NoMemory(); |
28388 | p->level--; |
28389 | return NULL; |
28390 | } |
28391 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28392 | PyMem_Free(_children); |
28393 | _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); |
28394 | p->level--; |
28395 | return _seq; |
28396 | } |
28397 | |
28398 | // _loop1_103: lambda_param_maybe_default |
28399 | static asdl_seq * |
28400 | _loop1_103_rule(Parser *p) |
28401 | { |
28402 | if (p->level++ == MAXSTACK) { |
28403 | p->error_indicator = 1; |
28404 | PyErr_NoMemory(); |
28405 | } |
28406 | if (p->error_indicator) { |
28407 | p->level--; |
28408 | return NULL; |
28409 | } |
28410 | void *_res = NULL; |
28411 | int _mark = p->mark; |
28412 | int _start_mark = p->mark; |
28413 | void **_children = PyMem_Malloc(sizeof(void *)); |
28414 | if (!_children) { |
28415 | p->error_indicator = 1; |
28416 | PyErr_NoMemory(); |
28417 | p->level--; |
28418 | return NULL; |
28419 | } |
28420 | Py_ssize_t _children_capacity = 1; |
28421 | Py_ssize_t _n = 0; |
28422 | { // lambda_param_maybe_default |
28423 | if (p->error_indicator) { |
28424 | p->level--; |
28425 | return NULL; |
28426 | } |
28427 | D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_maybe_default" )); |
28428 | NameDefaultPair* lambda_param_maybe_default_var; |
28429 | while ( |
28430 | (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default |
28431 | ) |
28432 | { |
28433 | _res = lambda_param_maybe_default_var; |
28434 | if (_n == _children_capacity) { |
28435 | _children_capacity *= 2; |
28436 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28437 | if (!_new_children) { |
28438 | p->error_indicator = 1; |
28439 | PyErr_NoMemory(); |
28440 | p->level--; |
28441 | return NULL; |
28442 | } |
28443 | _children = _new_children; |
28444 | } |
28445 | _children[_n++] = _res; |
28446 | _mark = p->mark; |
28447 | } |
28448 | p->mark = _mark; |
28449 | D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n" , p->level, ' ', |
28450 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_maybe_default" )); |
28451 | } |
28452 | if (_n == 0 || p->error_indicator) { |
28453 | PyMem_Free(_children); |
28454 | p->level--; |
28455 | return NULL; |
28456 | } |
28457 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28458 | if (!_seq) { |
28459 | PyMem_Free(_children); |
28460 | p->error_indicator = 1; |
28461 | PyErr_NoMemory(); |
28462 | p->level--; |
28463 | return NULL; |
28464 | } |
28465 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28466 | PyMem_Free(_children); |
28467 | _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); |
28468 | p->level--; |
28469 | return _seq; |
28470 | } |
28471 | |
28472 | // _loop1_104: ('or' conjunction) |
28473 | static asdl_seq * |
28474 | _loop1_104_rule(Parser *p) |
28475 | { |
28476 | if (p->level++ == MAXSTACK) { |
28477 | p->error_indicator = 1; |
28478 | PyErr_NoMemory(); |
28479 | } |
28480 | if (p->error_indicator) { |
28481 | p->level--; |
28482 | return NULL; |
28483 | } |
28484 | void *_res = NULL; |
28485 | int _mark = p->mark; |
28486 | int _start_mark = p->mark; |
28487 | void **_children = PyMem_Malloc(sizeof(void *)); |
28488 | if (!_children) { |
28489 | p->error_indicator = 1; |
28490 | PyErr_NoMemory(); |
28491 | p->level--; |
28492 | return NULL; |
28493 | } |
28494 | Py_ssize_t _children_capacity = 1; |
28495 | Py_ssize_t _n = 0; |
28496 | { // ('or' conjunction) |
28497 | if (p->error_indicator) { |
28498 | p->level--; |
28499 | return NULL; |
28500 | } |
28501 | D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('or' conjunction)" )); |
28502 | void *_tmp_187_var; |
28503 | while ( |
28504 | (_tmp_187_var = _tmp_187_rule(p)) // 'or' conjunction |
28505 | ) |
28506 | { |
28507 | _res = _tmp_187_var; |
28508 | if (_n == _children_capacity) { |
28509 | _children_capacity *= 2; |
28510 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28511 | if (!_new_children) { |
28512 | p->error_indicator = 1; |
28513 | PyErr_NoMemory(); |
28514 | p->level--; |
28515 | return NULL; |
28516 | } |
28517 | _children = _new_children; |
28518 | } |
28519 | _children[_n++] = _res; |
28520 | _mark = p->mark; |
28521 | } |
28522 | p->mark = _mark; |
28523 | D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n" , p->level, ' ', |
28524 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('or' conjunction)" )); |
28525 | } |
28526 | if (_n == 0 || p->error_indicator) { |
28527 | PyMem_Free(_children); |
28528 | p->level--; |
28529 | return NULL; |
28530 | } |
28531 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28532 | if (!_seq) { |
28533 | PyMem_Free(_children); |
28534 | p->error_indicator = 1; |
28535 | PyErr_NoMemory(); |
28536 | p->level--; |
28537 | return NULL; |
28538 | } |
28539 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28540 | PyMem_Free(_children); |
28541 | _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq); |
28542 | p->level--; |
28543 | return _seq; |
28544 | } |
28545 | |
28546 | // _loop1_105: ('and' inversion) |
28547 | static asdl_seq * |
28548 | _loop1_105_rule(Parser *p) |
28549 | { |
28550 | if (p->level++ == MAXSTACK) { |
28551 | p->error_indicator = 1; |
28552 | PyErr_NoMemory(); |
28553 | } |
28554 | if (p->error_indicator) { |
28555 | p->level--; |
28556 | return NULL; |
28557 | } |
28558 | void *_res = NULL; |
28559 | int _mark = p->mark; |
28560 | int _start_mark = p->mark; |
28561 | void **_children = PyMem_Malloc(sizeof(void *)); |
28562 | if (!_children) { |
28563 | p->error_indicator = 1; |
28564 | PyErr_NoMemory(); |
28565 | p->level--; |
28566 | return NULL; |
28567 | } |
28568 | Py_ssize_t _children_capacity = 1; |
28569 | Py_ssize_t _n = 0; |
28570 | { // ('and' inversion) |
28571 | if (p->error_indicator) { |
28572 | p->level--; |
28573 | return NULL; |
28574 | } |
28575 | D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('and' inversion)" )); |
28576 | void *_tmp_188_var; |
28577 | while ( |
28578 | (_tmp_188_var = _tmp_188_rule(p)) // 'and' inversion |
28579 | ) |
28580 | { |
28581 | _res = _tmp_188_var; |
28582 | if (_n == _children_capacity) { |
28583 | _children_capacity *= 2; |
28584 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28585 | if (!_new_children) { |
28586 | p->error_indicator = 1; |
28587 | PyErr_NoMemory(); |
28588 | p->level--; |
28589 | return NULL; |
28590 | } |
28591 | _children = _new_children; |
28592 | } |
28593 | _children[_n++] = _res; |
28594 | _mark = p->mark; |
28595 | } |
28596 | p->mark = _mark; |
28597 | D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n" , p->level, ' ', |
28598 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('and' inversion)" )); |
28599 | } |
28600 | if (_n == 0 || p->error_indicator) { |
28601 | PyMem_Free(_children); |
28602 | p->level--; |
28603 | return NULL; |
28604 | } |
28605 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28606 | if (!_seq) { |
28607 | PyMem_Free(_children); |
28608 | p->error_indicator = 1; |
28609 | PyErr_NoMemory(); |
28610 | p->level--; |
28611 | return NULL; |
28612 | } |
28613 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28614 | PyMem_Free(_children); |
28615 | _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); |
28616 | p->level--; |
28617 | return _seq; |
28618 | } |
28619 | |
28620 | // _loop1_106: compare_op_bitwise_or_pair |
28621 | static asdl_seq * |
28622 | _loop1_106_rule(Parser *p) |
28623 | { |
28624 | if (p->level++ == MAXSTACK) { |
28625 | p->error_indicator = 1; |
28626 | PyErr_NoMemory(); |
28627 | } |
28628 | if (p->error_indicator) { |
28629 | p->level--; |
28630 | return NULL; |
28631 | } |
28632 | void *_res = NULL; |
28633 | int _mark = p->mark; |
28634 | int _start_mark = p->mark; |
28635 | void **_children = PyMem_Malloc(sizeof(void *)); |
28636 | if (!_children) { |
28637 | p->error_indicator = 1; |
28638 | PyErr_NoMemory(); |
28639 | p->level--; |
28640 | return NULL; |
28641 | } |
28642 | Py_ssize_t _children_capacity = 1; |
28643 | Py_ssize_t _n = 0; |
28644 | { // compare_op_bitwise_or_pair |
28645 | if (p->error_indicator) { |
28646 | p->level--; |
28647 | return NULL; |
28648 | } |
28649 | D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair" )); |
28650 | CmpopExprPair* compare_op_bitwise_or_pair_var; |
28651 | while ( |
28652 | (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair |
28653 | ) |
28654 | { |
28655 | _res = compare_op_bitwise_or_pair_var; |
28656 | if (_n == _children_capacity) { |
28657 | _children_capacity *= 2; |
28658 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28659 | if (!_new_children) { |
28660 | p->error_indicator = 1; |
28661 | PyErr_NoMemory(); |
28662 | p->level--; |
28663 | return NULL; |
28664 | } |
28665 | _children = _new_children; |
28666 | } |
28667 | _children[_n++] = _res; |
28668 | _mark = p->mark; |
28669 | } |
28670 | p->mark = _mark; |
28671 | D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n" , p->level, ' ', |
28672 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "compare_op_bitwise_or_pair" )); |
28673 | } |
28674 | if (_n == 0 || p->error_indicator) { |
28675 | PyMem_Free(_children); |
28676 | p->level--; |
28677 | return NULL; |
28678 | } |
28679 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28680 | if (!_seq) { |
28681 | PyMem_Free(_children); |
28682 | p->error_indicator = 1; |
28683 | PyErr_NoMemory(); |
28684 | p->level--; |
28685 | return NULL; |
28686 | } |
28687 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28688 | PyMem_Free(_children); |
28689 | _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq); |
28690 | p->level--; |
28691 | return _seq; |
28692 | } |
28693 | |
28694 | // _tmp_107: '!=' |
28695 | static void * |
28696 | _tmp_107_rule(Parser *p) |
28697 | { |
28698 | if (p->level++ == MAXSTACK) { |
28699 | p->error_indicator = 1; |
28700 | PyErr_NoMemory(); |
28701 | } |
28702 | if (p->error_indicator) { |
28703 | p->level--; |
28704 | return NULL; |
28705 | } |
28706 | void * _res = NULL; |
28707 | int _mark = p->mark; |
28708 | { // '!=' |
28709 | if (p->error_indicator) { |
28710 | p->level--; |
28711 | return NULL; |
28712 | } |
28713 | D(fprintf(stderr, "%*c> _tmp_107[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'!='" )); |
28714 | Token * tok; |
28715 | if ( |
28716 | (tok = _PyPegen_expect_token(p, 28)) // token='!=' |
28717 | ) |
28718 | { |
28719 | D(fprintf(stderr, "%*c+ _tmp_107[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'!='" )); |
28720 | _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok; |
28721 | if (_res == NULL && PyErr_Occurred()) { |
28722 | p->error_indicator = 1; |
28723 | p->level--; |
28724 | return NULL; |
28725 | } |
28726 | goto done; |
28727 | } |
28728 | p->mark = _mark; |
28729 | D(fprintf(stderr, "%*c%s _tmp_107[%d-%d]: %s failed!\n" , p->level, ' ', |
28730 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'!='" )); |
28731 | } |
28732 | _res = NULL; |
28733 | done: |
28734 | p->level--; |
28735 | return _res; |
28736 | } |
28737 | |
28738 | // _loop0_109: ',' slice |
28739 | static asdl_seq * |
28740 | _loop0_109_rule(Parser *p) |
28741 | { |
28742 | if (p->level++ == MAXSTACK) { |
28743 | p->error_indicator = 1; |
28744 | PyErr_NoMemory(); |
28745 | } |
28746 | if (p->error_indicator) { |
28747 | p->level--; |
28748 | return NULL; |
28749 | } |
28750 | void *_res = NULL; |
28751 | int _mark = p->mark; |
28752 | int _start_mark = p->mark; |
28753 | void **_children = PyMem_Malloc(sizeof(void *)); |
28754 | if (!_children) { |
28755 | p->error_indicator = 1; |
28756 | PyErr_NoMemory(); |
28757 | p->level--; |
28758 | return NULL; |
28759 | } |
28760 | Py_ssize_t _children_capacity = 1; |
28761 | Py_ssize_t _n = 0; |
28762 | { // ',' slice |
28763 | if (p->error_indicator) { |
28764 | p->level--; |
28765 | return NULL; |
28766 | } |
28767 | D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' slice" )); |
28768 | Token * _literal; |
28769 | expr_ty elem; |
28770 | while ( |
28771 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
28772 | && |
28773 | (elem = slice_rule(p)) // slice |
28774 | ) |
28775 | { |
28776 | _res = elem; |
28777 | if (_res == NULL && PyErr_Occurred()) { |
28778 | p->error_indicator = 1; |
28779 | PyMem_Free(_children); |
28780 | p->level--; |
28781 | return NULL; |
28782 | } |
28783 | if (_n == _children_capacity) { |
28784 | _children_capacity *= 2; |
28785 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28786 | if (!_new_children) { |
28787 | p->error_indicator = 1; |
28788 | PyErr_NoMemory(); |
28789 | p->level--; |
28790 | return NULL; |
28791 | } |
28792 | _children = _new_children; |
28793 | } |
28794 | _children[_n++] = _res; |
28795 | _mark = p->mark; |
28796 | } |
28797 | p->mark = _mark; |
28798 | D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n" , p->level, ' ', |
28799 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' slice" )); |
28800 | } |
28801 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28802 | if (!_seq) { |
28803 | PyMem_Free(_children); |
28804 | p->error_indicator = 1; |
28805 | PyErr_NoMemory(); |
28806 | p->level--; |
28807 | return NULL; |
28808 | } |
28809 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28810 | PyMem_Free(_children); |
28811 | _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq); |
28812 | p->level--; |
28813 | return _seq; |
28814 | } |
28815 | |
28816 | // _gather_108: slice _loop0_109 |
28817 | static asdl_seq * |
28818 | _gather_108_rule(Parser *p) |
28819 | { |
28820 | if (p->level++ == MAXSTACK) { |
28821 | p->error_indicator = 1; |
28822 | PyErr_NoMemory(); |
28823 | } |
28824 | if (p->error_indicator) { |
28825 | p->level--; |
28826 | return NULL; |
28827 | } |
28828 | asdl_seq * _res = NULL; |
28829 | int _mark = p->mark; |
28830 | { // slice _loop0_109 |
28831 | if (p->error_indicator) { |
28832 | p->level--; |
28833 | return NULL; |
28834 | } |
28835 | D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "slice _loop0_109" )); |
28836 | expr_ty elem; |
28837 | asdl_seq * seq; |
28838 | if ( |
28839 | (elem = slice_rule(p)) // slice |
28840 | && |
28841 | (seq = _loop0_109_rule(p)) // _loop0_109 |
28842 | ) |
28843 | { |
28844 | D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "slice _loop0_109" )); |
28845 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
28846 | goto done; |
28847 | } |
28848 | p->mark = _mark; |
28849 | D(fprintf(stderr, "%*c%s _gather_108[%d-%d]: %s failed!\n" , p->level, ' ', |
28850 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "slice _loop0_109" )); |
28851 | } |
28852 | _res = NULL; |
28853 | done: |
28854 | p->level--; |
28855 | return _res; |
28856 | } |
28857 | |
28858 | // _tmp_110: ':' expression? |
28859 | static void * |
28860 | _tmp_110_rule(Parser *p) |
28861 | { |
28862 | if (p->level++ == MAXSTACK) { |
28863 | p->error_indicator = 1; |
28864 | PyErr_NoMemory(); |
28865 | } |
28866 | if (p->error_indicator) { |
28867 | p->level--; |
28868 | return NULL; |
28869 | } |
28870 | void * _res = NULL; |
28871 | int _mark = p->mark; |
28872 | { // ':' expression? |
28873 | if (p->error_indicator) { |
28874 | p->level--; |
28875 | return NULL; |
28876 | } |
28877 | D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "':' expression?" )); |
28878 | Token * _literal; |
28879 | void *d; |
28880 | if ( |
28881 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
28882 | && |
28883 | (d = expression_rule(p), !p->error_indicator) // expression? |
28884 | ) |
28885 | { |
28886 | D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "':' expression?" )); |
28887 | _res = d; |
28888 | if (_res == NULL && PyErr_Occurred()) { |
28889 | p->error_indicator = 1; |
28890 | p->level--; |
28891 | return NULL; |
28892 | } |
28893 | goto done; |
28894 | } |
28895 | p->mark = _mark; |
28896 | D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n" , p->level, ' ', |
28897 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "':' expression?" )); |
28898 | } |
28899 | _res = NULL; |
28900 | done: |
28901 | p->level--; |
28902 | return _res; |
28903 | } |
28904 | |
28905 | // _tmp_111: tuple | group | genexp |
28906 | static void * |
28907 | _tmp_111_rule(Parser *p) |
28908 | { |
28909 | if (p->level++ == MAXSTACK) { |
28910 | p->error_indicator = 1; |
28911 | PyErr_NoMemory(); |
28912 | } |
28913 | if (p->error_indicator) { |
28914 | p->level--; |
28915 | return NULL; |
28916 | } |
28917 | void * _res = NULL; |
28918 | int _mark = p->mark; |
28919 | { // tuple |
28920 | if (p->error_indicator) { |
28921 | p->level--; |
28922 | return NULL; |
28923 | } |
28924 | D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "tuple" )); |
28925 | expr_ty tuple_var; |
28926 | if ( |
28927 | (tuple_var = tuple_rule(p)) // tuple |
28928 | ) |
28929 | { |
28930 | D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "tuple" )); |
28931 | _res = tuple_var; |
28932 | goto done; |
28933 | } |
28934 | p->mark = _mark; |
28935 | D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n" , p->level, ' ', |
28936 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "tuple" )); |
28937 | } |
28938 | { // group |
28939 | if (p->error_indicator) { |
28940 | p->level--; |
28941 | return NULL; |
28942 | } |
28943 | D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "group" )); |
28944 | expr_ty group_var; |
28945 | if ( |
28946 | (group_var = group_rule(p)) // group |
28947 | ) |
28948 | { |
28949 | D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "group" )); |
28950 | _res = group_var; |
28951 | goto done; |
28952 | } |
28953 | p->mark = _mark; |
28954 | D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n" , p->level, ' ', |
28955 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "group" )); |
28956 | } |
28957 | { // genexp |
28958 | if (p->error_indicator) { |
28959 | p->level--; |
28960 | return NULL; |
28961 | } |
28962 | D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "genexp" )); |
28963 | expr_ty genexp_var; |
28964 | if ( |
28965 | (genexp_var = genexp_rule(p)) // genexp |
28966 | ) |
28967 | { |
28968 | D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "genexp" )); |
28969 | _res = genexp_var; |
28970 | goto done; |
28971 | } |
28972 | p->mark = _mark; |
28973 | D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n" , p->level, ' ', |
28974 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "genexp" )); |
28975 | } |
28976 | _res = NULL; |
28977 | done: |
28978 | p->level--; |
28979 | return _res; |
28980 | } |
28981 | |
28982 | // _tmp_112: list | listcomp |
28983 | static void * |
28984 | _tmp_112_rule(Parser *p) |
28985 | { |
28986 | if (p->level++ == MAXSTACK) { |
28987 | p->error_indicator = 1; |
28988 | PyErr_NoMemory(); |
28989 | } |
28990 | if (p->error_indicator) { |
28991 | p->level--; |
28992 | return NULL; |
28993 | } |
28994 | void * _res = NULL; |
28995 | int _mark = p->mark; |
28996 | { // list |
28997 | if (p->error_indicator) { |
28998 | p->level--; |
28999 | return NULL; |
29000 | } |
29001 | D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "list" )); |
29002 | expr_ty list_var; |
29003 | if ( |
29004 | (list_var = list_rule(p)) // list |
29005 | ) |
29006 | { |
29007 | D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "list" )); |
29008 | _res = list_var; |
29009 | goto done; |
29010 | } |
29011 | p->mark = _mark; |
29012 | D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n" , p->level, ' ', |
29013 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "list" )); |
29014 | } |
29015 | { // listcomp |
29016 | if (p->error_indicator) { |
29017 | p->level--; |
29018 | return NULL; |
29019 | } |
29020 | D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "listcomp" )); |
29021 | expr_ty listcomp_var; |
29022 | if ( |
29023 | (listcomp_var = listcomp_rule(p)) // listcomp |
29024 | ) |
29025 | { |
29026 | D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "listcomp" )); |
29027 | _res = listcomp_var; |
29028 | goto done; |
29029 | } |
29030 | p->mark = _mark; |
29031 | D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n" , p->level, ' ', |
29032 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "listcomp" )); |
29033 | } |
29034 | _res = NULL; |
29035 | done: |
29036 | p->level--; |
29037 | return _res; |
29038 | } |
29039 | |
29040 | // _tmp_113: dict | set | dictcomp | setcomp |
29041 | static void * |
29042 | _tmp_113_rule(Parser *p) |
29043 | { |
29044 | if (p->level++ == MAXSTACK) { |
29045 | p->error_indicator = 1; |
29046 | PyErr_NoMemory(); |
29047 | } |
29048 | if (p->error_indicator) { |
29049 | p->level--; |
29050 | return NULL; |
29051 | } |
29052 | void * _res = NULL; |
29053 | int _mark = p->mark; |
29054 | { // dict |
29055 | if (p->error_indicator) { |
29056 | p->level--; |
29057 | return NULL; |
29058 | } |
29059 | D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "dict" )); |
29060 | expr_ty dict_var; |
29061 | if ( |
29062 | (dict_var = dict_rule(p)) // dict |
29063 | ) |
29064 | { |
29065 | D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "dict" )); |
29066 | _res = dict_var; |
29067 | goto done; |
29068 | } |
29069 | p->mark = _mark; |
29070 | D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n" , p->level, ' ', |
29071 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "dict" )); |
29072 | } |
29073 | { // set |
29074 | if (p->error_indicator) { |
29075 | p->level--; |
29076 | return NULL; |
29077 | } |
29078 | D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "set" )); |
29079 | expr_ty set_var; |
29080 | if ( |
29081 | (set_var = set_rule(p)) // set |
29082 | ) |
29083 | { |
29084 | D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "set" )); |
29085 | _res = set_var; |
29086 | goto done; |
29087 | } |
29088 | p->mark = _mark; |
29089 | D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n" , p->level, ' ', |
29090 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "set" )); |
29091 | } |
29092 | { // dictcomp |
29093 | if (p->error_indicator) { |
29094 | p->level--; |
29095 | return NULL; |
29096 | } |
29097 | D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "dictcomp" )); |
29098 | expr_ty dictcomp_var; |
29099 | if ( |
29100 | (dictcomp_var = dictcomp_rule(p)) // dictcomp |
29101 | ) |
29102 | { |
29103 | D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "dictcomp" )); |
29104 | _res = dictcomp_var; |
29105 | goto done; |
29106 | } |
29107 | p->mark = _mark; |
29108 | D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n" , p->level, ' ', |
29109 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "dictcomp" )); |
29110 | } |
29111 | { // setcomp |
29112 | if (p->error_indicator) { |
29113 | p->level--; |
29114 | return NULL; |
29115 | } |
29116 | D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "setcomp" )); |
29117 | expr_ty setcomp_var; |
29118 | if ( |
29119 | (setcomp_var = setcomp_rule(p)) // setcomp |
29120 | ) |
29121 | { |
29122 | D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "setcomp" )); |
29123 | _res = setcomp_var; |
29124 | goto done; |
29125 | } |
29126 | p->mark = _mark; |
29127 | D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n" , p->level, ' ', |
29128 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "setcomp" )); |
29129 | } |
29130 | _res = NULL; |
29131 | done: |
29132 | p->level--; |
29133 | return _res; |
29134 | } |
29135 | |
29136 | // _loop1_114: STRING |
29137 | static asdl_seq * |
29138 | _loop1_114_rule(Parser *p) |
29139 | { |
29140 | if (p->level++ == MAXSTACK) { |
29141 | p->error_indicator = 1; |
29142 | PyErr_NoMemory(); |
29143 | } |
29144 | if (p->error_indicator) { |
29145 | p->level--; |
29146 | return NULL; |
29147 | } |
29148 | void *_res = NULL; |
29149 | int _mark = p->mark; |
29150 | int _start_mark = p->mark; |
29151 | void **_children = PyMem_Malloc(sizeof(void *)); |
29152 | if (!_children) { |
29153 | p->error_indicator = 1; |
29154 | PyErr_NoMemory(); |
29155 | p->level--; |
29156 | return NULL; |
29157 | } |
29158 | Py_ssize_t _children_capacity = 1; |
29159 | Py_ssize_t _n = 0; |
29160 | { // STRING |
29161 | if (p->error_indicator) { |
29162 | p->level--; |
29163 | return NULL; |
29164 | } |
29165 | D(fprintf(stderr, "%*c> _loop1_114[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "STRING" )); |
29166 | expr_ty string_var; |
29167 | while ( |
29168 | (string_var = _PyPegen_string_token(p)) // STRING |
29169 | ) |
29170 | { |
29171 | _res = string_var; |
29172 | if (_n == _children_capacity) { |
29173 | _children_capacity *= 2; |
29174 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29175 | if (!_new_children) { |
29176 | p->error_indicator = 1; |
29177 | PyErr_NoMemory(); |
29178 | p->level--; |
29179 | return NULL; |
29180 | } |
29181 | _children = _new_children; |
29182 | } |
29183 | _children[_n++] = _res; |
29184 | _mark = p->mark; |
29185 | } |
29186 | p->mark = _mark; |
29187 | D(fprintf(stderr, "%*c%s _loop1_114[%d-%d]: %s failed!\n" , p->level, ' ', |
29188 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "STRING" )); |
29189 | } |
29190 | if (_n == 0 || p->error_indicator) { |
29191 | PyMem_Free(_children); |
29192 | p->level--; |
29193 | return NULL; |
29194 | } |
29195 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29196 | if (!_seq) { |
29197 | PyMem_Free(_children); |
29198 | p->error_indicator = 1; |
29199 | PyErr_NoMemory(); |
29200 | p->level--; |
29201 | return NULL; |
29202 | } |
29203 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29204 | PyMem_Free(_children); |
29205 | _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq); |
29206 | p->level--; |
29207 | return _seq; |
29208 | } |
29209 | |
29210 | // _tmp_115: star_named_expression ',' star_named_expressions? |
29211 | static void * |
29212 | _tmp_115_rule(Parser *p) |
29213 | { |
29214 | if (p->level++ == MAXSTACK) { |
29215 | p->error_indicator = 1; |
29216 | PyErr_NoMemory(); |
29217 | } |
29218 | if (p->error_indicator) { |
29219 | p->level--; |
29220 | return NULL; |
29221 | } |
29222 | void * _res = NULL; |
29223 | int _mark = p->mark; |
29224 | { // star_named_expression ',' star_named_expressions? |
29225 | if (p->error_indicator) { |
29226 | p->level--; |
29227 | return NULL; |
29228 | } |
29229 | D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?" )); |
29230 | Token * _literal; |
29231 | expr_ty y; |
29232 | void *z; |
29233 | if ( |
29234 | (y = star_named_expression_rule(p)) // star_named_expression |
29235 | && |
29236 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
29237 | && |
29238 | (z = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions? |
29239 | ) |
29240 | { |
29241 | D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?" )); |
29242 | _res = _PyPegen_seq_insert_in_front ( p , y , z ); |
29243 | if (_res == NULL && PyErr_Occurred()) { |
29244 | p->error_indicator = 1; |
29245 | p->level--; |
29246 | return NULL; |
29247 | } |
29248 | goto done; |
29249 | } |
29250 | p->mark = _mark; |
29251 | D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n" , p->level, ' ', |
29252 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_named_expression ',' star_named_expressions?" )); |
29253 | } |
29254 | _res = NULL; |
29255 | done: |
29256 | p->level--; |
29257 | return _res; |
29258 | } |
29259 | |
29260 | // _tmp_116: yield_expr | named_expression |
29261 | static void * |
29262 | _tmp_116_rule(Parser *p) |
29263 | { |
29264 | if (p->level++ == MAXSTACK) { |
29265 | p->error_indicator = 1; |
29266 | PyErr_NoMemory(); |
29267 | } |
29268 | if (p->error_indicator) { |
29269 | p->level--; |
29270 | return NULL; |
29271 | } |
29272 | void * _res = NULL; |
29273 | int _mark = p->mark; |
29274 | { // yield_expr |
29275 | if (p->error_indicator) { |
29276 | p->level--; |
29277 | return NULL; |
29278 | } |
29279 | D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "yield_expr" )); |
29280 | expr_ty yield_expr_var; |
29281 | if ( |
29282 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
29283 | ) |
29284 | { |
29285 | D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "yield_expr" )); |
29286 | _res = yield_expr_var; |
29287 | goto done; |
29288 | } |
29289 | p->mark = _mark; |
29290 | D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n" , p->level, ' ', |
29291 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "yield_expr" )); |
29292 | } |
29293 | { // named_expression |
29294 | if (p->error_indicator) { |
29295 | p->level--; |
29296 | return NULL; |
29297 | } |
29298 | D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "named_expression" )); |
29299 | expr_ty named_expression_var; |
29300 | if ( |
29301 | (named_expression_var = named_expression_rule(p)) // named_expression |
29302 | ) |
29303 | { |
29304 | D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "named_expression" )); |
29305 | _res = named_expression_var; |
29306 | goto done; |
29307 | } |
29308 | p->mark = _mark; |
29309 | D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n" , p->level, ' ', |
29310 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "named_expression" )); |
29311 | } |
29312 | _res = NULL; |
29313 | done: |
29314 | p->level--; |
29315 | return _res; |
29316 | } |
29317 | |
29318 | // _tmp_117: assignment_expression | expression !':=' |
29319 | static void * |
29320 | _tmp_117_rule(Parser *p) |
29321 | { |
29322 | if (p->level++ == MAXSTACK) { |
29323 | p->error_indicator = 1; |
29324 | PyErr_NoMemory(); |
29325 | } |
29326 | if (p->error_indicator) { |
29327 | p->level--; |
29328 | return NULL; |
29329 | } |
29330 | void * _res = NULL; |
29331 | int _mark = p->mark; |
29332 | { // assignment_expression |
29333 | if (p->error_indicator) { |
29334 | p->level--; |
29335 | return NULL; |
29336 | } |
29337 | D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "assignment_expression" )); |
29338 | expr_ty assignment_expression_var; |
29339 | if ( |
29340 | (assignment_expression_var = assignment_expression_rule(p)) // assignment_expression |
29341 | ) |
29342 | { |
29343 | D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "assignment_expression" )); |
29344 | _res = assignment_expression_var; |
29345 | goto done; |
29346 | } |
29347 | p->mark = _mark; |
29348 | D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n" , p->level, ' ', |
29349 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "assignment_expression" )); |
29350 | } |
29351 | { // expression !':=' |
29352 | if (p->error_indicator) { |
29353 | p->level--; |
29354 | return NULL; |
29355 | } |
29356 | D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression !':='" )); |
29357 | expr_ty expression_var; |
29358 | if ( |
29359 | (expression_var = expression_rule(p)) // expression |
29360 | && |
29361 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' |
29362 | ) |
29363 | { |
29364 | D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression !':='" )); |
29365 | _res = expression_var; |
29366 | goto done; |
29367 | } |
29368 | p->mark = _mark; |
29369 | D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n" , p->level, ' ', |
29370 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression !':='" )); |
29371 | } |
29372 | _res = NULL; |
29373 | done: |
29374 | p->level--; |
29375 | return _res; |
29376 | } |
29377 | |
29378 | // _loop0_119: ',' double_starred_kvpair |
29379 | static asdl_seq * |
29380 | _loop0_119_rule(Parser *p) |
29381 | { |
29382 | if (p->level++ == MAXSTACK) { |
29383 | p->error_indicator = 1; |
29384 | PyErr_NoMemory(); |
29385 | } |
29386 | if (p->error_indicator) { |
29387 | p->level--; |
29388 | return NULL; |
29389 | } |
29390 | void *_res = NULL; |
29391 | int _mark = p->mark; |
29392 | int _start_mark = p->mark; |
29393 | void **_children = PyMem_Malloc(sizeof(void *)); |
29394 | if (!_children) { |
29395 | p->error_indicator = 1; |
29396 | PyErr_NoMemory(); |
29397 | p->level--; |
29398 | return NULL; |
29399 | } |
29400 | Py_ssize_t _children_capacity = 1; |
29401 | Py_ssize_t _n = 0; |
29402 | { // ',' double_starred_kvpair |
29403 | if (p->error_indicator) { |
29404 | p->level--; |
29405 | return NULL; |
29406 | } |
29407 | D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' double_starred_kvpair" )); |
29408 | Token * _literal; |
29409 | KeyValuePair* elem; |
29410 | while ( |
29411 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
29412 | && |
29413 | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
29414 | ) |
29415 | { |
29416 | _res = elem; |
29417 | if (_res == NULL && PyErr_Occurred()) { |
29418 | p->error_indicator = 1; |
29419 | PyMem_Free(_children); |
29420 | p->level--; |
29421 | return NULL; |
29422 | } |
29423 | if (_n == _children_capacity) { |
29424 | _children_capacity *= 2; |
29425 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29426 | if (!_new_children) { |
29427 | p->error_indicator = 1; |
29428 | PyErr_NoMemory(); |
29429 | p->level--; |
29430 | return NULL; |
29431 | } |
29432 | _children = _new_children; |
29433 | } |
29434 | _children[_n++] = _res; |
29435 | _mark = p->mark; |
29436 | } |
29437 | p->mark = _mark; |
29438 | D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n" , p->level, ' ', |
29439 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' double_starred_kvpair" )); |
29440 | } |
29441 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29442 | if (!_seq) { |
29443 | PyMem_Free(_children); |
29444 | p->error_indicator = 1; |
29445 | PyErr_NoMemory(); |
29446 | p->level--; |
29447 | return NULL; |
29448 | } |
29449 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29450 | PyMem_Free(_children); |
29451 | _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq); |
29452 | p->level--; |
29453 | return _seq; |
29454 | } |
29455 | |
29456 | // _gather_118: double_starred_kvpair _loop0_119 |
29457 | static asdl_seq * |
29458 | _gather_118_rule(Parser *p) |
29459 | { |
29460 | if (p->level++ == MAXSTACK) { |
29461 | p->error_indicator = 1; |
29462 | PyErr_NoMemory(); |
29463 | } |
29464 | if (p->error_indicator) { |
29465 | p->level--; |
29466 | return NULL; |
29467 | } |
29468 | asdl_seq * _res = NULL; |
29469 | int _mark = p->mark; |
29470 | { // double_starred_kvpair _loop0_119 |
29471 | if (p->error_indicator) { |
29472 | p->level--; |
29473 | return NULL; |
29474 | } |
29475 | D(fprintf(stderr, "%*c> _gather_118[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_119" )); |
29476 | KeyValuePair* elem; |
29477 | asdl_seq * seq; |
29478 | if ( |
29479 | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
29480 | && |
29481 | (seq = _loop0_119_rule(p)) // _loop0_119 |
29482 | ) |
29483 | { |
29484 | D(fprintf(stderr, "%*c+ _gather_118[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_119" )); |
29485 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
29486 | goto done; |
29487 | } |
29488 | p->mark = _mark; |
29489 | D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n" , p->level, ' ', |
29490 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "double_starred_kvpair _loop0_119" )); |
29491 | } |
29492 | _res = NULL; |
29493 | done: |
29494 | p->level--; |
29495 | return _res; |
29496 | } |
29497 | |
29498 | // _loop1_120: for_if_clause |
29499 | static asdl_seq * |
29500 | _loop1_120_rule(Parser *p) |
29501 | { |
29502 | if (p->level++ == MAXSTACK) { |
29503 | p->error_indicator = 1; |
29504 | PyErr_NoMemory(); |
29505 | } |
29506 | if (p->error_indicator) { |
29507 | p->level--; |
29508 | return NULL; |
29509 | } |
29510 | void *_res = NULL; |
29511 | int _mark = p->mark; |
29512 | int _start_mark = p->mark; |
29513 | void **_children = PyMem_Malloc(sizeof(void *)); |
29514 | if (!_children) { |
29515 | p->error_indicator = 1; |
29516 | PyErr_NoMemory(); |
29517 | p->level--; |
29518 | return NULL; |
29519 | } |
29520 | Py_ssize_t _children_capacity = 1; |
29521 | Py_ssize_t _n = 0; |
29522 | { // for_if_clause |
29523 | if (p->error_indicator) { |
29524 | p->level--; |
29525 | return NULL; |
29526 | } |
29527 | D(fprintf(stderr, "%*c> _loop1_120[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "for_if_clause" )); |
29528 | comprehension_ty for_if_clause_var; |
29529 | while ( |
29530 | (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause |
29531 | ) |
29532 | { |
29533 | _res = for_if_clause_var; |
29534 | if (_n == _children_capacity) { |
29535 | _children_capacity *= 2; |
29536 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29537 | if (!_new_children) { |
29538 | p->error_indicator = 1; |
29539 | PyErr_NoMemory(); |
29540 | p->level--; |
29541 | return NULL; |
29542 | } |
29543 | _children = _new_children; |
29544 | } |
29545 | _children[_n++] = _res; |
29546 | _mark = p->mark; |
29547 | } |
29548 | p->mark = _mark; |
29549 | D(fprintf(stderr, "%*c%s _loop1_120[%d-%d]: %s failed!\n" , p->level, ' ', |
29550 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "for_if_clause" )); |
29551 | } |
29552 | if (_n == 0 || p->error_indicator) { |
29553 | PyMem_Free(_children); |
29554 | p->level--; |
29555 | return NULL; |
29556 | } |
29557 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29558 | if (!_seq) { |
29559 | PyMem_Free(_children); |
29560 | p->error_indicator = 1; |
29561 | PyErr_NoMemory(); |
29562 | p->level--; |
29563 | return NULL; |
29564 | } |
29565 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29566 | PyMem_Free(_children); |
29567 | _PyPegen_insert_memo(p, _start_mark, _loop1_120_type, _seq); |
29568 | p->level--; |
29569 | return _seq; |
29570 | } |
29571 | |
29572 | // _loop0_121: ('if' disjunction) |
29573 | static asdl_seq * |
29574 | _loop0_121_rule(Parser *p) |
29575 | { |
29576 | if (p->level++ == MAXSTACK) { |
29577 | p->error_indicator = 1; |
29578 | PyErr_NoMemory(); |
29579 | } |
29580 | if (p->error_indicator) { |
29581 | p->level--; |
29582 | return NULL; |
29583 | } |
29584 | void *_res = NULL; |
29585 | int _mark = p->mark; |
29586 | int _start_mark = p->mark; |
29587 | void **_children = PyMem_Malloc(sizeof(void *)); |
29588 | if (!_children) { |
29589 | p->error_indicator = 1; |
29590 | PyErr_NoMemory(); |
29591 | p->level--; |
29592 | return NULL; |
29593 | } |
29594 | Py_ssize_t _children_capacity = 1; |
29595 | Py_ssize_t _n = 0; |
29596 | { // ('if' disjunction) |
29597 | if (p->error_indicator) { |
29598 | p->level--; |
29599 | return NULL; |
29600 | } |
29601 | D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('if' disjunction)" )); |
29602 | void *_tmp_189_var; |
29603 | while ( |
29604 | (_tmp_189_var = _tmp_189_rule(p)) // 'if' disjunction |
29605 | ) |
29606 | { |
29607 | _res = _tmp_189_var; |
29608 | if (_n == _children_capacity) { |
29609 | _children_capacity *= 2; |
29610 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29611 | if (!_new_children) { |
29612 | p->error_indicator = 1; |
29613 | PyErr_NoMemory(); |
29614 | p->level--; |
29615 | return NULL; |
29616 | } |
29617 | _children = _new_children; |
29618 | } |
29619 | _children[_n++] = _res; |
29620 | _mark = p->mark; |
29621 | } |
29622 | p->mark = _mark; |
29623 | D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n" , p->level, ' ', |
29624 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('if' disjunction)" )); |
29625 | } |
29626 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29627 | if (!_seq) { |
29628 | PyMem_Free(_children); |
29629 | p->error_indicator = 1; |
29630 | PyErr_NoMemory(); |
29631 | p->level--; |
29632 | return NULL; |
29633 | } |
29634 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29635 | PyMem_Free(_children); |
29636 | _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq); |
29637 | p->level--; |
29638 | return _seq; |
29639 | } |
29640 | |
29641 | // _loop0_122: ('if' disjunction) |
29642 | static asdl_seq * |
29643 | _loop0_122_rule(Parser *p) |
29644 | { |
29645 | if (p->level++ == MAXSTACK) { |
29646 | p->error_indicator = 1; |
29647 | PyErr_NoMemory(); |
29648 | } |
29649 | if (p->error_indicator) { |
29650 | p->level--; |
29651 | return NULL; |
29652 | } |
29653 | void *_res = NULL; |
29654 | int _mark = p->mark; |
29655 | int _start_mark = p->mark; |
29656 | void **_children = PyMem_Malloc(sizeof(void *)); |
29657 | if (!_children) { |
29658 | p->error_indicator = 1; |
29659 | PyErr_NoMemory(); |
29660 | p->level--; |
29661 | return NULL; |
29662 | } |
29663 | Py_ssize_t _children_capacity = 1; |
29664 | Py_ssize_t _n = 0; |
29665 | { // ('if' disjunction) |
29666 | if (p->error_indicator) { |
29667 | p->level--; |
29668 | return NULL; |
29669 | } |
29670 | D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "('if' disjunction)" )); |
29671 | void *_tmp_190_var; |
29672 | while ( |
29673 | (_tmp_190_var = _tmp_190_rule(p)) // 'if' disjunction |
29674 | ) |
29675 | { |
29676 | _res = _tmp_190_var; |
29677 | if (_n == _children_capacity) { |
29678 | _children_capacity *= 2; |
29679 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29680 | if (!_new_children) { |
29681 | p->error_indicator = 1; |
29682 | PyErr_NoMemory(); |
29683 | p->level--; |
29684 | return NULL; |
29685 | } |
29686 | _children = _new_children; |
29687 | } |
29688 | _children[_n++] = _res; |
29689 | _mark = p->mark; |
29690 | } |
29691 | p->mark = _mark; |
29692 | D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n" , p->level, ' ', |
29693 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "('if' disjunction)" )); |
29694 | } |
29695 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29696 | if (!_seq) { |
29697 | PyMem_Free(_children); |
29698 | p->error_indicator = 1; |
29699 | PyErr_NoMemory(); |
29700 | p->level--; |
29701 | return NULL; |
29702 | } |
29703 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29704 | PyMem_Free(_children); |
29705 | _PyPegen_insert_memo(p, _start_mark, _loop0_122_type, _seq); |
29706 | p->level--; |
29707 | return _seq; |
29708 | } |
29709 | |
29710 | // _loop0_124: ',' (starred_expression | (assignment_expression | expression !':=') !'=') |
29711 | static asdl_seq * |
29712 | _loop0_124_rule(Parser *p) |
29713 | { |
29714 | if (p->level++ == MAXSTACK) { |
29715 | p->error_indicator = 1; |
29716 | PyErr_NoMemory(); |
29717 | } |
29718 | if (p->error_indicator) { |
29719 | p->level--; |
29720 | return NULL; |
29721 | } |
29722 | void *_res = NULL; |
29723 | int _mark = p->mark; |
29724 | int _start_mark = p->mark; |
29725 | void **_children = PyMem_Malloc(sizeof(void *)); |
29726 | if (!_children) { |
29727 | p->error_indicator = 1; |
29728 | PyErr_NoMemory(); |
29729 | p->level--; |
29730 | return NULL; |
29731 | } |
29732 | Py_ssize_t _children_capacity = 1; |
29733 | Py_ssize_t _n = 0; |
29734 | { // ',' (starred_expression | (assignment_expression | expression !':=') !'=') |
29735 | if (p->error_indicator) { |
29736 | p->level--; |
29737 | return NULL; |
29738 | } |
29739 | D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')" )); |
29740 | Token * _literal; |
29741 | void *elem; |
29742 | while ( |
29743 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
29744 | && |
29745 | (elem = _tmp_191_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'=' |
29746 | ) |
29747 | { |
29748 | _res = elem; |
29749 | if (_res == NULL && PyErr_Occurred()) { |
29750 | p->error_indicator = 1; |
29751 | PyMem_Free(_children); |
29752 | p->level--; |
29753 | return NULL; |
29754 | } |
29755 | if (_n == _children_capacity) { |
29756 | _children_capacity *= 2; |
29757 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29758 | if (!_new_children) { |
29759 | p->error_indicator = 1; |
29760 | PyErr_NoMemory(); |
29761 | p->level--; |
29762 | return NULL; |
29763 | } |
29764 | _children = _new_children; |
29765 | } |
29766 | _children[_n++] = _res; |
29767 | _mark = p->mark; |
29768 | } |
29769 | p->mark = _mark; |
29770 | D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n" , p->level, ' ', |
29771 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')" )); |
29772 | } |
29773 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29774 | if (!_seq) { |
29775 | PyMem_Free(_children); |
29776 | p->error_indicator = 1; |
29777 | PyErr_NoMemory(); |
29778 | p->level--; |
29779 | return NULL; |
29780 | } |
29781 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29782 | PyMem_Free(_children); |
29783 | _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq); |
29784 | p->level--; |
29785 | return _seq; |
29786 | } |
29787 | |
29788 | // _gather_123: |
29789 | // | (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124 |
29790 | static asdl_seq * |
29791 | _gather_123_rule(Parser *p) |
29792 | { |
29793 | if (p->level++ == MAXSTACK) { |
29794 | p->error_indicator = 1; |
29795 | PyErr_NoMemory(); |
29796 | } |
29797 | if (p->error_indicator) { |
29798 | p->level--; |
29799 | return NULL; |
29800 | } |
29801 | asdl_seq * _res = NULL; |
29802 | int _mark = p->mark; |
29803 | { // (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124 |
29804 | if (p->error_indicator) { |
29805 | p->level--; |
29806 | return NULL; |
29807 | } |
29808 | D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124" )); |
29809 | void *elem; |
29810 | asdl_seq * seq; |
29811 | if ( |
29812 | (elem = _tmp_191_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'=' |
29813 | && |
29814 | (seq = _loop0_124_rule(p)) // _loop0_124 |
29815 | ) |
29816 | { |
29817 | D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124" )); |
29818 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
29819 | goto done; |
29820 | } |
29821 | p->mark = _mark; |
29822 | D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n" , p->level, ' ', |
29823 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124" )); |
29824 | } |
29825 | _res = NULL; |
29826 | done: |
29827 | p->level--; |
29828 | return _res; |
29829 | } |
29830 | |
29831 | // _tmp_125: ',' kwargs |
29832 | static void * |
29833 | _tmp_125_rule(Parser *p) |
29834 | { |
29835 | if (p->level++ == MAXSTACK) { |
29836 | p->error_indicator = 1; |
29837 | PyErr_NoMemory(); |
29838 | } |
29839 | if (p->error_indicator) { |
29840 | p->level--; |
29841 | return NULL; |
29842 | } |
29843 | void * _res = NULL; |
29844 | int _mark = p->mark; |
29845 | { // ',' kwargs |
29846 | if (p->error_indicator) { |
29847 | p->level--; |
29848 | return NULL; |
29849 | } |
29850 | D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' kwargs" )); |
29851 | Token * _literal; |
29852 | asdl_seq* k; |
29853 | if ( |
29854 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
29855 | && |
29856 | (k = kwargs_rule(p)) // kwargs |
29857 | ) |
29858 | { |
29859 | D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "',' kwargs" )); |
29860 | _res = k; |
29861 | if (_res == NULL && PyErr_Occurred()) { |
29862 | p->error_indicator = 1; |
29863 | p->level--; |
29864 | return NULL; |
29865 | } |
29866 | goto done; |
29867 | } |
29868 | p->mark = _mark; |
29869 | D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n" , p->level, ' ', |
29870 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' kwargs" )); |
29871 | } |
29872 | _res = NULL; |
29873 | done: |
29874 | p->level--; |
29875 | return _res; |
29876 | } |
29877 | |
29878 | // _loop0_127: ',' kwarg_or_starred |
29879 | static asdl_seq * |
29880 | _loop0_127_rule(Parser *p) |
29881 | { |
29882 | if (p->level++ == MAXSTACK) { |
29883 | p->error_indicator = 1; |
29884 | PyErr_NoMemory(); |
29885 | } |
29886 | if (p->error_indicator) { |
29887 | p->level--; |
29888 | return NULL; |
29889 | } |
29890 | void *_res = NULL; |
29891 | int _mark = p->mark; |
29892 | int _start_mark = p->mark; |
29893 | void **_children = PyMem_Malloc(sizeof(void *)); |
29894 | if (!_children) { |
29895 | p->error_indicator = 1; |
29896 | PyErr_NoMemory(); |
29897 | p->level--; |
29898 | return NULL; |
29899 | } |
29900 | Py_ssize_t _children_capacity = 1; |
29901 | Py_ssize_t _n = 0; |
29902 | { // ',' kwarg_or_starred |
29903 | if (p->error_indicator) { |
29904 | p->level--; |
29905 | return NULL; |
29906 | } |
29907 | D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' kwarg_or_starred" )); |
29908 | Token * _literal; |
29909 | KeywordOrStarred* elem; |
29910 | while ( |
29911 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
29912 | && |
29913 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
29914 | ) |
29915 | { |
29916 | _res = elem; |
29917 | if (_res == NULL && PyErr_Occurred()) { |
29918 | p->error_indicator = 1; |
29919 | PyMem_Free(_children); |
29920 | p->level--; |
29921 | return NULL; |
29922 | } |
29923 | if (_n == _children_capacity) { |
29924 | _children_capacity *= 2; |
29925 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29926 | if (!_new_children) { |
29927 | p->error_indicator = 1; |
29928 | PyErr_NoMemory(); |
29929 | p->level--; |
29930 | return NULL; |
29931 | } |
29932 | _children = _new_children; |
29933 | } |
29934 | _children[_n++] = _res; |
29935 | _mark = p->mark; |
29936 | } |
29937 | p->mark = _mark; |
29938 | D(fprintf(stderr, "%*c%s _loop0_127[%d-%d]: %s failed!\n" , p->level, ' ', |
29939 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' kwarg_or_starred" )); |
29940 | } |
29941 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29942 | if (!_seq) { |
29943 | PyMem_Free(_children); |
29944 | p->error_indicator = 1; |
29945 | PyErr_NoMemory(); |
29946 | p->level--; |
29947 | return NULL; |
29948 | } |
29949 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29950 | PyMem_Free(_children); |
29951 | _PyPegen_insert_memo(p, _start_mark, _loop0_127_type, _seq); |
29952 | p->level--; |
29953 | return _seq; |
29954 | } |
29955 | |
29956 | // _gather_126: kwarg_or_starred _loop0_127 |
29957 | static asdl_seq * |
29958 | _gather_126_rule(Parser *p) |
29959 | { |
29960 | if (p->level++ == MAXSTACK) { |
29961 | p->error_indicator = 1; |
29962 | PyErr_NoMemory(); |
29963 | } |
29964 | if (p->error_indicator) { |
29965 | p->level--; |
29966 | return NULL; |
29967 | } |
29968 | asdl_seq * _res = NULL; |
29969 | int _mark = p->mark; |
29970 | { // kwarg_or_starred _loop0_127 |
29971 | if (p->error_indicator) { |
29972 | p->level--; |
29973 | return NULL; |
29974 | } |
29975 | D(fprintf(stderr, "%*c> _gather_126[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_127" )); |
29976 | KeywordOrStarred* elem; |
29977 | asdl_seq * seq; |
29978 | if ( |
29979 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
29980 | && |
29981 | (seq = _loop0_127_rule(p)) // _loop0_127 |
29982 | ) |
29983 | { |
29984 | D(fprintf(stderr, "%*c+ _gather_126[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_127" )); |
29985 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
29986 | goto done; |
29987 | } |
29988 | p->mark = _mark; |
29989 | D(fprintf(stderr, "%*c%s _gather_126[%d-%d]: %s failed!\n" , p->level, ' ', |
29990 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "kwarg_or_starred _loop0_127" )); |
29991 | } |
29992 | _res = NULL; |
29993 | done: |
29994 | p->level--; |
29995 | return _res; |
29996 | } |
29997 | |
29998 | // _loop0_129: ',' kwarg_or_double_starred |
29999 | static asdl_seq * |
30000 | _loop0_129_rule(Parser *p) |
30001 | { |
30002 | if (p->level++ == MAXSTACK) { |
30003 | p->error_indicator = 1; |
30004 | PyErr_NoMemory(); |
30005 | } |
30006 | if (p->error_indicator) { |
30007 | p->level--; |
30008 | return NULL; |
30009 | } |
30010 | void *_res = NULL; |
30011 | int _mark = p->mark; |
30012 | int _start_mark = p->mark; |
30013 | void **_children = PyMem_Malloc(sizeof(void *)); |
30014 | if (!_children) { |
30015 | p->error_indicator = 1; |
30016 | PyErr_NoMemory(); |
30017 | p->level--; |
30018 | return NULL; |
30019 | } |
30020 | Py_ssize_t _children_capacity = 1; |
30021 | Py_ssize_t _n = 0; |
30022 | { // ',' kwarg_or_double_starred |
30023 | if (p->error_indicator) { |
30024 | p->level--; |
30025 | return NULL; |
30026 | } |
30027 | D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred" )); |
30028 | Token * _literal; |
30029 | KeywordOrStarred* elem; |
30030 | while ( |
30031 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
30032 | && |
30033 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
30034 | ) |
30035 | { |
30036 | _res = elem; |
30037 | if (_res == NULL && PyErr_Occurred()) { |
30038 | p->error_indicator = 1; |
30039 | PyMem_Free(_children); |
30040 | p->level--; |
30041 | return NULL; |
30042 | } |
30043 | if (_n == _children_capacity) { |
30044 | _children_capacity *= 2; |
30045 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30046 | if (!_new_children) { |
30047 | p->error_indicator = 1; |
30048 | PyErr_NoMemory(); |
30049 | p->level--; |
30050 | return NULL; |
30051 | } |
30052 | _children = _new_children; |
30053 | } |
30054 | _children[_n++] = _res; |
30055 | _mark = p->mark; |
30056 | } |
30057 | p->mark = _mark; |
30058 | D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n" , p->level, ' ', |
30059 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' kwarg_or_double_starred" )); |
30060 | } |
30061 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30062 | if (!_seq) { |
30063 | PyMem_Free(_children); |
30064 | p->error_indicator = 1; |
30065 | PyErr_NoMemory(); |
30066 | p->level--; |
30067 | return NULL; |
30068 | } |
30069 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30070 | PyMem_Free(_children); |
30071 | _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq); |
30072 | p->level--; |
30073 | return _seq; |
30074 | } |
30075 | |
30076 | // _gather_128: kwarg_or_double_starred _loop0_129 |
30077 | static asdl_seq * |
30078 | _gather_128_rule(Parser *p) |
30079 | { |
30080 | if (p->level++ == MAXSTACK) { |
30081 | p->error_indicator = 1; |
30082 | PyErr_NoMemory(); |
30083 | } |
30084 | if (p->error_indicator) { |
30085 | p->level--; |
30086 | return NULL; |
30087 | } |
30088 | asdl_seq * _res = NULL; |
30089 | int _mark = p->mark; |
30090 | { // kwarg_or_double_starred _loop0_129 |
30091 | if (p->error_indicator) { |
30092 | p->level--; |
30093 | return NULL; |
30094 | } |
30095 | D(fprintf(stderr, "%*c> _gather_128[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_129" )); |
30096 | KeywordOrStarred* elem; |
30097 | asdl_seq * seq; |
30098 | if ( |
30099 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
30100 | && |
30101 | (seq = _loop0_129_rule(p)) // _loop0_129 |
30102 | ) |
30103 | { |
30104 | D(fprintf(stderr, "%*c+ _gather_128[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_129" )); |
30105 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
30106 | goto done; |
30107 | } |
30108 | p->mark = _mark; |
30109 | D(fprintf(stderr, "%*c%s _gather_128[%d-%d]: %s failed!\n" , p->level, ' ', |
30110 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "kwarg_or_double_starred _loop0_129" )); |
30111 | } |
30112 | _res = NULL; |
30113 | done: |
30114 | p->level--; |
30115 | return _res; |
30116 | } |
30117 | |
30118 | // _loop0_131: ',' kwarg_or_starred |
30119 | static asdl_seq * |
30120 | _loop0_131_rule(Parser *p) |
30121 | { |
30122 | if (p->level++ == MAXSTACK) { |
30123 | p->error_indicator = 1; |
30124 | PyErr_NoMemory(); |
30125 | } |
30126 | if (p->error_indicator) { |
30127 | p->level--; |
30128 | return NULL; |
30129 | } |
30130 | void *_res = NULL; |
30131 | int _mark = p->mark; |
30132 | int _start_mark = p->mark; |
30133 | void **_children = PyMem_Malloc(sizeof(void *)); |
30134 | if (!_children) { |
30135 | p->error_indicator = 1; |
30136 | PyErr_NoMemory(); |
30137 | p->level--; |
30138 | return NULL; |
30139 | } |
30140 | Py_ssize_t _children_capacity = 1; |
30141 | Py_ssize_t _n = 0; |
30142 | { // ',' kwarg_or_starred |
30143 | if (p->error_indicator) { |
30144 | p->level--; |
30145 | return NULL; |
30146 | } |
30147 | D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' kwarg_or_starred" )); |
30148 | Token * _literal; |
30149 | KeywordOrStarred* elem; |
30150 | while ( |
30151 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
30152 | && |
30153 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
30154 | ) |
30155 | { |
30156 | _res = elem; |
30157 | if (_res == NULL && PyErr_Occurred()) { |
30158 | p->error_indicator = 1; |
30159 | PyMem_Free(_children); |
30160 | p->level--; |
30161 | return NULL; |
30162 | } |
30163 | if (_n == _children_capacity) { |
30164 | _children_capacity *= 2; |
30165 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30166 | if (!_new_children) { |
30167 | p->error_indicator = 1; |
30168 | PyErr_NoMemory(); |
30169 | p->level--; |
30170 | return NULL; |
30171 | } |
30172 | _children = _new_children; |
30173 | } |
30174 | _children[_n++] = _res; |
30175 | _mark = p->mark; |
30176 | } |
30177 | p->mark = _mark; |
30178 | D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n" , p->level, ' ', |
30179 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' kwarg_or_starred" )); |
30180 | } |
30181 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30182 | if (!_seq) { |
30183 | PyMem_Free(_children); |
30184 | p->error_indicator = 1; |
30185 | PyErr_NoMemory(); |
30186 | p->level--; |
30187 | return NULL; |
30188 | } |
30189 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30190 | PyMem_Free(_children); |
30191 | _PyPegen_insert_memo(p, _start_mark, _loop0_131_type, _seq); |
30192 | p->level--; |
30193 | return _seq; |
30194 | } |
30195 | |
30196 | // _gather_130: kwarg_or_starred _loop0_131 |
30197 | static asdl_seq * |
30198 | _gather_130_rule(Parser *p) |
30199 | { |
30200 | if (p->level++ == MAXSTACK) { |
30201 | p->error_indicator = 1; |
30202 | PyErr_NoMemory(); |
30203 | } |
30204 | if (p->error_indicator) { |
30205 | p->level--; |
30206 | return NULL; |
30207 | } |
30208 | asdl_seq * _res = NULL; |
30209 | int _mark = p->mark; |
30210 | { // kwarg_or_starred _loop0_131 |
30211 | if (p->error_indicator) { |
30212 | p->level--; |
30213 | return NULL; |
30214 | } |
30215 | D(fprintf(stderr, "%*c> _gather_130[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_131" )); |
30216 | KeywordOrStarred* elem; |
30217 | asdl_seq * seq; |
30218 | if ( |
30219 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
30220 | && |
30221 | (seq = _loop0_131_rule(p)) // _loop0_131 |
30222 | ) |
30223 | { |
30224 | D(fprintf(stderr, "%*c+ _gather_130[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_131" )); |
30225 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
30226 | goto done; |
30227 | } |
30228 | p->mark = _mark; |
30229 | D(fprintf(stderr, "%*c%s _gather_130[%d-%d]: %s failed!\n" , p->level, ' ', |
30230 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "kwarg_or_starred _loop0_131" )); |
30231 | } |
30232 | _res = NULL; |
30233 | done: |
30234 | p->level--; |
30235 | return _res; |
30236 | } |
30237 | |
30238 | // _loop0_133: ',' kwarg_or_double_starred |
30239 | static asdl_seq * |
30240 | _loop0_133_rule(Parser *p) |
30241 | { |
30242 | if (p->level++ == MAXSTACK) { |
30243 | p->error_indicator = 1; |
30244 | PyErr_NoMemory(); |
30245 | } |
30246 | if (p->error_indicator) { |
30247 | p->level--; |
30248 | return NULL; |
30249 | } |
30250 | void *_res = NULL; |
30251 | int _mark = p->mark; |
30252 | int _start_mark = p->mark; |
30253 | void **_children = PyMem_Malloc(sizeof(void *)); |
30254 | if (!_children) { |
30255 | p->error_indicator = 1; |
30256 | PyErr_NoMemory(); |
30257 | p->level--; |
30258 | return NULL; |
30259 | } |
30260 | Py_ssize_t _children_capacity = 1; |
30261 | Py_ssize_t _n = 0; |
30262 | { // ',' kwarg_or_double_starred |
30263 | if (p->error_indicator) { |
30264 | p->level--; |
30265 | return NULL; |
30266 | } |
30267 | D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred" )); |
30268 | Token * _literal; |
30269 | KeywordOrStarred* elem; |
30270 | while ( |
30271 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
30272 | && |
30273 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
30274 | ) |
30275 | { |
30276 | _res = elem; |
30277 | if (_res == NULL && PyErr_Occurred()) { |
30278 | p->error_indicator = 1; |
30279 | PyMem_Free(_children); |
30280 | p->level--; |
30281 | return NULL; |
30282 | } |
30283 | if (_n == _children_capacity) { |
30284 | _children_capacity *= 2; |
30285 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30286 | if (!_new_children) { |
30287 | p->error_indicator = 1; |
30288 | PyErr_NoMemory(); |
30289 | p->level--; |
30290 | return NULL; |
30291 | } |
30292 | _children = _new_children; |
30293 | } |
30294 | _children[_n++] = _res; |
30295 | _mark = p->mark; |
30296 | } |
30297 | p->mark = _mark; |
30298 | D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n" , p->level, ' ', |
30299 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' kwarg_or_double_starred" )); |
30300 | } |
30301 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30302 | if (!_seq) { |
30303 | PyMem_Free(_children); |
30304 | p->error_indicator = 1; |
30305 | PyErr_NoMemory(); |
30306 | p->level--; |
30307 | return NULL; |
30308 | } |
30309 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30310 | PyMem_Free(_children); |
30311 | _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); |
30312 | p->level--; |
30313 | return _seq; |
30314 | } |
30315 | |
30316 | // _gather_132: kwarg_or_double_starred _loop0_133 |
30317 | static asdl_seq * |
30318 | _gather_132_rule(Parser *p) |
30319 | { |
30320 | if (p->level++ == MAXSTACK) { |
30321 | p->error_indicator = 1; |
30322 | PyErr_NoMemory(); |
30323 | } |
30324 | if (p->error_indicator) { |
30325 | p->level--; |
30326 | return NULL; |
30327 | } |
30328 | asdl_seq * _res = NULL; |
30329 | int _mark = p->mark; |
30330 | { // kwarg_or_double_starred _loop0_133 |
30331 | if (p->error_indicator) { |
30332 | p->level--; |
30333 | return NULL; |
30334 | } |
30335 | D(fprintf(stderr, "%*c> _gather_132[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_133" )); |
30336 | KeywordOrStarred* elem; |
30337 | asdl_seq * seq; |
30338 | if ( |
30339 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
30340 | && |
30341 | (seq = _loop0_133_rule(p)) // _loop0_133 |
30342 | ) |
30343 | { |
30344 | D(fprintf(stderr, "%*c+ _gather_132[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_133" )); |
30345 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
30346 | goto done; |
30347 | } |
30348 | p->mark = _mark; |
30349 | D(fprintf(stderr, "%*c%s _gather_132[%d-%d]: %s failed!\n" , p->level, ' ', |
30350 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "kwarg_or_double_starred _loop0_133" )); |
30351 | } |
30352 | _res = NULL; |
30353 | done: |
30354 | p->level--; |
30355 | return _res; |
30356 | } |
30357 | |
30358 | // _loop0_134: (',' star_target) |
30359 | static asdl_seq * |
30360 | _loop0_134_rule(Parser *p) |
30361 | { |
30362 | if (p->level++ == MAXSTACK) { |
30363 | p->error_indicator = 1; |
30364 | PyErr_NoMemory(); |
30365 | } |
30366 | if (p->error_indicator) { |
30367 | p->level--; |
30368 | return NULL; |
30369 | } |
30370 | void *_res = NULL; |
30371 | int _mark = p->mark; |
30372 | int _start_mark = p->mark; |
30373 | void **_children = PyMem_Malloc(sizeof(void *)); |
30374 | if (!_children) { |
30375 | p->error_indicator = 1; |
30376 | PyErr_NoMemory(); |
30377 | p->level--; |
30378 | return NULL; |
30379 | } |
30380 | Py_ssize_t _children_capacity = 1; |
30381 | Py_ssize_t _n = 0; |
30382 | { // (',' star_target) |
30383 | if (p->error_indicator) { |
30384 | p->level--; |
30385 | return NULL; |
30386 | } |
30387 | D(fprintf(stderr, "%*c> _loop0_134[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(',' star_target)" )); |
30388 | void *_tmp_192_var; |
30389 | while ( |
30390 | (_tmp_192_var = _tmp_192_rule(p)) // ',' star_target |
30391 | ) |
30392 | { |
30393 | _res = _tmp_192_var; |
30394 | if (_n == _children_capacity) { |
30395 | _children_capacity *= 2; |
30396 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30397 | if (!_new_children) { |
30398 | p->error_indicator = 1; |
30399 | PyErr_NoMemory(); |
30400 | p->level--; |
30401 | return NULL; |
30402 | } |
30403 | _children = _new_children; |
30404 | } |
30405 | _children[_n++] = _res; |
30406 | _mark = p->mark; |
30407 | } |
30408 | p->mark = _mark; |
30409 | D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n" , p->level, ' ', |
30410 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(',' star_target)" )); |
30411 | } |
30412 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30413 | if (!_seq) { |
30414 | PyMem_Free(_children); |
30415 | p->error_indicator = 1; |
30416 | PyErr_NoMemory(); |
30417 | p->level--; |
30418 | return NULL; |
30419 | } |
30420 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30421 | PyMem_Free(_children); |
30422 | _PyPegen_insert_memo(p, _start_mark, _loop0_134_type, _seq); |
30423 | p->level--; |
30424 | return _seq; |
30425 | } |
30426 | |
30427 | // _loop0_136: ',' star_target |
30428 | static asdl_seq * |
30429 | _loop0_136_rule(Parser *p) |
30430 | { |
30431 | if (p->level++ == MAXSTACK) { |
30432 | p->error_indicator = 1; |
30433 | PyErr_NoMemory(); |
30434 | } |
30435 | if (p->error_indicator) { |
30436 | p->level--; |
30437 | return NULL; |
30438 | } |
30439 | void *_res = NULL; |
30440 | int _mark = p->mark; |
30441 | int _start_mark = p->mark; |
30442 | void **_children = PyMem_Malloc(sizeof(void *)); |
30443 | if (!_children) { |
30444 | p->error_indicator = 1; |
30445 | PyErr_NoMemory(); |
30446 | p->level--; |
30447 | return NULL; |
30448 | } |
30449 | Py_ssize_t _children_capacity = 1; |
30450 | Py_ssize_t _n = 0; |
30451 | { // ',' star_target |
30452 | if (p->error_indicator) { |
30453 | p->level--; |
30454 | return NULL; |
30455 | } |
30456 | D(fprintf(stderr, "%*c> _loop0_136[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' star_target" )); |
30457 | Token * _literal; |
30458 | expr_ty elem; |
30459 | while ( |
30460 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
30461 | && |
30462 | (elem = star_target_rule(p)) // star_target |
30463 | ) |
30464 | { |
30465 | _res = elem; |
30466 | if (_res == NULL && PyErr_Occurred()) { |
30467 | p->error_indicator = 1; |
30468 | PyMem_Free(_children); |
30469 | p->level--; |
30470 | return NULL; |
30471 | } |
30472 | if (_n == _children_capacity) { |
30473 | _children_capacity *= 2; |
30474 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30475 | if (!_new_children) { |
30476 | p->error_indicator = 1; |
30477 | PyErr_NoMemory(); |
30478 | p->level--; |
30479 | return NULL; |
30480 | } |
30481 | _children = _new_children; |
30482 | } |
30483 | _children[_n++] = _res; |
30484 | _mark = p->mark; |
30485 | } |
30486 | p->mark = _mark; |
30487 | D(fprintf(stderr, "%*c%s _loop0_136[%d-%d]: %s failed!\n" , p->level, ' ', |
30488 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' star_target" )); |
30489 | } |
30490 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30491 | if (!_seq) { |
30492 | PyMem_Free(_children); |
30493 | p->error_indicator = 1; |
30494 | PyErr_NoMemory(); |
30495 | p->level--; |
30496 | return NULL; |
30497 | } |
30498 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30499 | PyMem_Free(_children); |
30500 | _PyPegen_insert_memo(p, _start_mark, _loop0_136_type, _seq); |
30501 | p->level--; |
30502 | return _seq; |
30503 | } |
30504 | |
30505 | // _gather_135: star_target _loop0_136 |
30506 | static asdl_seq * |
30507 | _gather_135_rule(Parser *p) |
30508 | { |
30509 | if (p->level++ == MAXSTACK) { |
30510 | p->error_indicator = 1; |
30511 | PyErr_NoMemory(); |
30512 | } |
30513 | if (p->error_indicator) { |
30514 | p->level--; |
30515 | return NULL; |
30516 | } |
30517 | asdl_seq * _res = NULL; |
30518 | int _mark = p->mark; |
30519 | { // star_target _loop0_136 |
30520 | if (p->error_indicator) { |
30521 | p->level--; |
30522 | return NULL; |
30523 | } |
30524 | D(fprintf(stderr, "%*c> _gather_135[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_target _loop0_136" )); |
30525 | expr_ty elem; |
30526 | asdl_seq * seq; |
30527 | if ( |
30528 | (elem = star_target_rule(p)) // star_target |
30529 | && |
30530 | (seq = _loop0_136_rule(p)) // _loop0_136 |
30531 | ) |
30532 | { |
30533 | D(fprintf(stderr, "%*c+ _gather_135[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_target _loop0_136" )); |
30534 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
30535 | goto done; |
30536 | } |
30537 | p->mark = _mark; |
30538 | D(fprintf(stderr, "%*c%s _gather_135[%d-%d]: %s failed!\n" , p->level, ' ', |
30539 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_target _loop0_136" )); |
30540 | } |
30541 | _res = NULL; |
30542 | done: |
30543 | p->level--; |
30544 | return _res; |
30545 | } |
30546 | |
30547 | // _loop1_137: (',' star_target) |
30548 | static asdl_seq * |
30549 | _loop1_137_rule(Parser *p) |
30550 | { |
30551 | if (p->level++ == MAXSTACK) { |
30552 | p->error_indicator = 1; |
30553 | PyErr_NoMemory(); |
30554 | } |
30555 | if (p->error_indicator) { |
30556 | p->level--; |
30557 | return NULL; |
30558 | } |
30559 | void *_res = NULL; |
30560 | int _mark = p->mark; |
30561 | int _start_mark = p->mark; |
30562 | void **_children = PyMem_Malloc(sizeof(void *)); |
30563 | if (!_children) { |
30564 | p->error_indicator = 1; |
30565 | PyErr_NoMemory(); |
30566 | p->level--; |
30567 | return NULL; |
30568 | } |
30569 | Py_ssize_t _children_capacity = 1; |
30570 | Py_ssize_t _n = 0; |
30571 | { // (',' star_target) |
30572 | if (p->error_indicator) { |
30573 | p->level--; |
30574 | return NULL; |
30575 | } |
30576 | D(fprintf(stderr, "%*c> _loop1_137[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(',' star_target)" )); |
30577 | void *_tmp_193_var; |
30578 | while ( |
30579 | (_tmp_193_var = _tmp_193_rule(p)) // ',' star_target |
30580 | ) |
30581 | { |
30582 | _res = _tmp_193_var; |
30583 | if (_n == _children_capacity) { |
30584 | _children_capacity *= 2; |
30585 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30586 | if (!_new_children) { |
30587 | p->error_indicator = 1; |
30588 | PyErr_NoMemory(); |
30589 | p->level--; |
30590 | return NULL; |
30591 | } |
30592 | _children = _new_children; |
30593 | } |
30594 | _children[_n++] = _res; |
30595 | _mark = p->mark; |
30596 | } |
30597 | p->mark = _mark; |
30598 | D(fprintf(stderr, "%*c%s _loop1_137[%d-%d]: %s failed!\n" , p->level, ' ', |
30599 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(',' star_target)" )); |
30600 | } |
30601 | if (_n == 0 || p->error_indicator) { |
30602 | PyMem_Free(_children); |
30603 | p->level--; |
30604 | return NULL; |
30605 | } |
30606 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30607 | if (!_seq) { |
30608 | PyMem_Free(_children); |
30609 | p->error_indicator = 1; |
30610 | PyErr_NoMemory(); |
30611 | p->level--; |
30612 | return NULL; |
30613 | } |
30614 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30615 | PyMem_Free(_children); |
30616 | _PyPegen_insert_memo(p, _start_mark, _loop1_137_type, _seq); |
30617 | p->level--; |
30618 | return _seq; |
30619 | } |
30620 | |
30621 | // _tmp_138: !'*' star_target |
30622 | static void * |
30623 | _tmp_138_rule(Parser *p) |
30624 | { |
30625 | if (p->level++ == MAXSTACK) { |
30626 | p->error_indicator = 1; |
30627 | PyErr_NoMemory(); |
30628 | } |
30629 | if (p->error_indicator) { |
30630 | p->level--; |
30631 | return NULL; |
30632 | } |
30633 | void * _res = NULL; |
30634 | int _mark = p->mark; |
30635 | { // !'*' star_target |
30636 | if (p->error_indicator) { |
30637 | p->level--; |
30638 | return NULL; |
30639 | } |
30640 | D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "!'*' star_target" )); |
30641 | expr_ty star_target_var; |
30642 | if ( |
30643 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' |
30644 | && |
30645 | (star_target_var = star_target_rule(p)) // star_target |
30646 | ) |
30647 | { |
30648 | D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "!'*' star_target" )); |
30649 | _res = star_target_var; |
30650 | goto done; |
30651 | } |
30652 | p->mark = _mark; |
30653 | D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n" , p->level, ' ', |
30654 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "!'*' star_target" )); |
30655 | } |
30656 | _res = NULL; |
30657 | done: |
30658 | p->level--; |
30659 | return _res; |
30660 | } |
30661 | |
30662 | // _loop0_140: ',' del_target |
30663 | static asdl_seq * |
30664 | _loop0_140_rule(Parser *p) |
30665 | { |
30666 | if (p->level++ == MAXSTACK) { |
30667 | p->error_indicator = 1; |
30668 | PyErr_NoMemory(); |
30669 | } |
30670 | if (p->error_indicator) { |
30671 | p->level--; |
30672 | return NULL; |
30673 | } |
30674 | void *_res = NULL; |
30675 | int _mark = p->mark; |
30676 | int _start_mark = p->mark; |
30677 | void **_children = PyMem_Malloc(sizeof(void *)); |
30678 | if (!_children) { |
30679 | p->error_indicator = 1; |
30680 | PyErr_NoMemory(); |
30681 | p->level--; |
30682 | return NULL; |
30683 | } |
30684 | Py_ssize_t _children_capacity = 1; |
30685 | Py_ssize_t _n = 0; |
30686 | { // ',' del_target |
30687 | if (p->error_indicator) { |
30688 | p->level--; |
30689 | return NULL; |
30690 | } |
30691 | D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' del_target" )); |
30692 | Token * _literal; |
30693 | expr_ty elem; |
30694 | while ( |
30695 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
30696 | && |
30697 | (elem = del_target_rule(p)) // del_target |
30698 | ) |
30699 | { |
30700 | _res = elem; |
30701 | if (_res == NULL && PyErr_Occurred()) { |
30702 | p->error_indicator = 1; |
30703 | PyMem_Free(_children); |
30704 | p->level--; |
30705 | return NULL; |
30706 | } |
30707 | if (_n == _children_capacity) { |
30708 | _children_capacity *= 2; |
30709 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30710 | if (!_new_children) { |
30711 | p->error_indicator = 1; |
30712 | PyErr_NoMemory(); |
30713 | p->level--; |
30714 | return NULL; |
30715 | } |
30716 | _children = _new_children; |
30717 | } |
30718 | _children[_n++] = _res; |
30719 | _mark = p->mark; |
30720 | } |
30721 | p->mark = _mark; |
30722 | D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n" , p->level, ' ', |
30723 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' del_target" )); |
30724 | } |
30725 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30726 | if (!_seq) { |
30727 | PyMem_Free(_children); |
30728 | p->error_indicator = 1; |
30729 | PyErr_NoMemory(); |
30730 | p->level--; |
30731 | return NULL; |
30732 | } |
30733 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30734 | PyMem_Free(_children); |
30735 | _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq); |
30736 | p->level--; |
30737 | return _seq; |
30738 | } |
30739 | |
30740 | // _gather_139: del_target _loop0_140 |
30741 | static asdl_seq * |
30742 | _gather_139_rule(Parser *p) |
30743 | { |
30744 | if (p->level++ == MAXSTACK) { |
30745 | p->error_indicator = 1; |
30746 | PyErr_NoMemory(); |
30747 | } |
30748 | if (p->error_indicator) { |
30749 | p->level--; |
30750 | return NULL; |
30751 | } |
30752 | asdl_seq * _res = NULL; |
30753 | int _mark = p->mark; |
30754 | { // del_target _loop0_140 |
30755 | if (p->error_indicator) { |
30756 | p->level--; |
30757 | return NULL; |
30758 | } |
30759 | D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "del_target _loop0_140" )); |
30760 | expr_ty elem; |
30761 | asdl_seq * seq; |
30762 | if ( |
30763 | (elem = del_target_rule(p)) // del_target |
30764 | && |
30765 | (seq = _loop0_140_rule(p)) // _loop0_140 |
30766 | ) |
30767 | { |
30768 | D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "del_target _loop0_140" )); |
30769 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
30770 | goto done; |
30771 | } |
30772 | p->mark = _mark; |
30773 | D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n" , p->level, ' ', |
30774 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "del_target _loop0_140" )); |
30775 | } |
30776 | _res = NULL; |
30777 | done: |
30778 | p->level--; |
30779 | return _res; |
30780 | } |
30781 | |
30782 | // _tmp_141: args | expression for_if_clauses |
30783 | static void * |
30784 | _tmp_141_rule(Parser *p) |
30785 | { |
30786 | if (p->level++ == MAXSTACK) { |
30787 | p->error_indicator = 1; |
30788 | PyErr_NoMemory(); |
30789 | } |
30790 | if (p->error_indicator) { |
30791 | p->level--; |
30792 | return NULL; |
30793 | } |
30794 | void * _res = NULL; |
30795 | int _mark = p->mark; |
30796 | { // args |
30797 | if (p->error_indicator) { |
30798 | p->level--; |
30799 | return NULL; |
30800 | } |
30801 | D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "args" )); |
30802 | expr_ty args_var; |
30803 | if ( |
30804 | (args_var = args_rule(p)) // args |
30805 | ) |
30806 | { |
30807 | D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "args" )); |
30808 | _res = args_var; |
30809 | goto done; |
30810 | } |
30811 | p->mark = _mark; |
30812 | D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n" , p->level, ' ', |
30813 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "args" )); |
30814 | } |
30815 | { // expression for_if_clauses |
30816 | if (p->error_indicator) { |
30817 | p->level--; |
30818 | return NULL; |
30819 | } |
30820 | D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression for_if_clauses" )); |
30821 | expr_ty expression_var; |
30822 | asdl_comprehension_seq* for_if_clauses_var; |
30823 | if ( |
30824 | (expression_var = expression_rule(p)) // expression |
30825 | && |
30826 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
30827 | ) |
30828 | { |
30829 | D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression for_if_clauses" )); |
30830 | _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); |
30831 | goto done; |
30832 | } |
30833 | p->mark = _mark; |
30834 | D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n" , p->level, ' ', |
30835 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression for_if_clauses" )); |
30836 | } |
30837 | _res = NULL; |
30838 | done: |
30839 | p->level--; |
30840 | return _res; |
30841 | } |
30842 | |
30843 | // _tmp_142: 'True' | 'False' | 'None' |
30844 | static void * |
30845 | _tmp_142_rule(Parser *p) |
30846 | { |
30847 | if (p->level++ == MAXSTACK) { |
30848 | p->error_indicator = 1; |
30849 | PyErr_NoMemory(); |
30850 | } |
30851 | if (p->error_indicator) { |
30852 | p->level--; |
30853 | return NULL; |
30854 | } |
30855 | void * _res = NULL; |
30856 | int _mark = p->mark; |
30857 | { // 'True' |
30858 | if (p->error_indicator) { |
30859 | p->level--; |
30860 | return NULL; |
30861 | } |
30862 | D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'True'" )); |
30863 | Token * _keyword; |
30864 | if ( |
30865 | (_keyword = _PyPegen_expect_token(p, 524)) // token='True' |
30866 | ) |
30867 | { |
30868 | D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'True'" )); |
30869 | _res = _keyword; |
30870 | goto done; |
30871 | } |
30872 | p->mark = _mark; |
30873 | D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n" , p->level, ' ', |
30874 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'True'" )); |
30875 | } |
30876 | { // 'False' |
30877 | if (p->error_indicator) { |
30878 | p->level--; |
30879 | return NULL; |
30880 | } |
30881 | D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'False'" )); |
30882 | Token * _keyword; |
30883 | if ( |
30884 | (_keyword = _PyPegen_expect_token(p, 525)) // token='False' |
30885 | ) |
30886 | { |
30887 | D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'False'" )); |
30888 | _res = _keyword; |
30889 | goto done; |
30890 | } |
30891 | p->mark = _mark; |
30892 | D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n" , p->level, ' ', |
30893 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'False'" )); |
30894 | } |
30895 | { // 'None' |
30896 | if (p->error_indicator) { |
30897 | p->level--; |
30898 | return NULL; |
30899 | } |
30900 | D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'None'" )); |
30901 | Token * _keyword; |
30902 | if ( |
30903 | (_keyword = _PyPegen_expect_token(p, 523)) // token='None' |
30904 | ) |
30905 | { |
30906 | D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'None'" )); |
30907 | _res = _keyword; |
30908 | goto done; |
30909 | } |
30910 | p->mark = _mark; |
30911 | D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n" , p->level, ' ', |
30912 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'None'" )); |
30913 | } |
30914 | _res = NULL; |
30915 | done: |
30916 | p->level--; |
30917 | return _res; |
30918 | } |
30919 | |
30920 | // _tmp_143: NAME '=' |
30921 | static void * |
30922 | _tmp_143_rule(Parser *p) |
30923 | { |
30924 | if (p->level++ == MAXSTACK) { |
30925 | p->error_indicator = 1; |
30926 | PyErr_NoMemory(); |
30927 | } |
30928 | if (p->error_indicator) { |
30929 | p->level--; |
30930 | return NULL; |
30931 | } |
30932 | void * _res = NULL; |
30933 | int _mark = p->mark; |
30934 | { // NAME '=' |
30935 | if (p->error_indicator) { |
30936 | p->level--; |
30937 | return NULL; |
30938 | } |
30939 | D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME '='" )); |
30940 | Token * _literal; |
30941 | expr_ty name_var; |
30942 | if ( |
30943 | (name_var = _PyPegen_name_token(p)) // NAME |
30944 | && |
30945 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
30946 | ) |
30947 | { |
30948 | D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME '='" )); |
30949 | _res = _PyPegen_dummy_name(p, name_var, _literal); |
30950 | goto done; |
30951 | } |
30952 | p->mark = _mark; |
30953 | D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n" , p->level, ' ', |
30954 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME '='" )); |
30955 | } |
30956 | _res = NULL; |
30957 | done: |
30958 | p->level--; |
30959 | return _res; |
30960 | } |
30961 | |
30962 | // _tmp_144: NAME STRING | SOFT_KEYWORD |
30963 | static void * |
30964 | _tmp_144_rule(Parser *p) |
30965 | { |
30966 | if (p->level++ == MAXSTACK) { |
30967 | p->error_indicator = 1; |
30968 | PyErr_NoMemory(); |
30969 | } |
30970 | if (p->error_indicator) { |
30971 | p->level--; |
30972 | return NULL; |
30973 | } |
30974 | void * _res = NULL; |
30975 | int _mark = p->mark; |
30976 | { // NAME STRING |
30977 | if (p->error_indicator) { |
30978 | p->level--; |
30979 | return NULL; |
30980 | } |
30981 | D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "NAME STRING" )); |
30982 | expr_ty name_var; |
30983 | expr_ty string_var; |
30984 | if ( |
30985 | (name_var = _PyPegen_name_token(p)) // NAME |
30986 | && |
30987 | (string_var = _PyPegen_string_token(p)) // STRING |
30988 | ) |
30989 | { |
30990 | D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "NAME STRING" )); |
30991 | _res = _PyPegen_dummy_name(p, name_var, string_var); |
30992 | goto done; |
30993 | } |
30994 | p->mark = _mark; |
30995 | D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n" , p->level, ' ', |
30996 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "NAME STRING" )); |
30997 | } |
30998 | { // SOFT_KEYWORD |
30999 | if (p->error_indicator) { |
31000 | p->level--; |
31001 | return NULL; |
31002 | } |
31003 | D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "SOFT_KEYWORD" )); |
31004 | expr_ty soft_keyword_var; |
31005 | if ( |
31006 | (soft_keyword_var = _PyPegen_soft_keyword_token(p)) // SOFT_KEYWORD |
31007 | ) |
31008 | { |
31009 | D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "SOFT_KEYWORD" )); |
31010 | _res = soft_keyword_var; |
31011 | goto done; |
31012 | } |
31013 | p->mark = _mark; |
31014 | D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n" , p->level, ' ', |
31015 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "SOFT_KEYWORD" )); |
31016 | } |
31017 | _res = NULL; |
31018 | done: |
31019 | p->level--; |
31020 | return _res; |
31021 | } |
31022 | |
31023 | // _tmp_145: 'else' | ':' |
31024 | static void * |
31025 | _tmp_145_rule(Parser *p) |
31026 | { |
31027 | if (p->level++ == MAXSTACK) { |
31028 | p->error_indicator = 1; |
31029 | PyErr_NoMemory(); |
31030 | } |
31031 | if (p->error_indicator) { |
31032 | p->level--; |
31033 | return NULL; |
31034 | } |
31035 | void * _res = NULL; |
31036 | int _mark = p->mark; |
31037 | { // 'else' |
31038 | if (p->error_indicator) { |
31039 | p->level--; |
31040 | return NULL; |
31041 | } |
31042 | D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'else'" )); |
31043 | Token * _keyword; |
31044 | if ( |
31045 | (_keyword = _PyPegen_expect_token(p, 516)) // token='else' |
31046 | ) |
31047 | { |
31048 | D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'else'" )); |
31049 | _res = _keyword; |
31050 | goto done; |
31051 | } |
31052 | p->mark = _mark; |
31053 | D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n" , p->level, ' ', |
31054 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'else'" )); |
31055 | } |
31056 | { // ':' |
31057 | if (p->error_indicator) { |
31058 | p->level--; |
31059 | return NULL; |
31060 | } |
31061 | D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "':'" )); |
31062 | Token * _literal; |
31063 | if ( |
31064 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
31065 | ) |
31066 | { |
31067 | D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "':'" )); |
31068 | _res = _literal; |
31069 | goto done; |
31070 | } |
31071 | p->mark = _mark; |
31072 | D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n" , p->level, ' ', |
31073 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "':'" )); |
31074 | } |
31075 | _res = NULL; |
31076 | done: |
31077 | p->level--; |
31078 | return _res; |
31079 | } |
31080 | |
31081 | // _tmp_146: '=' | ':=' |
31082 | static void * |
31083 | _tmp_146_rule(Parser *p) |
31084 | { |
31085 | if (p->level++ == MAXSTACK) { |
31086 | p->error_indicator = 1; |
31087 | PyErr_NoMemory(); |
31088 | } |
31089 | if (p->error_indicator) { |
31090 | p->level--; |
31091 | return NULL; |
31092 | } |
31093 | void * _res = NULL; |
31094 | int _mark = p->mark; |
31095 | { // '=' |
31096 | if (p->error_indicator) { |
31097 | p->level--; |
31098 | return NULL; |
31099 | } |
31100 | D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'='" )); |
31101 | Token * _literal; |
31102 | if ( |
31103 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
31104 | ) |
31105 | { |
31106 | D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'='" )); |
31107 | _res = _literal; |
31108 | goto done; |
31109 | } |
31110 | p->mark = _mark; |
31111 | D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n" , p->level, ' ', |
31112 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'='" )); |
31113 | } |
31114 | { // ':=' |
31115 | if (p->error_indicator) { |
31116 | p->level--; |
31117 | return NULL; |
31118 | } |
31119 | D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "':='" )); |
31120 | Token * _literal; |
31121 | if ( |
31122 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
31123 | ) |
31124 | { |
31125 | D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "':='" )); |
31126 | _res = _literal; |
31127 | goto done; |
31128 | } |
31129 | p->mark = _mark; |
31130 | D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n" , p->level, ' ', |
31131 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "':='" )); |
31132 | } |
31133 | _res = NULL; |
31134 | done: |
31135 | p->level--; |
31136 | return _res; |
31137 | } |
31138 | |
31139 | // _tmp_147: list | tuple | genexp | 'True' | 'None' | 'False' |
31140 | static void * |
31141 | _tmp_147_rule(Parser *p) |
31142 | { |
31143 | if (p->level++ == MAXSTACK) { |
31144 | p->error_indicator = 1; |
31145 | PyErr_NoMemory(); |
31146 | } |
31147 | if (p->error_indicator) { |
31148 | p->level--; |
31149 | return NULL; |
31150 | } |
31151 | void * _res = NULL; |
31152 | int _mark = p->mark; |
31153 | { // list |
31154 | if (p->error_indicator) { |
31155 | p->level--; |
31156 | return NULL; |
31157 | } |
31158 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "list" )); |
31159 | expr_ty list_var; |
31160 | if ( |
31161 | (list_var = list_rule(p)) // list |
31162 | ) |
31163 | { |
31164 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "list" )); |
31165 | _res = list_var; |
31166 | goto done; |
31167 | } |
31168 | p->mark = _mark; |
31169 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n" , p->level, ' ', |
31170 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "list" )); |
31171 | } |
31172 | { // tuple |
31173 | if (p->error_indicator) { |
31174 | p->level--; |
31175 | return NULL; |
31176 | } |
31177 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "tuple" )); |
31178 | expr_ty tuple_var; |
31179 | if ( |
31180 | (tuple_var = tuple_rule(p)) // tuple |
31181 | ) |
31182 | { |
31183 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "tuple" )); |
31184 | _res = tuple_var; |
31185 | goto done; |
31186 | } |
31187 | p->mark = _mark; |
31188 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n" , p->level, ' ', |
31189 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "tuple" )); |
31190 | } |
31191 | { // genexp |
31192 | if (p->error_indicator) { |
31193 | p->level--; |
31194 | return NULL; |
31195 | } |
31196 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "genexp" )); |
31197 | expr_ty genexp_var; |
31198 | if ( |
31199 | (genexp_var = genexp_rule(p)) // genexp |
31200 | ) |
31201 | { |
31202 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "genexp" )); |
31203 | _res = genexp_var; |
31204 | goto done; |
31205 | } |
31206 | p->mark = _mark; |
31207 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n" , p->level, ' ', |
31208 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "genexp" )); |
31209 | } |
31210 | { // 'True' |
31211 | if (p->error_indicator) { |
31212 | p->level--; |
31213 | return NULL; |
31214 | } |
31215 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'True'" )); |
31216 | Token * _keyword; |
31217 | if ( |
31218 | (_keyword = _PyPegen_expect_token(p, 524)) // token='True' |
31219 | ) |
31220 | { |
31221 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'True'" )); |
31222 | _res = _keyword; |
31223 | goto done; |
31224 | } |
31225 | p->mark = _mark; |
31226 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n" , p->level, ' ', |
31227 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'True'" )); |
31228 | } |
31229 | { // 'None' |
31230 | if (p->error_indicator) { |
31231 | p->level--; |
31232 | return NULL; |
31233 | } |
31234 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'None'" )); |
31235 | Token * _keyword; |
31236 | if ( |
31237 | (_keyword = _PyPegen_expect_token(p, 523)) // token='None' |
31238 | ) |
31239 | { |
31240 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'None'" )); |
31241 | _res = _keyword; |
31242 | goto done; |
31243 | } |
31244 | p->mark = _mark; |
31245 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n" , p->level, ' ', |
31246 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'None'" )); |
31247 | } |
31248 | { // 'False' |
31249 | if (p->error_indicator) { |
31250 | p->level--; |
31251 | return NULL; |
31252 | } |
31253 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'False'" )); |
31254 | Token * _keyword; |
31255 | if ( |
31256 | (_keyword = _PyPegen_expect_token(p, 525)) // token='False' |
31257 | ) |
31258 | { |
31259 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'False'" )); |
31260 | _res = _keyword; |
31261 | goto done; |
31262 | } |
31263 | p->mark = _mark; |
31264 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n" , p->level, ' ', |
31265 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'False'" )); |
31266 | } |
31267 | _res = NULL; |
31268 | done: |
31269 | p->level--; |
31270 | return _res; |
31271 | } |
31272 | |
31273 | // _tmp_148: '=' | ':=' |
31274 | static void * |
31275 | _tmp_148_rule(Parser *p) |
31276 | { |
31277 | if (p->level++ == MAXSTACK) { |
31278 | p->error_indicator = 1; |
31279 | PyErr_NoMemory(); |
31280 | } |
31281 | if (p->error_indicator) { |
31282 | p->level--; |
31283 | return NULL; |
31284 | } |
31285 | void * _res = NULL; |
31286 | int _mark = p->mark; |
31287 | { // '=' |
31288 | if (p->error_indicator) { |
31289 | p->level--; |
31290 | return NULL; |
31291 | } |
31292 | D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'='" )); |
31293 | Token * _literal; |
31294 | if ( |
31295 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
31296 | ) |
31297 | { |
31298 | D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'='" )); |
31299 | _res = _literal; |
31300 | goto done; |
31301 | } |
31302 | p->mark = _mark; |
31303 | D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n" , p->level, ' ', |
31304 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'='" )); |
31305 | } |
31306 | { // ':=' |
31307 | if (p->error_indicator) { |
31308 | p->level--; |
31309 | return NULL; |
31310 | } |
31311 | D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "':='" )); |
31312 | Token * _literal; |
31313 | if ( |
31314 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
31315 | ) |
31316 | { |
31317 | D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "':='" )); |
31318 | _res = _literal; |
31319 | goto done; |
31320 | } |
31321 | p->mark = _mark; |
31322 | D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n" , p->level, ' ', |
31323 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "':='" )); |
31324 | } |
31325 | _res = NULL; |
31326 | done: |
31327 | p->level--; |
31328 | return _res; |
31329 | } |
31330 | |
31331 | // _loop0_149: star_named_expressions |
31332 | static asdl_seq * |
31333 | _loop0_149_rule(Parser *p) |
31334 | { |
31335 | if (p->level++ == MAXSTACK) { |
31336 | p->error_indicator = 1; |
31337 | PyErr_NoMemory(); |
31338 | } |
31339 | if (p->error_indicator) { |
31340 | p->level--; |
31341 | return NULL; |
31342 | } |
31343 | void *_res = NULL; |
31344 | int _mark = p->mark; |
31345 | int _start_mark = p->mark; |
31346 | void **_children = PyMem_Malloc(sizeof(void *)); |
31347 | if (!_children) { |
31348 | p->error_indicator = 1; |
31349 | PyErr_NoMemory(); |
31350 | p->level--; |
31351 | return NULL; |
31352 | } |
31353 | Py_ssize_t _children_capacity = 1; |
31354 | Py_ssize_t _n = 0; |
31355 | { // star_named_expressions |
31356 | if (p->error_indicator) { |
31357 | p->level--; |
31358 | return NULL; |
31359 | } |
31360 | D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_named_expressions" )); |
31361 | asdl_expr_seq* star_named_expressions_var; |
31362 | while ( |
31363 | (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions |
31364 | ) |
31365 | { |
31366 | _res = star_named_expressions_var; |
31367 | if (_n == _children_capacity) { |
31368 | _children_capacity *= 2; |
31369 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31370 | if (!_new_children) { |
31371 | p->error_indicator = 1; |
31372 | PyErr_NoMemory(); |
31373 | p->level--; |
31374 | return NULL; |
31375 | } |
31376 | _children = _new_children; |
31377 | } |
31378 | _children[_n++] = _res; |
31379 | _mark = p->mark; |
31380 | } |
31381 | p->mark = _mark; |
31382 | D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n" , p->level, ' ', |
31383 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_named_expressions" )); |
31384 | } |
31385 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31386 | if (!_seq) { |
31387 | PyMem_Free(_children); |
31388 | p->error_indicator = 1; |
31389 | PyErr_NoMemory(); |
31390 | p->level--; |
31391 | return NULL; |
31392 | } |
31393 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31394 | PyMem_Free(_children); |
31395 | _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); |
31396 | p->level--; |
31397 | return _seq; |
31398 | } |
31399 | |
31400 | // _loop0_150: (star_targets '=') |
31401 | static asdl_seq * |
31402 | _loop0_150_rule(Parser *p) |
31403 | { |
31404 | if (p->level++ == MAXSTACK) { |
31405 | p->error_indicator = 1; |
31406 | PyErr_NoMemory(); |
31407 | } |
31408 | if (p->error_indicator) { |
31409 | p->level--; |
31410 | return NULL; |
31411 | } |
31412 | void *_res = NULL; |
31413 | int _mark = p->mark; |
31414 | int _start_mark = p->mark; |
31415 | void **_children = PyMem_Malloc(sizeof(void *)); |
31416 | if (!_children) { |
31417 | p->error_indicator = 1; |
31418 | PyErr_NoMemory(); |
31419 | p->level--; |
31420 | return NULL; |
31421 | } |
31422 | Py_ssize_t _children_capacity = 1; |
31423 | Py_ssize_t _n = 0; |
31424 | { // (star_targets '=') |
31425 | if (p->error_indicator) { |
31426 | p->level--; |
31427 | return NULL; |
31428 | } |
31429 | D(fprintf(stderr, "%*c> _loop0_150[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(star_targets '=')" )); |
31430 | void *_tmp_194_var; |
31431 | while ( |
31432 | (_tmp_194_var = _tmp_194_rule(p)) // star_targets '=' |
31433 | ) |
31434 | { |
31435 | _res = _tmp_194_var; |
31436 | if (_n == _children_capacity) { |
31437 | _children_capacity *= 2; |
31438 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31439 | if (!_new_children) { |
31440 | p->error_indicator = 1; |
31441 | PyErr_NoMemory(); |
31442 | p->level--; |
31443 | return NULL; |
31444 | } |
31445 | _children = _new_children; |
31446 | } |
31447 | _children[_n++] = _res; |
31448 | _mark = p->mark; |
31449 | } |
31450 | p->mark = _mark; |
31451 | D(fprintf(stderr, "%*c%s _loop0_150[%d-%d]: %s failed!\n" , p->level, ' ', |
31452 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(star_targets '=')" )); |
31453 | } |
31454 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31455 | if (!_seq) { |
31456 | PyMem_Free(_children); |
31457 | p->error_indicator = 1; |
31458 | PyErr_NoMemory(); |
31459 | p->level--; |
31460 | return NULL; |
31461 | } |
31462 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31463 | PyMem_Free(_children); |
31464 | _PyPegen_insert_memo(p, _start_mark, _loop0_150_type, _seq); |
31465 | p->level--; |
31466 | return _seq; |
31467 | } |
31468 | |
31469 | // _loop0_151: (star_targets '=') |
31470 | static asdl_seq * |
31471 | _loop0_151_rule(Parser *p) |
31472 | { |
31473 | if (p->level++ == MAXSTACK) { |
31474 | p->error_indicator = 1; |
31475 | PyErr_NoMemory(); |
31476 | } |
31477 | if (p->error_indicator) { |
31478 | p->level--; |
31479 | return NULL; |
31480 | } |
31481 | void *_res = NULL; |
31482 | int _mark = p->mark; |
31483 | int _start_mark = p->mark; |
31484 | void **_children = PyMem_Malloc(sizeof(void *)); |
31485 | if (!_children) { |
31486 | p->error_indicator = 1; |
31487 | PyErr_NoMemory(); |
31488 | p->level--; |
31489 | return NULL; |
31490 | } |
31491 | Py_ssize_t _children_capacity = 1; |
31492 | Py_ssize_t _n = 0; |
31493 | { // (star_targets '=') |
31494 | if (p->error_indicator) { |
31495 | p->level--; |
31496 | return NULL; |
31497 | } |
31498 | D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(star_targets '=')" )); |
31499 | void *_tmp_195_var; |
31500 | while ( |
31501 | (_tmp_195_var = _tmp_195_rule(p)) // star_targets '=' |
31502 | ) |
31503 | { |
31504 | _res = _tmp_195_var; |
31505 | if (_n == _children_capacity) { |
31506 | _children_capacity *= 2; |
31507 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31508 | if (!_new_children) { |
31509 | p->error_indicator = 1; |
31510 | PyErr_NoMemory(); |
31511 | p->level--; |
31512 | return NULL; |
31513 | } |
31514 | _children = _new_children; |
31515 | } |
31516 | _children[_n++] = _res; |
31517 | _mark = p->mark; |
31518 | } |
31519 | p->mark = _mark; |
31520 | D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n" , p->level, ' ', |
31521 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(star_targets '=')" )); |
31522 | } |
31523 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31524 | if (!_seq) { |
31525 | PyMem_Free(_children); |
31526 | p->error_indicator = 1; |
31527 | PyErr_NoMemory(); |
31528 | p->level--; |
31529 | return NULL; |
31530 | } |
31531 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31532 | PyMem_Free(_children); |
31533 | _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq); |
31534 | p->level--; |
31535 | return _seq; |
31536 | } |
31537 | |
31538 | // _tmp_152: yield_expr | star_expressions |
31539 | static void * |
31540 | _tmp_152_rule(Parser *p) |
31541 | { |
31542 | if (p->level++ == MAXSTACK) { |
31543 | p->error_indicator = 1; |
31544 | PyErr_NoMemory(); |
31545 | } |
31546 | if (p->error_indicator) { |
31547 | p->level--; |
31548 | return NULL; |
31549 | } |
31550 | void * _res = NULL; |
31551 | int _mark = p->mark; |
31552 | { // yield_expr |
31553 | if (p->error_indicator) { |
31554 | p->level--; |
31555 | return NULL; |
31556 | } |
31557 | D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "yield_expr" )); |
31558 | expr_ty yield_expr_var; |
31559 | if ( |
31560 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
31561 | ) |
31562 | { |
31563 | D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "yield_expr" )); |
31564 | _res = yield_expr_var; |
31565 | goto done; |
31566 | } |
31567 | p->mark = _mark; |
31568 | D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n" , p->level, ' ', |
31569 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "yield_expr" )); |
31570 | } |
31571 | { // star_expressions |
31572 | if (p->error_indicator) { |
31573 | p->level--; |
31574 | return NULL; |
31575 | } |
31576 | D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_expressions" )); |
31577 | expr_ty star_expressions_var; |
31578 | if ( |
31579 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
31580 | ) |
31581 | { |
31582 | D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_expressions" )); |
31583 | _res = star_expressions_var; |
31584 | goto done; |
31585 | } |
31586 | p->mark = _mark; |
31587 | D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n" , p->level, ' ', |
31588 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_expressions" )); |
31589 | } |
31590 | _res = NULL; |
31591 | done: |
31592 | p->level--; |
31593 | return _res; |
31594 | } |
31595 | |
31596 | // _tmp_153: '[' | '(' | '{' |
31597 | static void * |
31598 | _tmp_153_rule(Parser *p) |
31599 | { |
31600 | if (p->level++ == MAXSTACK) { |
31601 | p->error_indicator = 1; |
31602 | PyErr_NoMemory(); |
31603 | } |
31604 | if (p->error_indicator) { |
31605 | p->level--; |
31606 | return NULL; |
31607 | } |
31608 | void * _res = NULL; |
31609 | int _mark = p->mark; |
31610 | { // '[' |
31611 | if (p->error_indicator) { |
31612 | p->level--; |
31613 | return NULL; |
31614 | } |
31615 | D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'['" )); |
31616 | Token * _literal; |
31617 | if ( |
31618 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
31619 | ) |
31620 | { |
31621 | D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'['" )); |
31622 | _res = _literal; |
31623 | goto done; |
31624 | } |
31625 | p->mark = _mark; |
31626 | D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n" , p->level, ' ', |
31627 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'['" )); |
31628 | } |
31629 | { // '(' |
31630 | if (p->error_indicator) { |
31631 | p->level--; |
31632 | return NULL; |
31633 | } |
31634 | D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'('" )); |
31635 | Token * _literal; |
31636 | if ( |
31637 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
31638 | ) |
31639 | { |
31640 | D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'('" )); |
31641 | _res = _literal; |
31642 | goto done; |
31643 | } |
31644 | p->mark = _mark; |
31645 | D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n" , p->level, ' ', |
31646 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'('" )); |
31647 | } |
31648 | { // '{' |
31649 | if (p->error_indicator) { |
31650 | p->level--; |
31651 | return NULL; |
31652 | } |
31653 | D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{'" )); |
31654 | Token * _literal; |
31655 | if ( |
31656 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
31657 | ) |
31658 | { |
31659 | D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{'" )); |
31660 | _res = _literal; |
31661 | goto done; |
31662 | } |
31663 | p->mark = _mark; |
31664 | D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n" , p->level, ' ', |
31665 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{'" )); |
31666 | } |
31667 | _res = NULL; |
31668 | done: |
31669 | p->level--; |
31670 | return _res; |
31671 | } |
31672 | |
31673 | // _tmp_154: '[' | '{' |
31674 | static void * |
31675 | _tmp_154_rule(Parser *p) |
31676 | { |
31677 | if (p->level++ == MAXSTACK) { |
31678 | p->error_indicator = 1; |
31679 | PyErr_NoMemory(); |
31680 | } |
31681 | if (p->error_indicator) { |
31682 | p->level--; |
31683 | return NULL; |
31684 | } |
31685 | void * _res = NULL; |
31686 | int _mark = p->mark; |
31687 | { // '[' |
31688 | if (p->error_indicator) { |
31689 | p->level--; |
31690 | return NULL; |
31691 | } |
31692 | D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'['" )); |
31693 | Token * _literal; |
31694 | if ( |
31695 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
31696 | ) |
31697 | { |
31698 | D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'['" )); |
31699 | _res = _literal; |
31700 | goto done; |
31701 | } |
31702 | p->mark = _mark; |
31703 | D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n" , p->level, ' ', |
31704 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'['" )); |
31705 | } |
31706 | { // '{' |
31707 | if (p->error_indicator) { |
31708 | p->level--; |
31709 | return NULL; |
31710 | } |
31711 | D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{'" )); |
31712 | Token * _literal; |
31713 | if ( |
31714 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
31715 | ) |
31716 | { |
31717 | D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{'" )); |
31718 | _res = _literal; |
31719 | goto done; |
31720 | } |
31721 | p->mark = _mark; |
31722 | D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n" , p->level, ' ', |
31723 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{'" )); |
31724 | } |
31725 | _res = NULL; |
31726 | done: |
31727 | p->level--; |
31728 | return _res; |
31729 | } |
31730 | |
31731 | // _tmp_155: '[' | '{' |
31732 | static void * |
31733 | _tmp_155_rule(Parser *p) |
31734 | { |
31735 | if (p->level++ == MAXSTACK) { |
31736 | p->error_indicator = 1; |
31737 | PyErr_NoMemory(); |
31738 | } |
31739 | if (p->error_indicator) { |
31740 | p->level--; |
31741 | return NULL; |
31742 | } |
31743 | void * _res = NULL; |
31744 | int _mark = p->mark; |
31745 | { // '[' |
31746 | if (p->error_indicator) { |
31747 | p->level--; |
31748 | return NULL; |
31749 | } |
31750 | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'['" )); |
31751 | Token * _literal; |
31752 | if ( |
31753 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
31754 | ) |
31755 | { |
31756 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'['" )); |
31757 | _res = _literal; |
31758 | goto done; |
31759 | } |
31760 | p->mark = _mark; |
31761 | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n" , p->level, ' ', |
31762 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'['" )); |
31763 | } |
31764 | { // '{' |
31765 | if (p->error_indicator) { |
31766 | p->level--; |
31767 | return NULL; |
31768 | } |
31769 | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'{'" )); |
31770 | Token * _literal; |
31771 | if ( |
31772 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
31773 | ) |
31774 | { |
31775 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'{'" )); |
31776 | _res = _literal; |
31777 | goto done; |
31778 | } |
31779 | p->mark = _mark; |
31780 | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n" , p->level, ' ', |
31781 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'{'" )); |
31782 | } |
31783 | _res = NULL; |
31784 | done: |
31785 | p->level--; |
31786 | return _res; |
31787 | } |
31788 | |
31789 | // _loop0_156: param_no_default |
31790 | static asdl_seq * |
31791 | _loop0_156_rule(Parser *p) |
31792 | { |
31793 | if (p->level++ == MAXSTACK) { |
31794 | p->error_indicator = 1; |
31795 | PyErr_NoMemory(); |
31796 | } |
31797 | if (p->error_indicator) { |
31798 | p->level--; |
31799 | return NULL; |
31800 | } |
31801 | void *_res = NULL; |
31802 | int _mark = p->mark; |
31803 | int _start_mark = p->mark; |
31804 | void **_children = PyMem_Malloc(sizeof(void *)); |
31805 | if (!_children) { |
31806 | p->error_indicator = 1; |
31807 | PyErr_NoMemory(); |
31808 | p->level--; |
31809 | return NULL; |
31810 | } |
31811 | Py_ssize_t _children_capacity = 1; |
31812 | Py_ssize_t _n = 0; |
31813 | { // param_no_default |
31814 | if (p->error_indicator) { |
31815 | p->level--; |
31816 | return NULL; |
31817 | } |
31818 | D(fprintf(stderr, "%*c> _loop0_156[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_no_default" )); |
31819 | arg_ty param_no_default_var; |
31820 | while ( |
31821 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
31822 | ) |
31823 | { |
31824 | _res = param_no_default_var; |
31825 | if (_n == _children_capacity) { |
31826 | _children_capacity *= 2; |
31827 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31828 | if (!_new_children) { |
31829 | p->error_indicator = 1; |
31830 | PyErr_NoMemory(); |
31831 | p->level--; |
31832 | return NULL; |
31833 | } |
31834 | _children = _new_children; |
31835 | } |
31836 | _children[_n++] = _res; |
31837 | _mark = p->mark; |
31838 | } |
31839 | p->mark = _mark; |
31840 | D(fprintf(stderr, "%*c%s _loop0_156[%d-%d]: %s failed!\n" , p->level, ' ', |
31841 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_no_default" )); |
31842 | } |
31843 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31844 | if (!_seq) { |
31845 | PyMem_Free(_children); |
31846 | p->error_indicator = 1; |
31847 | PyErr_NoMemory(); |
31848 | p->level--; |
31849 | return NULL; |
31850 | } |
31851 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31852 | PyMem_Free(_children); |
31853 | _PyPegen_insert_memo(p, _start_mark, _loop0_156_type, _seq); |
31854 | p->level--; |
31855 | return _seq; |
31856 | } |
31857 | |
31858 | // _loop1_157: param_with_default |
31859 | static asdl_seq * |
31860 | _loop1_157_rule(Parser *p) |
31861 | { |
31862 | if (p->level++ == MAXSTACK) { |
31863 | p->error_indicator = 1; |
31864 | PyErr_NoMemory(); |
31865 | } |
31866 | if (p->error_indicator) { |
31867 | p->level--; |
31868 | return NULL; |
31869 | } |
31870 | void *_res = NULL; |
31871 | int _mark = p->mark; |
31872 | int _start_mark = p->mark; |
31873 | void **_children = PyMem_Malloc(sizeof(void *)); |
31874 | if (!_children) { |
31875 | p->error_indicator = 1; |
31876 | PyErr_NoMemory(); |
31877 | p->level--; |
31878 | return NULL; |
31879 | } |
31880 | Py_ssize_t _children_capacity = 1; |
31881 | Py_ssize_t _n = 0; |
31882 | { // param_with_default |
31883 | if (p->error_indicator) { |
31884 | p->level--; |
31885 | return NULL; |
31886 | } |
31887 | D(fprintf(stderr, "%*c> _loop1_157[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "param_with_default" )); |
31888 | NameDefaultPair* param_with_default_var; |
31889 | while ( |
31890 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
31891 | ) |
31892 | { |
31893 | _res = param_with_default_var; |
31894 | if (_n == _children_capacity) { |
31895 | _children_capacity *= 2; |
31896 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31897 | if (!_new_children) { |
31898 | p->error_indicator = 1; |
31899 | PyErr_NoMemory(); |
31900 | p->level--; |
31901 | return NULL; |
31902 | } |
31903 | _children = _new_children; |
31904 | } |
31905 | _children[_n++] = _res; |
31906 | _mark = p->mark; |
31907 | } |
31908 | p->mark = _mark; |
31909 | D(fprintf(stderr, "%*c%s _loop1_157[%d-%d]: %s failed!\n" , p->level, ' ', |
31910 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "param_with_default" )); |
31911 | } |
31912 | if (_n == 0 || p->error_indicator) { |
31913 | PyMem_Free(_children); |
31914 | p->level--; |
31915 | return NULL; |
31916 | } |
31917 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31918 | if (!_seq) { |
31919 | PyMem_Free(_children); |
31920 | p->error_indicator = 1; |
31921 | PyErr_NoMemory(); |
31922 | p->level--; |
31923 | return NULL; |
31924 | } |
31925 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31926 | PyMem_Free(_children); |
31927 | _PyPegen_insert_memo(p, _start_mark, _loop1_157_type, _seq); |
31928 | p->level--; |
31929 | return _seq; |
31930 | } |
31931 | |
31932 | // _loop0_158: lambda_param_no_default |
31933 | static asdl_seq * |
31934 | _loop0_158_rule(Parser *p) |
31935 | { |
31936 | if (p->level++ == MAXSTACK) { |
31937 | p->error_indicator = 1; |
31938 | PyErr_NoMemory(); |
31939 | } |
31940 | if (p->error_indicator) { |
31941 | p->level--; |
31942 | return NULL; |
31943 | } |
31944 | void *_res = NULL; |
31945 | int _mark = p->mark; |
31946 | int _start_mark = p->mark; |
31947 | void **_children = PyMem_Malloc(sizeof(void *)); |
31948 | if (!_children) { |
31949 | p->error_indicator = 1; |
31950 | PyErr_NoMemory(); |
31951 | p->level--; |
31952 | return NULL; |
31953 | } |
31954 | Py_ssize_t _children_capacity = 1; |
31955 | Py_ssize_t _n = 0; |
31956 | { // lambda_param_no_default |
31957 | if (p->error_indicator) { |
31958 | p->level--; |
31959 | return NULL; |
31960 | } |
31961 | D(fprintf(stderr, "%*c> _loop0_158[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_no_default" )); |
31962 | arg_ty lambda_param_no_default_var; |
31963 | while ( |
31964 | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
31965 | ) |
31966 | { |
31967 | _res = lambda_param_no_default_var; |
31968 | if (_n == _children_capacity) { |
31969 | _children_capacity *= 2; |
31970 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31971 | if (!_new_children) { |
31972 | p->error_indicator = 1; |
31973 | PyErr_NoMemory(); |
31974 | p->level--; |
31975 | return NULL; |
31976 | } |
31977 | _children = _new_children; |
31978 | } |
31979 | _children[_n++] = _res; |
31980 | _mark = p->mark; |
31981 | } |
31982 | p->mark = _mark; |
31983 | D(fprintf(stderr, "%*c%s _loop0_158[%d-%d]: %s failed!\n" , p->level, ' ', |
31984 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_no_default" )); |
31985 | } |
31986 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31987 | if (!_seq) { |
31988 | PyMem_Free(_children); |
31989 | p->error_indicator = 1; |
31990 | PyErr_NoMemory(); |
31991 | p->level--; |
31992 | return NULL; |
31993 | } |
31994 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31995 | PyMem_Free(_children); |
31996 | _PyPegen_insert_memo(p, _start_mark, _loop0_158_type, _seq); |
31997 | p->level--; |
31998 | return _seq; |
31999 | } |
32000 | |
32001 | // _loop1_159: lambda_param_with_default |
32002 | static asdl_seq * |
32003 | _loop1_159_rule(Parser *p) |
32004 | { |
32005 | if (p->level++ == MAXSTACK) { |
32006 | p->error_indicator = 1; |
32007 | PyErr_NoMemory(); |
32008 | } |
32009 | if (p->error_indicator) { |
32010 | p->level--; |
32011 | return NULL; |
32012 | } |
32013 | void *_res = NULL; |
32014 | int _mark = p->mark; |
32015 | int _start_mark = p->mark; |
32016 | void **_children = PyMem_Malloc(sizeof(void *)); |
32017 | if (!_children) { |
32018 | p->error_indicator = 1; |
32019 | PyErr_NoMemory(); |
32020 | p->level--; |
32021 | return NULL; |
32022 | } |
32023 | Py_ssize_t _children_capacity = 1; |
32024 | Py_ssize_t _n = 0; |
32025 | { // lambda_param_with_default |
32026 | if (p->error_indicator) { |
32027 | p->level--; |
32028 | return NULL; |
32029 | } |
32030 | D(fprintf(stderr, "%*c> _loop1_159[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "lambda_param_with_default" )); |
32031 | NameDefaultPair* lambda_param_with_default_var; |
32032 | while ( |
32033 | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
32034 | ) |
32035 | { |
32036 | _res = lambda_param_with_default_var; |
32037 | if (_n == _children_capacity) { |
32038 | _children_capacity *= 2; |
32039 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32040 | if (!_new_children) { |
32041 | p->error_indicator = 1; |
32042 | PyErr_NoMemory(); |
32043 | p->level--; |
32044 | return NULL; |
32045 | } |
32046 | _children = _new_children; |
32047 | } |
32048 | _children[_n++] = _res; |
32049 | _mark = p->mark; |
32050 | } |
32051 | p->mark = _mark; |
32052 | D(fprintf(stderr, "%*c%s _loop1_159[%d-%d]: %s failed!\n" , p->level, ' ', |
32053 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "lambda_param_with_default" )); |
32054 | } |
32055 | if (_n == 0 || p->error_indicator) { |
32056 | PyMem_Free(_children); |
32057 | p->level--; |
32058 | return NULL; |
32059 | } |
32060 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32061 | if (!_seq) { |
32062 | PyMem_Free(_children); |
32063 | p->error_indicator = 1; |
32064 | PyErr_NoMemory(); |
32065 | p->level--; |
32066 | return NULL; |
32067 | } |
32068 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32069 | PyMem_Free(_children); |
32070 | _PyPegen_insert_memo(p, _start_mark, _loop1_159_type, _seq); |
32071 | p->level--; |
32072 | return _seq; |
32073 | } |
32074 | |
32075 | // _tmp_160: ')' | ',' (')' | '**') |
32076 | static void * |
32077 | _tmp_160_rule(Parser *p) |
32078 | { |
32079 | if (p->level++ == MAXSTACK) { |
32080 | p->error_indicator = 1; |
32081 | PyErr_NoMemory(); |
32082 | } |
32083 | if (p->error_indicator) { |
32084 | p->level--; |
32085 | return NULL; |
32086 | } |
32087 | void * _res = NULL; |
32088 | int _mark = p->mark; |
32089 | { // ')' |
32090 | if (p->error_indicator) { |
32091 | p->level--; |
32092 | return NULL; |
32093 | } |
32094 | D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "')'" )); |
32095 | Token * _literal; |
32096 | if ( |
32097 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
32098 | ) |
32099 | { |
32100 | D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "')'" )); |
32101 | _res = _literal; |
32102 | goto done; |
32103 | } |
32104 | p->mark = _mark; |
32105 | D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n" , p->level, ' ', |
32106 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "')'" )); |
32107 | } |
32108 | { // ',' (')' | '**') |
32109 | if (p->error_indicator) { |
32110 | p->level--; |
32111 | return NULL; |
32112 | } |
32113 | D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' (')' | '**')" )); |
32114 | Token * _literal; |
32115 | void *_tmp_196_var; |
32116 | if ( |
32117 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
32118 | && |
32119 | (_tmp_196_var = _tmp_196_rule(p)) // ')' | '**' |
32120 | ) |
32121 | { |
32122 | D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "',' (')' | '**')" )); |
32123 | _res = _PyPegen_dummy_name(p, _literal, _tmp_196_var); |
32124 | goto done; |
32125 | } |
32126 | p->mark = _mark; |
32127 | D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n" , p->level, ' ', |
32128 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' (')' | '**')" )); |
32129 | } |
32130 | _res = NULL; |
32131 | done: |
32132 | p->level--; |
32133 | return _res; |
32134 | } |
32135 | |
32136 | // _tmp_161: ':' | ',' (':' | '**') |
32137 | static void * |
32138 | _tmp_161_rule(Parser *p) |
32139 | { |
32140 | if (p->level++ == MAXSTACK) { |
32141 | p->error_indicator = 1; |
32142 | PyErr_NoMemory(); |
32143 | } |
32144 | if (p->error_indicator) { |
32145 | p->level--; |
32146 | return NULL; |
32147 | } |
32148 | void * _res = NULL; |
32149 | int _mark = p->mark; |
32150 | { // ':' |
32151 | if (p->error_indicator) { |
32152 | p->level--; |
32153 | return NULL; |
32154 | } |
32155 | D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "':'" )); |
32156 | Token * _literal; |
32157 | if ( |
32158 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
32159 | ) |
32160 | { |
32161 | D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "':'" )); |
32162 | _res = _literal; |
32163 | goto done; |
32164 | } |
32165 | p->mark = _mark; |
32166 | D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n" , p->level, ' ', |
32167 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "':'" )); |
32168 | } |
32169 | { // ',' (':' | '**') |
32170 | if (p->error_indicator) { |
32171 | p->level--; |
32172 | return NULL; |
32173 | } |
32174 | D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' (':' | '**')" )); |
32175 | Token * _literal; |
32176 | void *_tmp_197_var; |
32177 | if ( |
32178 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
32179 | && |
32180 | (_tmp_197_var = _tmp_197_rule(p)) // ':' | '**' |
32181 | ) |
32182 | { |
32183 | D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "',' (':' | '**')" )); |
32184 | _res = _PyPegen_dummy_name(p, _literal, _tmp_197_var); |
32185 | goto done; |
32186 | } |
32187 | p->mark = _mark; |
32188 | D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n" , p->level, ' ', |
32189 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' (':' | '**')" )); |
32190 | } |
32191 | _res = NULL; |
32192 | done: |
32193 | p->level--; |
32194 | return _res; |
32195 | } |
32196 | |
32197 | // _tmp_162: ',' | ')' | ':' |
32198 | static void * |
32199 | _tmp_162_rule(Parser *p) |
32200 | { |
32201 | if (p->level++ == MAXSTACK) { |
32202 | p->error_indicator = 1; |
32203 | PyErr_NoMemory(); |
32204 | } |
32205 | if (p->error_indicator) { |
32206 | p->level--; |
32207 | return NULL; |
32208 | } |
32209 | void * _res = NULL; |
32210 | int _mark = p->mark; |
32211 | { // ',' |
32212 | if (p->error_indicator) { |
32213 | p->level--; |
32214 | return NULL; |
32215 | } |
32216 | D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','" )); |
32217 | Token * _literal; |
32218 | if ( |
32219 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
32220 | ) |
32221 | { |
32222 | D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','" )); |
32223 | _res = _literal; |
32224 | goto done; |
32225 | } |
32226 | p->mark = _mark; |
32227 | D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n" , p->level, ' ', |
32228 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','" )); |
32229 | } |
32230 | { // ')' |
32231 | if (p->error_indicator) { |
32232 | p->level--; |
32233 | return NULL; |
32234 | } |
32235 | D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "')'" )); |
32236 | Token * _literal; |
32237 | if ( |
32238 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
32239 | ) |
32240 | { |
32241 | D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "')'" )); |
32242 | _res = _literal; |
32243 | goto done; |
32244 | } |
32245 | p->mark = _mark; |
32246 | D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n" , p->level, ' ', |
32247 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "')'" )); |
32248 | } |
32249 | { // ':' |
32250 | if (p->error_indicator) { |
32251 | p->level--; |
32252 | return NULL; |
32253 | } |
32254 | D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "':'" )); |
32255 | Token * _literal; |
32256 | if ( |
32257 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
32258 | ) |
32259 | { |
32260 | D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "':'" )); |
32261 | _res = _literal; |
32262 | goto done; |
32263 | } |
32264 | p->mark = _mark; |
32265 | D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n" , p->level, ' ', |
32266 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "':'" )); |
32267 | } |
32268 | _res = NULL; |
32269 | done: |
32270 | p->level--; |
32271 | return _res; |
32272 | } |
32273 | |
32274 | // _loop0_164: ',' (expression ['as' star_target]) |
32275 | static asdl_seq * |
32276 | _loop0_164_rule(Parser *p) |
32277 | { |
32278 | if (p->level++ == MAXSTACK) { |
32279 | p->error_indicator = 1; |
32280 | PyErr_NoMemory(); |
32281 | } |
32282 | if (p->error_indicator) { |
32283 | p->level--; |
32284 | return NULL; |
32285 | } |
32286 | void *_res = NULL; |
32287 | int _mark = p->mark; |
32288 | int _start_mark = p->mark; |
32289 | void **_children = PyMem_Malloc(sizeof(void *)); |
32290 | if (!_children) { |
32291 | p->error_indicator = 1; |
32292 | PyErr_NoMemory(); |
32293 | p->level--; |
32294 | return NULL; |
32295 | } |
32296 | Py_ssize_t _children_capacity = 1; |
32297 | Py_ssize_t _n = 0; |
32298 | { // ',' (expression ['as' star_target]) |
32299 | if (p->error_indicator) { |
32300 | p->level--; |
32301 | return NULL; |
32302 | } |
32303 | D(fprintf(stderr, "%*c> _loop0_164[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])" )); |
32304 | Token * _literal; |
32305 | void *elem; |
32306 | while ( |
32307 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
32308 | && |
32309 | (elem = _tmp_198_rule(p)) // expression ['as' star_target] |
32310 | ) |
32311 | { |
32312 | _res = elem; |
32313 | if (_res == NULL && PyErr_Occurred()) { |
32314 | p->error_indicator = 1; |
32315 | PyMem_Free(_children); |
32316 | p->level--; |
32317 | return NULL; |
32318 | } |
32319 | if (_n == _children_capacity) { |
32320 | _children_capacity *= 2; |
32321 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32322 | if (!_new_children) { |
32323 | p->error_indicator = 1; |
32324 | PyErr_NoMemory(); |
32325 | p->level--; |
32326 | return NULL; |
32327 | } |
32328 | _children = _new_children; |
32329 | } |
32330 | _children[_n++] = _res; |
32331 | _mark = p->mark; |
32332 | } |
32333 | p->mark = _mark; |
32334 | D(fprintf(stderr, "%*c%s _loop0_164[%d-%d]: %s failed!\n" , p->level, ' ', |
32335 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' (expression ['as' star_target])" )); |
32336 | } |
32337 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32338 | if (!_seq) { |
32339 | PyMem_Free(_children); |
32340 | p->error_indicator = 1; |
32341 | PyErr_NoMemory(); |
32342 | p->level--; |
32343 | return NULL; |
32344 | } |
32345 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32346 | PyMem_Free(_children); |
32347 | _PyPegen_insert_memo(p, _start_mark, _loop0_164_type, _seq); |
32348 | p->level--; |
32349 | return _seq; |
32350 | } |
32351 | |
32352 | // _gather_163: (expression ['as' star_target]) _loop0_164 |
32353 | static asdl_seq * |
32354 | _gather_163_rule(Parser *p) |
32355 | { |
32356 | if (p->level++ == MAXSTACK) { |
32357 | p->error_indicator = 1; |
32358 | PyErr_NoMemory(); |
32359 | } |
32360 | if (p->error_indicator) { |
32361 | p->level--; |
32362 | return NULL; |
32363 | } |
32364 | asdl_seq * _res = NULL; |
32365 | int _mark = p->mark; |
32366 | { // (expression ['as' star_target]) _loop0_164 |
32367 | if (p->error_indicator) { |
32368 | p->level--; |
32369 | return NULL; |
32370 | } |
32371 | D(fprintf(stderr, "%*c> _gather_163[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_164" )); |
32372 | void *elem; |
32373 | asdl_seq * seq; |
32374 | if ( |
32375 | (elem = _tmp_198_rule(p)) // expression ['as' star_target] |
32376 | && |
32377 | (seq = _loop0_164_rule(p)) // _loop0_164 |
32378 | ) |
32379 | { |
32380 | D(fprintf(stderr, "%*c+ _gather_163[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_164" )); |
32381 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
32382 | goto done; |
32383 | } |
32384 | p->mark = _mark; |
32385 | D(fprintf(stderr, "%*c%s _gather_163[%d-%d]: %s failed!\n" , p->level, ' ', |
32386 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(expression ['as' star_target]) _loop0_164" )); |
32387 | } |
32388 | _res = NULL; |
32389 | done: |
32390 | p->level--; |
32391 | return _res; |
32392 | } |
32393 | |
32394 | // _loop0_166: ',' (expressions ['as' star_target]) |
32395 | static asdl_seq * |
32396 | _loop0_166_rule(Parser *p) |
32397 | { |
32398 | if (p->level++ == MAXSTACK) { |
32399 | p->error_indicator = 1; |
32400 | PyErr_NoMemory(); |
32401 | } |
32402 | if (p->error_indicator) { |
32403 | p->level--; |
32404 | return NULL; |
32405 | } |
32406 | void *_res = NULL; |
32407 | int _mark = p->mark; |
32408 | int _start_mark = p->mark; |
32409 | void **_children = PyMem_Malloc(sizeof(void *)); |
32410 | if (!_children) { |
32411 | p->error_indicator = 1; |
32412 | PyErr_NoMemory(); |
32413 | p->level--; |
32414 | return NULL; |
32415 | } |
32416 | Py_ssize_t _children_capacity = 1; |
32417 | Py_ssize_t _n = 0; |
32418 | { // ',' (expressions ['as' star_target]) |
32419 | if (p->error_indicator) { |
32420 | p->level--; |
32421 | return NULL; |
32422 | } |
32423 | D(fprintf(stderr, "%*c> _loop0_166[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])" )); |
32424 | Token * _literal; |
32425 | void *elem; |
32426 | while ( |
32427 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
32428 | && |
32429 | (elem = _tmp_199_rule(p)) // expressions ['as' star_target] |
32430 | ) |
32431 | { |
32432 | _res = elem; |
32433 | if (_res == NULL && PyErr_Occurred()) { |
32434 | p->error_indicator = 1; |
32435 | PyMem_Free(_children); |
32436 | p->level--; |
32437 | return NULL; |
32438 | } |
32439 | if (_n == _children_capacity) { |
32440 | _children_capacity *= 2; |
32441 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32442 | if (!_new_children) { |
32443 | p->error_indicator = 1; |
32444 | PyErr_NoMemory(); |
32445 | p->level--; |
32446 | return NULL; |
32447 | } |
32448 | _children = _new_children; |
32449 | } |
32450 | _children[_n++] = _res; |
32451 | _mark = p->mark; |
32452 | } |
32453 | p->mark = _mark; |
32454 | D(fprintf(stderr, "%*c%s _loop0_166[%d-%d]: %s failed!\n" , p->level, ' ', |
32455 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' (expressions ['as' star_target])" )); |
32456 | } |
32457 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32458 | if (!_seq) { |
32459 | PyMem_Free(_children); |
32460 | p->error_indicator = 1; |
32461 | PyErr_NoMemory(); |
32462 | p->level--; |
32463 | return NULL; |
32464 | } |
32465 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32466 | PyMem_Free(_children); |
32467 | _PyPegen_insert_memo(p, _start_mark, _loop0_166_type, _seq); |
32468 | p->level--; |
32469 | return _seq; |
32470 | } |
32471 | |
32472 | // _gather_165: (expressions ['as' star_target]) _loop0_166 |
32473 | static asdl_seq * |
32474 | _gather_165_rule(Parser *p) |
32475 | { |
32476 | if (p->level++ == MAXSTACK) { |
32477 | p->error_indicator = 1; |
32478 | PyErr_NoMemory(); |
32479 | } |
32480 | if (p->error_indicator) { |
32481 | p->level--; |
32482 | return NULL; |
32483 | } |
32484 | asdl_seq * _res = NULL; |
32485 | int _mark = p->mark; |
32486 | { // (expressions ['as' star_target]) _loop0_166 |
32487 | if (p->error_indicator) { |
32488 | p->level--; |
32489 | return NULL; |
32490 | } |
32491 | D(fprintf(stderr, "%*c> _gather_165[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_166" )); |
32492 | void *elem; |
32493 | asdl_seq * seq; |
32494 | if ( |
32495 | (elem = _tmp_199_rule(p)) // expressions ['as' star_target] |
32496 | && |
32497 | (seq = _loop0_166_rule(p)) // _loop0_166 |
32498 | ) |
32499 | { |
32500 | D(fprintf(stderr, "%*c+ _gather_165[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_166" )); |
32501 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
32502 | goto done; |
32503 | } |
32504 | p->mark = _mark; |
32505 | D(fprintf(stderr, "%*c%s _gather_165[%d-%d]: %s failed!\n" , p->level, ' ', |
32506 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(expressions ['as' star_target]) _loop0_166" )); |
32507 | } |
32508 | _res = NULL; |
32509 | done: |
32510 | p->level--; |
32511 | return _res; |
32512 | } |
32513 | |
32514 | // _loop0_168: ',' (expression ['as' star_target]) |
32515 | static asdl_seq * |
32516 | _loop0_168_rule(Parser *p) |
32517 | { |
32518 | if (p->level++ == MAXSTACK) { |
32519 | p->error_indicator = 1; |
32520 | PyErr_NoMemory(); |
32521 | } |
32522 | if (p->error_indicator) { |
32523 | p->level--; |
32524 | return NULL; |
32525 | } |
32526 | void *_res = NULL; |
32527 | int _mark = p->mark; |
32528 | int _start_mark = p->mark; |
32529 | void **_children = PyMem_Malloc(sizeof(void *)); |
32530 | if (!_children) { |
32531 | p->error_indicator = 1; |
32532 | PyErr_NoMemory(); |
32533 | p->level--; |
32534 | return NULL; |
32535 | } |
32536 | Py_ssize_t _children_capacity = 1; |
32537 | Py_ssize_t _n = 0; |
32538 | { // ',' (expression ['as' star_target]) |
32539 | if (p->error_indicator) { |
32540 | p->level--; |
32541 | return NULL; |
32542 | } |
32543 | D(fprintf(stderr, "%*c> _loop0_168[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])" )); |
32544 | Token * _literal; |
32545 | void *elem; |
32546 | while ( |
32547 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
32548 | && |
32549 | (elem = _tmp_200_rule(p)) // expression ['as' star_target] |
32550 | ) |
32551 | { |
32552 | _res = elem; |
32553 | if (_res == NULL && PyErr_Occurred()) { |
32554 | p->error_indicator = 1; |
32555 | PyMem_Free(_children); |
32556 | p->level--; |
32557 | return NULL; |
32558 | } |
32559 | if (_n == _children_capacity) { |
32560 | _children_capacity *= 2; |
32561 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32562 | if (!_new_children) { |
32563 | p->error_indicator = 1; |
32564 | PyErr_NoMemory(); |
32565 | p->level--; |
32566 | return NULL; |
32567 | } |
32568 | _children = _new_children; |
32569 | } |
32570 | _children[_n++] = _res; |
32571 | _mark = p->mark; |
32572 | } |
32573 | p->mark = _mark; |
32574 | D(fprintf(stderr, "%*c%s _loop0_168[%d-%d]: %s failed!\n" , p->level, ' ', |
32575 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' (expression ['as' star_target])" )); |
32576 | } |
32577 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32578 | if (!_seq) { |
32579 | PyMem_Free(_children); |
32580 | p->error_indicator = 1; |
32581 | PyErr_NoMemory(); |
32582 | p->level--; |
32583 | return NULL; |
32584 | } |
32585 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32586 | PyMem_Free(_children); |
32587 | _PyPegen_insert_memo(p, _start_mark, _loop0_168_type, _seq); |
32588 | p->level--; |
32589 | return _seq; |
32590 | } |
32591 | |
32592 | // _gather_167: (expression ['as' star_target]) _loop0_168 |
32593 | static asdl_seq * |
32594 | _gather_167_rule(Parser *p) |
32595 | { |
32596 | if (p->level++ == MAXSTACK) { |
32597 | p->error_indicator = 1; |
32598 | PyErr_NoMemory(); |
32599 | } |
32600 | if (p->error_indicator) { |
32601 | p->level--; |
32602 | return NULL; |
32603 | } |
32604 | asdl_seq * _res = NULL; |
32605 | int _mark = p->mark; |
32606 | { // (expression ['as' star_target]) _loop0_168 |
32607 | if (p->error_indicator) { |
32608 | p->level--; |
32609 | return NULL; |
32610 | } |
32611 | D(fprintf(stderr, "%*c> _gather_167[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_168" )); |
32612 | void *elem; |
32613 | asdl_seq * seq; |
32614 | if ( |
32615 | (elem = _tmp_200_rule(p)) // expression ['as' star_target] |
32616 | && |
32617 | (seq = _loop0_168_rule(p)) // _loop0_168 |
32618 | ) |
32619 | { |
32620 | D(fprintf(stderr, "%*c+ _gather_167[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_168" )); |
32621 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
32622 | goto done; |
32623 | } |
32624 | p->mark = _mark; |
32625 | D(fprintf(stderr, "%*c%s _gather_167[%d-%d]: %s failed!\n" , p->level, ' ', |
32626 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(expression ['as' star_target]) _loop0_168" )); |
32627 | } |
32628 | _res = NULL; |
32629 | done: |
32630 | p->level--; |
32631 | return _res; |
32632 | } |
32633 | |
32634 | // _loop0_170: ',' (expressions ['as' star_target]) |
32635 | static asdl_seq * |
32636 | _loop0_170_rule(Parser *p) |
32637 | { |
32638 | if (p->level++ == MAXSTACK) { |
32639 | p->error_indicator = 1; |
32640 | PyErr_NoMemory(); |
32641 | } |
32642 | if (p->error_indicator) { |
32643 | p->level--; |
32644 | return NULL; |
32645 | } |
32646 | void *_res = NULL; |
32647 | int _mark = p->mark; |
32648 | int _start_mark = p->mark; |
32649 | void **_children = PyMem_Malloc(sizeof(void *)); |
32650 | if (!_children) { |
32651 | p->error_indicator = 1; |
32652 | PyErr_NoMemory(); |
32653 | p->level--; |
32654 | return NULL; |
32655 | } |
32656 | Py_ssize_t _children_capacity = 1; |
32657 | Py_ssize_t _n = 0; |
32658 | { // ',' (expressions ['as' star_target]) |
32659 | if (p->error_indicator) { |
32660 | p->level--; |
32661 | return NULL; |
32662 | } |
32663 | D(fprintf(stderr, "%*c> _loop0_170[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])" )); |
32664 | Token * _literal; |
32665 | void *elem; |
32666 | while ( |
32667 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
32668 | && |
32669 | (elem = _tmp_201_rule(p)) // expressions ['as' star_target] |
32670 | ) |
32671 | { |
32672 | _res = elem; |
32673 | if (_res == NULL && PyErr_Occurred()) { |
32674 | p->error_indicator = 1; |
32675 | PyMem_Free(_children); |
32676 | p->level--; |
32677 | return NULL; |
32678 | } |
32679 | if (_n == _children_capacity) { |
32680 | _children_capacity *= 2; |
32681 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32682 | if (!_new_children) { |
32683 | p->error_indicator = 1; |
32684 | PyErr_NoMemory(); |
32685 | p->level--; |
32686 | return NULL; |
32687 | } |
32688 | _children = _new_children; |
32689 | } |
32690 | _children[_n++] = _res; |
32691 | _mark = p->mark; |
32692 | } |
32693 | p->mark = _mark; |
32694 | D(fprintf(stderr, "%*c%s _loop0_170[%d-%d]: %s failed!\n" , p->level, ' ', |
32695 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' (expressions ['as' star_target])" )); |
32696 | } |
32697 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32698 | if (!_seq) { |
32699 | PyMem_Free(_children); |
32700 | p->error_indicator = 1; |
32701 | PyErr_NoMemory(); |
32702 | p->level--; |
32703 | return NULL; |
32704 | } |
32705 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32706 | PyMem_Free(_children); |
32707 | _PyPegen_insert_memo(p, _start_mark, _loop0_170_type, _seq); |
32708 | p->level--; |
32709 | return _seq; |
32710 | } |
32711 | |
32712 | // _gather_169: (expressions ['as' star_target]) _loop0_170 |
32713 | static asdl_seq * |
32714 | _gather_169_rule(Parser *p) |
32715 | { |
32716 | if (p->level++ == MAXSTACK) { |
32717 | p->error_indicator = 1; |
32718 | PyErr_NoMemory(); |
32719 | } |
32720 | if (p->error_indicator) { |
32721 | p->level--; |
32722 | return NULL; |
32723 | } |
32724 | asdl_seq * _res = NULL; |
32725 | int _mark = p->mark; |
32726 | { // (expressions ['as' star_target]) _loop0_170 |
32727 | if (p->error_indicator) { |
32728 | p->level--; |
32729 | return NULL; |
32730 | } |
32731 | D(fprintf(stderr, "%*c> _gather_169[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_170" )); |
32732 | void *elem; |
32733 | asdl_seq * seq; |
32734 | if ( |
32735 | (elem = _tmp_201_rule(p)) // expressions ['as' star_target] |
32736 | && |
32737 | (seq = _loop0_170_rule(p)) // _loop0_170 |
32738 | ) |
32739 | { |
32740 | D(fprintf(stderr, "%*c+ _gather_169[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_170" )); |
32741 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
32742 | goto done; |
32743 | } |
32744 | p->mark = _mark; |
32745 | D(fprintf(stderr, "%*c%s _gather_169[%d-%d]: %s failed!\n" , p->level, ' ', |
32746 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(expressions ['as' star_target]) _loop0_170" )); |
32747 | } |
32748 | _res = NULL; |
32749 | done: |
32750 | p->level--; |
32751 | return _res; |
32752 | } |
32753 | |
32754 | // _tmp_171: 'except' | 'finally' |
32755 | static void * |
32756 | _tmp_171_rule(Parser *p) |
32757 | { |
32758 | if (p->level++ == MAXSTACK) { |
32759 | p->error_indicator = 1; |
32760 | PyErr_NoMemory(); |
32761 | } |
32762 | if (p->error_indicator) { |
32763 | p->level--; |
32764 | return NULL; |
32765 | } |
32766 | void * _res = NULL; |
32767 | int _mark = p->mark; |
32768 | { // 'except' |
32769 | if (p->error_indicator) { |
32770 | p->level--; |
32771 | return NULL; |
32772 | } |
32773 | D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'except'" )); |
32774 | Token * _keyword; |
32775 | if ( |
32776 | (_keyword = _PyPegen_expect_token(p, 521)) // token='except' |
32777 | ) |
32778 | { |
32779 | D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'except'" )); |
32780 | _res = _keyword; |
32781 | goto done; |
32782 | } |
32783 | p->mark = _mark; |
32784 | D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n" , p->level, ' ', |
32785 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'except'" )); |
32786 | } |
32787 | { // 'finally' |
32788 | if (p->error_indicator) { |
32789 | p->level--; |
32790 | return NULL; |
32791 | } |
32792 | D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'finally'" )); |
32793 | Token * _keyword; |
32794 | if ( |
32795 | (_keyword = _PyPegen_expect_token(p, 522)) // token='finally' |
32796 | ) |
32797 | { |
32798 | D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'finally'" )); |
32799 | _res = _keyword; |
32800 | goto done; |
32801 | } |
32802 | p->mark = _mark; |
32803 | D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n" , p->level, ' ', |
32804 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'finally'" )); |
32805 | } |
32806 | _res = NULL; |
32807 | done: |
32808 | p->level--; |
32809 | return _res; |
32810 | } |
32811 | |
32812 | // _tmp_172: 'as' NAME |
32813 | static void * |
32814 | _tmp_172_rule(Parser *p) |
32815 | { |
32816 | if (p->level++ == MAXSTACK) { |
32817 | p->error_indicator = 1; |
32818 | PyErr_NoMemory(); |
32819 | } |
32820 | if (p->error_indicator) { |
32821 | p->level--; |
32822 | return NULL; |
32823 | } |
32824 | void * _res = NULL; |
32825 | int _mark = p->mark; |
32826 | { // 'as' NAME |
32827 | if (p->error_indicator) { |
32828 | p->level--; |
32829 | return NULL; |
32830 | } |
32831 | D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'as' NAME" )); |
32832 | Token * _keyword; |
32833 | expr_ty name_var; |
32834 | if ( |
32835 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
32836 | && |
32837 | (name_var = _PyPegen_name_token(p)) // NAME |
32838 | ) |
32839 | { |
32840 | D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'as' NAME" )); |
32841 | _res = _PyPegen_dummy_name(p, _keyword, name_var); |
32842 | goto done; |
32843 | } |
32844 | p->mark = _mark; |
32845 | D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n" , p->level, ' ', |
32846 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'as' NAME" )); |
32847 | } |
32848 | _res = NULL; |
32849 | done: |
32850 | p->level--; |
32851 | return _res; |
32852 | } |
32853 | |
32854 | // _tmp_173: 'as' NAME |
32855 | static void * |
32856 | _tmp_173_rule(Parser *p) |
32857 | { |
32858 | if (p->level++ == MAXSTACK) { |
32859 | p->error_indicator = 1; |
32860 | PyErr_NoMemory(); |
32861 | } |
32862 | if (p->error_indicator) { |
32863 | p->level--; |
32864 | return NULL; |
32865 | } |
32866 | void * _res = NULL; |
32867 | int _mark = p->mark; |
32868 | { // 'as' NAME |
32869 | if (p->error_indicator) { |
32870 | p->level--; |
32871 | return NULL; |
32872 | } |
32873 | D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'as' NAME" )); |
32874 | Token * _keyword; |
32875 | expr_ty name_var; |
32876 | if ( |
32877 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
32878 | && |
32879 | (name_var = _PyPegen_name_token(p)) // NAME |
32880 | ) |
32881 | { |
32882 | D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'as' NAME" )); |
32883 | _res = _PyPegen_dummy_name(p, _keyword, name_var); |
32884 | goto done; |
32885 | } |
32886 | p->mark = _mark; |
32887 | D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n" , p->level, ' ', |
32888 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'as' NAME" )); |
32889 | } |
32890 | _res = NULL; |
32891 | done: |
32892 | p->level--; |
32893 | return _res; |
32894 | } |
32895 | |
32896 | // _tmp_174: 'as' NAME |
32897 | static void * |
32898 | _tmp_174_rule(Parser *p) |
32899 | { |
32900 | if (p->level++ == MAXSTACK) { |
32901 | p->error_indicator = 1; |
32902 | PyErr_NoMemory(); |
32903 | } |
32904 | if (p->error_indicator) { |
32905 | p->level--; |
32906 | return NULL; |
32907 | } |
32908 | void * _res = NULL; |
32909 | int _mark = p->mark; |
32910 | { // 'as' NAME |
32911 | if (p->error_indicator) { |
32912 | p->level--; |
32913 | return NULL; |
32914 | } |
32915 | D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'as' NAME" )); |
32916 | Token * _keyword; |
32917 | expr_ty name_var; |
32918 | if ( |
32919 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
32920 | && |
32921 | (name_var = _PyPegen_name_token(p)) // NAME |
32922 | ) |
32923 | { |
32924 | D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'as' NAME" )); |
32925 | _res = _PyPegen_dummy_name(p, _keyword, name_var); |
32926 | goto done; |
32927 | } |
32928 | p->mark = _mark; |
32929 | D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n" , p->level, ' ', |
32930 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'as' NAME" )); |
32931 | } |
32932 | _res = NULL; |
32933 | done: |
32934 | p->level--; |
32935 | return _res; |
32936 | } |
32937 | |
32938 | // _tmp_175: positional_patterns ',' |
32939 | static void * |
32940 | _tmp_175_rule(Parser *p) |
32941 | { |
32942 | if (p->level++ == MAXSTACK) { |
32943 | p->error_indicator = 1; |
32944 | PyErr_NoMemory(); |
32945 | } |
32946 | if (p->error_indicator) { |
32947 | p->level--; |
32948 | return NULL; |
32949 | } |
32950 | void * _res = NULL; |
32951 | int _mark = p->mark; |
32952 | { // positional_patterns ',' |
32953 | if (p->error_indicator) { |
32954 | p->level--; |
32955 | return NULL; |
32956 | } |
32957 | D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "positional_patterns ','" )); |
32958 | Token * _literal; |
32959 | asdl_pattern_seq* positional_patterns_var; |
32960 | if ( |
32961 | (positional_patterns_var = positional_patterns_rule(p)) // positional_patterns |
32962 | && |
32963 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
32964 | ) |
32965 | { |
32966 | D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "positional_patterns ','" )); |
32967 | _res = _PyPegen_dummy_name(p, positional_patterns_var, _literal); |
32968 | goto done; |
32969 | } |
32970 | p->mark = _mark; |
32971 | D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n" , p->level, ' ', |
32972 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "positional_patterns ','" )); |
32973 | } |
32974 | _res = NULL; |
32975 | done: |
32976 | p->level--; |
32977 | return _res; |
32978 | } |
32979 | |
32980 | // _tmp_176: '->' expression |
32981 | static void * |
32982 | _tmp_176_rule(Parser *p) |
32983 | { |
32984 | if (p->level++ == MAXSTACK) { |
32985 | p->error_indicator = 1; |
32986 | PyErr_NoMemory(); |
32987 | } |
32988 | if (p->error_indicator) { |
32989 | p->level--; |
32990 | return NULL; |
32991 | } |
32992 | void * _res = NULL; |
32993 | int _mark = p->mark; |
32994 | { // '->' expression |
32995 | if (p->error_indicator) { |
32996 | p->level--; |
32997 | return NULL; |
32998 | } |
32999 | D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'->' expression" )); |
33000 | Token * _literal; |
33001 | expr_ty expression_var; |
33002 | if ( |
33003 | (_literal = _PyPegen_expect_token(p, 51)) // token='->' |
33004 | && |
33005 | (expression_var = expression_rule(p)) // expression |
33006 | ) |
33007 | { |
33008 | D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'->' expression" )); |
33009 | _res = _PyPegen_dummy_name(p, _literal, expression_var); |
33010 | goto done; |
33011 | } |
33012 | p->mark = _mark; |
33013 | D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n" , p->level, ' ', |
33014 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'->' expression" )); |
33015 | } |
33016 | _res = NULL; |
33017 | done: |
33018 | p->level--; |
33019 | return _res; |
33020 | } |
33021 | |
33022 | // _tmp_177: '(' arguments? ')' |
33023 | static void * |
33024 | _tmp_177_rule(Parser *p) |
33025 | { |
33026 | if (p->level++ == MAXSTACK) { |
33027 | p->error_indicator = 1; |
33028 | PyErr_NoMemory(); |
33029 | } |
33030 | if (p->error_indicator) { |
33031 | p->level--; |
33032 | return NULL; |
33033 | } |
33034 | void * _res = NULL; |
33035 | int _mark = p->mark; |
33036 | { // '(' arguments? ')' |
33037 | if (p->error_indicator) { |
33038 | p->level--; |
33039 | return NULL; |
33040 | } |
33041 | D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'(' arguments? ')'" )); |
33042 | Token * _literal; |
33043 | Token * _literal_1; |
33044 | void *_opt_var; |
33045 | UNUSED(_opt_var); // Silence compiler warnings |
33046 | if ( |
33047 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
33048 | && |
33049 | (_opt_var = arguments_rule(p), !p->error_indicator) // arguments? |
33050 | && |
33051 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
33052 | ) |
33053 | { |
33054 | D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'(' arguments? ')'" )); |
33055 | _res = _PyPegen_dummy_name(p, _literal, _opt_var, _literal_1); |
33056 | goto done; |
33057 | } |
33058 | p->mark = _mark; |
33059 | D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n" , p->level, ' ', |
33060 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'(' arguments? ')'" )); |
33061 | } |
33062 | _res = NULL; |
33063 | done: |
33064 | p->level--; |
33065 | return _res; |
33066 | } |
33067 | |
33068 | // _loop0_179: ',' double_starred_kvpair |
33069 | static asdl_seq * |
33070 | _loop0_179_rule(Parser *p) |
33071 | { |
33072 | if (p->level++ == MAXSTACK) { |
33073 | p->error_indicator = 1; |
33074 | PyErr_NoMemory(); |
33075 | } |
33076 | if (p->error_indicator) { |
33077 | p->level--; |
33078 | return NULL; |
33079 | } |
33080 | void *_res = NULL; |
33081 | int _mark = p->mark; |
33082 | int _start_mark = p->mark; |
33083 | void **_children = PyMem_Malloc(sizeof(void *)); |
33084 | if (!_children) { |
33085 | p->error_indicator = 1; |
33086 | PyErr_NoMemory(); |
33087 | p->level--; |
33088 | return NULL; |
33089 | } |
33090 | Py_ssize_t _children_capacity = 1; |
33091 | Py_ssize_t _n = 0; |
33092 | { // ',' double_starred_kvpair |
33093 | if (p->error_indicator) { |
33094 | p->level--; |
33095 | return NULL; |
33096 | } |
33097 | D(fprintf(stderr, "%*c> _loop0_179[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' double_starred_kvpair" )); |
33098 | Token * _literal; |
33099 | KeyValuePair* elem; |
33100 | while ( |
33101 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
33102 | && |
33103 | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
33104 | ) |
33105 | { |
33106 | _res = elem; |
33107 | if (_res == NULL && PyErr_Occurred()) { |
33108 | p->error_indicator = 1; |
33109 | PyMem_Free(_children); |
33110 | p->level--; |
33111 | return NULL; |
33112 | } |
33113 | if (_n == _children_capacity) { |
33114 | _children_capacity *= 2; |
33115 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
33116 | if (!_new_children) { |
33117 | p->error_indicator = 1; |
33118 | PyErr_NoMemory(); |
33119 | p->level--; |
33120 | return NULL; |
33121 | } |
33122 | _children = _new_children; |
33123 | } |
33124 | _children[_n++] = _res; |
33125 | _mark = p->mark; |
33126 | } |
33127 | p->mark = _mark; |
33128 | D(fprintf(stderr, "%*c%s _loop0_179[%d-%d]: %s failed!\n" , p->level, ' ', |
33129 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' double_starred_kvpair" )); |
33130 | } |
33131 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
33132 | if (!_seq) { |
33133 | PyMem_Free(_children); |
33134 | p->error_indicator = 1; |
33135 | PyErr_NoMemory(); |
33136 | p->level--; |
33137 | return NULL; |
33138 | } |
33139 | for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
33140 | PyMem_Free(_children); |
33141 | _PyPegen_insert_memo(p, _start_mark, _loop0_179_type, _seq); |
33142 | p->level--; |
33143 | return _seq; |
33144 | } |
33145 | |
33146 | // _gather_178: double_starred_kvpair _loop0_179 |
33147 | static asdl_seq * |
33148 | _gather_178_rule(Parser *p) |
33149 | { |
33150 | if (p->level++ == MAXSTACK) { |
33151 | p->error_indicator = 1; |
33152 | PyErr_NoMemory(); |
33153 | } |
33154 | if (p->error_indicator) { |
33155 | p->level--; |
33156 | return NULL; |
33157 | } |
33158 | asdl_seq * _res = NULL; |
33159 | int _mark = p->mark; |
33160 | { // double_starred_kvpair _loop0_179 |
33161 | if (p->error_indicator) { |
33162 | p->level--; |
33163 | return NULL; |
33164 | } |
33165 | D(fprintf(stderr, "%*c> _gather_178[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_179" )); |
33166 | KeyValuePair* elem; |
33167 | asdl_seq * seq; |
33168 | if ( |
33169 | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
33170 | && |
33171 | (seq = _loop0_179_rule(p)) // _loop0_179 |
33172 | ) |
33173 | { |
33174 | D(fprintf(stderr, "%*c+ _gather_178[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_179" )); |
33175 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
33176 | goto done; |
33177 | } |
33178 | p->mark = _mark; |
33179 | D(fprintf(stderr, "%*c%s _gather_178[%d-%d]: %s failed!\n" , p->level, ' ', |
33180 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "double_starred_kvpair _loop0_179" )); |
33181 | } |
33182 | _res = NULL; |
33183 | done: |
33184 | p->level--; |
33185 | return _res; |
33186 | } |
33187 | |
33188 | // _tmp_180: '}' | ',' |
33189 | static void * |
33190 | _tmp_180_rule(Parser *p) |
33191 | { |
33192 | if (p->level++ == MAXSTACK) { |
33193 | p->error_indicator = 1; |
33194 | PyErr_NoMemory(); |
33195 | } |
33196 | if (p->error_indicator) { |
33197 | p->level--; |
33198 | return NULL; |
33199 | } |
33200 | void * _res = NULL; |
33201 | int _mark = p->mark; |
33202 | { // '}' |
33203 | if (p->error_indicator) { |
33204 | p->level--; |
33205 | return NULL; |
33206 | } |
33207 | D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'}'" )); |
33208 | Token * _literal; |
33209 | if ( |
33210 | (_literal = _PyPegen_expect_token(p, 26)) // token='}' |
33211 | ) |
33212 | { |
33213 | D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'}'" )); |
33214 | _res = _literal; |
33215 | goto done; |
33216 | } |
33217 | p->mark = _mark; |
33218 | D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n" , p->level, ' ', |
33219 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'}'" )); |
33220 | } |
33221 | { // ',' |
33222 | if (p->error_indicator) { |
33223 | p->level--; |
33224 | return NULL; |
33225 | } |
33226 | D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "','" )); |
33227 | Token * _literal; |
33228 | if ( |
33229 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
33230 | ) |
33231 | { |
33232 | D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "','" )); |
33233 | _res = _literal; |
33234 | goto done; |
33235 | } |
33236 | p->mark = _mark; |
33237 | D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n" , p->level, ' ', |
33238 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "','" )); |
33239 | } |
33240 | _res = NULL; |
33241 | done: |
33242 | p->level--; |
33243 | return _res; |
33244 | } |
33245 | |
33246 | // _tmp_181: star_targets '=' |
33247 | static void * |
33248 | _tmp_181_rule(Parser *p) |
33249 | { |
33250 | if (p->level++ == MAXSTACK) { |
33251 | p->error_indicator = 1; |
33252 | PyErr_NoMemory(); |
33253 | } |
33254 | if (p->error_indicator) { |
33255 | p->level--; |
33256 | return NULL; |
33257 | } |
33258 | void * _res = NULL; |
33259 | int _mark = p->mark; |
33260 | { // star_targets '=' |
33261 | if (p->error_indicator) { |
33262 | p->level--; |
33263 | return NULL; |
33264 | } |
33265 | D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_targets '='" )); |
33266 | Token * _literal; |
33267 | expr_ty z; |
33268 | if ( |
33269 | (z = star_targets_rule(p)) // star_targets |
33270 | && |
33271 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
33272 | ) |
33273 | { |
33274 | D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_targets '='" )); |
33275 | _res = z; |
33276 | if (_res == NULL && PyErr_Occurred()) { |
33277 | p->error_indicator = 1; |
33278 | p->level--; |
33279 | return NULL; |
33280 | } |
33281 | goto done; |
33282 | } |
33283 | p->mark = _mark; |
33284 | D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n" , p->level, ' ', |
33285 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_targets '='" )); |
33286 | } |
33287 | _res = NULL; |
33288 | done: |
33289 | p->level--; |
33290 | return _res; |
33291 | } |
33292 | |
33293 | // _tmp_182: '.' | '...' |
33294 | static void * |
33295 | _tmp_182_rule(Parser *p) |
33296 | { |
33297 | if (p->level++ == MAXSTACK) { |
33298 | p->error_indicator = 1; |
33299 | PyErr_NoMemory(); |
33300 | } |
33301 | if (p->error_indicator) { |
33302 | p->level--; |
33303 | return NULL; |
33304 | } |
33305 | void * _res = NULL; |
33306 | int _mark = p->mark; |
33307 | { // '.' |
33308 | if (p->error_indicator) { |
33309 | p->level--; |
33310 | return NULL; |
33311 | } |
33312 | D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'.'" )); |
33313 | Token * _literal; |
33314 | if ( |
33315 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
33316 | ) |
33317 | { |
33318 | D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'.'" )); |
33319 | _res = _literal; |
33320 | goto done; |
33321 | } |
33322 | p->mark = _mark; |
33323 | D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n" , p->level, ' ', |
33324 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'.'" )); |
33325 | } |
33326 | { // '...' |
33327 | if (p->error_indicator) { |
33328 | p->level--; |
33329 | return NULL; |
33330 | } |
33331 | D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'...'" )); |
33332 | Token * _literal; |
33333 | if ( |
33334 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
33335 | ) |
33336 | { |
33337 | D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'...'" )); |
33338 | _res = _literal; |
33339 | goto done; |
33340 | } |
33341 | p->mark = _mark; |
33342 | D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n" , p->level, ' ', |
33343 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'...'" )); |
33344 | } |
33345 | _res = NULL; |
33346 | done: |
33347 | p->level--; |
33348 | return _res; |
33349 | } |
33350 | |
33351 | // _tmp_183: '.' | '...' |
33352 | static void * |
33353 | _tmp_183_rule(Parser *p) |
33354 | { |
33355 | if (p->level++ == MAXSTACK) { |
33356 | p->error_indicator = 1; |
33357 | PyErr_NoMemory(); |
33358 | } |
33359 | if (p->error_indicator) { |
33360 | p->level--; |
33361 | return NULL; |
33362 | } |
33363 | void * _res = NULL; |
33364 | int _mark = p->mark; |
33365 | { // '.' |
33366 | if (p->error_indicator) { |
33367 | p->level--; |
33368 | return NULL; |
33369 | } |
33370 | D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'.'" )); |
33371 | Token * _literal; |
33372 | if ( |
33373 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
33374 | ) |
33375 | { |
33376 | D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'.'" )); |
33377 | _res = _literal; |
33378 | goto done; |
33379 | } |
33380 | p->mark = _mark; |
33381 | D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n" , p->level, ' ', |
33382 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'.'" )); |
33383 | } |
33384 | { // '...' |
33385 | if (p->error_indicator) { |
33386 | p->level--; |
33387 | return NULL; |
33388 | } |
33389 | D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'...'" )); |
33390 | Token * _literal; |
33391 | if ( |
33392 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
33393 | ) |
33394 | { |
33395 | D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'...'" )); |
33396 | _res = _literal; |
33397 | goto done; |
33398 | } |
33399 | p->mark = _mark; |
33400 | D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n" , p->level, ' ', |
33401 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'...'" )); |
33402 | } |
33403 | _res = NULL; |
33404 | done: |
33405 | p->level--; |
33406 | return _res; |
33407 | } |
33408 | |
33409 | // _tmp_184: '@' named_expression NEWLINE |
33410 | static void * |
33411 | _tmp_184_rule(Parser *p) |
33412 | { |
33413 | if (p->level++ == MAXSTACK) { |
33414 | p->error_indicator = 1; |
33415 | PyErr_NoMemory(); |
33416 | } |
33417 | if (p->error_indicator) { |
33418 | p->level--; |
33419 | return NULL; |
33420 | } |
33421 | void * _res = NULL; |
33422 | int _mark = p->mark; |
33423 | { // '@' named_expression NEWLINE |
33424 | if (p->error_indicator) { |
33425 | p->level--; |
33426 | return NULL; |
33427 | } |
33428 | D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE" )); |
33429 | Token * _literal; |
33430 | expr_ty f; |
33431 | Token * newline_var; |
33432 | if ( |
33433 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
33434 | && |
33435 | (f = named_expression_rule(p)) // named_expression |
33436 | && |
33437 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
33438 | ) |
33439 | { |
33440 | D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE" )); |
33441 | _res = f; |
33442 | if (_res == NULL && PyErr_Occurred()) { |
33443 | p->error_indicator = 1; |
33444 | p->level--; |
33445 | return NULL; |
33446 | } |
33447 | goto done; |
33448 | } |
33449 | p->mark = _mark; |
33450 | D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n" , p->level, ' ', |
33451 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'@' named_expression NEWLINE" )); |
33452 | } |
33453 | _res = NULL; |
33454 | done: |
33455 | p->level--; |
33456 | return _res; |
33457 | } |
33458 | |
33459 | // _tmp_185: ',' star_expression |
33460 | static void * |
33461 | _tmp_185_rule(Parser *p) |
33462 | { |
33463 | if (p->level++ == MAXSTACK) { |
33464 | p->error_indicator = 1; |
33465 | PyErr_NoMemory(); |
33466 | } |
33467 | if (p->error_indicator) { |
33468 | p->level--; |
33469 | return NULL; |
33470 | } |
33471 | void * _res = NULL; |
33472 | int _mark = p->mark; |
33473 | { // ',' star_expression |
33474 | if (p->error_indicator) { |
33475 | p->level--; |
33476 | return NULL; |
33477 | } |
33478 | D(fprintf(stderr, "%*c> _tmp_185[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' star_expression" )); |
33479 | Token * _literal; |
33480 | expr_ty c; |
33481 | if ( |
33482 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
33483 | && |
33484 | (c = star_expression_rule(p)) // star_expression |
33485 | ) |
33486 | { |
33487 | D(fprintf(stderr, "%*c+ _tmp_185[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "',' star_expression" )); |
33488 | _res = c; |
33489 | if (_res == NULL && PyErr_Occurred()) { |
33490 | p->error_indicator = 1; |
33491 | p->level--; |
33492 | return NULL; |
33493 | } |
33494 | goto done; |
33495 | } |
33496 | p->mark = _mark; |
33497 | D(fprintf(stderr, "%*c%s _tmp_185[%d-%d]: %s failed!\n" , p->level, ' ', |
33498 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' star_expression" )); |
33499 | } |
33500 | _res = NULL; |
33501 | done: |
33502 | p->level--; |
33503 | return _res; |
33504 | } |
33505 | |
33506 | // _tmp_186: ',' expression |
33507 | static void * |
33508 | _tmp_186_rule(Parser *p) |
33509 | { |
33510 | if (p->level++ == MAXSTACK) { |
33511 | p->error_indicator = 1; |
33512 | PyErr_NoMemory(); |
33513 | } |
33514 | if (p->error_indicator) { |
33515 | p->level--; |
33516 | return NULL; |
33517 | } |
33518 | void * _res = NULL; |
33519 | int _mark = p->mark; |
33520 | { // ',' expression |
33521 | if (p->error_indicator) { |
33522 | p->level--; |
33523 | return NULL; |
33524 | } |
33525 | D(fprintf(stderr, "%*c> _tmp_186[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' expression" )); |
33526 | Token * _literal; |
33527 | expr_ty c; |
33528 | if ( |
33529 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
33530 | && |
33531 | (c = expression_rule(p)) // expression |
33532 | ) |
33533 | { |
33534 | D(fprintf(stderr, "%*c+ _tmp_186[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "',' expression" )); |
33535 | _res = c; |
33536 | if (_res == NULL && PyErr_Occurred()) { |
33537 | p->error_indicator = 1; |
33538 | p->level--; |
33539 | return NULL; |
33540 | } |
33541 | goto done; |
33542 | } |
33543 | p->mark = _mark; |
33544 | D(fprintf(stderr, "%*c%s _tmp_186[%d-%d]: %s failed!\n" , p->level, ' ', |
33545 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' expression" )); |
33546 | } |
33547 | _res = NULL; |
33548 | done: |
33549 | p->level--; |
33550 | return _res; |
33551 | } |
33552 | |
33553 | // _tmp_187: 'or' conjunction |
33554 | static void * |
33555 | _tmp_187_rule(Parser *p) |
33556 | { |
33557 | if (p->level++ == MAXSTACK) { |
33558 | p->error_indicator = 1; |
33559 | PyErr_NoMemory(); |
33560 | } |
33561 | if (p->error_indicator) { |
33562 | p->level--; |
33563 | return NULL; |
33564 | } |
33565 | void * _res = NULL; |
33566 | int _mark = p->mark; |
33567 | { // 'or' conjunction |
33568 | if (p->error_indicator) { |
33569 | p->level--; |
33570 | return NULL; |
33571 | } |
33572 | D(fprintf(stderr, "%*c> _tmp_187[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'or' conjunction" )); |
33573 | Token * _keyword; |
33574 | expr_ty c; |
33575 | if ( |
33576 | (_keyword = _PyPegen_expect_token(p, 531)) // token='or' |
33577 | && |
33578 | (c = conjunction_rule(p)) // conjunction |
33579 | ) |
33580 | { |
33581 | D(fprintf(stderr, "%*c+ _tmp_187[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'or' conjunction" )); |
33582 | _res = c; |
33583 | if (_res == NULL && PyErr_Occurred()) { |
33584 | p->error_indicator = 1; |
33585 | p->level--; |
33586 | return NULL; |
33587 | } |
33588 | goto done; |
33589 | } |
33590 | p->mark = _mark; |
33591 | D(fprintf(stderr, "%*c%s _tmp_187[%d-%d]: %s failed!\n" , p->level, ' ', |
33592 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'or' conjunction" )); |
33593 | } |
33594 | _res = NULL; |
33595 | done: |
33596 | p->level--; |
33597 | return _res; |
33598 | } |
33599 | |
33600 | // _tmp_188: 'and' inversion |
33601 | static void * |
33602 | _tmp_188_rule(Parser *p) |
33603 | { |
33604 | if (p->level++ == MAXSTACK) { |
33605 | p->error_indicator = 1; |
33606 | PyErr_NoMemory(); |
33607 | } |
33608 | if (p->error_indicator) { |
33609 | p->level--; |
33610 | return NULL; |
33611 | } |
33612 | void * _res = NULL; |
33613 | int _mark = p->mark; |
33614 | { // 'and' inversion |
33615 | if (p->error_indicator) { |
33616 | p->level--; |
33617 | return NULL; |
33618 | } |
33619 | D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'and' inversion" )); |
33620 | Token * _keyword; |
33621 | expr_ty c; |
33622 | if ( |
33623 | (_keyword = _PyPegen_expect_token(p, 532)) // token='and' |
33624 | && |
33625 | (c = inversion_rule(p)) // inversion |
33626 | ) |
33627 | { |
33628 | D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'and' inversion" )); |
33629 | _res = c; |
33630 | if (_res == NULL && PyErr_Occurred()) { |
33631 | p->error_indicator = 1; |
33632 | p->level--; |
33633 | return NULL; |
33634 | } |
33635 | goto done; |
33636 | } |
33637 | p->mark = _mark; |
33638 | D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n" , p->level, ' ', |
33639 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'and' inversion" )); |
33640 | } |
33641 | _res = NULL; |
33642 | done: |
33643 | p->level--; |
33644 | return _res; |
33645 | } |
33646 | |
33647 | // _tmp_189: 'if' disjunction |
33648 | static void * |
33649 | _tmp_189_rule(Parser *p) |
33650 | { |
33651 | if (p->level++ == MAXSTACK) { |
33652 | p->error_indicator = 1; |
33653 | PyErr_NoMemory(); |
33654 | } |
33655 | if (p->error_indicator) { |
33656 | p->level--; |
33657 | return NULL; |
33658 | } |
33659 | void * _res = NULL; |
33660 | int _mark = p->mark; |
33661 | { // 'if' disjunction |
33662 | if (p->error_indicator) { |
33663 | p->level--; |
33664 | return NULL; |
33665 | } |
33666 | D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'if' disjunction" )); |
33667 | Token * _keyword; |
33668 | expr_ty z; |
33669 | if ( |
33670 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
33671 | && |
33672 | (z = disjunction_rule(p)) // disjunction |
33673 | ) |
33674 | { |
33675 | D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'if' disjunction" )); |
33676 | _res = z; |
33677 | if (_res == NULL && PyErr_Occurred()) { |
33678 | p->error_indicator = 1; |
33679 | p->level--; |
33680 | return NULL; |
33681 | } |
33682 | goto done; |
33683 | } |
33684 | p->mark = _mark; |
33685 | D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n" , p->level, ' ', |
33686 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'if' disjunction" )); |
33687 | } |
33688 | _res = NULL; |
33689 | done: |
33690 | p->level--; |
33691 | return _res; |
33692 | } |
33693 | |
33694 | // _tmp_190: 'if' disjunction |
33695 | static void * |
33696 | _tmp_190_rule(Parser *p) |
33697 | { |
33698 | if (p->level++ == MAXSTACK) { |
33699 | p->error_indicator = 1; |
33700 | PyErr_NoMemory(); |
33701 | } |
33702 | if (p->error_indicator) { |
33703 | p->level--; |
33704 | return NULL; |
33705 | } |
33706 | void * _res = NULL; |
33707 | int _mark = p->mark; |
33708 | { // 'if' disjunction |
33709 | if (p->error_indicator) { |
33710 | p->level--; |
33711 | return NULL; |
33712 | } |
33713 | D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'if' disjunction" )); |
33714 | Token * _keyword; |
33715 | expr_ty z; |
33716 | if ( |
33717 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
33718 | && |
33719 | (z = disjunction_rule(p)) // disjunction |
33720 | ) |
33721 | { |
33722 | D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'if' disjunction" )); |
33723 | _res = z; |
33724 | if (_res == NULL && PyErr_Occurred()) { |
33725 | p->error_indicator = 1; |
33726 | p->level--; |
33727 | return NULL; |
33728 | } |
33729 | goto done; |
33730 | } |
33731 | p->mark = _mark; |
33732 | D(fprintf(stderr, "%*c%s _tmp_190[%d-%d]: %s failed!\n" , p->level, ' ', |
33733 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'if' disjunction" )); |
33734 | } |
33735 | _res = NULL; |
33736 | done: |
33737 | p->level--; |
33738 | return _res; |
33739 | } |
33740 | |
33741 | // _tmp_191: starred_expression | (assignment_expression | expression !':=') !'=' |
33742 | static void * |
33743 | _tmp_191_rule(Parser *p) |
33744 | { |
33745 | if (p->level++ == MAXSTACK) { |
33746 | p->error_indicator = 1; |
33747 | PyErr_NoMemory(); |
33748 | } |
33749 | if (p->error_indicator) { |
33750 | p->level--; |
33751 | return NULL; |
33752 | } |
33753 | void * _res = NULL; |
33754 | int _mark = p->mark; |
33755 | { // starred_expression |
33756 | if (p->error_indicator) { |
33757 | p->level--; |
33758 | return NULL; |
33759 | } |
33760 | D(fprintf(stderr, "%*c> _tmp_191[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "starred_expression" )); |
33761 | expr_ty starred_expression_var; |
33762 | if ( |
33763 | (starred_expression_var = starred_expression_rule(p)) // starred_expression |
33764 | ) |
33765 | { |
33766 | D(fprintf(stderr, "%*c+ _tmp_191[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "starred_expression" )); |
33767 | _res = starred_expression_var; |
33768 | goto done; |
33769 | } |
33770 | p->mark = _mark; |
33771 | D(fprintf(stderr, "%*c%s _tmp_191[%d-%d]: %s failed!\n" , p->level, ' ', |
33772 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "starred_expression" )); |
33773 | } |
33774 | { // (assignment_expression | expression !':=') !'=' |
33775 | if (p->error_indicator) { |
33776 | p->level--; |
33777 | return NULL; |
33778 | } |
33779 | D(fprintf(stderr, "%*c> _tmp_191[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='" )); |
33780 | void *_tmp_202_var; |
33781 | if ( |
33782 | (_tmp_202_var = _tmp_202_rule(p)) // assignment_expression | expression !':=' |
33783 | && |
33784 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' |
33785 | ) |
33786 | { |
33787 | D(fprintf(stderr, "%*c+ _tmp_191[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='" )); |
33788 | _res = _tmp_202_var; |
33789 | goto done; |
33790 | } |
33791 | p->mark = _mark; |
33792 | D(fprintf(stderr, "%*c%s _tmp_191[%d-%d]: %s failed!\n" , p->level, ' ', |
33793 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "(assignment_expression | expression !':=') !'='" )); |
33794 | } |
33795 | _res = NULL; |
33796 | done: |
33797 | p->level--; |
33798 | return _res; |
33799 | } |
33800 | |
33801 | // _tmp_192: ',' star_target |
33802 | static void * |
33803 | _tmp_192_rule(Parser *p) |
33804 | { |
33805 | if (p->level++ == MAXSTACK) { |
33806 | p->error_indicator = 1; |
33807 | PyErr_NoMemory(); |
33808 | } |
33809 | if (p->error_indicator) { |
33810 | p->level--; |
33811 | return NULL; |
33812 | } |
33813 | void * _res = NULL; |
33814 | int _mark = p->mark; |
33815 | { // ',' star_target |
33816 | if (p->error_indicator) { |
33817 | p->level--; |
33818 | return NULL; |
33819 | } |
33820 | D(fprintf(stderr, "%*c> _tmp_192[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' star_target" )); |
33821 | Token * _literal; |
33822 | expr_ty c; |
33823 | if ( |
33824 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
33825 | && |
33826 | (c = star_target_rule(p)) // star_target |
33827 | ) |
33828 | { |
33829 | D(fprintf(stderr, "%*c+ _tmp_192[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "',' star_target" )); |
33830 | _res = c; |
33831 | if (_res == NULL && PyErr_Occurred()) { |
33832 | p->error_indicator = 1; |
33833 | p->level--; |
33834 | return NULL; |
33835 | } |
33836 | goto done; |
33837 | } |
33838 | p->mark = _mark; |
33839 | D(fprintf(stderr, "%*c%s _tmp_192[%d-%d]: %s failed!\n" , p->level, ' ', |
33840 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' star_target" )); |
33841 | } |
33842 | _res = NULL; |
33843 | done: |
33844 | p->level--; |
33845 | return _res; |
33846 | } |
33847 | |
33848 | // _tmp_193: ',' star_target |
33849 | static void * |
33850 | _tmp_193_rule(Parser *p) |
33851 | { |
33852 | if (p->level++ == MAXSTACK) { |
33853 | p->error_indicator = 1; |
33854 | PyErr_NoMemory(); |
33855 | } |
33856 | if (p->error_indicator) { |
33857 | p->level--; |
33858 | return NULL; |
33859 | } |
33860 | void * _res = NULL; |
33861 | int _mark = p->mark; |
33862 | { // ',' star_target |
33863 | if (p->error_indicator) { |
33864 | p->level--; |
33865 | return NULL; |
33866 | } |
33867 | D(fprintf(stderr, "%*c> _tmp_193[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "',' star_target" )); |
33868 | Token * _literal; |
33869 | expr_ty c; |
33870 | if ( |
33871 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
33872 | && |
33873 | (c = star_target_rule(p)) // star_target |
33874 | ) |
33875 | { |
33876 | D(fprintf(stderr, "%*c+ _tmp_193[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "',' star_target" )); |
33877 | _res = c; |
33878 | if (_res == NULL && PyErr_Occurred()) { |
33879 | p->error_indicator = 1; |
33880 | p->level--; |
33881 | return NULL; |
33882 | } |
33883 | goto done; |
33884 | } |
33885 | p->mark = _mark; |
33886 | D(fprintf(stderr, "%*c%s _tmp_193[%d-%d]: %s failed!\n" , p->level, ' ', |
33887 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "',' star_target" )); |
33888 | } |
33889 | _res = NULL; |
33890 | done: |
33891 | p->level--; |
33892 | return _res; |
33893 | } |
33894 | |
33895 | // _tmp_194: star_targets '=' |
33896 | static void * |
33897 | _tmp_194_rule(Parser *p) |
33898 | { |
33899 | if (p->level++ == MAXSTACK) { |
33900 | p->error_indicator = 1; |
33901 | PyErr_NoMemory(); |
33902 | } |
33903 | if (p->error_indicator) { |
33904 | p->level--; |
33905 | return NULL; |
33906 | } |
33907 | void * _res = NULL; |
33908 | int _mark = p->mark; |
33909 | { // star_targets '=' |
33910 | if (p->error_indicator) { |
33911 | p->level--; |
33912 | return NULL; |
33913 | } |
33914 | D(fprintf(stderr, "%*c> _tmp_194[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_targets '='" )); |
33915 | Token * _literal; |
33916 | expr_ty star_targets_var; |
33917 | if ( |
33918 | (star_targets_var = star_targets_rule(p)) // star_targets |
33919 | && |
33920 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
33921 | ) |
33922 | { |
33923 | D(fprintf(stderr, "%*c+ _tmp_194[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_targets '='" )); |
33924 | _res = _PyPegen_dummy_name(p, star_targets_var, _literal); |
33925 | goto done; |
33926 | } |
33927 | p->mark = _mark; |
33928 | D(fprintf(stderr, "%*c%s _tmp_194[%d-%d]: %s failed!\n" , p->level, ' ', |
33929 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_targets '='" )); |
33930 | } |
33931 | _res = NULL; |
33932 | done: |
33933 | p->level--; |
33934 | return _res; |
33935 | } |
33936 | |
33937 | // _tmp_195: star_targets '=' |
33938 | static void * |
33939 | _tmp_195_rule(Parser *p) |
33940 | { |
33941 | if (p->level++ == MAXSTACK) { |
33942 | p->error_indicator = 1; |
33943 | PyErr_NoMemory(); |
33944 | } |
33945 | if (p->error_indicator) { |
33946 | p->level--; |
33947 | return NULL; |
33948 | } |
33949 | void * _res = NULL; |
33950 | int _mark = p->mark; |
33951 | { // star_targets '=' |
33952 | if (p->error_indicator) { |
33953 | p->level--; |
33954 | return NULL; |
33955 | } |
33956 | D(fprintf(stderr, "%*c> _tmp_195[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "star_targets '='" )); |
33957 | Token * _literal; |
33958 | expr_ty star_targets_var; |
33959 | if ( |
33960 | (star_targets_var = star_targets_rule(p)) // star_targets |
33961 | && |
33962 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
33963 | ) |
33964 | { |
33965 | D(fprintf(stderr, "%*c+ _tmp_195[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "star_targets '='" )); |
33966 | _res = _PyPegen_dummy_name(p, star_targets_var, _literal); |
33967 | goto done; |
33968 | } |
33969 | p->mark = _mark; |
33970 | D(fprintf(stderr, "%*c%s _tmp_195[%d-%d]: %s failed!\n" , p->level, ' ', |
33971 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "star_targets '='" )); |
33972 | } |
33973 | _res = NULL; |
33974 | done: |
33975 | p->level--; |
33976 | return _res; |
33977 | } |
33978 | |
33979 | // _tmp_196: ')' | '**' |
33980 | static void * |
33981 | _tmp_196_rule(Parser *p) |
33982 | { |
33983 | if (p->level++ == MAXSTACK) { |
33984 | p->error_indicator = 1; |
33985 | PyErr_NoMemory(); |
33986 | } |
33987 | if (p->error_indicator) { |
33988 | p->level--; |
33989 | return NULL; |
33990 | } |
33991 | void * _res = NULL; |
33992 | int _mark = p->mark; |
33993 | { // ')' |
33994 | if (p->error_indicator) { |
33995 | p->level--; |
33996 | return NULL; |
33997 | } |
33998 | D(fprintf(stderr, "%*c> _tmp_196[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "')'" )); |
33999 | Token * _literal; |
34000 | if ( |
34001 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
34002 | ) |
34003 | { |
34004 | D(fprintf(stderr, "%*c+ _tmp_196[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "')'" )); |
34005 | _res = _literal; |
34006 | goto done; |
34007 | } |
34008 | p->mark = _mark; |
34009 | D(fprintf(stderr, "%*c%s _tmp_196[%d-%d]: %s failed!\n" , p->level, ' ', |
34010 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "')'" )); |
34011 | } |
34012 | { // '**' |
34013 | if (p->error_indicator) { |
34014 | p->level--; |
34015 | return NULL; |
34016 | } |
34017 | D(fprintf(stderr, "%*c> _tmp_196[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'**'" )); |
34018 | Token * _literal; |
34019 | if ( |
34020 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
34021 | ) |
34022 | { |
34023 | D(fprintf(stderr, "%*c+ _tmp_196[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'**'" )); |
34024 | _res = _literal; |
34025 | goto done; |
34026 | } |
34027 | p->mark = _mark; |
34028 | D(fprintf(stderr, "%*c%s _tmp_196[%d-%d]: %s failed!\n" , p->level, ' ', |
34029 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'**'" )); |
34030 | } |
34031 | _res = NULL; |
34032 | done: |
34033 | p->level--; |
34034 | return _res; |
34035 | } |
34036 | |
34037 | // _tmp_197: ':' | '**' |
34038 | static void * |
34039 | _tmp_197_rule(Parser *p) |
34040 | { |
34041 | if (p->level++ == MAXSTACK) { |
34042 | p->error_indicator = 1; |
34043 | PyErr_NoMemory(); |
34044 | } |
34045 | if (p->error_indicator) { |
34046 | p->level--; |
34047 | return NULL; |
34048 | } |
34049 | void * _res = NULL; |
34050 | int _mark = p->mark; |
34051 | { // ':' |
34052 | if (p->error_indicator) { |
34053 | p->level--; |
34054 | return NULL; |
34055 | } |
34056 | D(fprintf(stderr, "%*c> _tmp_197[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "':'" )); |
34057 | Token * _literal; |
34058 | if ( |
34059 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
34060 | ) |
34061 | { |
34062 | D(fprintf(stderr, "%*c+ _tmp_197[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "':'" )); |
34063 | _res = _literal; |
34064 | goto done; |
34065 | } |
34066 | p->mark = _mark; |
34067 | D(fprintf(stderr, "%*c%s _tmp_197[%d-%d]: %s failed!\n" , p->level, ' ', |
34068 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "':'" )); |
34069 | } |
34070 | { // '**' |
34071 | if (p->error_indicator) { |
34072 | p->level--; |
34073 | return NULL; |
34074 | } |
34075 | D(fprintf(stderr, "%*c> _tmp_197[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'**'" )); |
34076 | Token * _literal; |
34077 | if ( |
34078 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
34079 | ) |
34080 | { |
34081 | D(fprintf(stderr, "%*c+ _tmp_197[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'**'" )); |
34082 | _res = _literal; |
34083 | goto done; |
34084 | } |
34085 | p->mark = _mark; |
34086 | D(fprintf(stderr, "%*c%s _tmp_197[%d-%d]: %s failed!\n" , p->level, ' ', |
34087 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'**'" )); |
34088 | } |
34089 | _res = NULL; |
34090 | done: |
34091 | p->level--; |
34092 | return _res; |
34093 | } |
34094 | |
34095 | // _tmp_198: expression ['as' star_target] |
34096 | static void * |
34097 | _tmp_198_rule(Parser *p) |
34098 | { |
34099 | if (p->level++ == MAXSTACK) { |
34100 | p->error_indicator = 1; |
34101 | PyErr_NoMemory(); |
34102 | } |
34103 | if (p->error_indicator) { |
34104 | p->level--; |
34105 | return NULL; |
34106 | } |
34107 | void * _res = NULL; |
34108 | int _mark = p->mark; |
34109 | { // expression ['as' star_target] |
34110 | if (p->error_indicator) { |
34111 | p->level--; |
34112 | return NULL; |
34113 | } |
34114 | D(fprintf(stderr, "%*c> _tmp_198[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression ['as' star_target]" )); |
34115 | void *_opt_var; |
34116 | UNUSED(_opt_var); // Silence compiler warnings |
34117 | expr_ty expression_var; |
34118 | if ( |
34119 | (expression_var = expression_rule(p)) // expression |
34120 | && |
34121 | (_opt_var = _tmp_203_rule(p), !p->error_indicator) // ['as' star_target] |
34122 | ) |
34123 | { |
34124 | D(fprintf(stderr, "%*c+ _tmp_198[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression ['as' star_target]" )); |
34125 | _res = _PyPegen_dummy_name(p, expression_var, _opt_var); |
34126 | goto done; |
34127 | } |
34128 | p->mark = _mark; |
34129 | D(fprintf(stderr, "%*c%s _tmp_198[%d-%d]: %s failed!\n" , p->level, ' ', |
34130 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression ['as' star_target]" )); |
34131 | } |
34132 | _res = NULL; |
34133 | done: |
34134 | p->level--; |
34135 | return _res; |
34136 | } |
34137 | |
34138 | // _tmp_199: expressions ['as' star_target] |
34139 | static void * |
34140 | _tmp_199_rule(Parser *p) |
34141 | { |
34142 | if (p->level++ == MAXSTACK) { |
34143 | p->error_indicator = 1; |
34144 | PyErr_NoMemory(); |
34145 | } |
34146 | if (p->error_indicator) { |
34147 | p->level--; |
34148 | return NULL; |
34149 | } |
34150 | void * _res = NULL; |
34151 | int _mark = p->mark; |
34152 | { // expressions ['as' star_target] |
34153 | if (p->error_indicator) { |
34154 | p->level--; |
34155 | return NULL; |
34156 | } |
34157 | D(fprintf(stderr, "%*c> _tmp_199[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expressions ['as' star_target]" )); |
34158 | void *_opt_var; |
34159 | UNUSED(_opt_var); // Silence compiler warnings |
34160 | expr_ty expressions_var; |
34161 | if ( |
34162 | (expressions_var = expressions_rule(p)) // expressions |
34163 | && |
34164 | (_opt_var = _tmp_204_rule(p), !p->error_indicator) // ['as' star_target] |
34165 | ) |
34166 | { |
34167 | D(fprintf(stderr, "%*c+ _tmp_199[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expressions ['as' star_target]" )); |
34168 | _res = _PyPegen_dummy_name(p, expressions_var, _opt_var); |
34169 | goto done; |
34170 | } |
34171 | p->mark = _mark; |
34172 | D(fprintf(stderr, "%*c%s _tmp_199[%d-%d]: %s failed!\n" , p->level, ' ', |
34173 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expressions ['as' star_target]" )); |
34174 | } |
34175 | _res = NULL; |
34176 | done: |
34177 | p->level--; |
34178 | return _res; |
34179 | } |
34180 | |
34181 | // _tmp_200: expression ['as' star_target] |
34182 | static void * |
34183 | _tmp_200_rule(Parser *p) |
34184 | { |
34185 | if (p->level++ == MAXSTACK) { |
34186 | p->error_indicator = 1; |
34187 | PyErr_NoMemory(); |
34188 | } |
34189 | if (p->error_indicator) { |
34190 | p->level--; |
34191 | return NULL; |
34192 | } |
34193 | void * _res = NULL; |
34194 | int _mark = p->mark; |
34195 | { // expression ['as' star_target] |
34196 | if (p->error_indicator) { |
34197 | p->level--; |
34198 | return NULL; |
34199 | } |
34200 | D(fprintf(stderr, "%*c> _tmp_200[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression ['as' star_target]" )); |
34201 | void *_opt_var; |
34202 | UNUSED(_opt_var); // Silence compiler warnings |
34203 | expr_ty expression_var; |
34204 | if ( |
34205 | (expression_var = expression_rule(p)) // expression |
34206 | && |
34207 | (_opt_var = _tmp_205_rule(p), !p->error_indicator) // ['as' star_target] |
34208 | ) |
34209 | { |
34210 | D(fprintf(stderr, "%*c+ _tmp_200[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression ['as' star_target]" )); |
34211 | _res = _PyPegen_dummy_name(p, expression_var, _opt_var); |
34212 | goto done; |
34213 | } |
34214 | p->mark = _mark; |
34215 | D(fprintf(stderr, "%*c%s _tmp_200[%d-%d]: %s failed!\n" , p->level, ' ', |
34216 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression ['as' star_target]" )); |
34217 | } |
34218 | _res = NULL; |
34219 | done: |
34220 | p->level--; |
34221 | return _res; |
34222 | } |
34223 | |
34224 | // _tmp_201: expressions ['as' star_target] |
34225 | static void * |
34226 | _tmp_201_rule(Parser *p) |
34227 | { |
34228 | if (p->level++ == MAXSTACK) { |
34229 | p->error_indicator = 1; |
34230 | PyErr_NoMemory(); |
34231 | } |
34232 | if (p->error_indicator) { |
34233 | p->level--; |
34234 | return NULL; |
34235 | } |
34236 | void * _res = NULL; |
34237 | int _mark = p->mark; |
34238 | { // expressions ['as' star_target] |
34239 | if (p->error_indicator) { |
34240 | p->level--; |
34241 | return NULL; |
34242 | } |
34243 | D(fprintf(stderr, "%*c> _tmp_201[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expressions ['as' star_target]" )); |
34244 | void *_opt_var; |
34245 | UNUSED(_opt_var); // Silence compiler warnings |
34246 | expr_ty expressions_var; |
34247 | if ( |
34248 | (expressions_var = expressions_rule(p)) // expressions |
34249 | && |
34250 | (_opt_var = _tmp_206_rule(p), !p->error_indicator) // ['as' star_target] |
34251 | ) |
34252 | { |
34253 | D(fprintf(stderr, "%*c+ _tmp_201[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expressions ['as' star_target]" )); |
34254 | _res = _PyPegen_dummy_name(p, expressions_var, _opt_var); |
34255 | goto done; |
34256 | } |
34257 | p->mark = _mark; |
34258 | D(fprintf(stderr, "%*c%s _tmp_201[%d-%d]: %s failed!\n" , p->level, ' ', |
34259 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expressions ['as' star_target]" )); |
34260 | } |
34261 | _res = NULL; |
34262 | done: |
34263 | p->level--; |
34264 | return _res; |
34265 | } |
34266 | |
34267 | // _tmp_202: assignment_expression | expression !':=' |
34268 | static void * |
34269 | _tmp_202_rule(Parser *p) |
34270 | { |
34271 | if (p->level++ == MAXSTACK) { |
34272 | p->error_indicator = 1; |
34273 | PyErr_NoMemory(); |
34274 | } |
34275 | if (p->error_indicator) { |
34276 | p->level--; |
34277 | return NULL; |
34278 | } |
34279 | void * _res = NULL; |
34280 | int _mark = p->mark; |
34281 | { // assignment_expression |
34282 | if (p->error_indicator) { |
34283 | p->level--; |
34284 | return NULL; |
34285 | } |
34286 | D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "assignment_expression" )); |
34287 | expr_ty assignment_expression_var; |
34288 | if ( |
34289 | (assignment_expression_var = assignment_expression_rule(p)) // assignment_expression |
34290 | ) |
34291 | { |
34292 | D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "assignment_expression" )); |
34293 | _res = assignment_expression_var; |
34294 | goto done; |
34295 | } |
34296 | p->mark = _mark; |
34297 | D(fprintf(stderr, "%*c%s _tmp_202[%d-%d]: %s failed!\n" , p->level, ' ', |
34298 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "assignment_expression" )); |
34299 | } |
34300 | { // expression !':=' |
34301 | if (p->error_indicator) { |
34302 | p->level--; |
34303 | return NULL; |
34304 | } |
34305 | D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "expression !':='" )); |
34306 | expr_ty expression_var; |
34307 | if ( |
34308 | (expression_var = expression_rule(p)) // expression |
34309 | && |
34310 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' |
34311 | ) |
34312 | { |
34313 | D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "expression !':='" )); |
34314 | _res = expression_var; |
34315 | goto done; |
34316 | } |
34317 | p->mark = _mark; |
34318 | D(fprintf(stderr, "%*c%s _tmp_202[%d-%d]: %s failed!\n" , p->level, ' ', |
34319 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "expression !':='" )); |
34320 | } |
34321 | _res = NULL; |
34322 | done: |
34323 | p->level--; |
34324 | return _res; |
34325 | } |
34326 | |
34327 | // _tmp_203: 'as' star_target |
34328 | static void * |
34329 | _tmp_203_rule(Parser *p) |
34330 | { |
34331 | if (p->level++ == MAXSTACK) { |
34332 | p->error_indicator = 1; |
34333 | PyErr_NoMemory(); |
34334 | } |
34335 | if (p->error_indicator) { |
34336 | p->level--; |
34337 | return NULL; |
34338 | } |
34339 | void * _res = NULL; |
34340 | int _mark = p->mark; |
34341 | { // 'as' star_target |
34342 | if (p->error_indicator) { |
34343 | p->level--; |
34344 | return NULL; |
34345 | } |
34346 | D(fprintf(stderr, "%*c> _tmp_203[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'as' star_target" )); |
34347 | Token * _keyword; |
34348 | expr_ty star_target_var; |
34349 | if ( |
34350 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
34351 | && |
34352 | (star_target_var = star_target_rule(p)) // star_target |
34353 | ) |
34354 | { |
34355 | D(fprintf(stderr, "%*c+ _tmp_203[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'as' star_target" )); |
34356 | _res = _PyPegen_dummy_name(p, _keyword, star_target_var); |
34357 | goto done; |
34358 | } |
34359 | p->mark = _mark; |
34360 | D(fprintf(stderr, "%*c%s _tmp_203[%d-%d]: %s failed!\n" , p->level, ' ', |
34361 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'as' star_target" )); |
34362 | } |
34363 | _res = NULL; |
34364 | done: |
34365 | p->level--; |
34366 | return _res; |
34367 | } |
34368 | |
34369 | // _tmp_204: 'as' star_target |
34370 | static void * |
34371 | _tmp_204_rule(Parser *p) |
34372 | { |
34373 | if (p->level++ == MAXSTACK) { |
34374 | p->error_indicator = 1; |
34375 | PyErr_NoMemory(); |
34376 | } |
34377 | if (p->error_indicator) { |
34378 | p->level--; |
34379 | return NULL; |
34380 | } |
34381 | void * _res = NULL; |
34382 | int _mark = p->mark; |
34383 | { // 'as' star_target |
34384 | if (p->error_indicator) { |
34385 | p->level--; |
34386 | return NULL; |
34387 | } |
34388 | D(fprintf(stderr, "%*c> _tmp_204[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'as' star_target" )); |
34389 | Token * _keyword; |
34390 | expr_ty star_target_var; |
34391 | if ( |
34392 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
34393 | && |
34394 | (star_target_var = star_target_rule(p)) // star_target |
34395 | ) |
34396 | { |
34397 | D(fprintf(stderr, "%*c+ _tmp_204[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'as' star_target" )); |
34398 | _res = _PyPegen_dummy_name(p, _keyword, star_target_var); |
34399 | goto done; |
34400 | } |
34401 | p->mark = _mark; |
34402 | D(fprintf(stderr, "%*c%s _tmp_204[%d-%d]: %s failed!\n" , p->level, ' ', |
34403 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'as' star_target" )); |
34404 | } |
34405 | _res = NULL; |
34406 | done: |
34407 | p->level--; |
34408 | return _res; |
34409 | } |
34410 | |
34411 | // _tmp_205: 'as' star_target |
34412 | static void * |
34413 | _tmp_205_rule(Parser *p) |
34414 | { |
34415 | if (p->level++ == MAXSTACK) { |
34416 | p->error_indicator = 1; |
34417 | PyErr_NoMemory(); |
34418 | } |
34419 | if (p->error_indicator) { |
34420 | p->level--; |
34421 | return NULL; |
34422 | } |
34423 | void * _res = NULL; |
34424 | int _mark = p->mark; |
34425 | { // 'as' star_target |
34426 | if (p->error_indicator) { |
34427 | p->level--; |
34428 | return NULL; |
34429 | } |
34430 | D(fprintf(stderr, "%*c> _tmp_205[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'as' star_target" )); |
34431 | Token * _keyword; |
34432 | expr_ty star_target_var; |
34433 | if ( |
34434 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
34435 | && |
34436 | (star_target_var = star_target_rule(p)) // star_target |
34437 | ) |
34438 | { |
34439 | D(fprintf(stderr, "%*c+ _tmp_205[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'as' star_target" )); |
34440 | _res = _PyPegen_dummy_name(p, _keyword, star_target_var); |
34441 | goto done; |
34442 | } |
34443 | p->mark = _mark; |
34444 | D(fprintf(stderr, "%*c%s _tmp_205[%d-%d]: %s failed!\n" , p->level, ' ', |
34445 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'as' star_target" )); |
34446 | } |
34447 | _res = NULL; |
34448 | done: |
34449 | p->level--; |
34450 | return _res; |
34451 | } |
34452 | |
34453 | // _tmp_206: 'as' star_target |
34454 | static void * |
34455 | _tmp_206_rule(Parser *p) |
34456 | { |
34457 | if (p->level++ == MAXSTACK) { |
34458 | p->error_indicator = 1; |
34459 | PyErr_NoMemory(); |
34460 | } |
34461 | if (p->error_indicator) { |
34462 | p->level--; |
34463 | return NULL; |
34464 | } |
34465 | void * _res = NULL; |
34466 | int _mark = p->mark; |
34467 | { // 'as' star_target |
34468 | if (p->error_indicator) { |
34469 | p->level--; |
34470 | return NULL; |
34471 | } |
34472 | D(fprintf(stderr, "%*c> _tmp_206[%d-%d]: %s\n" , p->level, ' ', _mark, p->mark, "'as' star_target" )); |
34473 | Token * _keyword; |
34474 | expr_ty star_target_var; |
34475 | if ( |
34476 | (_keyword = _PyPegen_expect_token(p, 520)) // token='as' |
34477 | && |
34478 | (star_target_var = star_target_rule(p)) // star_target |
34479 | ) |
34480 | { |
34481 | D(fprintf(stderr, "%*c+ _tmp_206[%d-%d]: %s succeeded!\n" , p->level, ' ', _mark, p->mark, "'as' star_target" )); |
34482 | _res = _PyPegen_dummy_name(p, _keyword, star_target_var); |
34483 | goto done; |
34484 | } |
34485 | p->mark = _mark; |
34486 | D(fprintf(stderr, "%*c%s _tmp_206[%d-%d]: %s failed!\n" , p->level, ' ', |
34487 | p->error_indicator ? "ERROR!" : "-" , _mark, p->mark, "'as' star_target" )); |
34488 | } |
34489 | _res = NULL; |
34490 | done: |
34491 | p->level--; |
34492 | return _res; |
34493 | } |
34494 | |
34495 | void * |
34496 | _PyPegen_parse(Parser *p) |
34497 | { |
34498 | // Initialize keywords |
34499 | p->keywords = reserved_keywords; |
34500 | p->n_keyword_lists = n_keyword_lists; |
34501 | p->soft_keywords = soft_keywords; |
34502 | |
34503 | // Run parser |
34504 | void *result = NULL; |
34505 | if (p->start_rule == Py_file_input) { |
34506 | result = file_rule(p); |
34507 | } else if (p->start_rule == Py_single_input) { |
34508 | result = interactive_rule(p); |
34509 | } else if (p->start_rule == Py_eval_input) { |
34510 | result = eval_rule(p); |
34511 | } else if (p->start_rule == Py_func_type_input) { |
34512 | result = func_type_rule(p); |
34513 | } else if (p->start_rule == Py_fstring_input) { |
34514 | result = fstring_rule(p); |
34515 | } |
34516 | |
34517 | return result; |
34518 | } |
34519 | |
34520 | // The end |
34521 | |