/src/cpython/Parser/parser.c
Line | Count | Source |
1 | | // @generated by pegen from python.gram |
2 | | #include "pegen.h" |
3 | | |
4 | | #if defined(Py_DEBUG) && defined(Py_BUILD_CORE) |
5 | | # define D(x) if (p->debug) { x; } |
6 | | #else |
7 | | # define D(x) |
8 | | #endif |
9 | | |
10 | | #ifdef __wasi__ |
11 | | # ifdef Py_DEBUG |
12 | | # define MAXSTACK 1000 |
13 | | # else |
14 | | # define MAXSTACK 4000 |
15 | | # endif |
16 | | #else |
17 | 166M | # define MAXSTACK 6000 |
18 | | #endif |
19 | | static const int n_keyword_lists = 9; |
20 | | static KeywordToken *reserved_keywords[] = { |
21 | | (KeywordToken[]) {{NULL, -1}}, |
22 | | (KeywordToken[]) {{NULL, -1}}, |
23 | | (KeywordToken[]) { |
24 | | {"if", 691}, |
25 | | {"as", 689}, |
26 | | {"in", 704}, |
27 | | {"or", 589}, |
28 | | {"is", 597}, |
29 | | {NULL, -1}, |
30 | | }, |
31 | | (KeywordToken[]) { |
32 | | {"del", 630}, |
33 | | {"def", 708}, |
34 | | {"for", 703}, |
35 | | {"try", 665}, |
36 | | {"and", 590}, |
37 | | {"not", 712}, |
38 | | {NULL, -1}, |
39 | | }, |
40 | | (KeywordToken[]) { |
41 | | {"from", 642}, |
42 | | {"pass", 527}, |
43 | | {"with", 656}, |
44 | | {"elif", 696}, |
45 | | {"else", 695}, |
46 | | {"None", 624}, |
47 | | {"True", 623}, |
48 | | {NULL, -1}, |
49 | | }, |
50 | | (KeywordToken[]) { |
51 | | {"raise", 628}, |
52 | | {"yield", 588}, |
53 | | {"break", 528}, |
54 | | {"async", 707}, |
55 | | {"class", 710}, |
56 | | {"while", 698}, |
57 | | {"False", 625}, |
58 | | {"await", 598}, |
59 | | {NULL, -1}, |
60 | | }, |
61 | | (KeywordToken[]) { |
62 | | {"return", 522}, |
63 | | {"import", 643}, |
64 | | {"assert", 634}, |
65 | | {"global", 530}, |
66 | | {"except", 686}, |
67 | | {"lambda", 622}, |
68 | | {NULL, -1}, |
69 | | }, |
70 | | (KeywordToken[]) { |
71 | | {"finally", 682}, |
72 | | {NULL, -1}, |
73 | | }, |
74 | | (KeywordToken[]) { |
75 | | {"continue", 529}, |
76 | | {"nonlocal", 531}, |
77 | | {NULL, -1}, |
78 | | }, |
79 | | }; |
80 | | static char *soft_keywords[] = { |
81 | | "_", |
82 | | "case", |
83 | | "match", |
84 | | "type", |
85 | | NULL, |
86 | | }; |
87 | | #define file_type 1000 |
88 | | #define interactive_type 1001 |
89 | | #define eval_type 1002 |
90 | | #define func_type_type 1003 |
91 | | #define statements_type 1004 |
92 | | #define statement_type 1005 |
93 | | #define single_compound_stmt_type 1006 |
94 | | #define statement_newline_type 1007 |
95 | | #define simple_stmts_type 1008 |
96 | 433k | #define simple_stmt_type 1009 |
97 | | #define compound_stmt_type 1010 |
98 | | #define assignment_type 1011 |
99 | | #define annotated_rhs_type 1012 |
100 | | #define augassign_type 1013 |
101 | | #define return_stmt_type 1014 |
102 | | #define raise_stmt_type 1015 |
103 | | #define pass_stmt_type 1016 |
104 | | #define break_stmt_type 1017 |
105 | | #define continue_stmt_type 1018 |
106 | | #define global_stmt_type 1019 |
107 | | #define nonlocal_stmt_type 1020 |
108 | | #define del_stmt_type 1021 |
109 | | #define yield_stmt_type 1022 |
110 | | #define assert_stmt_type 1023 |
111 | | #define import_stmt_type 1024 |
112 | | #define import_name_type 1025 |
113 | | #define import_from_type 1026 |
114 | | #define import_from_targets_type 1027 |
115 | | #define import_from_as_names_type 1028 |
116 | | #define import_from_as_name_type 1029 |
117 | | #define dotted_as_names_type 1030 |
118 | | #define dotted_as_name_type 1031 |
119 | 73.1k | #define dotted_name_type 1032 // Left-recursive |
120 | 143k | #define block_type 1033 |
121 | | #define decorators_type 1034 |
122 | | #define class_def_type 1035 |
123 | | #define class_def_raw_type 1036 |
124 | | #define function_def_type 1037 |
125 | | #define function_def_raw_type 1038 |
126 | | #define params_type 1039 |
127 | | #define parameters_type 1040 |
128 | | #define slash_no_default_type 1041 |
129 | | #define slash_with_default_type 1042 |
130 | | #define star_etc_type 1043 |
131 | | #define kwds_type 1044 |
132 | | #define param_no_default_type 1045 |
133 | | #define param_no_default_star_annotation_type 1046 |
134 | | #define param_with_default_type 1047 |
135 | | #define param_maybe_default_type 1048 |
136 | | #define param_type 1049 |
137 | | #define param_star_annotation_type 1050 |
138 | | #define annotation_type 1051 |
139 | | #define star_annotation_type 1052 |
140 | | #define default_type 1053 |
141 | | #define if_stmt_type 1054 |
142 | | #define elif_stmt_type 1055 |
143 | | #define else_block_type 1056 |
144 | | #define while_stmt_type 1057 |
145 | | #define for_stmt_type 1058 |
146 | | #define with_stmt_type 1059 |
147 | | #define with_item_type 1060 |
148 | | #define try_stmt_type 1061 |
149 | | #define except_block_type 1062 |
150 | | #define except_star_block_type 1063 |
151 | | #define finally_block_type 1064 |
152 | | #define match_stmt_type 1065 |
153 | | #define subject_expr_type 1066 |
154 | | #define case_block_type 1067 |
155 | | #define guard_type 1068 |
156 | | #define patterns_type 1069 |
157 | | #define pattern_type 1070 |
158 | | #define as_pattern_type 1071 |
159 | | #define or_pattern_type 1072 |
160 | 268k | #define closed_pattern_type 1073 |
161 | | #define literal_pattern_type 1074 |
162 | | #define literal_expr_type 1075 |
163 | | #define complex_number_type 1076 |
164 | | #define signed_number_type 1077 |
165 | | #define signed_real_number_type 1078 |
166 | | #define real_number_type 1079 |
167 | | #define imaginary_number_type 1080 |
168 | | #define capture_pattern_type 1081 |
169 | | #define pattern_capture_target_type 1082 |
170 | | #define wildcard_pattern_type 1083 |
171 | | #define value_pattern_type 1084 |
172 | 138k | #define attr_type 1085 // Left-recursive |
173 | | #define name_or_attr_type 1086 // Left-recursive |
174 | | #define group_pattern_type 1087 |
175 | | #define sequence_pattern_type 1088 |
176 | | #define open_sequence_pattern_type 1089 |
177 | | #define maybe_sequence_pattern_type 1090 |
178 | | #define maybe_star_pattern_type 1091 |
179 | 47.7k | #define star_pattern_type 1092 |
180 | | #define mapping_pattern_type 1093 |
181 | | #define items_pattern_type 1094 |
182 | | #define key_value_pattern_type 1095 |
183 | | #define double_star_pattern_type 1096 |
184 | | #define class_pattern_type 1097 |
185 | | #define positional_patterns_type 1098 |
186 | | #define keyword_patterns_type 1099 |
187 | | #define keyword_pattern_type 1100 |
188 | | #define type_alias_type 1101 |
189 | | #define type_params_type 1102 |
190 | | #define type_param_seq_type 1103 |
191 | 21.5k | #define type_param_type 1104 |
192 | | #define type_param_bound_type 1105 |
193 | | #define type_param_default_type 1106 |
194 | | #define type_param_starred_default_type 1107 |
195 | | #define expressions_type 1108 |
196 | 2.24M | #define expression_type 1109 |
197 | | #define yield_expr_type 1110 |
198 | | #define star_expressions_type 1111 |
199 | 1.41M | #define star_expression_type 1112 |
200 | | #define star_named_expressions_type 1113 |
201 | | #define star_named_expression_type 1114 |
202 | | #define assignment_expression_type 1115 |
203 | | #define named_expression_type 1116 |
204 | 2.63M | #define disjunction_type 1117 |
205 | 1.99M | #define conjunction_type 1118 |
206 | 2.04M | #define inversion_type 1119 |
207 | | #define comparison_type 1120 |
208 | | #define compare_op_bitwise_or_pair_type 1121 |
209 | | #define eq_bitwise_or_type 1122 |
210 | | #define noteq_bitwise_or_type 1123 |
211 | | #define lte_bitwise_or_type 1124 |
212 | | #define lt_bitwise_or_type 1125 |
213 | | #define gte_bitwise_or_type 1126 |
214 | | #define gt_bitwise_or_type 1127 |
215 | | #define notin_bitwise_or_type 1128 |
216 | | #define in_bitwise_or_type 1129 |
217 | | #define isnot_bitwise_or_type 1130 |
218 | | #define is_bitwise_or_type 1131 |
219 | 3.78M | #define bitwise_or_type 1132 // Left-recursive |
220 | 3.50M | #define bitwise_xor_type 1133 // Left-recursive |
221 | 3.51M | #define bitwise_and_type 1134 // Left-recursive |
222 | 4.70M | #define shift_expr_type 1135 // Left-recursive |
223 | 5.03M | #define sum_type 1136 // Left-recursive |
224 | 8.64M | #define term_type 1137 // Left-recursive |
225 | 2.21M | #define factor_type 1138 |
226 | | #define power_type 1139 |
227 | 2.31M | #define await_primary_type 1140 |
228 | 7.37M | #define primary_type 1141 // Left-recursive |
229 | | #define slices_type 1142 |
230 | | #define slice_type 1143 |
231 | | #define atom_type 1144 |
232 | | #define group_type 1145 |
233 | | #define lambdef_type 1146 |
234 | | #define lambda_params_type 1147 |
235 | | #define lambda_parameters_type 1148 |
236 | | #define lambda_slash_no_default_type 1149 |
237 | | #define lambda_slash_with_default_type 1150 |
238 | | #define lambda_star_etc_type 1151 |
239 | | #define lambda_kwds_type 1152 |
240 | | #define lambda_param_no_default_type 1153 |
241 | | #define lambda_param_with_default_type 1154 |
242 | | #define lambda_param_maybe_default_type 1155 |
243 | | #define lambda_param_type 1156 |
244 | | #define fstring_middle_type 1157 |
245 | | #define fstring_replacement_field_type 1158 |
246 | | #define fstring_conversion_type 1159 |
247 | | #define fstring_full_format_spec_type 1160 |
248 | | #define fstring_format_spec_type 1161 |
249 | | #define fstring_type 1162 |
250 | | #define tstring_format_spec_replacement_field_type 1163 |
251 | | #define tstring_format_spec_type 1164 |
252 | | #define tstring_full_format_spec_type 1165 |
253 | | #define tstring_replacement_field_type 1166 |
254 | | #define tstring_middle_type 1167 |
255 | 144k | #define tstring_type 1168 |
256 | | #define string_type 1169 |
257 | 253k | #define strings_type 1170 |
258 | | #define list_type 1171 |
259 | | #define tuple_type 1172 |
260 | | #define set_type 1173 |
261 | | #define dict_type 1174 |
262 | | #define double_starred_kvpairs_type 1175 |
263 | | #define double_starred_kvpair_type 1176 |
264 | | #define kvpair_type 1177 |
265 | | #define for_if_clauses_type 1178 |
266 | | #define for_if_clause_type 1179 |
267 | | #define listcomp_type 1180 |
268 | | #define setcomp_type 1181 |
269 | | #define genexp_type 1182 |
270 | | #define dictcomp_type 1183 |
271 | 115k | #define arguments_type 1184 |
272 | | #define args_type 1185 |
273 | | #define kwargs_type 1186 |
274 | | #define starred_expression_type 1187 |
275 | | #define kwarg_or_starred_type 1188 |
276 | | #define kwarg_or_double_starred_type 1189 |
277 | | #define star_targets_type 1190 |
278 | | #define star_targets_list_seq_type 1191 |
279 | | #define star_targets_tuple_seq_type 1192 |
280 | 756k | #define star_target_type 1193 |
281 | 513k | #define target_with_star_atom_type 1194 |
282 | | #define star_atom_type 1195 |
283 | | #define single_target_type 1196 |
284 | | #define single_subscript_attribute_target_type 1197 |
285 | 2.75M | #define t_primary_type 1198 // Left-recursive |
286 | | #define t_lookahead_type 1199 |
287 | | #define del_targets_type 1200 |
288 | 20.4k | #define del_target_type 1201 |
289 | | #define del_t_atom_type 1202 |
290 | | #define type_expressions_type 1203 |
291 | | #define func_type_comment_type 1204 |
292 | | #define invalid_arguments_type 1205 |
293 | | #define invalid_kwarg_type 1206 |
294 | | #define expression_without_invalid_type 1207 |
295 | | #define invalid_legacy_expression_type 1208 |
296 | | #define invalid_type_param_type 1209 |
297 | | #define invalid_expression_type 1210 |
298 | 295k | #define invalid_named_expression_type 1211 |
299 | | #define invalid_assignment_type 1212 |
300 | | #define invalid_ann_assign_target_type 1213 |
301 | | #define invalid_raise_stmt_type 1214 |
302 | | #define invalid_del_stmt_type 1215 |
303 | | #define invalid_assert_stmt_type 1216 |
304 | | #define invalid_block_type 1217 |
305 | | #define invalid_comprehension_type 1218 |
306 | | #define invalid_dict_comprehension_type 1219 |
307 | | #define invalid_parameters_type 1220 |
308 | | #define invalid_default_type 1221 |
309 | | #define invalid_star_etc_type 1222 |
310 | | #define invalid_kwds_type 1223 |
311 | | #define invalid_parameters_helper_type 1224 |
312 | | #define invalid_lambda_parameters_type 1225 |
313 | | #define invalid_lambda_parameters_helper_type 1226 |
314 | | #define invalid_lambda_star_etc_type 1227 |
315 | | #define invalid_lambda_kwds_type 1228 |
316 | | #define invalid_double_type_comments_type 1229 |
317 | | #define invalid_with_item_type 1230 |
318 | | #define invalid_for_if_clause_type 1231 |
319 | | #define invalid_for_target_type 1232 |
320 | | #define invalid_group_type 1233 |
321 | | #define invalid_import_type 1234 |
322 | | #define invalid_dotted_as_name_type 1235 |
323 | | #define invalid_import_from_as_name_type 1236 |
324 | | #define invalid_import_from_targets_type 1237 |
325 | | #define invalid_with_stmt_type 1238 |
326 | | #define invalid_with_stmt_indent_type 1239 |
327 | | #define invalid_try_stmt_type 1240 |
328 | | #define invalid_except_stmt_type 1241 |
329 | | #define invalid_except_star_stmt_type 1242 |
330 | | #define invalid_finally_stmt_type 1243 |
331 | | #define invalid_except_stmt_indent_type 1244 |
332 | | #define invalid_except_star_stmt_indent_type 1245 |
333 | | #define invalid_match_stmt_type 1246 |
334 | | #define invalid_case_block_type 1247 |
335 | | #define invalid_as_pattern_type 1248 |
336 | | #define invalid_class_pattern_type 1249 |
337 | | #define invalid_mapping_pattern_type 1250 |
338 | | #define invalid_class_argument_pattern_type 1251 |
339 | | #define invalid_if_stmt_type 1252 |
340 | | #define invalid_elif_stmt_type 1253 |
341 | | #define invalid_else_stmt_type 1254 |
342 | | #define invalid_while_stmt_type 1255 |
343 | | #define invalid_for_stmt_type 1256 |
344 | | #define invalid_def_raw_type 1257 |
345 | | #define invalid_class_def_raw_type 1258 |
346 | | #define invalid_double_starred_kvpairs_type 1259 |
347 | | #define invalid_kvpair_type 1260 |
348 | | #define invalid_starred_expression_unpacking_type 1261 |
349 | | #define invalid_starred_expression_type 1262 |
350 | | #define invalid_fstring_replacement_field_type 1263 |
351 | | #define invalid_fstring_conversion_character_type 1264 |
352 | | #define invalid_tstring_replacement_field_type 1265 |
353 | | #define invalid_tstring_conversion_character_type 1266 |
354 | | #define invalid_string_tstring_concat_type 1267 |
355 | | #define invalid_arithmetic_type 1268 |
356 | | #define invalid_factor_type 1269 |
357 | | #define invalid_type_params_type 1270 |
358 | | #define _loop0_1_type 1271 |
359 | | #define _loop1_2_type 1272 |
360 | | #define _loop0_3_type 1273 |
361 | | #define _gather_4_type 1274 |
362 | | #define _tmp_5_type 1275 |
363 | | #define _tmp_6_type 1276 |
364 | | #define _tmp_7_type 1277 |
365 | | #define _tmp_8_type 1278 |
366 | | #define _tmp_9_type 1279 |
367 | | #define _tmp_10_type 1280 |
368 | | #define _tmp_11_type 1281 |
369 | | #define _loop1_12_type 1282 |
370 | | #define _loop0_13_type 1283 |
371 | | #define _gather_14_type 1284 |
372 | | #define _tmp_15_type 1285 |
373 | | #define _tmp_16_type 1286 |
374 | | #define _loop0_17_type 1287 |
375 | | #define _loop1_18_type 1288 |
376 | | #define _loop0_19_type 1289 |
377 | | #define _gather_20_type 1290 |
378 | | #define _tmp_21_type 1291 |
379 | | #define _loop0_22_type 1292 |
380 | | #define _gather_23_type 1293 |
381 | | #define _loop1_24_type 1294 |
382 | | #define _tmp_25_type 1295 |
383 | | #define _tmp_26_type 1296 |
384 | | #define _loop0_27_type 1297 |
385 | | #define _loop0_28_type 1298 |
386 | | #define _loop1_29_type 1299 |
387 | | #define _loop1_30_type 1300 |
388 | | #define _loop0_31_type 1301 |
389 | | #define _loop1_32_type 1302 |
390 | | #define _loop0_33_type 1303 |
391 | | #define _gather_34_type 1304 |
392 | | #define _tmp_35_type 1305 |
393 | | #define _loop1_36_type 1306 |
394 | | #define _loop1_37_type 1307 |
395 | | #define _loop1_38_type 1308 |
396 | | #define _loop0_39_type 1309 |
397 | | #define _gather_40_type 1310 |
398 | | #define _tmp_41_type 1311 |
399 | | #define _tmp_42_type 1312 |
400 | | #define _tmp_43_type 1313 |
401 | | #define _loop0_44_type 1314 |
402 | | #define _gather_45_type 1315 |
403 | | #define _loop0_46_type 1316 |
404 | | #define _gather_47_type 1317 |
405 | | #define _tmp_48_type 1318 |
406 | | #define _loop0_49_type 1319 |
407 | | #define _gather_50_type 1320 |
408 | | #define _loop0_51_type 1321 |
409 | | #define _gather_52_type 1322 |
410 | | #define _loop0_53_type 1323 |
411 | | #define _gather_54_type 1324 |
412 | | #define _loop1_55_type 1325 |
413 | | #define _loop1_56_type 1326 |
414 | | #define _loop0_57_type 1327 |
415 | | #define _gather_58_type 1328 |
416 | | #define _loop1_59_type 1329 |
417 | | #define _loop1_60_type 1330 |
418 | | #define _loop1_61_type 1331 |
419 | | #define _tmp_62_type 1332 |
420 | | #define _loop0_63_type 1333 |
421 | | #define _gather_64_type 1334 |
422 | | #define _tmp_65_type 1335 |
423 | | #define _tmp_66_type 1336 |
424 | | #define _tmp_67_type 1337 |
425 | | #define _tmp_68_type 1338 |
426 | | #define _tmp_69_type 1339 |
427 | | #define _loop0_70_type 1340 |
428 | | #define _loop0_71_type 1341 |
429 | | #define _loop1_72_type 1342 |
430 | | #define _loop1_73_type 1343 |
431 | | #define _loop0_74_type 1344 |
432 | | #define _loop1_75_type 1345 |
433 | | #define _loop0_76_type 1346 |
434 | | #define _loop0_77_type 1347 |
435 | | #define _loop0_78_type 1348 |
436 | | #define _loop0_79_type 1349 |
437 | | #define _loop1_80_type 1350 |
438 | | #define _loop1_81_type 1351 |
439 | | #define _tmp_82_type 1352 |
440 | | #define _loop0_83_type 1353 |
441 | | #define _gather_84_type 1354 |
442 | | #define _loop1_85_type 1355 |
443 | | #define _loop0_86_type 1356 |
444 | | #define _tmp_87_type 1357 |
445 | | #define _loop0_88_type 1358 |
446 | | #define _gather_89_type 1359 |
447 | | #define _tmp_90_type 1360 |
448 | | #define _loop0_91_type 1361 |
449 | | #define _gather_92_type 1362 |
450 | | #define _loop0_93_type 1363 |
451 | | #define _gather_94_type 1364 |
452 | | #define _loop0_95_type 1365 |
453 | | #define _loop0_96_type 1366 |
454 | | #define _gather_97_type 1367 |
455 | | #define _loop1_98_type 1368 |
456 | | #define _tmp_99_type 1369 |
457 | | #define _loop0_100_type 1370 |
458 | | #define _gather_101_type 1371 |
459 | | #define _loop0_102_type 1372 |
460 | | #define _gather_103_type 1373 |
461 | | #define _tmp_104_type 1374 |
462 | | #define _tmp_105_type 1375 |
463 | | #define _loop0_106_type 1376 |
464 | | #define _gather_107_type 1377 |
465 | | #define _tmp_108_type 1378 |
466 | | #define _tmp_109_type 1379 |
467 | | #define _tmp_110_type 1380 |
468 | | #define _tmp_111_type 1381 |
469 | | #define _tmp_112_type 1382 |
470 | | #define _loop1_113_type 1383 |
471 | | #define _tmp_114_type 1384 |
472 | | #define _tmp_115_type 1385 |
473 | | #define _tmp_116_type 1386 |
474 | | #define _tmp_117_type 1387 |
475 | | #define _tmp_118_type 1388 |
476 | | #define _loop0_119_type 1389 |
477 | | #define _loop0_120_type 1390 |
478 | | #define _tmp_121_type 1391 |
479 | | #define _tmp_122_type 1392 |
480 | | #define _tmp_123_type 1393 |
481 | | #define _tmp_124_type 1394 |
482 | | #define _tmp_125_type 1395 |
483 | | #define _tmp_126_type 1396 |
484 | | #define _tmp_127_type 1397 |
485 | | #define _tmp_128_type 1398 |
486 | | #define _tmp_129_type 1399 |
487 | | #define _loop0_130_type 1400 |
488 | | #define _gather_131_type 1401 |
489 | | #define _tmp_132_type 1402 |
490 | | #define _tmp_133_type 1403 |
491 | | #define _tmp_134_type 1404 |
492 | | #define _tmp_135_type 1405 |
493 | | #define _loop0_136_type 1406 |
494 | | #define _gather_137_type 1407 |
495 | | #define _tmp_138_type 1408 |
496 | | #define _loop0_139_type 1409 |
497 | | #define _gather_140_type 1410 |
498 | | #define _loop0_141_type 1411 |
499 | | #define _gather_142_type 1412 |
500 | | #define _tmp_143_type 1413 |
501 | | #define _loop0_144_type 1414 |
502 | | #define _tmp_145_type 1415 |
503 | | #define _tmp_146_type 1416 |
504 | | #define _tmp_147_type 1417 |
505 | | #define _tmp_148_type 1418 |
506 | | #define _tmp_149_type 1419 |
507 | | #define _tmp_150_type 1420 |
508 | | #define _tmp_151_type 1421 |
509 | | #define _tmp_152_type 1422 |
510 | | #define _tmp_153_type 1423 |
511 | | #define _tmp_154_type 1424 |
512 | | #define _tmp_155_type 1425 |
513 | | #define _tmp_156_type 1426 |
514 | | #define _tmp_157_type 1427 |
515 | | #define _tmp_158_type 1428 |
516 | | #define _tmp_159_type 1429 |
517 | | #define _tmp_160_type 1430 |
518 | | #define _tmp_161_type 1431 |
519 | | #define _tmp_162_type 1432 |
520 | | #define _tmp_163_type 1433 |
521 | | #define _tmp_164_type 1434 |
522 | | #define _tmp_165_type 1435 |
523 | | #define _tmp_166_type 1436 |
524 | | #define _tmp_167_type 1437 |
525 | | #define _tmp_168_type 1438 |
526 | | #define _tmp_169_type 1439 |
527 | | #define _tmp_170_type 1440 |
528 | | #define _tmp_171_type 1441 |
529 | | #define _loop0_172_type 1442 |
530 | | #define _tmp_173_type 1443 |
531 | | #define _tmp_174_type 1444 |
532 | | #define _tmp_175_type 1445 |
533 | | #define _tmp_176_type 1446 |
534 | | #define _tmp_177_type 1447 |
535 | | |
536 | | static mod_ty file_rule(Parser *p); |
537 | | static mod_ty interactive_rule(Parser *p); |
538 | | static mod_ty eval_rule(Parser *p); |
539 | | static mod_ty func_type_rule(Parser *p); |
540 | | static asdl_stmt_seq* statements_rule(Parser *p); |
541 | | static asdl_stmt_seq* statement_rule(Parser *p); |
542 | | static asdl_stmt_seq* single_compound_stmt_rule(Parser *p); |
543 | | static asdl_stmt_seq* statement_newline_rule(Parser *p); |
544 | | static asdl_stmt_seq* simple_stmts_rule(Parser *p); |
545 | | static stmt_ty simple_stmt_rule(Parser *p); |
546 | | static stmt_ty compound_stmt_rule(Parser *p); |
547 | | static stmt_ty assignment_rule(Parser *p); |
548 | | static expr_ty annotated_rhs_rule(Parser *p); |
549 | | static AugOperator* augassign_rule(Parser *p); |
550 | | static stmt_ty return_stmt_rule(Parser *p); |
551 | | static stmt_ty raise_stmt_rule(Parser *p); |
552 | | static stmt_ty pass_stmt_rule(Parser *p); |
553 | | static stmt_ty break_stmt_rule(Parser *p); |
554 | | static stmt_ty continue_stmt_rule(Parser *p); |
555 | | static stmt_ty global_stmt_rule(Parser *p); |
556 | | static stmt_ty nonlocal_stmt_rule(Parser *p); |
557 | | static stmt_ty del_stmt_rule(Parser *p); |
558 | | static stmt_ty yield_stmt_rule(Parser *p); |
559 | | static stmt_ty assert_stmt_rule(Parser *p); |
560 | | static stmt_ty import_stmt_rule(Parser *p); |
561 | | static stmt_ty import_name_rule(Parser *p); |
562 | | static stmt_ty import_from_rule(Parser *p); |
563 | | static asdl_alias_seq* import_from_targets_rule(Parser *p); |
564 | | static asdl_alias_seq* import_from_as_names_rule(Parser *p); |
565 | | static alias_ty import_from_as_name_rule(Parser *p); |
566 | | static asdl_alias_seq* dotted_as_names_rule(Parser *p); |
567 | | static alias_ty dotted_as_name_rule(Parser *p); |
568 | | static expr_ty dotted_name_rule(Parser *p); |
569 | | static asdl_stmt_seq* block_rule(Parser *p); |
570 | | static asdl_expr_seq* decorators_rule(Parser *p); |
571 | | static stmt_ty class_def_rule(Parser *p); |
572 | | static stmt_ty class_def_raw_rule(Parser *p); |
573 | | static stmt_ty function_def_rule(Parser *p); |
574 | | static stmt_ty function_def_raw_rule(Parser *p); |
575 | | static arguments_ty params_rule(Parser *p); |
576 | | static arguments_ty parameters_rule(Parser *p); |
577 | | static asdl_arg_seq* slash_no_default_rule(Parser *p); |
578 | | static SlashWithDefault* slash_with_default_rule(Parser *p); |
579 | | static StarEtc* star_etc_rule(Parser *p); |
580 | | static arg_ty kwds_rule(Parser *p); |
581 | | static arg_ty param_no_default_rule(Parser *p); |
582 | | static arg_ty param_no_default_star_annotation_rule(Parser *p); |
583 | | static NameDefaultPair* param_with_default_rule(Parser *p); |
584 | | static NameDefaultPair* param_maybe_default_rule(Parser *p); |
585 | | static arg_ty param_rule(Parser *p); |
586 | | static arg_ty param_star_annotation_rule(Parser *p); |
587 | | static expr_ty annotation_rule(Parser *p); |
588 | | static expr_ty star_annotation_rule(Parser *p); |
589 | | static expr_ty default_rule(Parser *p); |
590 | | static stmt_ty if_stmt_rule(Parser *p); |
591 | | static stmt_ty elif_stmt_rule(Parser *p); |
592 | | static asdl_stmt_seq* else_block_rule(Parser *p); |
593 | | static stmt_ty while_stmt_rule(Parser *p); |
594 | | static stmt_ty for_stmt_rule(Parser *p); |
595 | | static stmt_ty with_stmt_rule(Parser *p); |
596 | | static withitem_ty with_item_rule(Parser *p); |
597 | | static stmt_ty try_stmt_rule(Parser *p); |
598 | | static excepthandler_ty except_block_rule(Parser *p); |
599 | | static excepthandler_ty except_star_block_rule(Parser *p); |
600 | | static asdl_stmt_seq* finally_block_rule(Parser *p); |
601 | | static stmt_ty match_stmt_rule(Parser *p); |
602 | | static expr_ty subject_expr_rule(Parser *p); |
603 | | static match_case_ty case_block_rule(Parser *p); |
604 | | static expr_ty guard_rule(Parser *p); |
605 | | static pattern_ty patterns_rule(Parser *p); |
606 | | static pattern_ty pattern_rule(Parser *p); |
607 | | static pattern_ty as_pattern_rule(Parser *p); |
608 | | static pattern_ty or_pattern_rule(Parser *p); |
609 | | static pattern_ty closed_pattern_rule(Parser *p); |
610 | | static pattern_ty literal_pattern_rule(Parser *p); |
611 | | static expr_ty literal_expr_rule(Parser *p); |
612 | | static expr_ty complex_number_rule(Parser *p); |
613 | | static expr_ty signed_number_rule(Parser *p); |
614 | | static expr_ty signed_real_number_rule(Parser *p); |
615 | | static expr_ty real_number_rule(Parser *p); |
616 | | static expr_ty imaginary_number_rule(Parser *p); |
617 | | static pattern_ty capture_pattern_rule(Parser *p); |
618 | | static expr_ty pattern_capture_target_rule(Parser *p); |
619 | | static pattern_ty wildcard_pattern_rule(Parser *p); |
620 | | static pattern_ty value_pattern_rule(Parser *p); |
621 | | static expr_ty attr_rule(Parser *p); |
622 | | static expr_ty name_or_attr_rule(Parser *p); |
623 | | static pattern_ty group_pattern_rule(Parser *p); |
624 | | static pattern_ty sequence_pattern_rule(Parser *p); |
625 | | static asdl_seq* open_sequence_pattern_rule(Parser *p); |
626 | | static asdl_seq* maybe_sequence_pattern_rule(Parser *p); |
627 | | static pattern_ty maybe_star_pattern_rule(Parser *p); |
628 | | static pattern_ty star_pattern_rule(Parser *p); |
629 | | static pattern_ty mapping_pattern_rule(Parser *p); |
630 | | static asdl_seq* items_pattern_rule(Parser *p); |
631 | | static KeyPatternPair* key_value_pattern_rule(Parser *p); |
632 | | static expr_ty double_star_pattern_rule(Parser *p); |
633 | | static pattern_ty class_pattern_rule(Parser *p); |
634 | | static asdl_pattern_seq* positional_patterns_rule(Parser *p); |
635 | | static asdl_seq* keyword_patterns_rule(Parser *p); |
636 | | static KeyPatternPair* keyword_pattern_rule(Parser *p); |
637 | | static stmt_ty type_alias_rule(Parser *p); |
638 | | static asdl_type_param_seq* type_params_rule(Parser *p); |
639 | | static asdl_type_param_seq* type_param_seq_rule(Parser *p); |
640 | | static type_param_ty type_param_rule(Parser *p); |
641 | | static expr_ty type_param_bound_rule(Parser *p); |
642 | | static expr_ty type_param_default_rule(Parser *p); |
643 | | static expr_ty type_param_starred_default_rule(Parser *p); |
644 | | static expr_ty expressions_rule(Parser *p); |
645 | | static expr_ty expression_rule(Parser *p); |
646 | | static expr_ty yield_expr_rule(Parser *p); |
647 | | static expr_ty star_expressions_rule(Parser *p); |
648 | | static expr_ty star_expression_rule(Parser *p); |
649 | | static asdl_expr_seq* star_named_expressions_rule(Parser *p); |
650 | | static expr_ty star_named_expression_rule(Parser *p); |
651 | | static expr_ty assignment_expression_rule(Parser *p); |
652 | | static expr_ty named_expression_rule(Parser *p); |
653 | | static expr_ty disjunction_rule(Parser *p); |
654 | | static expr_ty conjunction_rule(Parser *p); |
655 | | static expr_ty inversion_rule(Parser *p); |
656 | | static expr_ty comparison_rule(Parser *p); |
657 | | static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p); |
658 | | static CmpopExprPair* eq_bitwise_or_rule(Parser *p); |
659 | | static CmpopExprPair* noteq_bitwise_or_rule(Parser *p); |
660 | | static CmpopExprPair* lte_bitwise_or_rule(Parser *p); |
661 | | static CmpopExprPair* lt_bitwise_or_rule(Parser *p); |
662 | | static CmpopExprPair* gte_bitwise_or_rule(Parser *p); |
663 | | static CmpopExprPair* gt_bitwise_or_rule(Parser *p); |
664 | | static CmpopExprPair* notin_bitwise_or_rule(Parser *p); |
665 | | static CmpopExprPair* in_bitwise_or_rule(Parser *p); |
666 | | static CmpopExprPair* isnot_bitwise_or_rule(Parser *p); |
667 | | static CmpopExprPair* is_bitwise_or_rule(Parser *p); |
668 | | static expr_ty bitwise_or_rule(Parser *p); |
669 | | static expr_ty bitwise_xor_rule(Parser *p); |
670 | | static expr_ty bitwise_and_rule(Parser *p); |
671 | | static expr_ty shift_expr_rule(Parser *p); |
672 | | static expr_ty sum_rule(Parser *p); |
673 | | static expr_ty term_rule(Parser *p); |
674 | | static expr_ty factor_rule(Parser *p); |
675 | | static expr_ty power_rule(Parser *p); |
676 | | static expr_ty await_primary_rule(Parser *p); |
677 | | static expr_ty primary_rule(Parser *p); |
678 | | static expr_ty slices_rule(Parser *p); |
679 | | static expr_ty slice_rule(Parser *p); |
680 | | static expr_ty atom_rule(Parser *p); |
681 | | static expr_ty group_rule(Parser *p); |
682 | | static expr_ty lambdef_rule(Parser *p); |
683 | | static arguments_ty lambda_params_rule(Parser *p); |
684 | | static arguments_ty lambda_parameters_rule(Parser *p); |
685 | | static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p); |
686 | | static SlashWithDefault* lambda_slash_with_default_rule(Parser *p); |
687 | | static StarEtc* lambda_star_etc_rule(Parser *p); |
688 | | static arg_ty lambda_kwds_rule(Parser *p); |
689 | | static arg_ty lambda_param_no_default_rule(Parser *p); |
690 | | static NameDefaultPair* lambda_param_with_default_rule(Parser *p); |
691 | | static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p); |
692 | | static arg_ty lambda_param_rule(Parser *p); |
693 | | static expr_ty fstring_middle_rule(Parser *p); |
694 | | static expr_ty fstring_replacement_field_rule(Parser *p); |
695 | | static ResultTokenWithMetadata* fstring_conversion_rule(Parser *p); |
696 | | static ResultTokenWithMetadata* fstring_full_format_spec_rule(Parser *p); |
697 | | static expr_ty fstring_format_spec_rule(Parser *p); |
698 | | static expr_ty fstring_rule(Parser *p); |
699 | | static expr_ty tstring_format_spec_replacement_field_rule(Parser *p); |
700 | | static expr_ty tstring_format_spec_rule(Parser *p); |
701 | | static ResultTokenWithMetadata* tstring_full_format_spec_rule(Parser *p); |
702 | | static expr_ty tstring_replacement_field_rule(Parser *p); |
703 | | static expr_ty tstring_middle_rule(Parser *p); |
704 | | static expr_ty tstring_rule(Parser *p); |
705 | | static expr_ty string_rule(Parser *p); |
706 | | static expr_ty strings_rule(Parser *p); |
707 | | static expr_ty list_rule(Parser *p); |
708 | | static expr_ty tuple_rule(Parser *p); |
709 | | static expr_ty set_rule(Parser *p); |
710 | | static expr_ty dict_rule(Parser *p); |
711 | | static asdl_seq* double_starred_kvpairs_rule(Parser *p); |
712 | | static KeyValuePair* double_starred_kvpair_rule(Parser *p); |
713 | | static KeyValuePair* kvpair_rule(Parser *p); |
714 | | static asdl_comprehension_seq* for_if_clauses_rule(Parser *p); |
715 | | static comprehension_ty for_if_clause_rule(Parser *p); |
716 | | static expr_ty listcomp_rule(Parser *p); |
717 | | static expr_ty setcomp_rule(Parser *p); |
718 | | static expr_ty genexp_rule(Parser *p); |
719 | | static expr_ty dictcomp_rule(Parser *p); |
720 | | static expr_ty arguments_rule(Parser *p); |
721 | | static expr_ty args_rule(Parser *p); |
722 | | static asdl_seq* kwargs_rule(Parser *p); |
723 | | static expr_ty starred_expression_rule(Parser *p); |
724 | | static KeywordOrStarred* kwarg_or_starred_rule(Parser *p); |
725 | | static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p); |
726 | | static expr_ty star_targets_rule(Parser *p); |
727 | | static asdl_expr_seq* star_targets_list_seq_rule(Parser *p); |
728 | | static asdl_expr_seq* star_targets_tuple_seq_rule(Parser *p); |
729 | | static expr_ty star_target_rule(Parser *p); |
730 | | static expr_ty target_with_star_atom_rule(Parser *p); |
731 | | static expr_ty star_atom_rule(Parser *p); |
732 | | static expr_ty single_target_rule(Parser *p); |
733 | | static expr_ty single_subscript_attribute_target_rule(Parser *p); |
734 | | static expr_ty t_primary_rule(Parser *p); |
735 | | static void *t_lookahead_rule(Parser *p); |
736 | | static asdl_expr_seq* del_targets_rule(Parser *p); |
737 | | static expr_ty del_target_rule(Parser *p); |
738 | | static expr_ty del_t_atom_rule(Parser *p); |
739 | | static asdl_expr_seq* type_expressions_rule(Parser *p); |
740 | | static Token* func_type_comment_rule(Parser *p); |
741 | | static void *invalid_arguments_rule(Parser *p); |
742 | | static void *invalid_kwarg_rule(Parser *p); |
743 | | static expr_ty expression_without_invalid_rule(Parser *p); |
744 | | static void *invalid_legacy_expression_rule(Parser *p); |
745 | | static void *invalid_type_param_rule(Parser *p); |
746 | | static void *invalid_expression_rule(Parser *p); |
747 | | static void *invalid_named_expression_rule(Parser *p); |
748 | | static void *invalid_assignment_rule(Parser *p); |
749 | | static expr_ty invalid_ann_assign_target_rule(Parser *p); |
750 | | static void *invalid_raise_stmt_rule(Parser *p); |
751 | | static void *invalid_del_stmt_rule(Parser *p); |
752 | | static void *invalid_assert_stmt_rule(Parser *p); |
753 | | static void *invalid_block_rule(Parser *p); |
754 | | static void *invalid_comprehension_rule(Parser *p); |
755 | | static void *invalid_dict_comprehension_rule(Parser *p); |
756 | | static void *invalid_parameters_rule(Parser *p); |
757 | | static void *invalid_default_rule(Parser *p); |
758 | | static void *invalid_star_etc_rule(Parser *p); |
759 | | static void *invalid_kwds_rule(Parser *p); |
760 | | static void *invalid_parameters_helper_rule(Parser *p); |
761 | | static void *invalid_lambda_parameters_rule(Parser *p); |
762 | | static void *invalid_lambda_parameters_helper_rule(Parser *p); |
763 | | static void *invalid_lambda_star_etc_rule(Parser *p); |
764 | | static void *invalid_lambda_kwds_rule(Parser *p); |
765 | | static void *invalid_double_type_comments_rule(Parser *p); |
766 | | static void *invalid_with_item_rule(Parser *p); |
767 | | static void *invalid_for_if_clause_rule(Parser *p); |
768 | | static void *invalid_for_target_rule(Parser *p); |
769 | | static void *invalid_group_rule(Parser *p); |
770 | | static void *invalid_import_rule(Parser *p); |
771 | | static void *invalid_dotted_as_name_rule(Parser *p); |
772 | | static void *invalid_import_from_as_name_rule(Parser *p); |
773 | | static void *invalid_import_from_targets_rule(Parser *p); |
774 | | static void *invalid_with_stmt_rule(Parser *p); |
775 | | static void *invalid_with_stmt_indent_rule(Parser *p); |
776 | | static void *invalid_try_stmt_rule(Parser *p); |
777 | | static void *invalid_except_stmt_rule(Parser *p); |
778 | | static void *invalid_except_star_stmt_rule(Parser *p); |
779 | | static void *invalid_finally_stmt_rule(Parser *p); |
780 | | static void *invalid_except_stmt_indent_rule(Parser *p); |
781 | | static void *invalid_except_star_stmt_indent_rule(Parser *p); |
782 | | static void *invalid_match_stmt_rule(Parser *p); |
783 | | static void *invalid_case_block_rule(Parser *p); |
784 | | static void *invalid_as_pattern_rule(Parser *p); |
785 | | static void *invalid_class_pattern_rule(Parser *p); |
786 | | static void *invalid_mapping_pattern_rule(Parser *p); |
787 | | static asdl_pattern_seq* invalid_class_argument_pattern_rule(Parser *p); |
788 | | static void *invalid_if_stmt_rule(Parser *p); |
789 | | static void *invalid_elif_stmt_rule(Parser *p); |
790 | | static void *invalid_else_stmt_rule(Parser *p); |
791 | | static void *invalid_while_stmt_rule(Parser *p); |
792 | | static void *invalid_for_stmt_rule(Parser *p); |
793 | | static void *invalid_def_raw_rule(Parser *p); |
794 | | static void *invalid_class_def_raw_rule(Parser *p); |
795 | | static void *invalid_double_starred_kvpairs_rule(Parser *p); |
796 | | static void *invalid_kvpair_rule(Parser *p); |
797 | | static void *invalid_starred_expression_unpacking_rule(Parser *p); |
798 | | static void *invalid_starred_expression_rule(Parser *p); |
799 | | static void *invalid_fstring_replacement_field_rule(Parser *p); |
800 | | static void *invalid_fstring_conversion_character_rule(Parser *p); |
801 | | static void *invalid_tstring_replacement_field_rule(Parser *p); |
802 | | static void *invalid_tstring_conversion_character_rule(Parser *p); |
803 | | static void *invalid_string_tstring_concat_rule(Parser *p); |
804 | | static void *invalid_arithmetic_rule(Parser *p); |
805 | | static void *invalid_factor_rule(Parser *p); |
806 | | static void *invalid_type_params_rule(Parser *p); |
807 | | static asdl_seq *_loop0_1_rule(Parser *p); |
808 | | static asdl_seq *_loop1_2_rule(Parser *p); |
809 | | static asdl_seq *_loop0_3_rule(Parser *p); |
810 | | static asdl_seq *_gather_4_rule(Parser *p); |
811 | | static void *_tmp_5_rule(Parser *p); |
812 | | static void *_tmp_6_rule(Parser *p); |
813 | | static void *_tmp_7_rule(Parser *p); |
814 | | static void *_tmp_8_rule(Parser *p); |
815 | | static void *_tmp_9_rule(Parser *p); |
816 | | static void *_tmp_10_rule(Parser *p); |
817 | | static void *_tmp_11_rule(Parser *p); |
818 | | static asdl_seq *_loop1_12_rule(Parser *p); |
819 | | static asdl_seq *_loop0_13_rule(Parser *p); |
820 | | static asdl_seq *_gather_14_rule(Parser *p); |
821 | | static void *_tmp_15_rule(Parser *p); |
822 | | static void *_tmp_16_rule(Parser *p); |
823 | | static asdl_seq *_loop0_17_rule(Parser *p); |
824 | | static asdl_seq *_loop1_18_rule(Parser *p); |
825 | | static asdl_seq *_loop0_19_rule(Parser *p); |
826 | | static asdl_seq *_gather_20_rule(Parser *p); |
827 | | static void *_tmp_21_rule(Parser *p); |
828 | | static asdl_seq *_loop0_22_rule(Parser *p); |
829 | | static asdl_seq *_gather_23_rule(Parser *p); |
830 | | static asdl_seq *_loop1_24_rule(Parser *p); |
831 | | static void *_tmp_25_rule(Parser *p); |
832 | | static void *_tmp_26_rule(Parser *p); |
833 | | static asdl_seq *_loop0_27_rule(Parser *p); |
834 | | static asdl_seq *_loop0_28_rule(Parser *p); |
835 | | static asdl_seq *_loop1_29_rule(Parser *p); |
836 | | static asdl_seq *_loop1_30_rule(Parser *p); |
837 | | static asdl_seq *_loop0_31_rule(Parser *p); |
838 | | static asdl_seq *_loop1_32_rule(Parser *p); |
839 | | static asdl_seq *_loop0_33_rule(Parser *p); |
840 | | static asdl_seq *_gather_34_rule(Parser *p); |
841 | | static void *_tmp_35_rule(Parser *p); |
842 | | static asdl_seq *_loop1_36_rule(Parser *p); |
843 | | static asdl_seq *_loop1_37_rule(Parser *p); |
844 | | static asdl_seq *_loop1_38_rule(Parser *p); |
845 | | static asdl_seq *_loop0_39_rule(Parser *p); |
846 | | static asdl_seq *_gather_40_rule(Parser *p); |
847 | | static void *_tmp_41_rule(Parser *p); |
848 | | static void *_tmp_42_rule(Parser *p); |
849 | | static void *_tmp_43_rule(Parser *p); |
850 | | static asdl_seq *_loop0_44_rule(Parser *p); |
851 | | static asdl_seq *_gather_45_rule(Parser *p); |
852 | | static asdl_seq *_loop0_46_rule(Parser *p); |
853 | | static asdl_seq *_gather_47_rule(Parser *p); |
854 | | static void *_tmp_48_rule(Parser *p); |
855 | | static asdl_seq *_loop0_49_rule(Parser *p); |
856 | | static asdl_seq *_gather_50_rule(Parser *p); |
857 | | static asdl_seq *_loop0_51_rule(Parser *p); |
858 | | static asdl_seq *_gather_52_rule(Parser *p); |
859 | | static asdl_seq *_loop0_53_rule(Parser *p); |
860 | | static asdl_seq *_gather_54_rule(Parser *p); |
861 | | static asdl_seq *_loop1_55_rule(Parser *p); |
862 | | static asdl_seq *_loop1_56_rule(Parser *p); |
863 | | static asdl_seq *_loop0_57_rule(Parser *p); |
864 | | static asdl_seq *_gather_58_rule(Parser *p); |
865 | | static asdl_seq *_loop1_59_rule(Parser *p); |
866 | | static asdl_seq *_loop1_60_rule(Parser *p); |
867 | | static asdl_seq *_loop1_61_rule(Parser *p); |
868 | | static void *_tmp_62_rule(Parser *p); |
869 | | static asdl_seq *_loop0_63_rule(Parser *p); |
870 | | static asdl_seq *_gather_64_rule(Parser *p); |
871 | | static void *_tmp_65_rule(Parser *p); |
872 | | static void *_tmp_66_rule(Parser *p); |
873 | | static void *_tmp_67_rule(Parser *p); |
874 | | static void *_tmp_68_rule(Parser *p); |
875 | | static void *_tmp_69_rule(Parser *p); |
876 | | static asdl_seq *_loop0_70_rule(Parser *p); |
877 | | static asdl_seq *_loop0_71_rule(Parser *p); |
878 | | static asdl_seq *_loop1_72_rule(Parser *p); |
879 | | static asdl_seq *_loop1_73_rule(Parser *p); |
880 | | static asdl_seq *_loop0_74_rule(Parser *p); |
881 | | static asdl_seq *_loop1_75_rule(Parser *p); |
882 | | static asdl_seq *_loop0_76_rule(Parser *p); |
883 | | static asdl_seq *_loop0_77_rule(Parser *p); |
884 | | static asdl_seq *_loop0_78_rule(Parser *p); |
885 | | static asdl_seq *_loop0_79_rule(Parser *p); |
886 | | static asdl_seq *_loop1_80_rule(Parser *p); |
887 | | static asdl_seq *_loop1_81_rule(Parser *p); |
888 | | static void *_tmp_82_rule(Parser *p); |
889 | | static asdl_seq *_loop0_83_rule(Parser *p); |
890 | | static asdl_seq *_gather_84_rule(Parser *p); |
891 | | static asdl_seq *_loop1_85_rule(Parser *p); |
892 | | static asdl_seq *_loop0_86_rule(Parser *p); |
893 | | static void *_tmp_87_rule(Parser *p); |
894 | | static asdl_seq *_loop0_88_rule(Parser *p); |
895 | | static asdl_seq *_gather_89_rule(Parser *p); |
896 | | static void *_tmp_90_rule(Parser *p); |
897 | | static asdl_seq *_loop0_91_rule(Parser *p); |
898 | | static asdl_seq *_gather_92_rule(Parser *p); |
899 | | static asdl_seq *_loop0_93_rule(Parser *p); |
900 | | static asdl_seq *_gather_94_rule(Parser *p); |
901 | | static asdl_seq *_loop0_95_rule(Parser *p); |
902 | | static asdl_seq *_loop0_96_rule(Parser *p); |
903 | | static asdl_seq *_gather_97_rule(Parser *p); |
904 | | static asdl_seq *_loop1_98_rule(Parser *p); |
905 | | static void *_tmp_99_rule(Parser *p); |
906 | | static asdl_seq *_loop0_100_rule(Parser *p); |
907 | | static asdl_seq *_gather_101_rule(Parser *p); |
908 | | static asdl_seq *_loop0_102_rule(Parser *p); |
909 | | static asdl_seq *_gather_103_rule(Parser *p); |
910 | | static void *_tmp_104_rule(Parser *p); |
911 | | static void *_tmp_105_rule(Parser *p); |
912 | | static asdl_seq *_loop0_106_rule(Parser *p); |
913 | | static asdl_seq *_gather_107_rule(Parser *p); |
914 | | static void *_tmp_108_rule(Parser *p); |
915 | | static void *_tmp_109_rule(Parser *p); |
916 | | static void *_tmp_110_rule(Parser *p); |
917 | | static void *_tmp_111_rule(Parser *p); |
918 | | static void *_tmp_112_rule(Parser *p); |
919 | | static asdl_seq *_loop1_113_rule(Parser *p); |
920 | | static void *_tmp_114_rule(Parser *p); |
921 | | static void *_tmp_115_rule(Parser *p); |
922 | | static void *_tmp_116_rule(Parser *p); |
923 | | static void *_tmp_117_rule(Parser *p); |
924 | | static void *_tmp_118_rule(Parser *p); |
925 | | static asdl_seq *_loop0_119_rule(Parser *p); |
926 | | static asdl_seq *_loop0_120_rule(Parser *p); |
927 | | static void *_tmp_121_rule(Parser *p); |
928 | | static void *_tmp_122_rule(Parser *p); |
929 | | static void *_tmp_123_rule(Parser *p); |
930 | | static void *_tmp_124_rule(Parser *p); |
931 | | static void *_tmp_125_rule(Parser *p); |
932 | | static void *_tmp_126_rule(Parser *p); |
933 | | static void *_tmp_127_rule(Parser *p); |
934 | | static void *_tmp_128_rule(Parser *p); |
935 | | static void *_tmp_129_rule(Parser *p); |
936 | | static asdl_seq *_loop0_130_rule(Parser *p); |
937 | | static asdl_seq *_gather_131_rule(Parser *p); |
938 | | static void *_tmp_132_rule(Parser *p); |
939 | | static void *_tmp_133_rule(Parser *p); |
940 | | static void *_tmp_134_rule(Parser *p); |
941 | | static void *_tmp_135_rule(Parser *p); |
942 | | static asdl_seq *_loop0_136_rule(Parser *p); |
943 | | static asdl_seq *_gather_137_rule(Parser *p); |
944 | | static void *_tmp_138_rule(Parser *p); |
945 | | static asdl_seq *_loop0_139_rule(Parser *p); |
946 | | static asdl_seq *_gather_140_rule(Parser *p); |
947 | | static asdl_seq *_loop0_141_rule(Parser *p); |
948 | | static asdl_seq *_gather_142_rule(Parser *p); |
949 | | static void *_tmp_143_rule(Parser *p); |
950 | | static asdl_seq *_loop0_144_rule(Parser *p); |
951 | | static void *_tmp_145_rule(Parser *p); |
952 | | static void *_tmp_146_rule(Parser *p); |
953 | | static void *_tmp_147_rule(Parser *p); |
954 | | static void *_tmp_148_rule(Parser *p); |
955 | | static void *_tmp_149_rule(Parser *p); |
956 | | static void *_tmp_150_rule(Parser *p); |
957 | | static void *_tmp_151_rule(Parser *p); |
958 | | static void *_tmp_152_rule(Parser *p); |
959 | | static void *_tmp_153_rule(Parser *p); |
960 | | static void *_tmp_154_rule(Parser *p); |
961 | | static void *_tmp_155_rule(Parser *p); |
962 | | static void *_tmp_156_rule(Parser *p); |
963 | | static void *_tmp_157_rule(Parser *p); |
964 | | static void *_tmp_158_rule(Parser *p); |
965 | | static void *_tmp_159_rule(Parser *p); |
966 | | static void *_tmp_160_rule(Parser *p); |
967 | | static void *_tmp_161_rule(Parser *p); |
968 | | static void *_tmp_162_rule(Parser *p); |
969 | | static void *_tmp_163_rule(Parser *p); |
970 | | static void *_tmp_164_rule(Parser *p); |
971 | | static void *_tmp_165_rule(Parser *p); |
972 | | static void *_tmp_166_rule(Parser *p); |
973 | | static void *_tmp_167_rule(Parser *p); |
974 | | static void *_tmp_168_rule(Parser *p); |
975 | | static void *_tmp_169_rule(Parser *p); |
976 | | static void *_tmp_170_rule(Parser *p); |
977 | | static void *_tmp_171_rule(Parser *p); |
978 | | static asdl_seq *_loop0_172_rule(Parser *p); |
979 | | static void *_tmp_173_rule(Parser *p); |
980 | | static void *_tmp_174_rule(Parser *p); |
981 | | static void *_tmp_175_rule(Parser *p); |
982 | | static void *_tmp_176_rule(Parser *p); |
983 | | static void *_tmp_177_rule(Parser *p); |
984 | | |
985 | | |
986 | | // file: statements? $ |
987 | | static mod_ty |
988 | | file_rule(Parser *p) |
989 | 31.2k | { |
990 | 31.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
991 | 0 | _Pypegen_stack_overflow(p); |
992 | 0 | } |
993 | 31.2k | if (p->error_indicator) { |
994 | 2.90k | p->level--; |
995 | 2.90k | return NULL; |
996 | 2.90k | } |
997 | 28.3k | mod_ty _res = NULL; |
998 | 28.3k | int _mark = p->mark; |
999 | 28.3k | { // statements? $ |
1000 | 28.3k | if (p->error_indicator) { |
1001 | 0 | p->level--; |
1002 | 0 | return NULL; |
1003 | 0 | } |
1004 | 28.3k | D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $")); |
1005 | 28.3k | void *a; |
1006 | 28.3k | Token * endmarker_var; |
1007 | 28.3k | if ( |
1008 | 28.3k | (a = statements_rule(p), !p->error_indicator) // statements? |
1009 | 22.5k | && |
1010 | 22.5k | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
1011 | 28.3k | ) |
1012 | 6.57k | { |
1013 | 6.57k | D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $")); |
1014 | 6.57k | _res = _PyPegen_make_module ( p , a ); |
1015 | 6.57k | if (_res == NULL && PyErr_Occurred()) { |
1016 | 0 | p->error_indicator = 1; |
1017 | 0 | p->level--; |
1018 | 0 | return NULL; |
1019 | 0 | } |
1020 | 6.57k | goto done; |
1021 | 6.57k | } |
1022 | 21.7k | p->mark = _mark; |
1023 | 21.7k | D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ', |
1024 | 21.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $")); |
1025 | 21.7k | } |
1026 | 21.7k | _res = NULL; |
1027 | 28.3k | done: |
1028 | 28.3k | p->level--; |
1029 | 28.3k | return _res; |
1030 | 21.7k | } |
1031 | | |
1032 | | // interactive: statement_newline |
1033 | | static mod_ty |
1034 | | interactive_rule(Parser *p) |
1035 | 0 | { |
1036 | 0 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
1037 | 0 | _Pypegen_stack_overflow(p); |
1038 | 0 | } |
1039 | 0 | if (p->error_indicator) { |
1040 | 0 | p->level--; |
1041 | 0 | return NULL; |
1042 | 0 | } |
1043 | 0 | mod_ty _res = NULL; |
1044 | 0 | int _mark = p->mark; |
1045 | 0 | { // statement_newline |
1046 | 0 | if (p->error_indicator) { |
1047 | 0 | p->level--; |
1048 | 0 | return NULL; |
1049 | 0 | } |
1050 | 0 | D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline")); |
1051 | 0 | asdl_stmt_seq* a; |
1052 | 0 | if ( |
1053 | 0 | (a = statement_newline_rule(p)) // statement_newline |
1054 | 0 | ) |
1055 | 0 | { |
1056 | 0 | D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline")); |
1057 | 0 | _res = _PyAST_Interactive ( a , p -> arena ); |
1058 | 0 | if (_res == NULL && PyErr_Occurred()) { |
1059 | 0 | p->error_indicator = 1; |
1060 | 0 | p->level--; |
1061 | 0 | return NULL; |
1062 | 0 | } |
1063 | 0 | goto done; |
1064 | 0 | } |
1065 | 0 | p->mark = _mark; |
1066 | 0 | D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ', |
1067 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline")); |
1068 | 0 | } |
1069 | 0 | _res = NULL; |
1070 | 0 | done: |
1071 | 0 | p->level--; |
1072 | 0 | return _res; |
1073 | 0 | } |
1074 | | |
1075 | | // eval: expressions NEWLINE* $ |
1076 | | static mod_ty |
1077 | | eval_rule(Parser *p) |
1078 | 75 | { |
1079 | 75 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
1080 | 0 | _Pypegen_stack_overflow(p); |
1081 | 0 | } |
1082 | 75 | if (p->error_indicator) { |
1083 | 0 | p->level--; |
1084 | 0 | return NULL; |
1085 | 0 | } |
1086 | 75 | mod_ty _res = NULL; |
1087 | 75 | int _mark = p->mark; |
1088 | 75 | { // expressions NEWLINE* $ |
1089 | 75 | if (p->error_indicator) { |
1090 | 0 | p->level--; |
1091 | 0 | return NULL; |
1092 | 0 | } |
1093 | 75 | D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $")); |
1094 | 75 | asdl_seq * _loop0_1_var; |
1095 | 75 | expr_ty a; |
1096 | 75 | Token * endmarker_var; |
1097 | 75 | if ( |
1098 | 75 | (a = expressions_rule(p)) // expressions |
1099 | 75 | && |
1100 | 75 | (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE* |
1101 | 75 | && |
1102 | 75 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
1103 | 75 | ) |
1104 | 75 | { |
1105 | 75 | D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $")); |
1106 | 75 | _res = _PyAST_Expression ( a , p -> arena ); |
1107 | 75 | if (_res == NULL && PyErr_Occurred()) { |
1108 | 0 | p->error_indicator = 1; |
1109 | 0 | p->level--; |
1110 | 0 | return NULL; |
1111 | 0 | } |
1112 | 75 | goto done; |
1113 | 75 | } |
1114 | 0 | p->mark = _mark; |
1115 | 0 | D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ', |
1116 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $")); |
1117 | 0 | } |
1118 | 0 | _res = NULL; |
1119 | 75 | done: |
1120 | 75 | p->level--; |
1121 | 75 | return _res; |
1122 | 0 | } |
1123 | | |
1124 | | // func_type: '(' type_expressions? ')' '->' expression NEWLINE* $ |
1125 | | static mod_ty |
1126 | | func_type_rule(Parser *p) |
1127 | 0 | { |
1128 | 0 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
1129 | 0 | _Pypegen_stack_overflow(p); |
1130 | 0 | } |
1131 | 0 | if (p->error_indicator) { |
1132 | 0 | p->level--; |
1133 | 0 | return NULL; |
1134 | 0 | } |
1135 | 0 | mod_ty _res = NULL; |
1136 | 0 | int _mark = p->mark; |
1137 | 0 | { // '(' type_expressions? ')' '->' expression NEWLINE* $ |
1138 | 0 | if (p->error_indicator) { |
1139 | 0 | p->level--; |
1140 | 0 | return NULL; |
1141 | 0 | } |
1142 | 0 | D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
1143 | 0 | Token * _literal; |
1144 | 0 | Token * _literal_1; |
1145 | 0 | Token * _literal_2; |
1146 | 0 | asdl_seq * _loop0_1_var; |
1147 | 0 | void *a; |
1148 | 0 | expr_ty b; |
1149 | 0 | Token * endmarker_var; |
1150 | 0 | if ( |
1151 | 0 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
1152 | 0 | && |
1153 | 0 | (a = type_expressions_rule(p), !p->error_indicator) // type_expressions? |
1154 | 0 | && |
1155 | 0 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
1156 | 0 | && |
1157 | 0 | (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->' |
1158 | 0 | && |
1159 | 0 | (b = expression_rule(p)) // expression |
1160 | 0 | && |
1161 | 0 | (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE* |
1162 | 0 | && |
1163 | 0 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
1164 | 0 | ) |
1165 | 0 | { |
1166 | 0 | D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
1167 | 0 | _res = _PyAST_FunctionType ( a , b , p -> arena ); |
1168 | 0 | if (_res == NULL && PyErr_Occurred()) { |
1169 | 0 | p->error_indicator = 1; |
1170 | 0 | p->level--; |
1171 | 0 | return NULL; |
1172 | 0 | } |
1173 | 0 | goto done; |
1174 | 0 | } |
1175 | 0 | p->mark = _mark; |
1176 | 0 | D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ', |
1177 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
1178 | 0 | } |
1179 | 0 | _res = NULL; |
1180 | 0 | done: |
1181 | 0 | p->level--; |
1182 | 0 | return _res; |
1183 | 0 | } |
1184 | | |
1185 | | // statements: statement+ |
1186 | | static asdl_stmt_seq* |
1187 | | statements_rule(Parser *p) |
1188 | 54.2k | { |
1189 | 54.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
1190 | 0 | _Pypegen_stack_overflow(p); |
1191 | 0 | } |
1192 | 54.2k | if (p->error_indicator) { |
1193 | 0 | p->level--; |
1194 | 0 | return NULL; |
1195 | 0 | } |
1196 | 54.2k | asdl_stmt_seq* _res = NULL; |
1197 | 54.2k | int _mark = p->mark; |
1198 | 54.2k | { // statement+ |
1199 | 54.2k | if (p->error_indicator) { |
1200 | 0 | p->level--; |
1201 | 0 | return NULL; |
1202 | 0 | } |
1203 | 54.2k | D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+")); |
1204 | 54.2k | asdl_seq * a; |
1205 | 54.2k | if ( |
1206 | 54.2k | (a = _loop1_2_rule(p)) // statement+ |
1207 | 54.2k | ) |
1208 | 33.4k | { |
1209 | 33.4k | D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+")); |
1210 | 33.4k | _res = ( asdl_stmt_seq* ) _PyPegen_seq_flatten ( p , a ); |
1211 | 33.4k | if (_res == NULL && PyErr_Occurred()) { |
1212 | 0 | p->error_indicator = 1; |
1213 | 0 | p->level--; |
1214 | 0 | return NULL; |
1215 | 0 | } |
1216 | 33.4k | goto done; |
1217 | 33.4k | } |
1218 | 20.8k | p->mark = _mark; |
1219 | 20.8k | D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ', |
1220 | 20.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+")); |
1221 | 20.8k | } |
1222 | 20.8k | _res = NULL; |
1223 | 54.2k | done: |
1224 | 54.2k | p->level--; |
1225 | 54.2k | return _res; |
1226 | 20.8k | } |
1227 | | |
1228 | | // statement: compound_stmt | simple_stmts |
1229 | | static asdl_stmt_seq* |
1230 | | statement_rule(Parser *p) |
1231 | 176k | { |
1232 | 176k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
1233 | 0 | _Pypegen_stack_overflow(p); |
1234 | 0 | } |
1235 | 176k | if (p->error_indicator) { |
1236 | 0 | p->level--; |
1237 | 0 | return NULL; |
1238 | 0 | } |
1239 | 176k | asdl_stmt_seq* _res = NULL; |
1240 | 176k | int _mark = p->mark; |
1241 | 176k | { // compound_stmt |
1242 | 176k | if (p->error_indicator) { |
1243 | 0 | p->level--; |
1244 | 0 | return NULL; |
1245 | 0 | } |
1246 | 176k | D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt")); |
1247 | 176k | stmt_ty a; |
1248 | 176k | if ( |
1249 | 176k | (a = compound_stmt_rule(p)) // compound_stmt |
1250 | 176k | ) |
1251 | 38.9k | { |
1252 | 38.9k | D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt")); |
1253 | 38.9k | _res = _PyPegen_register_stmts ( p , ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , a ) ); |
1254 | 38.9k | if (_res == NULL && PyErr_Occurred()) { |
1255 | 0 | p->error_indicator = 1; |
1256 | 0 | p->level--; |
1257 | 0 | return NULL; |
1258 | 0 | } |
1259 | 38.9k | goto done; |
1260 | 38.9k | } |
1261 | 137k | p->mark = _mark; |
1262 | 137k | D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ', |
1263 | 137k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt")); |
1264 | 137k | } |
1265 | 0 | { // simple_stmts |
1266 | 137k | if (p->error_indicator) { |
1267 | 1.99k | p->level--; |
1268 | 1.99k | return NULL; |
1269 | 1.99k | } |
1270 | 135k | D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
1271 | 135k | asdl_stmt_seq* a; |
1272 | 135k | if ( |
1273 | 135k | (a = (asdl_stmt_seq*)simple_stmts_rule(p)) // simple_stmts |
1274 | 135k | ) |
1275 | 83.6k | { |
1276 | 83.6k | D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
1277 | 83.6k | _res = a; |
1278 | 83.6k | if (_res == NULL && PyErr_Occurred()) { |
1279 | 0 | p->error_indicator = 1; |
1280 | 0 | p->level--; |
1281 | 0 | return NULL; |
1282 | 0 | } |
1283 | 83.6k | goto done; |
1284 | 83.6k | } |
1285 | 52.2k | p->mark = _mark; |
1286 | 52.2k | D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ', |
1287 | 52.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts")); |
1288 | 52.2k | } |
1289 | 52.2k | _res = NULL; |
1290 | 174k | done: |
1291 | 174k | p->level--; |
1292 | 174k | return _res; |
1293 | 52.2k | } |
1294 | | |
1295 | | // single_compound_stmt: compound_stmt |
1296 | | static asdl_stmt_seq* |
1297 | | single_compound_stmt_rule(Parser *p) |
1298 | 0 | { |
1299 | 0 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
1300 | 0 | _Pypegen_stack_overflow(p); |
1301 | 0 | } |
1302 | 0 | if (p->error_indicator) { |
1303 | 0 | p->level--; |
1304 | 0 | return NULL; |
1305 | 0 | } |
1306 | 0 | asdl_stmt_seq* _res = NULL; |
1307 | 0 | int _mark = p->mark; |
1308 | 0 | { // compound_stmt |
1309 | 0 | if (p->error_indicator) { |
1310 | 0 | p->level--; |
1311 | 0 | return NULL; |
1312 | 0 | } |
1313 | 0 | D(fprintf(stderr, "%*c> single_compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt")); |
1314 | 0 | stmt_ty a; |
1315 | 0 | if ( |
1316 | 0 | (a = compound_stmt_rule(p)) // compound_stmt |
1317 | 0 | ) |
1318 | 0 | { |
1319 | 0 | D(fprintf(stderr, "%*c+ single_compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt")); |
1320 | 0 | _res = _PyPegen_register_stmts ( p , ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , a ) ); |
1321 | 0 | if (_res == NULL && PyErr_Occurred()) { |
1322 | 0 | p->error_indicator = 1; |
1323 | 0 | p->level--; |
1324 | 0 | return NULL; |
1325 | 0 | } |
1326 | 0 | goto done; |
1327 | 0 | } |
1328 | 0 | p->mark = _mark; |
1329 | 0 | D(fprintf(stderr, "%*c%s single_compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1330 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt")); |
1331 | 0 | } |
1332 | 0 | _res = NULL; |
1333 | 0 | done: |
1334 | 0 | p->level--; |
1335 | 0 | return _res; |
1336 | 0 | } |
1337 | | |
1338 | | // statement_newline: single_compound_stmt NEWLINE | simple_stmts | NEWLINE | $ |
1339 | | static asdl_stmt_seq* |
1340 | | statement_newline_rule(Parser *p) |
1341 | 0 | { |
1342 | 0 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
1343 | 0 | _Pypegen_stack_overflow(p); |
1344 | 0 | } |
1345 | 0 | if (p->error_indicator) { |
1346 | 0 | p->level--; |
1347 | 0 | return NULL; |
1348 | 0 | } |
1349 | 0 | asdl_stmt_seq* _res = NULL; |
1350 | 0 | int _mark = p->mark; |
1351 | 0 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
1352 | 0 | p->error_indicator = 1; |
1353 | 0 | p->level--; |
1354 | 0 | return NULL; |
1355 | 0 | } |
1356 | 0 | int _start_lineno = p->tokens[_mark]->lineno; |
1357 | 0 | UNUSED(_start_lineno); // Only used by EXTRA macro |
1358 | 0 | int _start_col_offset = p->tokens[_mark]->col_offset; |
1359 | 0 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
1360 | 0 | { // single_compound_stmt NEWLINE |
1361 | 0 | if (p->error_indicator) { |
1362 | 0 | p->level--; |
1363 | 0 | return NULL; |
1364 | 0 | } |
1365 | 0 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_compound_stmt NEWLINE")); |
1366 | 0 | asdl_stmt_seq* a; |
1367 | 0 | Token * newline_var; |
1368 | 0 | if ( |
1369 | 0 | (a = single_compound_stmt_rule(p)) // single_compound_stmt |
1370 | 0 | && |
1371 | 0 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
1372 | 0 | ) |
1373 | 0 | { |
1374 | 0 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_compound_stmt NEWLINE")); |
1375 | 0 | _res = a; |
1376 | 0 | if (_res == NULL && PyErr_Occurred()) { |
1377 | 0 | p->error_indicator = 1; |
1378 | 0 | p->level--; |
1379 | 0 | return NULL; |
1380 | 0 | } |
1381 | 0 | goto done; |
1382 | 0 | } |
1383 | 0 | p->mark = _mark; |
1384 | 0 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
1385 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_compound_stmt NEWLINE")); |
1386 | 0 | } |
1387 | 0 | { // simple_stmts |
1388 | 0 | if (p->error_indicator) { |
1389 | 0 | p->level--; |
1390 | 0 | return NULL; |
1391 | 0 | } |
1392 | 0 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
1393 | 0 | asdl_stmt_seq* simple_stmts_var; |
1394 | 0 | if ( |
1395 | 0 | (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts |
1396 | 0 | ) |
1397 | 0 | { |
1398 | 0 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
1399 | 0 | _res = simple_stmts_var; |
1400 | 0 | goto done; |
1401 | 0 | } |
1402 | 0 | p->mark = _mark; |
1403 | 0 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
1404 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts")); |
1405 | 0 | } |
1406 | 0 | { // NEWLINE |
1407 | 0 | if (p->error_indicator) { |
1408 | 0 | p->level--; |
1409 | 0 | return NULL; |
1410 | 0 | } |
1411 | 0 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
1412 | 0 | Token * newline_var; |
1413 | 0 | if ( |
1414 | 0 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
1415 | 0 | ) |
1416 | 0 | { |
1417 | 0 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
1418 | 0 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
1419 | 0 | if (_token == NULL) { |
1420 | 0 | p->level--; |
1421 | 0 | return NULL; |
1422 | 0 | } |
1423 | 0 | int _end_lineno = _token->end_lineno; |
1424 | 0 | UNUSED(_end_lineno); // Only used by EXTRA macro |
1425 | 0 | int _end_col_offset = _token->end_col_offset; |
1426 | 0 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
1427 | 0 | _res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , CHECK ( stmt_ty , _PyAST_Pass ( EXTRA ) ) ); |
1428 | 0 | if (_res == NULL && PyErr_Occurred()) { |
1429 | 0 | p->error_indicator = 1; |
1430 | 0 | p->level--; |
1431 | 0 | return NULL; |
1432 | 0 | } |
1433 | 0 | goto done; |
1434 | 0 | } |
1435 | 0 | p->mark = _mark; |
1436 | 0 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
1437 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
1438 | 0 | } |
1439 | 0 | { // $ |
1440 | 0 | if (p->error_indicator) { |
1441 | 0 | p->level--; |
1442 | 0 | return NULL; |
1443 | 0 | } |
1444 | 0 | D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$")); |
1445 | 0 | Token * endmarker_var; |
1446 | 0 | if ( |
1447 | 0 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
1448 | 0 | ) |
1449 | 0 | { |
1450 | 0 | D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$")); |
1451 | 0 | _res = _PyPegen_interactive_exit ( p ); |
1452 | 0 | if (_res == NULL && PyErr_Occurred()) { |
1453 | 0 | p->error_indicator = 1; |
1454 | 0 | p->level--; |
1455 | 0 | return NULL; |
1456 | 0 | } |
1457 | 0 | goto done; |
1458 | 0 | } |
1459 | 0 | p->mark = _mark; |
1460 | 0 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
1461 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$")); |
1462 | 0 | } |
1463 | 0 | _res = NULL; |
1464 | 0 | done: |
1465 | 0 | p->level--; |
1466 | 0 | return _res; |
1467 | 0 | } |
1468 | | |
1469 | | // simple_stmts: simple_stmt !';' NEWLINE | ';'.simple_stmt+ ';'? NEWLINE |
1470 | | static asdl_stmt_seq* |
1471 | | simple_stmts_rule(Parser *p) |
1472 | 168k | { |
1473 | 168k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
1474 | 0 | _Pypegen_stack_overflow(p); |
1475 | 0 | } |
1476 | 168k | if (p->error_indicator) { |
1477 | 0 | p->level--; |
1478 | 0 | return NULL; |
1479 | 0 | } |
1480 | 168k | asdl_stmt_seq* _res = NULL; |
1481 | 168k | int _mark = p->mark; |
1482 | 168k | { // simple_stmt !';' NEWLINE |
1483 | 168k | if (p->error_indicator) { |
1484 | 0 | p->level--; |
1485 | 0 | return NULL; |
1486 | 0 | } |
1487 | 168k | D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE")); |
1488 | 168k | stmt_ty a; |
1489 | 168k | Token * newline_var; |
1490 | 168k | if ( |
1491 | 168k | (a = simple_stmt_rule(p)) // simple_stmt |
1492 | 123k | && |
1493 | 123k | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';' |
1494 | 120k | && |
1495 | 120k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
1496 | 168k | ) |
1497 | 110k | { |
1498 | 110k | D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE")); |
1499 | 110k | _res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , a ); |
1500 | 110k | if (_res == NULL && PyErr_Occurred()) { |
1501 | 0 | p->error_indicator = 1; |
1502 | 0 | p->level--; |
1503 | 0 | return NULL; |
1504 | 0 | } |
1505 | 110k | goto done; |
1506 | 110k | } |
1507 | 57.8k | p->mark = _mark; |
1508 | 57.8k | D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ', |
1509 | 57.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt !';' NEWLINE")); |
1510 | 57.8k | } |
1511 | 0 | { // ';'.simple_stmt+ ';'? NEWLINE |
1512 | 57.8k | if (p->error_indicator) { |
1513 | 3.86k | p->level--; |
1514 | 3.86k | return NULL; |
1515 | 3.86k | } |
1516 | 53.9k | D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE")); |
1517 | 53.9k | void *_opt_var; |
1518 | 53.9k | UNUSED(_opt_var); // Silence compiler warnings |
1519 | 53.9k | asdl_stmt_seq* a; |
1520 | 53.9k | Token * newline_var; |
1521 | 53.9k | if ( |
1522 | 53.9k | (a = (asdl_stmt_seq*)_gather_4_rule(p)) // ';'.simple_stmt+ |
1523 | 12.8k | && |
1524 | 12.8k | (_opt_var = _PyPegen_expect_token(p, 13), !p->error_indicator) // ';'? |
1525 | 12.8k | && |
1526 | 12.8k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
1527 | 53.9k | ) |
1528 | 2.75k | { |
1529 | 2.75k | D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE")); |
1530 | 2.75k | _res = a; |
1531 | 2.75k | if (_res == NULL && PyErr_Occurred()) { |
1532 | 0 | p->error_indicator = 1; |
1533 | 0 | p->level--; |
1534 | 0 | return NULL; |
1535 | 0 | } |
1536 | 2.75k | goto done; |
1537 | 2.75k | } |
1538 | 51.2k | p->mark = _mark; |
1539 | 51.2k | D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ', |
1540 | 51.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE")); |
1541 | 51.2k | } |
1542 | 51.2k | _res = NULL; |
1543 | 164k | done: |
1544 | 164k | p->level--; |
1545 | 164k | return _res; |
1546 | 51.2k | } |
1547 | | |
1548 | | // simple_stmt: |
1549 | | // | assignment |
1550 | | // | &"type" type_alias |
1551 | | // | star_expressions |
1552 | | // | &'return' return_stmt |
1553 | | // | &('import' | 'from') import_stmt |
1554 | | // | &'raise' raise_stmt |
1555 | | // | &'pass' pass_stmt |
1556 | | // | &'del' del_stmt |
1557 | | // | &'yield' yield_stmt |
1558 | | // | &'assert' assert_stmt |
1559 | | // | &'break' break_stmt |
1560 | | // | &'continue' continue_stmt |
1561 | | // | &'global' global_stmt |
1562 | | // | &'nonlocal' nonlocal_stmt |
1563 | | static stmt_ty |
1564 | | simple_stmt_rule(Parser *p) |
1565 | 246k | { |
1566 | 246k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
1567 | 0 | _Pypegen_stack_overflow(p); |
1568 | 0 | } |
1569 | 246k | if (p->error_indicator) { |
1570 | 0 | p->level--; |
1571 | 0 | return NULL; |
1572 | 0 | } |
1573 | 246k | stmt_ty _res = NULL; |
1574 | 246k | if (_PyPegen_is_memoized(p, simple_stmt_type, &_res)) { |
1575 | 53.9k | p->level--; |
1576 | 53.9k | return _res; |
1577 | 53.9k | } |
1578 | 192k | int _mark = p->mark; |
1579 | 192k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
1580 | 0 | p->error_indicator = 1; |
1581 | 0 | p->level--; |
1582 | 0 | return NULL; |
1583 | 0 | } |
1584 | 192k | int _start_lineno = p->tokens[_mark]->lineno; |
1585 | 192k | UNUSED(_start_lineno); // Only used by EXTRA macro |
1586 | 192k | int _start_col_offset = p->tokens[_mark]->col_offset; |
1587 | 192k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
1588 | 192k | { // assignment |
1589 | 192k | if (p->error_indicator) { |
1590 | 0 | p->level--; |
1591 | 0 | return NULL; |
1592 | 0 | } |
1593 | 192k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment")); |
1594 | 192k | stmt_ty assignment_var; |
1595 | 192k | if ( |
1596 | 192k | (assignment_var = assignment_rule(p)) // assignment |
1597 | 192k | ) |
1598 | 24.1k | { |
1599 | 24.1k | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment")); |
1600 | 24.1k | _res = assignment_var; |
1601 | 24.1k | goto done; |
1602 | 24.1k | } |
1603 | 168k | p->mark = _mark; |
1604 | 168k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1605 | 168k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment")); |
1606 | 168k | } |
1607 | 0 | { // &"type" type_alias |
1608 | 168k | if (p->error_indicator) { |
1609 | 4.15k | p->level--; |
1610 | 4.15k | return NULL; |
1611 | 4.15k | } |
1612 | 164k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&\"type\" type_alias")); |
1613 | 164k | stmt_ty type_alias_var; |
1614 | 164k | if ( |
1615 | 164k | _PyPegen_lookahead_with_string(1, _PyPegen_expect_soft_keyword, p, "type") |
1616 | 482 | && |
1617 | 482 | (type_alias_var = type_alias_rule(p)) // type_alias |
1618 | 164k | ) |
1619 | 264 | { |
1620 | 264 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&\"type\" type_alias")); |
1621 | 264 | _res = type_alias_var; |
1622 | 264 | goto done; |
1623 | 264 | } |
1624 | 163k | p->mark = _mark; |
1625 | 163k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1626 | 163k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&\"type\" type_alias")); |
1627 | 163k | } |
1628 | 0 | { // star_expressions |
1629 | 163k | if (p->error_indicator) { |
1630 | 3 | p->level--; |
1631 | 3 | return NULL; |
1632 | 3 | } |
1633 | 163k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
1634 | 163k | expr_ty e; |
1635 | 163k | if ( |
1636 | 163k | (e = star_expressions_rule(p)) // star_expressions |
1637 | 163k | ) |
1638 | 94.2k | { |
1639 | 94.2k | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
1640 | 94.2k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
1641 | 94.2k | if (_token == NULL) { |
1642 | 0 | p->level--; |
1643 | 0 | return NULL; |
1644 | 0 | } |
1645 | 94.2k | int _end_lineno = _token->end_lineno; |
1646 | 94.2k | UNUSED(_end_lineno); // Only used by EXTRA macro |
1647 | 94.2k | int _end_col_offset = _token->end_col_offset; |
1648 | 94.2k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
1649 | 94.2k | _res = _PyAST_Expr ( e , EXTRA ); |
1650 | 94.2k | if (_res == NULL && PyErr_Occurred()) { |
1651 | 0 | p->error_indicator = 1; |
1652 | 0 | p->level--; |
1653 | 0 | return NULL; |
1654 | 0 | } |
1655 | 94.2k | goto done; |
1656 | 94.2k | } |
1657 | 69.5k | p->mark = _mark; |
1658 | 69.5k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1659 | 69.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
1660 | 69.5k | } |
1661 | 0 | { // &'return' return_stmt |
1662 | 69.5k | if (p->error_indicator) { |
1663 | 353 | p->level--; |
1664 | 353 | return NULL; |
1665 | 353 | } |
1666 | 69.1k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt")); |
1667 | 69.1k | stmt_ty return_stmt_var; |
1668 | 69.1k | if ( |
1669 | 69.1k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 522) // token='return' |
1670 | 7.01k | && |
1671 | 7.01k | (return_stmt_var = return_stmt_rule(p)) // return_stmt |
1672 | 69.1k | ) |
1673 | 6.95k | { |
1674 | 6.95k | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt")); |
1675 | 6.95k | _res = return_stmt_var; |
1676 | 6.95k | goto done; |
1677 | 6.95k | } |
1678 | 62.2k | p->mark = _mark; |
1679 | 62.2k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1680 | 62.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt")); |
1681 | 62.2k | } |
1682 | 0 | { // &('import' | 'from') import_stmt |
1683 | 62.2k | if (p->error_indicator) { |
1684 | 67 | p->level--; |
1685 | 67 | return NULL; |
1686 | 67 | } |
1687 | 62.1k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt")); |
1688 | 62.1k | stmt_ty import_stmt_var; |
1689 | 62.1k | if ( |
1690 | 62.1k | _PyPegen_lookahead(1, _tmp_5_rule, p) |
1691 | 6.29k | && |
1692 | 6.29k | (import_stmt_var = import_stmt_rule(p)) // import_stmt |
1693 | 62.1k | ) |
1694 | 6.06k | { |
1695 | 6.06k | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt")); |
1696 | 6.06k | _res = import_stmt_var; |
1697 | 6.06k | goto done; |
1698 | 6.06k | } |
1699 | 56.0k | p->mark = _mark; |
1700 | 56.0k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1701 | 56.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt")); |
1702 | 56.0k | } |
1703 | 0 | { // &'raise' raise_stmt |
1704 | 56.0k | if (p->error_indicator) { |
1705 | 76 | p->level--; |
1706 | 76 | return NULL; |
1707 | 76 | } |
1708 | 56.0k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt")); |
1709 | 56.0k | stmt_ty raise_stmt_var; |
1710 | 56.0k | if ( |
1711 | 56.0k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 628) // token='raise' |
1712 | 4.38k | && |
1713 | 4.38k | (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt |
1714 | 56.0k | ) |
1715 | 4.34k | { |
1716 | 4.34k | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt")); |
1717 | 4.34k | _res = raise_stmt_var; |
1718 | 4.34k | goto done; |
1719 | 4.34k | } |
1720 | 51.6k | p->mark = _mark; |
1721 | 51.6k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1722 | 51.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt")); |
1723 | 51.6k | } |
1724 | 0 | { // &'pass' pass_stmt |
1725 | 51.6k | if (p->error_indicator) { |
1726 | 40 | p->level--; |
1727 | 40 | return NULL; |
1728 | 40 | } |
1729 | 51.6k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'pass' pass_stmt")); |
1730 | 51.6k | stmt_ty pass_stmt_var; |
1731 | 51.6k | if ( |
1732 | 51.6k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 527) // token='pass' |
1733 | 952 | && |
1734 | 952 | (pass_stmt_var = pass_stmt_rule(p)) // pass_stmt |
1735 | 51.6k | ) |
1736 | 952 | { |
1737 | 952 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'pass' pass_stmt")); |
1738 | 952 | _res = pass_stmt_var; |
1739 | 952 | goto done; |
1740 | 952 | } |
1741 | 50.6k | p->mark = _mark; |
1742 | 50.6k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1743 | 50.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'pass' pass_stmt")); |
1744 | 50.6k | } |
1745 | 0 | { // &'del' del_stmt |
1746 | 50.6k | if (p->error_indicator) { |
1747 | 0 | p->level--; |
1748 | 0 | return NULL; |
1749 | 0 | } |
1750 | 50.6k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt")); |
1751 | 50.6k | stmt_ty del_stmt_var; |
1752 | 50.6k | if ( |
1753 | 50.6k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 630) // token='del' |
1754 | 1.55k | && |
1755 | 1.55k | (del_stmt_var = del_stmt_rule(p)) // del_stmt |
1756 | 50.6k | ) |
1757 | 1.02k | { |
1758 | 1.02k | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt")); |
1759 | 1.02k | _res = del_stmt_var; |
1760 | 1.02k | goto done; |
1761 | 1.02k | } |
1762 | 49.6k | p->mark = _mark; |
1763 | 49.6k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1764 | 49.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt")); |
1765 | 49.6k | } |
1766 | 0 | { // &'yield' yield_stmt |
1767 | 49.6k | if (p->error_indicator) { |
1768 | 183 | p->level--; |
1769 | 183 | return NULL; |
1770 | 183 | } |
1771 | 49.4k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt")); |
1772 | 49.4k | stmt_ty yield_stmt_var; |
1773 | 49.4k | if ( |
1774 | 49.4k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 588) // token='yield' |
1775 | 1.71k | && |
1776 | 1.71k | (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt |
1777 | 49.4k | ) |
1778 | 1.71k | { |
1779 | 1.71k | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt")); |
1780 | 1.71k | _res = yield_stmt_var; |
1781 | 1.71k | goto done; |
1782 | 1.71k | } |
1783 | 47.7k | p->mark = _mark; |
1784 | 47.7k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1785 | 47.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt")); |
1786 | 47.7k | } |
1787 | 0 | { // &'assert' assert_stmt |
1788 | 47.7k | if (p->error_indicator) { |
1789 | 5 | p->level--; |
1790 | 5 | return NULL; |
1791 | 5 | } |
1792 | 47.7k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt")); |
1793 | 47.7k | stmt_ty assert_stmt_var; |
1794 | 47.7k | if ( |
1795 | 47.7k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 634) // token='assert' |
1796 | 1.09k | && |
1797 | 1.09k | (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt |
1798 | 47.7k | ) |
1799 | 1.00k | { |
1800 | 1.00k | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt")); |
1801 | 1.00k | _res = assert_stmt_var; |
1802 | 1.00k | goto done; |
1803 | 1.00k | } |
1804 | 46.7k | p->mark = _mark; |
1805 | 46.7k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1806 | 46.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt")); |
1807 | 46.7k | } |
1808 | 0 | { // &'break' break_stmt |
1809 | 46.7k | if (p->error_indicator) { |
1810 | 74 | p->level--; |
1811 | 74 | return NULL; |
1812 | 74 | } |
1813 | 46.6k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'break' break_stmt")); |
1814 | 46.6k | stmt_ty break_stmt_var; |
1815 | 46.6k | if ( |
1816 | 46.6k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 528) // token='break' |
1817 | 1.58k | && |
1818 | 1.58k | (break_stmt_var = break_stmt_rule(p)) // break_stmt |
1819 | 46.6k | ) |
1820 | 1.58k | { |
1821 | 1.58k | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'break' break_stmt")); |
1822 | 1.58k | _res = break_stmt_var; |
1823 | 1.58k | goto done; |
1824 | 1.58k | } |
1825 | 45.0k | p->mark = _mark; |
1826 | 45.0k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1827 | 45.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'break' break_stmt")); |
1828 | 45.0k | } |
1829 | 0 | { // &'continue' continue_stmt |
1830 | 45.0k | if (p->error_indicator) { |
1831 | 0 | p->level--; |
1832 | 0 | return NULL; |
1833 | 0 | } |
1834 | 45.0k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'continue' continue_stmt")); |
1835 | 45.0k | stmt_ty continue_stmt_var; |
1836 | 45.0k | if ( |
1837 | 45.0k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 529) // token='continue' |
1838 | 1.09k | && |
1839 | 1.09k | (continue_stmt_var = continue_stmt_rule(p)) // continue_stmt |
1840 | 45.0k | ) |
1841 | 1.09k | { |
1842 | 1.09k | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'continue' continue_stmt")); |
1843 | 1.09k | _res = continue_stmt_var; |
1844 | 1.09k | goto done; |
1845 | 1.09k | } |
1846 | 43.9k | p->mark = _mark; |
1847 | 43.9k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1848 | 43.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'continue' continue_stmt")); |
1849 | 43.9k | } |
1850 | 0 | { // &'global' global_stmt |
1851 | 43.9k | if (p->error_indicator) { |
1852 | 0 | p->level--; |
1853 | 0 | return NULL; |
1854 | 0 | } |
1855 | 43.9k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt")); |
1856 | 43.9k | stmt_ty global_stmt_var; |
1857 | 43.9k | if ( |
1858 | 43.9k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 530) // token='global' |
1859 | 865 | && |
1860 | 865 | (global_stmt_var = global_stmt_rule(p)) // global_stmt |
1861 | 43.9k | ) |
1862 | 858 | { |
1863 | 858 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt")); |
1864 | 858 | _res = global_stmt_var; |
1865 | 858 | goto done; |
1866 | 858 | } |
1867 | 43.1k | p->mark = _mark; |
1868 | 43.1k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1869 | 43.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt")); |
1870 | 43.1k | } |
1871 | 0 | { // &'nonlocal' nonlocal_stmt |
1872 | 43.1k | if (p->error_indicator) { |
1873 | 1 | p->level--; |
1874 | 1 | return NULL; |
1875 | 1 | } |
1876 | 43.1k | D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt")); |
1877 | 43.1k | stmt_ty nonlocal_stmt_var; |
1878 | 43.1k | if ( |
1879 | 43.1k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 531) // token='nonlocal' |
1880 | 476 | && |
1881 | 476 | (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt |
1882 | 43.1k | ) |
1883 | 473 | { |
1884 | 473 | D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt")); |
1885 | 473 | _res = nonlocal_stmt_var; |
1886 | 473 | goto done; |
1887 | 473 | } |
1888 | 42.6k | p->mark = _mark; |
1889 | 42.6k | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1890 | 42.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt")); |
1891 | 42.6k | } |
1892 | 42.6k | _res = NULL; |
1893 | 187k | done: |
1894 | 187k | _PyPegen_insert_memo(p, _mark, simple_stmt_type, _res); |
1895 | 187k | p->level--; |
1896 | 187k | return _res; |
1897 | 42.6k | } |
1898 | | |
1899 | | // compound_stmt: |
1900 | | // | &('def' | '@' | 'async') function_def |
1901 | | // | &'if' if_stmt |
1902 | | // | &('class' | '@') class_def |
1903 | | // | &('with' | 'async') with_stmt |
1904 | | // | &('for' | 'async') for_stmt |
1905 | | // | &'try' try_stmt |
1906 | | // | &'while' while_stmt |
1907 | | // | match_stmt |
1908 | | static stmt_ty |
1909 | | compound_stmt_rule(Parser *p) |
1910 | 176k | { |
1911 | 176k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
1912 | 0 | _Pypegen_stack_overflow(p); |
1913 | 0 | } |
1914 | 176k | if (p->error_indicator) { |
1915 | 0 | p->level--; |
1916 | 0 | return NULL; |
1917 | 0 | } |
1918 | 176k | stmt_ty _res = NULL; |
1919 | 176k | int _mark = p->mark; |
1920 | 176k | { // &('def' | '@' | 'async') function_def |
1921 | 176k | if (p->error_indicator) { |
1922 | 0 | p->level--; |
1923 | 0 | return NULL; |
1924 | 0 | } |
1925 | 176k | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | 'async') function_def")); |
1926 | 176k | stmt_ty function_def_var; |
1927 | 176k | if ( |
1928 | 176k | _PyPegen_lookahead(1, _tmp_6_rule, p) |
1929 | 15.4k | && |
1930 | 15.4k | (function_def_var = function_def_rule(p)) // function_def |
1931 | 176k | ) |
1932 | 11.9k | { |
1933 | 11.9k | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | 'async') function_def")); |
1934 | 11.9k | _res = function_def_var; |
1935 | 11.9k | goto done; |
1936 | 11.9k | } |
1937 | 164k | p->mark = _mark; |
1938 | 164k | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1939 | 164k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | 'async') function_def")); |
1940 | 164k | } |
1941 | 0 | { // &'if' if_stmt |
1942 | 164k | if (p->error_indicator) { |
1943 | 1.19k | p->level--; |
1944 | 1.19k | return NULL; |
1945 | 1.19k | } |
1946 | 163k | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt")); |
1947 | 163k | stmt_ty if_stmt_var; |
1948 | 163k | if ( |
1949 | 163k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 691) // token='if' |
1950 | 9.97k | && |
1951 | 9.97k | (if_stmt_var = if_stmt_rule(p)) // if_stmt |
1952 | 163k | ) |
1953 | 9.82k | { |
1954 | 9.82k | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt")); |
1955 | 9.82k | _res = if_stmt_var; |
1956 | 9.82k | goto done; |
1957 | 9.82k | } |
1958 | 153k | p->mark = _mark; |
1959 | 153k | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1960 | 153k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt")); |
1961 | 153k | } |
1962 | 0 | { // &('class' | '@') class_def |
1963 | 153k | if (p->error_indicator) { |
1964 | 53 | p->level--; |
1965 | 53 | return NULL; |
1966 | 53 | } |
1967 | 153k | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def")); |
1968 | 153k | stmt_ty class_def_var; |
1969 | 153k | if ( |
1970 | 153k | _PyPegen_lookahead(1, _tmp_7_rule, p) |
1971 | 3.90k | && |
1972 | 3.90k | (class_def_var = class_def_rule(p)) // class_def |
1973 | 153k | ) |
1974 | 3.45k | { |
1975 | 3.45k | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def")); |
1976 | 3.45k | _res = class_def_var; |
1977 | 3.45k | goto done; |
1978 | 3.45k | } |
1979 | 150k | p->mark = _mark; |
1980 | 150k | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
1981 | 150k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def")); |
1982 | 150k | } |
1983 | 0 | { // &('with' | 'async') with_stmt |
1984 | 150k | if (p->error_indicator) { |
1985 | 39 | p->level--; |
1986 | 39 | return NULL; |
1987 | 39 | } |
1988 | 150k | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | 'async') with_stmt")); |
1989 | 150k | stmt_ty with_stmt_var; |
1990 | 150k | if ( |
1991 | 150k | _PyPegen_lookahead(1, _tmp_8_rule, p) |
1992 | 4.45k | && |
1993 | 4.45k | (with_stmt_var = with_stmt_rule(p)) // with_stmt |
1994 | 150k | ) |
1995 | 3.20k | { |
1996 | 3.20k | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | 'async') with_stmt")); |
1997 | 3.20k | _res = with_stmt_var; |
1998 | 3.20k | goto done; |
1999 | 3.20k | } |
2000 | 147k | p->mark = _mark; |
2001 | 147k | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
2002 | 147k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | 'async') with_stmt")); |
2003 | 147k | } |
2004 | 0 | { // &('for' | 'async') for_stmt |
2005 | 147k | if (p->error_indicator) { |
2006 | 136 | p->level--; |
2007 | 136 | return NULL; |
2008 | 136 | } |
2009 | 147k | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | 'async') for_stmt")); |
2010 | 147k | stmt_ty for_stmt_var; |
2011 | 147k | if ( |
2012 | 147k | _PyPegen_lookahead(1, _tmp_9_rule, p) |
2013 | 2.93k | && |
2014 | 2.93k | (for_stmt_var = for_stmt_rule(p)) // for_stmt |
2015 | 147k | ) |
2016 | 2.64k | { |
2017 | 2.64k | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | 'async') for_stmt")); |
2018 | 2.64k | _res = for_stmt_var; |
2019 | 2.64k | goto done; |
2020 | 2.64k | } |
2021 | 144k | p->mark = _mark; |
2022 | 144k | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
2023 | 144k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | 'async') for_stmt")); |
2024 | 144k | } |
2025 | 0 | { // &'try' try_stmt |
2026 | 144k | if (p->error_indicator) { |
2027 | 40 | p->level--; |
2028 | 40 | return NULL; |
2029 | 40 | } |
2030 | 144k | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt")); |
2031 | 144k | stmt_ty try_stmt_var; |
2032 | 144k | if ( |
2033 | 144k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 665) // token='try' |
2034 | 6.23k | && |
2035 | 6.23k | (try_stmt_var = try_stmt_rule(p)) // try_stmt |
2036 | 144k | ) |
2037 | 5.71k | { |
2038 | 5.71k | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt")); |
2039 | 5.71k | _res = try_stmt_var; |
2040 | 5.71k | goto done; |
2041 | 5.71k | } |
2042 | 138k | p->mark = _mark; |
2043 | 138k | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
2044 | 138k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt")); |
2045 | 138k | } |
2046 | 0 | { // &'while' while_stmt |
2047 | 138k | if (p->error_indicator) { |
2048 | 173 | p->level--; |
2049 | 173 | return NULL; |
2050 | 173 | } |
2051 | 138k | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt")); |
2052 | 138k | stmt_ty while_stmt_var; |
2053 | 138k | if ( |
2054 | 138k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 698) // token='while' |
2055 | 1.55k | && |
2056 | 1.55k | (while_stmt_var = while_stmt_rule(p)) // while_stmt |
2057 | 138k | ) |
2058 | 1.47k | { |
2059 | 1.47k | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt")); |
2060 | 1.47k | _res = while_stmt_var; |
2061 | 1.47k | goto done; |
2062 | 1.47k | } |
2063 | 136k | p->mark = _mark; |
2064 | 136k | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
2065 | 136k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt")); |
2066 | 136k | } |
2067 | 0 | { // match_stmt |
2068 | 136k | if (p->error_indicator) { |
2069 | 20 | p->level--; |
2070 | 20 | return NULL; |
2071 | 20 | } |
2072 | 136k | D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "match_stmt")); |
2073 | 136k | stmt_ty match_stmt_var; |
2074 | 136k | if ( |
2075 | 136k | (match_stmt_var = match_stmt_rule(p)) // match_stmt |
2076 | 136k | ) |
2077 | 654 | { |
2078 | 654 | D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "match_stmt")); |
2079 | 654 | _res = match_stmt_var; |
2080 | 654 | goto done; |
2081 | 654 | } |
2082 | 136k | p->mark = _mark; |
2083 | 136k | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
2084 | 136k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "match_stmt")); |
2085 | 136k | } |
2086 | 136k | _res = NULL; |
2087 | 175k | done: |
2088 | 175k | p->level--; |
2089 | 175k | return _res; |
2090 | 136k | } |
2091 | | |
2092 | | // assignment: |
2093 | | // | NAME ':' expression ['=' annotated_rhs] |
2094 | | // | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs] |
2095 | | // | ((star_targets '='))+ annotated_rhs !'=' TYPE_COMMENT? |
2096 | | // | single_target augassign ~ annotated_rhs |
2097 | | // | invalid_assignment |
2098 | | static stmt_ty |
2099 | | assignment_rule(Parser *p) |
2100 | 192k | { |
2101 | 192k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
2102 | 0 | _Pypegen_stack_overflow(p); |
2103 | 0 | } |
2104 | 192k | if (p->error_indicator) { |
2105 | 0 | p->level--; |
2106 | 0 | return NULL; |
2107 | 0 | } |
2108 | 192k | stmt_ty _res = NULL; |
2109 | 192k | int _mark = p->mark; |
2110 | 192k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
2111 | 0 | p->error_indicator = 1; |
2112 | 0 | p->level--; |
2113 | 0 | return NULL; |
2114 | 0 | } |
2115 | 192k | int _start_lineno = p->tokens[_mark]->lineno; |
2116 | 192k | UNUSED(_start_lineno); // Only used by EXTRA macro |
2117 | 192k | int _start_col_offset = p->tokens[_mark]->col_offset; |
2118 | 192k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
2119 | 192k | { // NAME ':' expression ['=' annotated_rhs] |
2120 | 192k | if (p->error_indicator) { |
2121 | 0 | p->level--; |
2122 | 0 | return NULL; |
2123 | 0 | } |
2124 | 192k | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
2125 | 192k | Token * _literal; |
2126 | 192k | expr_ty a; |
2127 | 192k | expr_ty b; |
2128 | 192k | void *c; |
2129 | 192k | if ( |
2130 | 192k | (a = _PyPegen_name_token(p)) // NAME |
2131 | 87.8k | && |
2132 | 87.8k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
2133 | 2.34k | && |
2134 | 2.34k | (b = expression_rule(p)) // expression |
2135 | 2.24k | && |
2136 | 2.24k | (c = _tmp_10_rule(p), !p->error_indicator) // ['=' annotated_rhs] |
2137 | 192k | ) |
2138 | 2.23k | { |
2139 | 2.23k | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
2140 | 2.23k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2141 | 2.23k | if (_token == NULL) { |
2142 | 0 | p->level--; |
2143 | 0 | return NULL; |
2144 | 0 | } |
2145 | 2.23k | int _end_lineno = _token->end_lineno; |
2146 | 2.23k | UNUSED(_end_lineno); // Only used by EXTRA macro |
2147 | 2.23k | int _end_col_offset = _token->end_col_offset; |
2148 | 2.23k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2149 | 2.23k | _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 ) ); |
2150 | 2.23k | if (_res == NULL && PyErr_Occurred()) { |
2151 | 0 | p->error_indicator = 1; |
2152 | 0 | p->level--; |
2153 | 0 | return NULL; |
2154 | 0 | } |
2155 | 2.23k | goto done; |
2156 | 2.23k | } |
2157 | 190k | p->mark = _mark; |
2158 | 190k | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
2159 | 190k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
2160 | 190k | } |
2161 | 0 | { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs] |
2162 | 190k | if (p->error_indicator) { |
2163 | 148 | p->level--; |
2164 | 148 | return NULL; |
2165 | 148 | } |
2166 | 189k | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]")); |
2167 | 189k | Token * _literal; |
2168 | 189k | void *a; |
2169 | 189k | expr_ty b; |
2170 | 189k | void *c; |
2171 | 189k | if ( |
2172 | 189k | (a = _tmp_11_rule(p)) // '(' single_target ')' | single_subscript_attribute_target |
2173 | 6.36k | && |
2174 | 6.36k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
2175 | 941 | && |
2176 | 941 | (b = expression_rule(p)) // expression |
2177 | 926 | && |
2178 | 926 | (c = _tmp_10_rule(p), !p->error_indicator) // ['=' annotated_rhs] |
2179 | 189k | ) |
2180 | 916 | { |
2181 | 916 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]")); |
2182 | 916 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2183 | 916 | if (_token == NULL) { |
2184 | 0 | p->level--; |
2185 | 0 | return NULL; |
2186 | 0 | } |
2187 | 916 | int _end_lineno = _token->end_lineno; |
2188 | 916 | UNUSED(_end_lineno); // Only used by EXTRA macro |
2189 | 916 | int _end_col_offset = _token->end_col_offset; |
2190 | 916 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2191 | 916 | _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotations syntax is" , _PyAST_AnnAssign ( a , b , c , 0 , EXTRA ) ); |
2192 | 916 | if (_res == NULL && PyErr_Occurred()) { |
2193 | 0 | p->error_indicator = 1; |
2194 | 0 | p->level--; |
2195 | 0 | return NULL; |
2196 | 0 | } |
2197 | 916 | goto done; |
2198 | 916 | } |
2199 | 189k | p->mark = _mark; |
2200 | 189k | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
2201 | 189k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]")); |
2202 | 189k | } |
2203 | 0 | { // ((star_targets '='))+ annotated_rhs !'=' TYPE_COMMENT? |
2204 | 189k | if (p->error_indicator) { |
2205 | 2.48k | p->level--; |
2206 | 2.48k | return NULL; |
2207 | 2.48k | } |
2208 | 186k | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ annotated_rhs !'=' TYPE_COMMENT?")); |
2209 | 186k | asdl_expr_seq* a; |
2210 | 186k | expr_ty b; |
2211 | 186k | void *tc; |
2212 | 186k | if ( |
2213 | 186k | (a = (asdl_expr_seq*)_loop1_12_rule(p)) // ((star_targets '='))+ |
2214 | 18.4k | && |
2215 | 18.4k | (b = annotated_rhs_rule(p)) // annotated_rhs |
2216 | 18.2k | && |
2217 | 18.2k | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' |
2218 | 18.1k | && |
2219 | 18.1k | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
2220 | 186k | ) |
2221 | 18.1k | { |
2222 | 18.1k | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ annotated_rhs !'=' TYPE_COMMENT?")); |
2223 | 18.1k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2224 | 18.1k | if (_token == NULL) { |
2225 | 0 | p->level--; |
2226 | 0 | return NULL; |
2227 | 0 | } |
2228 | 18.1k | int _end_lineno = _token->end_lineno; |
2229 | 18.1k | UNUSED(_end_lineno); // Only used by EXTRA macro |
2230 | 18.1k | int _end_col_offset = _token->end_col_offset; |
2231 | 18.1k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2232 | 18.1k | _res = _PyAST_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
2233 | 18.1k | if (_res == NULL && PyErr_Occurred()) { |
2234 | 0 | p->error_indicator = 1; |
2235 | 0 | p->level--; |
2236 | 0 | return NULL; |
2237 | 0 | } |
2238 | 18.1k | goto done; |
2239 | 18.1k | } |
2240 | 168k | p->mark = _mark; |
2241 | 168k | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
2242 | 168k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ annotated_rhs !'=' TYPE_COMMENT?")); |
2243 | 168k | } |
2244 | 0 | { // single_target augassign ~ annotated_rhs |
2245 | 168k | if (p->error_indicator) { |
2246 | 217 | p->level--; |
2247 | 217 | return NULL; |
2248 | 217 | } |
2249 | 168k | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ annotated_rhs")); |
2250 | 168k | int _cut_var = 0; |
2251 | 168k | expr_ty a; |
2252 | 168k | AugOperator* b; |
2253 | 168k | expr_ty c; |
2254 | 168k | if ( |
2255 | 168k | (a = single_target_rule(p)) // single_target |
2256 | 67.2k | && |
2257 | 67.2k | (b = augassign_rule(p)) // augassign |
2258 | 2.91k | && |
2259 | 2.91k | (_cut_var = 1) |
2260 | 2.91k | && |
2261 | 2.91k | (c = annotated_rhs_rule(p)) // annotated_rhs |
2262 | 168k | ) |
2263 | 2.76k | { |
2264 | 2.76k | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ annotated_rhs")); |
2265 | 2.76k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2266 | 2.76k | if (_token == NULL) { |
2267 | 0 | p->level--; |
2268 | 0 | return NULL; |
2269 | 0 | } |
2270 | 2.76k | int _end_lineno = _token->end_lineno; |
2271 | 2.76k | UNUSED(_end_lineno); // Only used by EXTRA macro |
2272 | 2.76k | int _end_col_offset = _token->end_col_offset; |
2273 | 2.76k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2274 | 2.76k | _res = _PyAST_AugAssign ( a , b -> kind , c , EXTRA ); |
2275 | 2.76k | if (_res == NULL && PyErr_Occurred()) { |
2276 | 0 | p->error_indicator = 1; |
2277 | 0 | p->level--; |
2278 | 0 | return NULL; |
2279 | 0 | } |
2280 | 2.76k | goto done; |
2281 | 2.76k | } |
2282 | 165k | p->mark = _mark; |
2283 | 165k | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
2284 | 165k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ annotated_rhs")); |
2285 | 165k | if (_cut_var) { |
2286 | 155 | p->level--; |
2287 | 155 | return NULL; |
2288 | 155 | } |
2289 | 165k | } |
2290 | 165k | if (p->call_invalid_rules) { // invalid_assignment |
2291 | 38.4k | if (p->error_indicator) { |
2292 | 0 | p->level--; |
2293 | 0 | return NULL; |
2294 | 0 | } |
2295 | 38.4k | D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment")); |
2296 | 38.4k | void *invalid_assignment_var; |
2297 | 38.4k | if ( |
2298 | 38.4k | (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment |
2299 | 38.4k | ) |
2300 | 0 | { |
2301 | 0 | D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment")); |
2302 | 0 | _res = invalid_assignment_var; |
2303 | 0 | goto done; |
2304 | 0 | } |
2305 | 38.4k | p->mark = _mark; |
2306 | 38.4k | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
2307 | 38.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment")); |
2308 | 38.4k | } |
2309 | 165k | _res = NULL; |
2310 | 189k | done: |
2311 | 189k | p->level--; |
2312 | 189k | return _res; |
2313 | 165k | } |
2314 | | |
2315 | | // annotated_rhs: yield_expr | star_expressions |
2316 | | static expr_ty |
2317 | | annotated_rhs_rule(Parser *p) |
2318 | 56.5k | { |
2319 | 56.5k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
2320 | 1 | _Pypegen_stack_overflow(p); |
2321 | 1 | } |
2322 | 56.5k | if (p->error_indicator) { |
2323 | 1 | p->level--; |
2324 | 1 | return NULL; |
2325 | 1 | } |
2326 | 56.5k | expr_ty _res = NULL; |
2327 | 56.5k | int _mark = p->mark; |
2328 | 56.5k | { // yield_expr |
2329 | 56.5k | if (p->error_indicator) { |
2330 | 0 | p->level--; |
2331 | 0 | return NULL; |
2332 | 0 | } |
2333 | 56.5k | D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
2334 | 56.5k | expr_ty yield_expr_var; |
2335 | 56.5k | if ( |
2336 | 56.5k | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
2337 | 56.5k | ) |
2338 | 278 | { |
2339 | 278 | D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
2340 | 278 | _res = yield_expr_var; |
2341 | 278 | goto done; |
2342 | 278 | } |
2343 | 56.2k | p->mark = _mark; |
2344 | 56.2k | D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', |
2345 | 56.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
2346 | 56.2k | } |
2347 | 0 | { // star_expressions |
2348 | 56.2k | if (p->error_indicator) { |
2349 | 90 | p->level--; |
2350 | 90 | return NULL; |
2351 | 90 | } |
2352 | 56.1k | D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
2353 | 56.1k | expr_ty star_expressions_var; |
2354 | 56.1k | if ( |
2355 | 56.1k | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
2356 | 56.1k | ) |
2357 | 51.0k | { |
2358 | 51.0k | D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
2359 | 51.0k | _res = star_expressions_var; |
2360 | 51.0k | goto done; |
2361 | 51.0k | } |
2362 | 5.08k | p->mark = _mark; |
2363 | 5.08k | D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', |
2364 | 5.08k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
2365 | 5.08k | } |
2366 | 5.08k | _res = NULL; |
2367 | 56.4k | done: |
2368 | 56.4k | p->level--; |
2369 | 56.4k | return _res; |
2370 | 5.08k | } |
2371 | | |
2372 | | // augassign: |
2373 | | // | '+=' |
2374 | | // | '-=' |
2375 | | // | '*=' |
2376 | | // | '@=' |
2377 | | // | '/=' |
2378 | | // | '%=' |
2379 | | // | '&=' |
2380 | | // | '|=' |
2381 | | // | '^=' |
2382 | | // | '<<=' |
2383 | | // | '>>=' |
2384 | | // | '**=' |
2385 | | // | '//=' |
2386 | | static AugOperator* |
2387 | | augassign_rule(Parser *p) |
2388 | 93.1k | { |
2389 | 93.1k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
2390 | 0 | _Pypegen_stack_overflow(p); |
2391 | 0 | } |
2392 | 93.1k | if (p->error_indicator) { |
2393 | 0 | p->level--; |
2394 | 0 | return NULL; |
2395 | 0 | } |
2396 | 93.1k | AugOperator* _res = NULL; |
2397 | 93.1k | int _mark = p->mark; |
2398 | 93.1k | { // '+=' |
2399 | 93.1k | if (p->error_indicator) { |
2400 | 0 | p->level--; |
2401 | 0 | return NULL; |
2402 | 0 | } |
2403 | 93.1k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='")); |
2404 | 93.1k | Token * _literal; |
2405 | 93.1k | if ( |
2406 | 93.1k | (_literal = _PyPegen_expect_token(p, 36)) // token='+=' |
2407 | 93.1k | ) |
2408 | 705 | { |
2409 | 705 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='")); |
2410 | 705 | _res = _PyPegen_augoperator ( p , Add ); |
2411 | 705 | if (_res == NULL && PyErr_Occurred()) { |
2412 | 0 | p->error_indicator = 1; |
2413 | 0 | p->level--; |
2414 | 0 | return NULL; |
2415 | 0 | } |
2416 | 705 | goto done; |
2417 | 705 | } |
2418 | 92.4k | p->mark = _mark; |
2419 | 92.4k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2420 | 92.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='")); |
2421 | 92.4k | } |
2422 | 0 | { // '-=' |
2423 | 92.4k | if (p->error_indicator) { |
2424 | 0 | p->level--; |
2425 | 0 | return NULL; |
2426 | 0 | } |
2427 | 92.4k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='")); |
2428 | 92.4k | Token * _literal; |
2429 | 92.4k | if ( |
2430 | 92.4k | (_literal = _PyPegen_expect_token(p, 37)) // token='-=' |
2431 | 92.4k | ) |
2432 | 288 | { |
2433 | 288 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='")); |
2434 | 288 | _res = _PyPegen_augoperator ( p , Sub ); |
2435 | 288 | if (_res == NULL && PyErr_Occurred()) { |
2436 | 0 | p->error_indicator = 1; |
2437 | 0 | p->level--; |
2438 | 0 | return NULL; |
2439 | 0 | } |
2440 | 288 | goto done; |
2441 | 288 | } |
2442 | 92.1k | p->mark = _mark; |
2443 | 92.1k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2444 | 92.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='")); |
2445 | 92.1k | } |
2446 | 0 | { // '*=' |
2447 | 92.1k | if (p->error_indicator) { |
2448 | 0 | p->level--; |
2449 | 0 | return NULL; |
2450 | 0 | } |
2451 | 92.1k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='")); |
2452 | 92.1k | Token * _literal; |
2453 | 92.1k | if ( |
2454 | 92.1k | (_literal = _PyPegen_expect_token(p, 38)) // token='*=' |
2455 | 92.1k | ) |
2456 | 214 | { |
2457 | 214 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='")); |
2458 | 214 | _res = _PyPegen_augoperator ( p , Mult ); |
2459 | 214 | if (_res == NULL && PyErr_Occurred()) { |
2460 | 0 | p->error_indicator = 1; |
2461 | 0 | p->level--; |
2462 | 0 | return NULL; |
2463 | 0 | } |
2464 | 214 | goto done; |
2465 | 214 | } |
2466 | 91.9k | p->mark = _mark; |
2467 | 91.9k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2468 | 91.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='")); |
2469 | 91.9k | } |
2470 | 0 | { // '@=' |
2471 | 91.9k | if (p->error_indicator) { |
2472 | 0 | p->level--; |
2473 | 0 | return NULL; |
2474 | 0 | } |
2475 | 91.9k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='")); |
2476 | 91.9k | Token * _literal; |
2477 | 91.9k | if ( |
2478 | 91.9k | (_literal = _PyPegen_expect_token(p, 50)) // token='@=' |
2479 | 91.9k | ) |
2480 | 91 | { |
2481 | 91 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='")); |
2482 | 91 | _res = CHECK_VERSION ( AugOperator* , 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) ); |
2483 | 91 | if (_res == NULL && PyErr_Occurred()) { |
2484 | 0 | p->error_indicator = 1; |
2485 | 0 | p->level--; |
2486 | 0 | return NULL; |
2487 | 0 | } |
2488 | 91 | goto done; |
2489 | 91 | } |
2490 | 91.8k | p->mark = _mark; |
2491 | 91.8k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2492 | 91.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='")); |
2493 | 91.8k | } |
2494 | 0 | { // '/=' |
2495 | 91.8k | if (p->error_indicator) { |
2496 | 0 | p->level--; |
2497 | 0 | return NULL; |
2498 | 0 | } |
2499 | 91.8k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='")); |
2500 | 91.8k | Token * _literal; |
2501 | 91.8k | if ( |
2502 | 91.8k | (_literal = _PyPegen_expect_token(p, 39)) // token='/=' |
2503 | 91.8k | ) |
2504 | 372 | { |
2505 | 372 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='")); |
2506 | 372 | _res = _PyPegen_augoperator ( p , Div ); |
2507 | 372 | if (_res == NULL && PyErr_Occurred()) { |
2508 | 0 | p->error_indicator = 1; |
2509 | 0 | p->level--; |
2510 | 0 | return NULL; |
2511 | 0 | } |
2512 | 372 | goto done; |
2513 | 372 | } |
2514 | 91.5k | p->mark = _mark; |
2515 | 91.5k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2516 | 91.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='")); |
2517 | 91.5k | } |
2518 | 0 | { // '%=' |
2519 | 91.5k | if (p->error_indicator) { |
2520 | 0 | p->level--; |
2521 | 0 | return NULL; |
2522 | 0 | } |
2523 | 91.5k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='")); |
2524 | 91.5k | Token * _literal; |
2525 | 91.5k | if ( |
2526 | 91.5k | (_literal = _PyPegen_expect_token(p, 40)) // token='%=' |
2527 | 91.5k | ) |
2528 | 308 | { |
2529 | 308 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='")); |
2530 | 308 | _res = _PyPegen_augoperator ( p , Mod ); |
2531 | 308 | if (_res == NULL && PyErr_Occurred()) { |
2532 | 0 | p->error_indicator = 1; |
2533 | 0 | p->level--; |
2534 | 0 | return NULL; |
2535 | 0 | } |
2536 | 308 | goto done; |
2537 | 308 | } |
2538 | 91.2k | p->mark = _mark; |
2539 | 91.2k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2540 | 91.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='")); |
2541 | 91.2k | } |
2542 | 0 | { // '&=' |
2543 | 91.2k | if (p->error_indicator) { |
2544 | 0 | p->level--; |
2545 | 0 | return NULL; |
2546 | 0 | } |
2547 | 91.2k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='")); |
2548 | 91.2k | Token * _literal; |
2549 | 91.2k | if ( |
2550 | 91.2k | (_literal = _PyPegen_expect_token(p, 41)) // token='&=' |
2551 | 91.2k | ) |
2552 | 217 | { |
2553 | 217 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='")); |
2554 | 217 | _res = _PyPegen_augoperator ( p , BitAnd ); |
2555 | 217 | if (_res == NULL && PyErr_Occurred()) { |
2556 | 0 | p->error_indicator = 1; |
2557 | 0 | p->level--; |
2558 | 0 | return NULL; |
2559 | 0 | } |
2560 | 217 | goto done; |
2561 | 217 | } |
2562 | 90.9k | p->mark = _mark; |
2563 | 90.9k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2564 | 90.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='")); |
2565 | 90.9k | } |
2566 | 0 | { // '|=' |
2567 | 90.9k | if (p->error_indicator) { |
2568 | 0 | p->level--; |
2569 | 0 | return NULL; |
2570 | 0 | } |
2571 | 90.9k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='")); |
2572 | 90.9k | Token * _literal; |
2573 | 90.9k | if ( |
2574 | 90.9k | (_literal = _PyPegen_expect_token(p, 42)) // token='|=' |
2575 | 90.9k | ) |
2576 | 302 | { |
2577 | 302 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='")); |
2578 | 302 | _res = _PyPegen_augoperator ( p , BitOr ); |
2579 | 302 | if (_res == NULL && PyErr_Occurred()) { |
2580 | 0 | p->error_indicator = 1; |
2581 | 0 | p->level--; |
2582 | 0 | return NULL; |
2583 | 0 | } |
2584 | 302 | goto done; |
2585 | 302 | } |
2586 | 90.6k | p->mark = _mark; |
2587 | 90.6k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2588 | 90.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='")); |
2589 | 90.6k | } |
2590 | 0 | { // '^=' |
2591 | 90.6k | if (p->error_indicator) { |
2592 | 0 | p->level--; |
2593 | 0 | return NULL; |
2594 | 0 | } |
2595 | 90.6k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='")); |
2596 | 90.6k | Token * _literal; |
2597 | 90.6k | if ( |
2598 | 90.6k | (_literal = _PyPegen_expect_token(p, 43)) // token='^=' |
2599 | 90.6k | ) |
2600 | 110 | { |
2601 | 110 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='")); |
2602 | 110 | _res = _PyPegen_augoperator ( p , BitXor ); |
2603 | 110 | if (_res == NULL && PyErr_Occurred()) { |
2604 | 0 | p->error_indicator = 1; |
2605 | 0 | p->level--; |
2606 | 0 | return NULL; |
2607 | 0 | } |
2608 | 110 | goto done; |
2609 | 110 | } |
2610 | 90.5k | p->mark = _mark; |
2611 | 90.5k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2612 | 90.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='")); |
2613 | 90.5k | } |
2614 | 0 | { // '<<=' |
2615 | 90.5k | if (p->error_indicator) { |
2616 | 0 | p->level--; |
2617 | 0 | return NULL; |
2618 | 0 | } |
2619 | 90.5k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='")); |
2620 | 90.5k | Token * _literal; |
2621 | 90.5k | if ( |
2622 | 90.5k | (_literal = _PyPegen_expect_token(p, 44)) // token='<<=' |
2623 | 90.5k | ) |
2624 | 89 | { |
2625 | 89 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='")); |
2626 | 89 | _res = _PyPegen_augoperator ( p , LShift ); |
2627 | 89 | if (_res == NULL && PyErr_Occurred()) { |
2628 | 0 | p->error_indicator = 1; |
2629 | 0 | p->level--; |
2630 | 0 | return NULL; |
2631 | 0 | } |
2632 | 89 | goto done; |
2633 | 89 | } |
2634 | 90.4k | p->mark = _mark; |
2635 | 90.4k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2636 | 90.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='")); |
2637 | 90.4k | } |
2638 | 0 | { // '>>=' |
2639 | 90.4k | if (p->error_indicator) { |
2640 | 0 | p->level--; |
2641 | 0 | return NULL; |
2642 | 0 | } |
2643 | 90.4k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='")); |
2644 | 90.4k | Token * _literal; |
2645 | 90.4k | if ( |
2646 | 90.4k | (_literal = _PyPegen_expect_token(p, 45)) // token='>>=' |
2647 | 90.4k | ) |
2648 | 82 | { |
2649 | 82 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='")); |
2650 | 82 | _res = _PyPegen_augoperator ( p , RShift ); |
2651 | 82 | if (_res == NULL && PyErr_Occurred()) { |
2652 | 0 | p->error_indicator = 1; |
2653 | 0 | p->level--; |
2654 | 0 | return NULL; |
2655 | 0 | } |
2656 | 82 | goto done; |
2657 | 82 | } |
2658 | 90.4k | p->mark = _mark; |
2659 | 90.4k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2660 | 90.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='")); |
2661 | 90.4k | } |
2662 | 0 | { // '**=' |
2663 | 90.4k | if (p->error_indicator) { |
2664 | 0 | p->level--; |
2665 | 0 | return NULL; |
2666 | 0 | } |
2667 | 90.4k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='")); |
2668 | 90.4k | Token * _literal; |
2669 | 90.4k | if ( |
2670 | 90.4k | (_literal = _PyPegen_expect_token(p, 46)) // token='**=' |
2671 | 90.4k | ) |
2672 | 73 | { |
2673 | 73 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='")); |
2674 | 73 | _res = _PyPegen_augoperator ( p , Pow ); |
2675 | 73 | if (_res == NULL && PyErr_Occurred()) { |
2676 | 0 | p->error_indicator = 1; |
2677 | 0 | p->level--; |
2678 | 0 | return NULL; |
2679 | 0 | } |
2680 | 73 | goto done; |
2681 | 73 | } |
2682 | 90.3k | p->mark = _mark; |
2683 | 90.3k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2684 | 90.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='")); |
2685 | 90.3k | } |
2686 | 0 | { // '//=' |
2687 | 90.3k | if (p->error_indicator) { |
2688 | 0 | p->level--; |
2689 | 0 | return NULL; |
2690 | 0 | } |
2691 | 90.3k | D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='")); |
2692 | 90.3k | Token * _literal; |
2693 | 90.3k | if ( |
2694 | 90.3k | (_literal = _PyPegen_expect_token(p, 48)) // token='//=' |
2695 | 90.3k | ) |
2696 | 224 | { |
2697 | 224 | D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='")); |
2698 | 224 | _res = _PyPegen_augoperator ( p , FloorDiv ); |
2699 | 224 | if (_res == NULL && PyErr_Occurred()) { |
2700 | 0 | p->error_indicator = 1; |
2701 | 0 | p->level--; |
2702 | 0 | return NULL; |
2703 | 0 | } |
2704 | 224 | goto done; |
2705 | 224 | } |
2706 | 90.1k | p->mark = _mark; |
2707 | 90.1k | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
2708 | 90.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='")); |
2709 | 90.1k | } |
2710 | 90.1k | _res = NULL; |
2711 | 93.1k | done: |
2712 | 93.1k | p->level--; |
2713 | 93.1k | return _res; |
2714 | 90.1k | } |
2715 | | |
2716 | | // return_stmt: 'return' star_expressions? |
2717 | | static stmt_ty |
2718 | | return_stmt_rule(Parser *p) |
2719 | 7.01k | { |
2720 | 7.01k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
2721 | 0 | _Pypegen_stack_overflow(p); |
2722 | 0 | } |
2723 | 7.01k | if (p->error_indicator) { |
2724 | 0 | p->level--; |
2725 | 0 | return NULL; |
2726 | 0 | } |
2727 | 7.01k | stmt_ty _res = NULL; |
2728 | 7.01k | int _mark = p->mark; |
2729 | 7.01k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
2730 | 0 | p->error_indicator = 1; |
2731 | 0 | p->level--; |
2732 | 0 | return NULL; |
2733 | 0 | } |
2734 | 7.01k | int _start_lineno = p->tokens[_mark]->lineno; |
2735 | 7.01k | UNUSED(_start_lineno); // Only used by EXTRA macro |
2736 | 7.01k | int _start_col_offset = p->tokens[_mark]->col_offset; |
2737 | 7.01k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
2738 | 7.01k | { // 'return' star_expressions? |
2739 | 7.01k | if (p->error_indicator) { |
2740 | 0 | p->level--; |
2741 | 0 | return NULL; |
2742 | 0 | } |
2743 | 7.01k | D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); |
2744 | 7.01k | Token * _keyword; |
2745 | 7.01k | void *a; |
2746 | 7.01k | if ( |
2747 | 7.01k | (_keyword = _PyPegen_expect_token(p, 522)) // token='return' |
2748 | 7.01k | && |
2749 | 7.01k | (a = star_expressions_rule(p), !p->error_indicator) // star_expressions? |
2750 | 7.01k | ) |
2751 | 6.95k | { |
2752 | 6.95k | D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?")); |
2753 | 6.95k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2754 | 6.95k | if (_token == NULL) { |
2755 | 0 | p->level--; |
2756 | 0 | return NULL; |
2757 | 0 | } |
2758 | 6.95k | int _end_lineno = _token->end_lineno; |
2759 | 6.95k | UNUSED(_end_lineno); // Only used by EXTRA macro |
2760 | 6.95k | int _end_col_offset = _token->end_col_offset; |
2761 | 6.95k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2762 | 6.95k | _res = _PyAST_Return ( a , EXTRA ); |
2763 | 6.95k | if (_res == NULL && PyErr_Occurred()) { |
2764 | 0 | p->error_indicator = 1; |
2765 | 0 | p->level--; |
2766 | 0 | return NULL; |
2767 | 0 | } |
2768 | 6.95k | goto done; |
2769 | 6.95k | } |
2770 | 67 | p->mark = _mark; |
2771 | 67 | D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
2772 | 67 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?")); |
2773 | 67 | } |
2774 | 67 | _res = NULL; |
2775 | 7.01k | done: |
2776 | 7.01k | p->level--; |
2777 | 7.01k | return _res; |
2778 | 67 | } |
2779 | | |
2780 | | // raise_stmt: |
2781 | | // | 'raise' expression 'from' expression |
2782 | | // | invalid_raise_stmt |
2783 | | // | 'raise' expression |
2784 | | // | 'raise' |
2785 | | static stmt_ty |
2786 | | raise_stmt_rule(Parser *p) |
2787 | 4.38k | { |
2788 | 4.38k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
2789 | 0 | _Pypegen_stack_overflow(p); |
2790 | 0 | } |
2791 | 4.38k | if (p->error_indicator) { |
2792 | 0 | p->level--; |
2793 | 0 | return NULL; |
2794 | 0 | } |
2795 | 4.38k | stmt_ty _res = NULL; |
2796 | 4.38k | int _mark = p->mark; |
2797 | 4.38k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
2798 | 0 | p->error_indicator = 1; |
2799 | 0 | p->level--; |
2800 | 0 | return NULL; |
2801 | 0 | } |
2802 | 4.38k | int _start_lineno = p->tokens[_mark]->lineno; |
2803 | 4.38k | UNUSED(_start_lineno); // Only used by EXTRA macro |
2804 | 4.38k | int _start_col_offset = p->tokens[_mark]->col_offset; |
2805 | 4.38k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
2806 | 4.38k | { // 'raise' expression 'from' expression |
2807 | 4.38k | if (p->error_indicator) { |
2808 | 0 | p->level--; |
2809 | 0 | return NULL; |
2810 | 0 | } |
2811 | 4.38k | D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression 'from' expression")); |
2812 | 4.38k | Token * _keyword; |
2813 | 4.38k | Token * _keyword_1; |
2814 | 4.38k | expr_ty a; |
2815 | 4.38k | expr_ty b; |
2816 | 4.38k | if ( |
2817 | 4.38k | (_keyword = _PyPegen_expect_token(p, 628)) // token='raise' |
2818 | 4.38k | && |
2819 | 4.38k | (a = expression_rule(p)) // expression |
2820 | 3.52k | && |
2821 | 3.52k | (_keyword_1 = _PyPegen_expect_token(p, 642)) // token='from' |
2822 | 787 | && |
2823 | 787 | (b = expression_rule(p)) // expression |
2824 | 4.38k | ) |
2825 | 782 | { |
2826 | 782 | D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression 'from' expression")); |
2827 | 782 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2828 | 782 | if (_token == NULL) { |
2829 | 0 | p->level--; |
2830 | 0 | return NULL; |
2831 | 0 | } |
2832 | 782 | int _end_lineno = _token->end_lineno; |
2833 | 782 | UNUSED(_end_lineno); // Only used by EXTRA macro |
2834 | 782 | int _end_col_offset = _token->end_col_offset; |
2835 | 782 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2836 | 782 | _res = _PyAST_Raise ( a , b , EXTRA ); |
2837 | 782 | if (_res == NULL && PyErr_Occurred()) { |
2838 | 0 | p->error_indicator = 1; |
2839 | 0 | p->level--; |
2840 | 0 | return NULL; |
2841 | 0 | } |
2842 | 782 | goto done; |
2843 | 782 | } |
2844 | 3.60k | p->mark = _mark; |
2845 | 3.60k | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
2846 | 3.60k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression 'from' expression")); |
2847 | 3.60k | } |
2848 | 3.60k | if (p->call_invalid_rules) { // invalid_raise_stmt |
2849 | 572 | if (p->error_indicator) { |
2850 | 35 | p->level--; |
2851 | 35 | return NULL; |
2852 | 35 | } |
2853 | 537 | D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_raise_stmt")); |
2854 | 537 | void *invalid_raise_stmt_var; |
2855 | 537 | if ( |
2856 | 537 | (invalid_raise_stmt_var = invalid_raise_stmt_rule(p)) // invalid_raise_stmt |
2857 | 537 | ) |
2858 | 0 | { |
2859 | 0 | D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_raise_stmt")); |
2860 | 0 | _res = invalid_raise_stmt_var; |
2861 | 0 | goto done; |
2862 | 0 | } |
2863 | 537 | p->mark = _mark; |
2864 | 537 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
2865 | 537 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_raise_stmt")); |
2866 | 537 | } |
2867 | 3.57k | { // 'raise' expression |
2868 | 3.57k | if (p->error_indicator) { |
2869 | 5 | p->level--; |
2870 | 5 | return NULL; |
2871 | 5 | } |
2872 | 3.56k | D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression")); |
2873 | 3.56k | Token * _keyword; |
2874 | 3.56k | expr_ty a; |
2875 | 3.56k | if ( |
2876 | 3.56k | (_keyword = _PyPegen_expect_token(p, 628)) // token='raise' |
2877 | 3.56k | && |
2878 | 3.56k | (a = expression_rule(p)) // expression |
2879 | 3.56k | ) |
2880 | 2.73k | { |
2881 | 2.73k | D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression")); |
2882 | 2.73k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2883 | 2.73k | if (_token == NULL) { |
2884 | 0 | p->level--; |
2885 | 0 | return NULL; |
2886 | 0 | } |
2887 | 2.73k | int _end_lineno = _token->end_lineno; |
2888 | 2.73k | UNUSED(_end_lineno); // Only used by EXTRA macro |
2889 | 2.73k | int _end_col_offset = _token->end_col_offset; |
2890 | 2.73k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2891 | 2.73k | _res = _PyAST_Raise ( a , NULL , EXTRA ); |
2892 | 2.73k | if (_res == NULL && PyErr_Occurred()) { |
2893 | 0 | p->error_indicator = 1; |
2894 | 0 | p->level--; |
2895 | 0 | return NULL; |
2896 | 0 | } |
2897 | 2.73k | goto done; |
2898 | 2.73k | } |
2899 | 829 | p->mark = _mark; |
2900 | 829 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
2901 | 829 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression")); |
2902 | 829 | } |
2903 | 0 | { // 'raise' |
2904 | 829 | if (p->error_indicator) { |
2905 | 0 | p->level--; |
2906 | 0 | return NULL; |
2907 | 0 | } |
2908 | 829 | D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'")); |
2909 | 829 | Token * _keyword; |
2910 | 829 | if ( |
2911 | 829 | (_keyword = _PyPegen_expect_token(p, 628)) // token='raise' |
2912 | 829 | ) |
2913 | 829 | { |
2914 | 829 | D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'")); |
2915 | 829 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2916 | 829 | if (_token == NULL) { |
2917 | 0 | p->level--; |
2918 | 0 | return NULL; |
2919 | 0 | } |
2920 | 829 | int _end_lineno = _token->end_lineno; |
2921 | 829 | UNUSED(_end_lineno); // Only used by EXTRA macro |
2922 | 829 | int _end_col_offset = _token->end_col_offset; |
2923 | 829 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2924 | 829 | _res = _PyAST_Raise ( NULL , NULL , EXTRA ); |
2925 | 829 | if (_res == NULL && PyErr_Occurred()) { |
2926 | 0 | p->error_indicator = 1; |
2927 | 0 | p->level--; |
2928 | 0 | return NULL; |
2929 | 0 | } |
2930 | 829 | goto done; |
2931 | 829 | } |
2932 | 0 | p->mark = _mark; |
2933 | 0 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
2934 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'")); |
2935 | 0 | } |
2936 | 0 | _res = NULL; |
2937 | 4.34k | done: |
2938 | 4.34k | p->level--; |
2939 | 4.34k | return _res; |
2940 | 0 | } |
2941 | | |
2942 | | // pass_stmt: 'pass' |
2943 | | static stmt_ty |
2944 | | pass_stmt_rule(Parser *p) |
2945 | 182k | { |
2946 | 182k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
2947 | 0 | _Pypegen_stack_overflow(p); |
2948 | 0 | } |
2949 | 182k | if (p->error_indicator) { |
2950 | 0 | p->level--; |
2951 | 0 | return NULL; |
2952 | 0 | } |
2953 | 182k | stmt_ty _res = NULL; |
2954 | 182k | int _mark = p->mark; |
2955 | 182k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
2956 | 0 | p->error_indicator = 1; |
2957 | 0 | p->level--; |
2958 | 0 | return NULL; |
2959 | 0 | } |
2960 | 182k | int _start_lineno = p->tokens[_mark]->lineno; |
2961 | 182k | UNUSED(_start_lineno); // Only used by EXTRA macro |
2962 | 182k | int _start_col_offset = p->tokens[_mark]->col_offset; |
2963 | 182k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
2964 | 182k | { // 'pass' |
2965 | 182k | if (p->error_indicator) { |
2966 | 0 | p->level--; |
2967 | 0 | return NULL; |
2968 | 0 | } |
2969 | 182k | D(fprintf(stderr, "%*c> pass_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'")); |
2970 | 182k | Token * _keyword; |
2971 | 182k | if ( |
2972 | 182k | (_keyword = _PyPegen_expect_token(p, 527)) // token='pass' |
2973 | 182k | ) |
2974 | 1.36k | { |
2975 | 1.36k | D(fprintf(stderr, "%*c+ pass_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'")); |
2976 | 1.36k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
2977 | 1.36k | if (_token == NULL) { |
2978 | 0 | p->level--; |
2979 | 0 | return NULL; |
2980 | 0 | } |
2981 | 1.36k | int _end_lineno = _token->end_lineno; |
2982 | 1.36k | UNUSED(_end_lineno); // Only used by EXTRA macro |
2983 | 1.36k | int _end_col_offset = _token->end_col_offset; |
2984 | 1.36k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
2985 | 1.36k | _res = _PyAST_Pass ( EXTRA ); |
2986 | 1.36k | if (_res == NULL && PyErr_Occurred()) { |
2987 | 0 | p->error_indicator = 1; |
2988 | 0 | p->level--; |
2989 | 0 | return NULL; |
2990 | 0 | } |
2991 | 1.36k | goto done; |
2992 | 1.36k | } |
2993 | 181k | p->mark = _mark; |
2994 | 181k | D(fprintf(stderr, "%*c%s pass_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
2995 | 181k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'")); |
2996 | 181k | } |
2997 | 181k | _res = NULL; |
2998 | 182k | done: |
2999 | 182k | p->level--; |
3000 | 182k | return _res; |
3001 | 181k | } |
3002 | | |
3003 | | // break_stmt: 'break' |
3004 | | static stmt_ty |
3005 | | break_stmt_rule(Parser *p) |
3006 | 183k | { |
3007 | 183k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3008 | 0 | _Pypegen_stack_overflow(p); |
3009 | 0 | } |
3010 | 183k | if (p->error_indicator) { |
3011 | 0 | p->level--; |
3012 | 0 | return NULL; |
3013 | 0 | } |
3014 | 183k | stmt_ty _res = NULL; |
3015 | 183k | int _mark = p->mark; |
3016 | 183k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3017 | 0 | p->error_indicator = 1; |
3018 | 0 | p->level--; |
3019 | 0 | return NULL; |
3020 | 0 | } |
3021 | 183k | int _start_lineno = p->tokens[_mark]->lineno; |
3022 | 183k | UNUSED(_start_lineno); // Only used by EXTRA macro |
3023 | 183k | int _start_col_offset = p->tokens[_mark]->col_offset; |
3024 | 183k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3025 | 183k | { // 'break' |
3026 | 183k | if (p->error_indicator) { |
3027 | 0 | p->level--; |
3028 | 0 | return NULL; |
3029 | 0 | } |
3030 | 183k | D(fprintf(stderr, "%*c> break_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'")); |
3031 | 183k | Token * _keyword; |
3032 | 183k | if ( |
3033 | 183k | (_keyword = _PyPegen_expect_token(p, 528)) // token='break' |
3034 | 183k | ) |
3035 | 2.03k | { |
3036 | 2.03k | D(fprintf(stderr, "%*c+ break_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'")); |
3037 | 2.03k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3038 | 2.03k | if (_token == NULL) { |
3039 | 0 | p->level--; |
3040 | 0 | return NULL; |
3041 | 0 | } |
3042 | 2.03k | int _end_lineno = _token->end_lineno; |
3043 | 2.03k | UNUSED(_end_lineno); // Only used by EXTRA macro |
3044 | 2.03k | int _end_col_offset = _token->end_col_offset; |
3045 | 2.03k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3046 | 2.03k | _res = _PyAST_Break ( EXTRA ); |
3047 | 2.03k | if (_res == NULL && PyErr_Occurred()) { |
3048 | 0 | p->error_indicator = 1; |
3049 | 0 | p->level--; |
3050 | 0 | return NULL; |
3051 | 0 | } |
3052 | 2.03k | goto done; |
3053 | 2.03k | } |
3054 | 181k | p->mark = _mark; |
3055 | 181k | D(fprintf(stderr, "%*c%s break_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
3056 | 181k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'")); |
3057 | 181k | } |
3058 | 181k | _res = NULL; |
3059 | 183k | done: |
3060 | 183k | p->level--; |
3061 | 183k | return _res; |
3062 | 181k | } |
3063 | | |
3064 | | // continue_stmt: 'continue' |
3065 | | static stmt_ty |
3066 | | continue_stmt_rule(Parser *p) |
3067 | 182k | { |
3068 | 182k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3069 | 0 | _Pypegen_stack_overflow(p); |
3070 | 0 | } |
3071 | 182k | if (p->error_indicator) { |
3072 | 0 | p->level--; |
3073 | 0 | return NULL; |
3074 | 0 | } |
3075 | 182k | stmt_ty _res = NULL; |
3076 | 182k | int _mark = p->mark; |
3077 | 182k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3078 | 0 | p->error_indicator = 1; |
3079 | 0 | p->level--; |
3080 | 0 | return NULL; |
3081 | 0 | } |
3082 | 182k | int _start_lineno = p->tokens[_mark]->lineno; |
3083 | 182k | UNUSED(_start_lineno); // Only used by EXTRA macro |
3084 | 182k | int _start_col_offset = p->tokens[_mark]->col_offset; |
3085 | 182k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3086 | 182k | { // 'continue' |
3087 | 182k | if (p->error_indicator) { |
3088 | 0 | p->level--; |
3089 | 0 | return NULL; |
3090 | 0 | } |
3091 | 182k | D(fprintf(stderr, "%*c> continue_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'")); |
3092 | 182k | Token * _keyword; |
3093 | 182k | if ( |
3094 | 182k | (_keyword = _PyPegen_expect_token(p, 529)) // token='continue' |
3095 | 182k | ) |
3096 | 2.60k | { |
3097 | 2.60k | D(fprintf(stderr, "%*c+ continue_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'")); |
3098 | 2.60k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3099 | 2.60k | if (_token == NULL) { |
3100 | 0 | p->level--; |
3101 | 0 | return NULL; |
3102 | 0 | } |
3103 | 2.60k | int _end_lineno = _token->end_lineno; |
3104 | 2.60k | UNUSED(_end_lineno); // Only used by EXTRA macro |
3105 | 2.60k | int _end_col_offset = _token->end_col_offset; |
3106 | 2.60k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3107 | 2.60k | _res = _PyAST_Continue ( EXTRA ); |
3108 | 2.60k | if (_res == NULL && PyErr_Occurred()) { |
3109 | 0 | p->error_indicator = 1; |
3110 | 0 | p->level--; |
3111 | 0 | return NULL; |
3112 | 0 | } |
3113 | 2.60k | goto done; |
3114 | 2.60k | } |
3115 | 179k | p->mark = _mark; |
3116 | 179k | D(fprintf(stderr, "%*c%s continue_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
3117 | 179k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'")); |
3118 | 179k | } |
3119 | 179k | _res = NULL; |
3120 | 182k | done: |
3121 | 182k | p->level--; |
3122 | 182k | return _res; |
3123 | 179k | } |
3124 | | |
3125 | | // global_stmt: 'global' ','.NAME+ |
3126 | | static stmt_ty |
3127 | | global_stmt_rule(Parser *p) |
3128 | 865 | { |
3129 | 865 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3130 | 0 | _Pypegen_stack_overflow(p); |
3131 | 0 | } |
3132 | 865 | if (p->error_indicator) { |
3133 | 0 | p->level--; |
3134 | 0 | return NULL; |
3135 | 0 | } |
3136 | 865 | stmt_ty _res = NULL; |
3137 | 865 | int _mark = p->mark; |
3138 | 865 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3139 | 0 | p->error_indicator = 1; |
3140 | 0 | p->level--; |
3141 | 0 | return NULL; |
3142 | 0 | } |
3143 | 865 | int _start_lineno = p->tokens[_mark]->lineno; |
3144 | 865 | UNUSED(_start_lineno); // Only used by EXTRA macro |
3145 | 865 | int _start_col_offset = p->tokens[_mark]->col_offset; |
3146 | 865 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3147 | 865 | { // 'global' ','.NAME+ |
3148 | 865 | if (p->error_indicator) { |
3149 | 0 | p->level--; |
3150 | 0 | return NULL; |
3151 | 0 | } |
3152 | 865 | D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+")); |
3153 | 865 | Token * _keyword; |
3154 | 865 | asdl_expr_seq* a; |
3155 | 865 | if ( |
3156 | 865 | (_keyword = _PyPegen_expect_token(p, 530)) // token='global' |
3157 | 865 | && |
3158 | 865 | (a = (asdl_expr_seq*)_gather_14_rule(p)) // ','.NAME+ |
3159 | 865 | ) |
3160 | 858 | { |
3161 | 858 | D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+")); |
3162 | 858 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3163 | 858 | if (_token == NULL) { |
3164 | 0 | p->level--; |
3165 | 0 | return NULL; |
3166 | 0 | } |
3167 | 858 | int _end_lineno = _token->end_lineno; |
3168 | 858 | UNUSED(_end_lineno); // Only used by EXTRA macro |
3169 | 858 | int _end_col_offset = _token->end_col_offset; |
3170 | 858 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3171 | 858 | _res = _PyAST_Global ( CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA ); |
3172 | 858 | if (_res == NULL && PyErr_Occurred()) { |
3173 | 0 | p->error_indicator = 1; |
3174 | 0 | p->level--; |
3175 | 0 | return NULL; |
3176 | 0 | } |
3177 | 858 | goto done; |
3178 | 858 | } |
3179 | 7 | p->mark = _mark; |
3180 | 7 | D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
3181 | 7 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+")); |
3182 | 7 | } |
3183 | 7 | _res = NULL; |
3184 | 865 | done: |
3185 | 865 | p->level--; |
3186 | 865 | return _res; |
3187 | 7 | } |
3188 | | |
3189 | | // nonlocal_stmt: 'nonlocal' ','.NAME+ |
3190 | | static stmt_ty |
3191 | | nonlocal_stmt_rule(Parser *p) |
3192 | 476 | { |
3193 | 476 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3194 | 0 | _Pypegen_stack_overflow(p); |
3195 | 0 | } |
3196 | 476 | if (p->error_indicator) { |
3197 | 0 | p->level--; |
3198 | 0 | return NULL; |
3199 | 0 | } |
3200 | 476 | stmt_ty _res = NULL; |
3201 | 476 | int _mark = p->mark; |
3202 | 476 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3203 | 0 | p->error_indicator = 1; |
3204 | 0 | p->level--; |
3205 | 0 | return NULL; |
3206 | 0 | } |
3207 | 476 | int _start_lineno = p->tokens[_mark]->lineno; |
3208 | 476 | UNUSED(_start_lineno); // Only used by EXTRA macro |
3209 | 476 | int _start_col_offset = p->tokens[_mark]->col_offset; |
3210 | 476 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3211 | 476 | { // 'nonlocal' ','.NAME+ |
3212 | 476 | if (p->error_indicator) { |
3213 | 0 | p->level--; |
3214 | 0 | return NULL; |
3215 | 0 | } |
3216 | 476 | D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+")); |
3217 | 476 | Token * _keyword; |
3218 | 476 | asdl_expr_seq* a; |
3219 | 476 | if ( |
3220 | 476 | (_keyword = _PyPegen_expect_token(p, 531)) // token='nonlocal' |
3221 | 476 | && |
3222 | 476 | (a = (asdl_expr_seq*)_gather_14_rule(p)) // ','.NAME+ |
3223 | 476 | ) |
3224 | 473 | { |
3225 | 473 | D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+")); |
3226 | 473 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3227 | 473 | if (_token == NULL) { |
3228 | 0 | p->level--; |
3229 | 0 | return NULL; |
3230 | 0 | } |
3231 | 473 | int _end_lineno = _token->end_lineno; |
3232 | 473 | UNUSED(_end_lineno); // Only used by EXTRA macro |
3233 | 473 | int _end_col_offset = _token->end_col_offset; |
3234 | 473 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3235 | 473 | _res = _PyAST_Nonlocal ( CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA ); |
3236 | 473 | if (_res == NULL && PyErr_Occurred()) { |
3237 | 0 | p->error_indicator = 1; |
3238 | 0 | p->level--; |
3239 | 0 | return NULL; |
3240 | 0 | } |
3241 | 473 | goto done; |
3242 | 473 | } |
3243 | 3 | p->mark = _mark; |
3244 | 3 | D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
3245 | 3 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+")); |
3246 | 3 | } |
3247 | 3 | _res = NULL; |
3248 | 476 | done: |
3249 | 476 | p->level--; |
3250 | 476 | return _res; |
3251 | 3 | } |
3252 | | |
3253 | | // del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt |
3254 | | static stmt_ty |
3255 | | del_stmt_rule(Parser *p) |
3256 | 1.55k | { |
3257 | 1.55k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3258 | 0 | _Pypegen_stack_overflow(p); |
3259 | 0 | } |
3260 | 1.55k | if (p->error_indicator) { |
3261 | 0 | p->level--; |
3262 | 0 | return NULL; |
3263 | 0 | } |
3264 | 1.55k | stmt_ty _res = NULL; |
3265 | 1.55k | int _mark = p->mark; |
3266 | 1.55k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3267 | 0 | p->error_indicator = 1; |
3268 | 0 | p->level--; |
3269 | 0 | return NULL; |
3270 | 0 | } |
3271 | 1.55k | int _start_lineno = p->tokens[_mark]->lineno; |
3272 | 1.55k | UNUSED(_start_lineno); // Only used by EXTRA macro |
3273 | 1.55k | int _start_col_offset = p->tokens[_mark]->col_offset; |
3274 | 1.55k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3275 | 1.55k | { // 'del' del_targets &(';' | NEWLINE) |
3276 | 1.55k | if (p->error_indicator) { |
3277 | 0 | p->level--; |
3278 | 0 | return NULL; |
3279 | 0 | } |
3280 | 1.55k | D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)")); |
3281 | 1.55k | Token * _keyword; |
3282 | 1.55k | asdl_expr_seq* a; |
3283 | 1.55k | if ( |
3284 | 1.55k | (_keyword = _PyPegen_expect_token(p, 630)) // token='del' |
3285 | 1.55k | && |
3286 | 1.55k | (a = del_targets_rule(p)) // del_targets |
3287 | 1.32k | && |
3288 | 1.32k | _PyPegen_lookahead(1, _tmp_15_rule, p) |
3289 | 1.55k | ) |
3290 | 1.02k | { |
3291 | 1.02k | D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)")); |
3292 | 1.02k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3293 | 1.02k | if (_token == NULL) { |
3294 | 0 | p->level--; |
3295 | 0 | return NULL; |
3296 | 0 | } |
3297 | 1.02k | int _end_lineno = _token->end_lineno; |
3298 | 1.02k | UNUSED(_end_lineno); // Only used by EXTRA macro |
3299 | 1.02k | int _end_col_offset = _token->end_col_offset; |
3300 | 1.02k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3301 | 1.02k | _res = _PyAST_Delete ( a , EXTRA ); |
3302 | 1.02k | if (_res == NULL && PyErr_Occurred()) { |
3303 | 0 | p->error_indicator = 1; |
3304 | 0 | p->level--; |
3305 | 0 | return NULL; |
3306 | 0 | } |
3307 | 1.02k | goto done; |
3308 | 1.02k | } |
3309 | 529 | p->mark = _mark; |
3310 | 529 | D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
3311 | 529 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)")); |
3312 | 529 | } |
3313 | 529 | if (p->call_invalid_rules) { // invalid_del_stmt |
3314 | 390 | if (p->error_indicator) { |
3315 | 79 | p->level--; |
3316 | 79 | return NULL; |
3317 | 79 | } |
3318 | 311 | D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt")); |
3319 | 311 | void *invalid_del_stmt_var; |
3320 | 311 | if ( |
3321 | 311 | (invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt |
3322 | 311 | ) |
3323 | 0 | { |
3324 | 0 | D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt")); |
3325 | 0 | _res = invalid_del_stmt_var; |
3326 | 0 | goto done; |
3327 | 0 | } |
3328 | 311 | p->mark = _mark; |
3329 | 311 | D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
3330 | 311 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt")); |
3331 | 311 | } |
3332 | 450 | _res = NULL; |
3333 | 1.47k | done: |
3334 | 1.47k | p->level--; |
3335 | 1.47k | return _res; |
3336 | 450 | } |
3337 | | |
3338 | | // yield_stmt: yield_expr |
3339 | | static stmt_ty |
3340 | | yield_stmt_rule(Parser *p) |
3341 | 1.71k | { |
3342 | 1.71k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3343 | 0 | _Pypegen_stack_overflow(p); |
3344 | 0 | } |
3345 | 1.71k | if (p->error_indicator) { |
3346 | 0 | p->level--; |
3347 | 0 | return NULL; |
3348 | 0 | } |
3349 | 1.71k | stmt_ty _res = NULL; |
3350 | 1.71k | int _mark = p->mark; |
3351 | 1.71k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3352 | 0 | p->error_indicator = 1; |
3353 | 0 | p->level--; |
3354 | 0 | return NULL; |
3355 | 0 | } |
3356 | 1.71k | int _start_lineno = p->tokens[_mark]->lineno; |
3357 | 1.71k | UNUSED(_start_lineno); // Only used by EXTRA macro |
3358 | 1.71k | int _start_col_offset = p->tokens[_mark]->col_offset; |
3359 | 1.71k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3360 | 1.71k | { // yield_expr |
3361 | 1.71k | if (p->error_indicator) { |
3362 | 0 | p->level--; |
3363 | 0 | return NULL; |
3364 | 0 | } |
3365 | 1.71k | D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
3366 | 1.71k | expr_ty y; |
3367 | 1.71k | if ( |
3368 | 1.71k | (y = yield_expr_rule(p)) // yield_expr |
3369 | 1.71k | ) |
3370 | 1.71k | { |
3371 | 1.71k | D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
3372 | 1.71k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3373 | 1.71k | if (_token == NULL) { |
3374 | 0 | p->level--; |
3375 | 0 | return NULL; |
3376 | 0 | } |
3377 | 1.71k | int _end_lineno = _token->end_lineno; |
3378 | 1.71k | UNUSED(_end_lineno); // Only used by EXTRA macro |
3379 | 1.71k | int _end_col_offset = _token->end_col_offset; |
3380 | 1.71k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3381 | 1.71k | _res = _PyAST_Expr ( y , EXTRA ); |
3382 | 1.71k | if (_res == NULL && PyErr_Occurred()) { |
3383 | 0 | p->error_indicator = 1; |
3384 | 0 | p->level--; |
3385 | 0 | return NULL; |
3386 | 0 | } |
3387 | 1.71k | goto done; |
3388 | 1.71k | } |
3389 | 5 | p->mark = _mark; |
3390 | 5 | D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
3391 | 5 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
3392 | 5 | } |
3393 | 5 | _res = NULL; |
3394 | 1.71k | done: |
3395 | 1.71k | p->level--; |
3396 | 1.71k | return _res; |
3397 | 5 | } |
3398 | | |
3399 | | // assert_stmt: invalid_assert_stmt | 'assert' expression [',' expression] |
3400 | | static stmt_ty |
3401 | | assert_stmt_rule(Parser *p) |
3402 | 1.09k | { |
3403 | 1.09k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3404 | 0 | _Pypegen_stack_overflow(p); |
3405 | 0 | } |
3406 | 1.09k | if (p->error_indicator) { |
3407 | 0 | p->level--; |
3408 | 0 | return NULL; |
3409 | 0 | } |
3410 | 1.09k | stmt_ty _res = NULL; |
3411 | 1.09k | int _mark = p->mark; |
3412 | 1.09k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3413 | 0 | p->error_indicator = 1; |
3414 | 0 | p->level--; |
3415 | 0 | return NULL; |
3416 | 0 | } |
3417 | 1.09k | int _start_lineno = p->tokens[_mark]->lineno; |
3418 | 1.09k | UNUSED(_start_lineno); // Only used by EXTRA macro |
3419 | 1.09k | int _start_col_offset = p->tokens[_mark]->col_offset; |
3420 | 1.09k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3421 | 1.09k | if (p->call_invalid_rules) { // invalid_assert_stmt |
3422 | 353 | if (p->error_indicator) { |
3423 | 0 | p->level--; |
3424 | 0 | return NULL; |
3425 | 0 | } |
3426 | 353 | D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assert_stmt")); |
3427 | 353 | void *invalid_assert_stmt_var; |
3428 | 353 | if ( |
3429 | 353 | (invalid_assert_stmt_var = invalid_assert_stmt_rule(p)) // invalid_assert_stmt |
3430 | 353 | ) |
3431 | 0 | { |
3432 | 0 | D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assert_stmt")); |
3433 | 0 | _res = invalid_assert_stmt_var; |
3434 | 0 | goto done; |
3435 | 0 | } |
3436 | 353 | p->mark = _mark; |
3437 | 353 | D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
3438 | 353 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assert_stmt")); |
3439 | 353 | } |
3440 | 1.09k | { // 'assert' expression [',' expression] |
3441 | 1.09k | if (p->error_indicator) { |
3442 | 72 | p->level--; |
3443 | 72 | return NULL; |
3444 | 72 | } |
3445 | 1.02k | D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]")); |
3446 | 1.02k | Token * _keyword; |
3447 | 1.02k | expr_ty a; |
3448 | 1.02k | void *b; |
3449 | 1.02k | if ( |
3450 | 1.02k | (_keyword = _PyPegen_expect_token(p, 634)) // token='assert' |
3451 | 1.02k | && |
3452 | 1.02k | (a = expression_rule(p)) // expression |
3453 | 1.00k | && |
3454 | 1.00k | (b = _tmp_16_rule(p), !p->error_indicator) // [',' expression] |
3455 | 1.02k | ) |
3456 | 1.00k | { |
3457 | 1.00k | D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]")); |
3458 | 1.00k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3459 | 1.00k | if (_token == NULL) { |
3460 | 0 | p->level--; |
3461 | 0 | return NULL; |
3462 | 0 | } |
3463 | 1.00k | int _end_lineno = _token->end_lineno; |
3464 | 1.00k | UNUSED(_end_lineno); // Only used by EXTRA macro |
3465 | 1.00k | int _end_col_offset = _token->end_col_offset; |
3466 | 1.00k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3467 | 1.00k | _res = _PyAST_Assert ( a , b , EXTRA ); |
3468 | 1.00k | if (_res == NULL && PyErr_Occurred()) { |
3469 | 0 | p->error_indicator = 1; |
3470 | 0 | p->level--; |
3471 | 0 | return NULL; |
3472 | 0 | } |
3473 | 1.00k | goto done; |
3474 | 1.00k | } |
3475 | 15 | p->mark = _mark; |
3476 | 15 | D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
3477 | 15 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]")); |
3478 | 15 | } |
3479 | 15 | _res = NULL; |
3480 | 1.02k | done: |
3481 | 1.02k | p->level--; |
3482 | 1.02k | return _res; |
3483 | 15 | } |
3484 | | |
3485 | | // import_stmt: invalid_import | import_name | import_from |
3486 | | static stmt_ty |
3487 | | import_stmt_rule(Parser *p) |
3488 | 6.29k | { |
3489 | 6.29k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3490 | 0 | _Pypegen_stack_overflow(p); |
3491 | 0 | } |
3492 | 6.29k | if (p->error_indicator) { |
3493 | 0 | p->level--; |
3494 | 0 | return NULL; |
3495 | 0 | } |
3496 | 6.29k | stmt_ty _res = NULL; |
3497 | 6.29k | int _mark = p->mark; |
3498 | 6.29k | if (p->call_invalid_rules) { // invalid_import |
3499 | 1.71k | if (p->error_indicator) { |
3500 | 0 | p->level--; |
3501 | 0 | return NULL; |
3502 | 0 | } |
3503 | 1.71k | D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import")); |
3504 | 1.71k | void *invalid_import_var; |
3505 | 1.71k | if ( |
3506 | 1.71k | (invalid_import_var = invalid_import_rule(p)) // invalid_import |
3507 | 1.71k | ) |
3508 | 0 | { |
3509 | 0 | D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import")); |
3510 | 0 | _res = invalid_import_var; |
3511 | 0 | goto done; |
3512 | 0 | } |
3513 | 1.71k | p->mark = _mark; |
3514 | 1.71k | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
3515 | 1.71k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import")); |
3516 | 1.71k | } |
3517 | 6.29k | { // import_name |
3518 | 6.29k | if (p->error_indicator) { |
3519 | 6 | p->level--; |
3520 | 6 | return NULL; |
3521 | 6 | } |
3522 | 6.29k | D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name")); |
3523 | 6.29k | stmt_ty import_name_var; |
3524 | 6.29k | if ( |
3525 | 6.29k | (import_name_var = import_name_rule(p)) // import_name |
3526 | 6.29k | ) |
3527 | 2.93k | { |
3528 | 2.93k | D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name")); |
3529 | 2.93k | _res = import_name_var; |
3530 | 2.93k | goto done; |
3531 | 2.93k | } |
3532 | 3.36k | p->mark = _mark; |
3533 | 3.36k | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
3534 | 3.36k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name")); |
3535 | 3.36k | } |
3536 | 0 | { // import_from |
3537 | 3.36k | if (p->error_indicator) { |
3538 | 30 | p->level--; |
3539 | 30 | return NULL; |
3540 | 30 | } |
3541 | 3.33k | D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from")); |
3542 | 3.33k | stmt_ty import_from_var; |
3543 | 3.33k | if ( |
3544 | 3.33k | (import_from_var = import_from_rule(p)) // import_from |
3545 | 3.33k | ) |
3546 | 3.12k | { |
3547 | 3.12k | D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from")); |
3548 | 3.12k | _res = import_from_var; |
3549 | 3.12k | goto done; |
3550 | 3.12k | } |
3551 | 203 | p->mark = _mark; |
3552 | 203 | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
3553 | 203 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from")); |
3554 | 203 | } |
3555 | 203 | _res = NULL; |
3556 | 6.26k | done: |
3557 | 6.26k | p->level--; |
3558 | 6.26k | return _res; |
3559 | 203 | } |
3560 | | |
3561 | | // import_name: 'import' dotted_as_names |
3562 | | static stmt_ty |
3563 | | import_name_rule(Parser *p) |
3564 | 6.29k | { |
3565 | 6.29k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3566 | 0 | _Pypegen_stack_overflow(p); |
3567 | 0 | } |
3568 | 6.29k | if (p->error_indicator) { |
3569 | 0 | p->level--; |
3570 | 0 | return NULL; |
3571 | 0 | } |
3572 | 6.29k | stmt_ty _res = NULL; |
3573 | 6.29k | int _mark = p->mark; |
3574 | 6.29k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3575 | 0 | p->error_indicator = 1; |
3576 | 0 | p->level--; |
3577 | 0 | return NULL; |
3578 | 0 | } |
3579 | 6.29k | int _start_lineno = p->tokens[_mark]->lineno; |
3580 | 6.29k | UNUSED(_start_lineno); // Only used by EXTRA macro |
3581 | 6.29k | int _start_col_offset = p->tokens[_mark]->col_offset; |
3582 | 6.29k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3583 | 6.29k | { // 'import' dotted_as_names |
3584 | 6.29k | if (p->error_indicator) { |
3585 | 0 | p->level--; |
3586 | 0 | return NULL; |
3587 | 0 | } |
3588 | 6.29k | D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names")); |
3589 | 6.29k | Token * _keyword; |
3590 | 6.29k | asdl_alias_seq* a; |
3591 | 6.29k | if ( |
3592 | 6.29k | (_keyword = _PyPegen_expect_token(p, 643)) // token='import' |
3593 | 2.97k | && |
3594 | 2.97k | (a = dotted_as_names_rule(p)) // dotted_as_names |
3595 | 6.29k | ) |
3596 | 2.93k | { |
3597 | 2.93k | D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names")); |
3598 | 2.93k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3599 | 2.93k | if (_token == NULL) { |
3600 | 0 | p->level--; |
3601 | 0 | return NULL; |
3602 | 0 | } |
3603 | 2.93k | int _end_lineno = _token->end_lineno; |
3604 | 2.93k | UNUSED(_end_lineno); // Only used by EXTRA macro |
3605 | 2.93k | int _end_col_offset = _token->end_col_offset; |
3606 | 2.93k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3607 | 2.93k | _res = _PyAST_Import ( a , EXTRA ); |
3608 | 2.93k | if (_res == NULL && PyErr_Occurred()) { |
3609 | 0 | p->error_indicator = 1; |
3610 | 0 | p->level--; |
3611 | 0 | return NULL; |
3612 | 0 | } |
3613 | 2.93k | goto done; |
3614 | 2.93k | } |
3615 | 3.36k | p->mark = _mark; |
3616 | 3.36k | D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ', |
3617 | 3.36k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names")); |
3618 | 3.36k | } |
3619 | 3.36k | _res = NULL; |
3620 | 6.29k | done: |
3621 | 6.29k | p->level--; |
3622 | 6.29k | return _res; |
3623 | 3.36k | } |
3624 | | |
3625 | | // import_from: |
3626 | | // | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets |
3627 | | // | 'from' (('.' | '...'))+ 'import' import_from_targets |
3628 | | static stmt_ty |
3629 | | import_from_rule(Parser *p) |
3630 | 3.33k | { |
3631 | 3.33k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3632 | 0 | _Pypegen_stack_overflow(p); |
3633 | 0 | } |
3634 | 3.33k | if (p->error_indicator) { |
3635 | 0 | p->level--; |
3636 | 0 | return NULL; |
3637 | 0 | } |
3638 | 3.33k | stmt_ty _res = NULL; |
3639 | 3.33k | int _mark = p->mark; |
3640 | 3.33k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3641 | 0 | p->error_indicator = 1; |
3642 | 0 | p->level--; |
3643 | 0 | return NULL; |
3644 | 0 | } |
3645 | 3.33k | int _start_lineno = p->tokens[_mark]->lineno; |
3646 | 3.33k | UNUSED(_start_lineno); // Only used by EXTRA macro |
3647 | 3.33k | int _start_col_offset = p->tokens[_mark]->col_offset; |
3648 | 3.33k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3649 | 3.33k | { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets |
3650 | 3.33k | if (p->error_indicator) { |
3651 | 0 | p->level--; |
3652 | 0 | return NULL; |
3653 | 0 | } |
3654 | 3.33k | D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets")); |
3655 | 3.33k | Token * _keyword; |
3656 | 3.33k | Token * _keyword_1; |
3657 | 3.33k | asdl_seq * a; |
3658 | 3.33k | expr_ty b; |
3659 | 3.33k | asdl_alias_seq* c; |
3660 | 3.33k | if ( |
3661 | 3.33k | (_keyword = _PyPegen_expect_token(p, 642)) // token='from' |
3662 | 3.32k | && |
3663 | 3.32k | (a = _loop0_17_rule(p)) // (('.' | '...'))* |
3664 | 3.32k | && |
3665 | 3.32k | (b = dotted_name_rule(p)) // dotted_name |
3666 | 2.06k | && |
3667 | 2.06k | (_keyword_1 = _PyPegen_expect_token(p, 643)) // token='import' |
3668 | 2.02k | && |
3669 | 2.02k | (c = import_from_targets_rule(p)) // import_from_targets |
3670 | 3.33k | ) |
3671 | 1.98k | { |
3672 | 1.98k | D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets")); |
3673 | 1.98k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3674 | 1.98k | if (_token == NULL) { |
3675 | 0 | p->level--; |
3676 | 0 | return NULL; |
3677 | 0 | } |
3678 | 1.98k | int _end_lineno = _token->end_lineno; |
3679 | 1.98k | UNUSED(_end_lineno); // Only used by EXTRA macro |
3680 | 1.98k | int _end_col_offset = _token->end_col_offset; |
3681 | 1.98k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3682 | 1.98k | _res = _PyPegen_checked_future_import ( p , b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA ); |
3683 | 1.98k | if (_res == NULL && PyErr_Occurred()) { |
3684 | 0 | p->error_indicator = 1; |
3685 | 0 | p->level--; |
3686 | 0 | return NULL; |
3687 | 0 | } |
3688 | 1.98k | goto done; |
3689 | 1.98k | } |
3690 | 1.34k | p->mark = _mark; |
3691 | 1.34k | D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ', |
3692 | 1.34k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets")); |
3693 | 1.34k | } |
3694 | 0 | { // 'from' (('.' | '...'))+ 'import' import_from_targets |
3695 | 1.34k | if (p->error_indicator) { |
3696 | 24 | p->level--; |
3697 | 24 | return NULL; |
3698 | 24 | } |
3699 | 1.31k | D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
3700 | 1.31k | Token * _keyword; |
3701 | 1.31k | Token * _keyword_1; |
3702 | 1.31k | asdl_seq * a; |
3703 | 1.31k | asdl_alias_seq* b; |
3704 | 1.31k | if ( |
3705 | 1.31k | (_keyword = _PyPegen_expect_token(p, 642)) // token='from' |
3706 | 1.30k | && |
3707 | 1.30k | (a = _loop1_18_rule(p)) // (('.' | '...'))+ |
3708 | 1.24k | && |
3709 | 1.24k | (_keyword_1 = _PyPegen_expect_token(p, 643)) // token='import' |
3710 | 1.18k | && |
3711 | 1.18k | (b = import_from_targets_rule(p)) // import_from_targets |
3712 | 1.31k | ) |
3713 | 1.14k | { |
3714 | 1.14k | D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
3715 | 1.14k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3716 | 1.14k | if (_token == NULL) { |
3717 | 0 | p->level--; |
3718 | 0 | return NULL; |
3719 | 0 | } |
3720 | 1.14k | int _end_lineno = _token->end_lineno; |
3721 | 1.14k | UNUSED(_end_lineno); // Only used by EXTRA macro |
3722 | 1.14k | int _end_col_offset = _token->end_col_offset; |
3723 | 1.14k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3724 | 1.14k | _res = _PyAST_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA ); |
3725 | 1.14k | if (_res == NULL && PyErr_Occurred()) { |
3726 | 0 | p->error_indicator = 1; |
3727 | 0 | p->level--; |
3728 | 0 | return NULL; |
3729 | 0 | } |
3730 | 1.14k | goto done; |
3731 | 1.14k | } |
3732 | 179 | p->mark = _mark; |
3733 | 179 | D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ', |
3734 | 179 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
3735 | 179 | } |
3736 | 179 | _res = NULL; |
3737 | 3.30k | done: |
3738 | 3.30k | p->level--; |
3739 | 3.30k | return _res; |
3740 | 179 | } |
3741 | | |
3742 | | // import_from_targets: |
3743 | | // | '(' import_from_as_names ','? ')' |
3744 | | // | import_from_as_names !',' |
3745 | | // | '*' |
3746 | | // | invalid_import_from_targets |
3747 | | static asdl_alias_seq* |
3748 | | import_from_targets_rule(Parser *p) |
3749 | 3.20k | { |
3750 | 3.20k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3751 | 0 | _Pypegen_stack_overflow(p); |
3752 | 0 | } |
3753 | 3.20k | if (p->error_indicator) { |
3754 | 0 | p->level--; |
3755 | 0 | return NULL; |
3756 | 0 | } |
3757 | 3.20k | asdl_alias_seq* _res = NULL; |
3758 | 3.20k | int _mark = p->mark; |
3759 | 3.20k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3760 | 2 | p->error_indicator = 1; |
3761 | 2 | p->level--; |
3762 | 2 | return NULL; |
3763 | 2 | } |
3764 | 3.20k | int _start_lineno = p->tokens[_mark]->lineno; |
3765 | 3.20k | UNUSED(_start_lineno); // Only used by EXTRA macro |
3766 | 3.20k | int _start_col_offset = p->tokens[_mark]->col_offset; |
3767 | 3.20k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3768 | 3.20k | { // '(' import_from_as_names ','? ')' |
3769 | 3.20k | if (p->error_indicator) { |
3770 | 0 | p->level--; |
3771 | 0 | return NULL; |
3772 | 0 | } |
3773 | 3.20k | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
3774 | 3.20k | Token * _literal; |
3775 | 3.20k | Token * _literal_1; |
3776 | 3.20k | void *_opt_var; |
3777 | 3.20k | UNUSED(_opt_var); // Silence compiler warnings |
3778 | 3.20k | asdl_alias_seq* a; |
3779 | 3.20k | if ( |
3780 | 3.20k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
3781 | 81 | && |
3782 | 81 | (a = import_from_as_names_rule(p)) // import_from_as_names |
3783 | 74 | && |
3784 | 74 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
3785 | 73 | && |
3786 | 73 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
3787 | 3.20k | ) |
3788 | 66 | { |
3789 | 66 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
3790 | 66 | _res = a; |
3791 | 66 | if (_res == NULL && PyErr_Occurred()) { |
3792 | 0 | p->error_indicator = 1; |
3793 | 0 | p->level--; |
3794 | 0 | return NULL; |
3795 | 0 | } |
3796 | 66 | goto done; |
3797 | 66 | } |
3798 | 3.13k | p->mark = _mark; |
3799 | 3.13k | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
3800 | 3.13k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
3801 | 3.13k | } |
3802 | 0 | { // import_from_as_names !',' |
3803 | 3.13k | if (p->error_indicator) { |
3804 | 4 | p->level--; |
3805 | 4 | return NULL; |
3806 | 4 | } |
3807 | 3.13k | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','")); |
3808 | 3.13k | asdl_alias_seq* import_from_as_names_var; |
3809 | 3.13k | if ( |
3810 | 3.13k | (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names |
3811 | 2.49k | && |
3812 | 2.49k | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
3813 | 3.13k | ) |
3814 | 2.45k | { |
3815 | 2.45k | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','")); |
3816 | 2.45k | _res = import_from_as_names_var; |
3817 | 2.45k | goto done; |
3818 | 2.45k | } |
3819 | 677 | p->mark = _mark; |
3820 | 677 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
3821 | 677 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','")); |
3822 | 677 | } |
3823 | 0 | { // '*' |
3824 | 677 | if (p->error_indicator) { |
3825 | 2 | p->level--; |
3826 | 2 | return NULL; |
3827 | 2 | } |
3828 | 675 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); |
3829 | 675 | Token * _literal; |
3830 | 675 | if ( |
3831 | 675 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
3832 | 675 | ) |
3833 | 608 | { |
3834 | 608 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); |
3835 | 608 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3836 | 608 | if (_token == NULL) { |
3837 | 0 | p->level--; |
3838 | 0 | return NULL; |
3839 | 0 | } |
3840 | 608 | int _end_lineno = _token->end_lineno; |
3841 | 608 | UNUSED(_end_lineno); // Only used by EXTRA macro |
3842 | 608 | int _end_col_offset = _token->end_col_offset; |
3843 | 608 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3844 | 608 | _res = ( asdl_alias_seq* ) _PyPegen_singleton_seq ( p , CHECK ( alias_ty , _PyPegen_alias_for_star ( p , EXTRA ) ) ); |
3845 | 608 | if (_res == NULL && PyErr_Occurred()) { |
3846 | 0 | p->error_indicator = 1; |
3847 | 0 | p->level--; |
3848 | 0 | return NULL; |
3849 | 0 | } |
3850 | 608 | goto done; |
3851 | 608 | } |
3852 | 67 | p->mark = _mark; |
3853 | 67 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
3854 | 67 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); |
3855 | 67 | } |
3856 | 67 | if (p->call_invalid_rules) { // invalid_import_from_targets |
3857 | 33 | if (p->error_indicator) { |
3858 | 0 | p->level--; |
3859 | 0 | return NULL; |
3860 | 0 | } |
3861 | 33 | D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets")); |
3862 | 33 | void *invalid_import_from_targets_var; |
3863 | 33 | if ( |
3864 | 33 | (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets |
3865 | 33 | ) |
3866 | 0 | { |
3867 | 0 | D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets")); |
3868 | 0 | _res = invalid_import_from_targets_var; |
3869 | 0 | goto done; |
3870 | 0 | } |
3871 | 33 | p->mark = _mark; |
3872 | 33 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
3873 | 33 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets")); |
3874 | 33 | } |
3875 | 67 | _res = NULL; |
3876 | 3.19k | done: |
3877 | 3.19k | p->level--; |
3878 | 3.19k | return _res; |
3879 | 67 | } |
3880 | | |
3881 | | // import_from_as_names: ','.import_from_as_name+ |
3882 | | static asdl_alias_seq* |
3883 | | import_from_as_names_rule(Parser *p) |
3884 | 3.24k | { |
3885 | 3.24k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3886 | 0 | _Pypegen_stack_overflow(p); |
3887 | 0 | } |
3888 | 3.24k | if (p->error_indicator) { |
3889 | 0 | p->level--; |
3890 | 0 | return NULL; |
3891 | 0 | } |
3892 | 3.24k | asdl_alias_seq* _res = NULL; |
3893 | 3.24k | int _mark = p->mark; |
3894 | 3.24k | { // ','.import_from_as_name+ |
3895 | 3.24k | if (p->error_indicator) { |
3896 | 0 | p->level--; |
3897 | 0 | return NULL; |
3898 | 0 | } |
3899 | 3.24k | D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+")); |
3900 | 3.24k | asdl_alias_seq* a; |
3901 | 3.24k | if ( |
3902 | 3.24k | (a = (asdl_alias_seq*)_gather_20_rule(p)) // ','.import_from_as_name+ |
3903 | 3.24k | ) |
3904 | 2.58k | { |
3905 | 2.58k | D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+")); |
3906 | 2.58k | _res = a; |
3907 | 2.58k | if (_res == NULL && PyErr_Occurred()) { |
3908 | 0 | p->error_indicator = 1; |
3909 | 0 | p->level--; |
3910 | 0 | return NULL; |
3911 | 0 | } |
3912 | 2.58k | goto done; |
3913 | 2.58k | } |
3914 | 656 | p->mark = _mark; |
3915 | 656 | D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ', |
3916 | 656 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+")); |
3917 | 656 | } |
3918 | 656 | _res = NULL; |
3919 | 3.24k | done: |
3920 | 3.24k | p->level--; |
3921 | 3.24k | return _res; |
3922 | 656 | } |
3923 | | |
3924 | | // import_from_as_name: invalid_import_from_as_name | NAME ['as' NAME] |
3925 | | static alias_ty |
3926 | | import_from_as_name_rule(Parser *p) |
3927 | 6.09k | { |
3928 | 6.09k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
3929 | 0 | _Pypegen_stack_overflow(p); |
3930 | 0 | } |
3931 | 6.09k | if (p->error_indicator) { |
3932 | 0 | p->level--; |
3933 | 0 | return NULL; |
3934 | 0 | } |
3935 | 6.09k | alias_ty _res = NULL; |
3936 | 6.09k | int _mark = p->mark; |
3937 | 6.09k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
3938 | 3 | p->error_indicator = 1; |
3939 | 3 | p->level--; |
3940 | 3 | return NULL; |
3941 | 3 | } |
3942 | 6.09k | int _start_lineno = p->tokens[_mark]->lineno; |
3943 | 6.09k | UNUSED(_start_lineno); // Only used by EXTRA macro |
3944 | 6.09k | int _start_col_offset = p->tokens[_mark]->col_offset; |
3945 | 6.09k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
3946 | 6.09k | if (p->call_invalid_rules) { // invalid_import_from_as_name |
3947 | 2.34k | if (p->error_indicator) { |
3948 | 0 | p->level--; |
3949 | 0 | return NULL; |
3950 | 0 | } |
3951 | 2.34k | D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_as_name")); |
3952 | 2.34k | void *invalid_import_from_as_name_var; |
3953 | 2.34k | if ( |
3954 | 2.34k | (invalid_import_from_as_name_var = invalid_import_from_as_name_rule(p)) // invalid_import_from_as_name |
3955 | 2.34k | ) |
3956 | 0 | { |
3957 | 0 | D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_as_name")); |
3958 | 0 | _res = invalid_import_from_as_name_var; |
3959 | 0 | goto done; |
3960 | 0 | } |
3961 | 2.34k | p->mark = _mark; |
3962 | 2.34k | D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
3963 | 2.34k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_as_name")); |
3964 | 2.34k | } |
3965 | 6.09k | { // NAME ['as' NAME] |
3966 | 6.09k | if (p->error_indicator) { |
3967 | 2 | p->level--; |
3968 | 2 | return NULL; |
3969 | 2 | } |
3970 | 6.09k | D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]")); |
3971 | 6.09k | expr_ty a; |
3972 | 6.09k | void *b; |
3973 | 6.09k | if ( |
3974 | 6.09k | (a = _PyPegen_name_token(p)) // NAME |
3975 | 5.37k | && |
3976 | 5.37k | (b = _tmp_21_rule(p), !p->error_indicator) // ['as' NAME] |
3977 | 6.09k | ) |
3978 | 5.37k | { |
3979 | 5.37k | D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]")); |
3980 | 5.37k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
3981 | 5.37k | if (_token == NULL) { |
3982 | 0 | p->level--; |
3983 | 0 | return NULL; |
3984 | 0 | } |
3985 | 5.37k | int _end_lineno = _token->end_lineno; |
3986 | 5.37k | UNUSED(_end_lineno); // Only used by EXTRA macro |
3987 | 5.37k | int _end_col_offset = _token->end_col_offset; |
3988 | 5.37k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
3989 | 5.37k | _res = _PyAST_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , EXTRA ); |
3990 | 5.37k | if (_res == NULL && PyErr_Occurred()) { |
3991 | 0 | p->error_indicator = 1; |
3992 | 0 | p->level--; |
3993 | 0 | return NULL; |
3994 | 0 | } |
3995 | 5.37k | goto done; |
3996 | 5.37k | } |
3997 | 721 | p->mark = _mark; |
3998 | 721 | D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
3999 | 721 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]")); |
4000 | 721 | } |
4001 | 721 | _res = NULL; |
4002 | 6.09k | done: |
4003 | 6.09k | p->level--; |
4004 | 6.09k | return _res; |
4005 | 721 | } |
4006 | | |
4007 | | // dotted_as_names: ','.dotted_as_name+ |
4008 | | static asdl_alias_seq* |
4009 | | dotted_as_names_rule(Parser *p) |
4010 | 2.97k | { |
4011 | 2.97k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
4012 | 0 | _Pypegen_stack_overflow(p); |
4013 | 0 | } |
4014 | 2.97k | if (p->error_indicator) { |
4015 | 0 | p->level--; |
4016 | 0 | return NULL; |
4017 | 0 | } |
4018 | 2.97k | asdl_alias_seq* _res = NULL; |
4019 | 2.97k | int _mark = p->mark; |
4020 | 2.97k | { // ','.dotted_as_name+ |
4021 | 2.97k | if (p->error_indicator) { |
4022 | 0 | p->level--; |
4023 | 0 | return NULL; |
4024 | 0 | } |
4025 | 2.97k | D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+")); |
4026 | 2.97k | asdl_alias_seq* a; |
4027 | 2.97k | if ( |
4028 | 2.97k | (a = (asdl_alias_seq*)_gather_23_rule(p)) // ','.dotted_as_name+ |
4029 | 2.97k | ) |
4030 | 2.93k | { |
4031 | 2.93k | D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+")); |
4032 | 2.93k | _res = a; |
4033 | 2.93k | if (_res == NULL && PyErr_Occurred()) { |
4034 | 0 | p->error_indicator = 1; |
4035 | 0 | p->level--; |
4036 | 0 | return NULL; |
4037 | 0 | } |
4038 | 2.93k | goto done; |
4039 | 2.93k | } |
4040 | 40 | p->mark = _mark; |
4041 | 40 | D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ', |
4042 | 40 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+")); |
4043 | 40 | } |
4044 | 40 | _res = NULL; |
4045 | 2.97k | done: |
4046 | 2.97k | p->level--; |
4047 | 2.97k | return _res; |
4048 | 40 | } |
4049 | | |
4050 | | // dotted_as_name: invalid_dotted_as_name | dotted_name ['as' NAME] |
4051 | | static alias_ty |
4052 | | dotted_as_name_rule(Parser *p) |
4053 | 10.2k | { |
4054 | 10.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
4055 | 0 | _Pypegen_stack_overflow(p); |
4056 | 0 | } |
4057 | 10.2k | if (p->error_indicator) { |
4058 | 0 | p->level--; |
4059 | 0 | return NULL; |
4060 | 0 | } |
4061 | 10.2k | alias_ty _res = NULL; |
4062 | 10.2k | int _mark = p->mark; |
4063 | 10.2k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
4064 | 1 | p->error_indicator = 1; |
4065 | 1 | p->level--; |
4066 | 1 | return NULL; |
4067 | 1 | } |
4068 | 10.1k | int _start_lineno = p->tokens[_mark]->lineno; |
4069 | 10.1k | UNUSED(_start_lineno); // Only used by EXTRA macro |
4070 | 10.1k | int _start_col_offset = p->tokens[_mark]->col_offset; |
4071 | 10.1k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
4072 | 10.1k | if (p->call_invalid_rules) { // invalid_dotted_as_name |
4073 | 2.89k | if (p->error_indicator) { |
4074 | 0 | p->level--; |
4075 | 0 | return NULL; |
4076 | 0 | } |
4077 | 2.89k | D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dotted_as_name")); |
4078 | 2.89k | void *invalid_dotted_as_name_var; |
4079 | 2.89k | if ( |
4080 | 2.89k | (invalid_dotted_as_name_var = invalid_dotted_as_name_rule(p)) // invalid_dotted_as_name |
4081 | 2.89k | ) |
4082 | 0 | { |
4083 | 0 | D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dotted_as_name")); |
4084 | 0 | _res = invalid_dotted_as_name_var; |
4085 | 0 | goto done; |
4086 | 0 | } |
4087 | 2.89k | p->mark = _mark; |
4088 | 2.89k | D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
4089 | 2.89k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dotted_as_name")); |
4090 | 2.89k | } |
4091 | 10.1k | { // dotted_name ['as' NAME] |
4092 | 10.1k | if (p->error_indicator) { |
4093 | 30 | p->level--; |
4094 | 30 | return NULL; |
4095 | 30 | } |
4096 | 10.1k | D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]")); |
4097 | 10.1k | expr_ty a; |
4098 | 10.1k | void *b; |
4099 | 10.1k | if ( |
4100 | 10.1k | (a = dotted_name_rule(p)) // dotted_name |
4101 | 10.1k | && |
4102 | 10.1k | (b = _tmp_21_rule(p), !p->error_indicator) // ['as' NAME] |
4103 | 10.1k | ) |
4104 | 10.0k | { |
4105 | 10.0k | D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]")); |
4106 | 10.0k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4107 | 10.0k | if (_token == NULL) { |
4108 | 0 | p->level--; |
4109 | 0 | return NULL; |
4110 | 0 | } |
4111 | 10.0k | int _end_lineno = _token->end_lineno; |
4112 | 10.0k | UNUSED(_end_lineno); // Only used by EXTRA macro |
4113 | 10.0k | int _end_col_offset = _token->end_col_offset; |
4114 | 10.0k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4115 | 10.0k | _res = _PyAST_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , EXTRA ); |
4116 | 10.0k | if (_res == NULL && PyErr_Occurred()) { |
4117 | 0 | p->error_indicator = 1; |
4118 | 0 | p->level--; |
4119 | 0 | return NULL; |
4120 | 0 | } |
4121 | 10.0k | goto done; |
4122 | 10.0k | } |
4123 | 70 | p->mark = _mark; |
4124 | 70 | D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
4125 | 70 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]")); |
4126 | 70 | } |
4127 | 70 | _res = NULL; |
4128 | 10.1k | done: |
4129 | 10.1k | p->level--; |
4130 | 10.1k | return _res; |
4131 | 70 | } |
4132 | | |
4133 | | // Left-recursive |
4134 | | // dotted_name: dotted_name '.' NAME | NAME |
4135 | | static expr_ty dotted_name_raw(Parser *); |
4136 | | static expr_ty |
4137 | | dotted_name_rule(Parser *p) |
4138 | 46.0k | { |
4139 | 46.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
4140 | 0 | _Pypegen_stack_overflow(p); |
4141 | 0 | } |
4142 | 46.0k | expr_ty _res = NULL; |
4143 | 46.0k | if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) { |
4144 | 32.5k | p->level--; |
4145 | 32.5k | return _res; |
4146 | 32.5k | } |
4147 | 13.5k | int _mark = p->mark; |
4148 | 13.5k | int _resmark = p->mark; |
4149 | 27.0k | while (1) { |
4150 | 27.0k | int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res); |
4151 | 27.0k | if (tmpvar_0) { |
4152 | 0 | p->level--; |
4153 | 0 | return _res; |
4154 | 0 | } |
4155 | 27.0k | p->mark = _mark; |
4156 | 27.0k | void *_raw = dotted_name_raw(p); |
4157 | 27.0k | if (p->error_indicator) { |
4158 | 10 | p->level--; |
4159 | 10 | return NULL; |
4160 | 10 | } |
4161 | 27.0k | if (_raw == NULL || p->mark <= _resmark) |
4162 | 13.5k | break; |
4163 | 13.5k | _resmark = p->mark; |
4164 | 13.5k | _res = _raw; |
4165 | 13.5k | } |
4166 | 13.5k | p->mark = _resmark; |
4167 | 13.5k | p->level--; |
4168 | 13.5k | return _res; |
4169 | 13.5k | } |
4170 | | static expr_ty |
4171 | | dotted_name_raw(Parser *p) |
4172 | 27.0k | { |
4173 | 27.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
4174 | 0 | _Pypegen_stack_overflow(p); |
4175 | 0 | } |
4176 | 27.0k | if (p->error_indicator) { |
4177 | 7 | p->level--; |
4178 | 7 | return NULL; |
4179 | 7 | } |
4180 | 27.0k | expr_ty _res = NULL; |
4181 | 27.0k | int _mark = p->mark; |
4182 | 27.0k | { // dotted_name '.' NAME |
4183 | 27.0k | if (p->error_indicator) { |
4184 | 0 | p->level--; |
4185 | 0 | return NULL; |
4186 | 0 | } |
4187 | 27.0k | D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME")); |
4188 | 27.0k | Token * _literal; |
4189 | 27.0k | expr_ty a; |
4190 | 27.0k | expr_ty b; |
4191 | 27.0k | if ( |
4192 | 27.0k | (a = dotted_name_rule(p)) // dotted_name |
4193 | 13.5k | && |
4194 | 13.5k | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
4195 | 1.33k | && |
4196 | 1.33k | (b = _PyPegen_name_token(p)) // NAME |
4197 | 27.0k | ) |
4198 | 1.31k | { |
4199 | 1.31k | D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME")); |
4200 | 1.31k | _res = _PyPegen_join_names_with_dot ( p , a , b ); |
4201 | 1.31k | if (_res == NULL && PyErr_Occurred()) { |
4202 | 0 | p->error_indicator = 1; |
4203 | 0 | p->level--; |
4204 | 0 | return NULL; |
4205 | 0 | } |
4206 | 1.31k | goto done; |
4207 | 1.31k | } |
4208 | 25.7k | p->mark = _mark; |
4209 | 25.7k | D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ', |
4210 | 25.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME")); |
4211 | 25.7k | } |
4212 | 0 | { // NAME |
4213 | 25.7k | if (p->error_indicator) { |
4214 | 3 | p->level--; |
4215 | 3 | return NULL; |
4216 | 3 | } |
4217 | 25.7k | D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
4218 | 25.7k | expr_ty name_var; |
4219 | 25.7k | if ( |
4220 | 25.7k | (name_var = _PyPegen_name_token(p)) // NAME |
4221 | 25.7k | ) |
4222 | 24.4k | { |
4223 | 24.4k | D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
4224 | 24.4k | _res = name_var; |
4225 | 24.4k | goto done; |
4226 | 24.4k | } |
4227 | 1.31k | p->mark = _mark; |
4228 | 1.31k | D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ', |
4229 | 1.31k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
4230 | 1.31k | } |
4231 | 1.31k | _res = NULL; |
4232 | 27.0k | done: |
4233 | 27.0k | p->level--; |
4234 | 27.0k | return _res; |
4235 | 1.31k | } |
4236 | | |
4237 | | // block: NEWLINE INDENT statements DEDENT | simple_stmts | invalid_block |
4238 | | static asdl_stmt_seq* |
4239 | | block_rule(Parser *p) |
4240 | 85.6k | { |
4241 | 85.6k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
4242 | 0 | _Pypegen_stack_overflow(p); |
4243 | 0 | } |
4244 | 85.6k | if (p->error_indicator) { |
4245 | 0 | p->level--; |
4246 | 0 | return NULL; |
4247 | 0 | } |
4248 | 85.6k | asdl_stmt_seq* _res = NULL; |
4249 | 85.6k | if (_PyPegen_is_memoized(p, block_type, &_res)) { |
4250 | 27.3k | p->level--; |
4251 | 27.3k | return _res; |
4252 | 27.3k | } |
4253 | 58.2k | int _mark = p->mark; |
4254 | 58.2k | { // NEWLINE INDENT statements DEDENT |
4255 | 58.2k | if (p->error_indicator) { |
4256 | 0 | p->level--; |
4257 | 0 | return NULL; |
4258 | 0 | } |
4259 | 58.2k | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT")); |
4260 | 58.2k | asdl_stmt_seq* a; |
4261 | 58.2k | Token * dedent_var; |
4262 | 58.2k | Token * indent_var; |
4263 | 58.2k | Token * newline_var; |
4264 | 58.2k | if ( |
4265 | 58.2k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
4266 | 26.0k | && |
4267 | 26.0k | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
4268 | 25.9k | && |
4269 | 25.9k | (a = statements_rule(p)) // statements |
4270 | 25.4k | && |
4271 | 25.4k | (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' |
4272 | 58.2k | ) |
4273 | 25.3k | { |
4274 | 25.3k | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT")); |
4275 | 25.3k | _res = a; |
4276 | 25.3k | if (_res == NULL && PyErr_Occurred()) { |
4277 | 0 | p->error_indicator = 1; |
4278 | 0 | p->level--; |
4279 | 0 | return NULL; |
4280 | 0 | } |
4281 | 25.3k | goto done; |
4282 | 25.3k | } |
4283 | 32.8k | p->mark = _mark; |
4284 | 32.8k | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
4285 | 32.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT")); |
4286 | 32.8k | } |
4287 | 0 | { // simple_stmts |
4288 | 32.8k | if (p->error_indicator) { |
4289 | 142 | p->level--; |
4290 | 142 | return NULL; |
4291 | 142 | } |
4292 | 32.7k | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
4293 | 32.7k | asdl_stmt_seq* simple_stmts_var; |
4294 | 32.7k | if ( |
4295 | 32.7k | (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts |
4296 | 32.7k | ) |
4297 | 29.8k | { |
4298 | 29.8k | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts")); |
4299 | 29.8k | _res = simple_stmts_var; |
4300 | 29.8k | goto done; |
4301 | 29.8k | } |
4302 | 2.82k | p->mark = _mark; |
4303 | 2.82k | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
4304 | 2.82k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts")); |
4305 | 2.82k | } |
4306 | 2.82k | if (p->call_invalid_rules) { // invalid_block |
4307 | 2.26k | if (p->error_indicator) { |
4308 | 20 | p->level--; |
4309 | 20 | return NULL; |
4310 | 20 | } |
4311 | 2.24k | D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block")); |
4312 | 2.24k | void *invalid_block_var; |
4313 | 2.24k | if ( |
4314 | 2.24k | (invalid_block_var = invalid_block_rule(p)) // invalid_block |
4315 | 2.24k | ) |
4316 | 0 | { |
4317 | 0 | D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block")); |
4318 | 0 | _res = invalid_block_var; |
4319 | 0 | goto done; |
4320 | 0 | } |
4321 | 2.24k | p->mark = _mark; |
4322 | 2.24k | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
4323 | 2.24k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block")); |
4324 | 2.24k | } |
4325 | 2.80k | _res = NULL; |
4326 | 58.0k | done: |
4327 | 58.0k | _PyPegen_insert_memo(p, _mark, block_type, _res); |
4328 | 58.0k | p->level--; |
4329 | 58.0k | return _res; |
4330 | 2.80k | } |
4331 | | |
4332 | | // decorators: (('@' named_expression NEWLINE))+ |
4333 | | static asdl_expr_seq* |
4334 | | decorators_rule(Parser *p) |
4335 | 19.3k | { |
4336 | 19.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
4337 | 0 | _Pypegen_stack_overflow(p); |
4338 | 0 | } |
4339 | 19.3k | if (p->error_indicator) { |
4340 | 0 | p->level--; |
4341 | 0 | return NULL; |
4342 | 0 | } |
4343 | 19.3k | asdl_expr_seq* _res = NULL; |
4344 | 19.3k | int _mark = p->mark; |
4345 | 19.3k | { // (('@' named_expression NEWLINE))+ |
4346 | 19.3k | if (p->error_indicator) { |
4347 | 0 | p->level--; |
4348 | 0 | return NULL; |
4349 | 0 | } |
4350 | 19.3k | D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); |
4351 | 19.3k | asdl_expr_seq* a; |
4352 | 19.3k | if ( |
4353 | 19.3k | (a = (asdl_expr_seq*)_loop1_24_rule(p)) // (('@' named_expression NEWLINE))+ |
4354 | 19.3k | ) |
4355 | 2.23k | { |
4356 | 2.23k | D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+")); |
4357 | 2.23k | _res = a; |
4358 | 2.23k | if (_res == NULL && PyErr_Occurred()) { |
4359 | 0 | p->error_indicator = 1; |
4360 | 0 | p->level--; |
4361 | 0 | return NULL; |
4362 | 0 | } |
4363 | 2.23k | goto done; |
4364 | 2.23k | } |
4365 | 17.0k | p->mark = _mark; |
4366 | 17.0k | D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ', |
4367 | 17.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+")); |
4368 | 17.0k | } |
4369 | 17.0k | _res = NULL; |
4370 | 19.3k | done: |
4371 | 19.3k | p->level--; |
4372 | 19.3k | return _res; |
4373 | 17.0k | } |
4374 | | |
4375 | | // class_def: decorators class_def_raw | class_def_raw |
4376 | | static stmt_ty |
4377 | | class_def_rule(Parser *p) |
4378 | 3.90k | { |
4379 | 3.90k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
4380 | 0 | _Pypegen_stack_overflow(p); |
4381 | 0 | } |
4382 | 3.90k | if (p->error_indicator) { |
4383 | 0 | p->level--; |
4384 | 0 | return NULL; |
4385 | 0 | } |
4386 | 3.90k | stmt_ty _res = NULL; |
4387 | 3.90k | int _mark = p->mark; |
4388 | 3.90k | { // decorators class_def_raw |
4389 | 3.90k | if (p->error_indicator) { |
4390 | 0 | p->level--; |
4391 | 0 | return NULL; |
4392 | 0 | } |
4393 | 3.90k | D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw")); |
4394 | 3.90k | asdl_expr_seq* a; |
4395 | 3.90k | stmt_ty b; |
4396 | 3.90k | if ( |
4397 | 3.90k | (a = decorators_rule(p)) // decorators |
4398 | 567 | && |
4399 | 567 | (b = class_def_raw_rule(p)) // class_def_raw |
4400 | 3.90k | ) |
4401 | 380 | { |
4402 | 380 | D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw")); |
4403 | 380 | _res = _PyPegen_class_def_decorators ( p , a , b ); |
4404 | 380 | if (_res == NULL && PyErr_Occurred()) { |
4405 | 0 | p->error_indicator = 1; |
4406 | 0 | p->level--; |
4407 | 0 | return NULL; |
4408 | 0 | } |
4409 | 380 | goto done; |
4410 | 380 | } |
4411 | 3.52k | p->mark = _mark; |
4412 | 3.52k | D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', |
4413 | 3.52k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw")); |
4414 | 3.52k | } |
4415 | 0 | { // class_def_raw |
4416 | 3.52k | if (p->error_indicator) { |
4417 | 3 | p->level--; |
4418 | 3 | return NULL; |
4419 | 3 | } |
4420 | 3.51k | D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw")); |
4421 | 3.51k | stmt_ty class_def_raw_var; |
4422 | 3.51k | if ( |
4423 | 3.51k | (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw |
4424 | 3.51k | ) |
4425 | 3.07k | { |
4426 | 3.07k | D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw")); |
4427 | 3.07k | _res = class_def_raw_var; |
4428 | 3.07k | goto done; |
4429 | 3.07k | } |
4430 | 441 | p->mark = _mark; |
4431 | 441 | D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', |
4432 | 441 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw")); |
4433 | 441 | } |
4434 | 441 | _res = NULL; |
4435 | 3.89k | done: |
4436 | 3.89k | p->level--; |
4437 | 3.89k | return _res; |
4438 | 441 | } |
4439 | | |
4440 | | // class_def_raw: |
4441 | | // | invalid_class_def_raw |
4442 | | // | 'class' NAME type_params? ['(' arguments? ')'] ':' block |
4443 | | static stmt_ty |
4444 | | class_def_raw_rule(Parser *p) |
4445 | 4.08k | { |
4446 | 4.08k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
4447 | 0 | _Pypegen_stack_overflow(p); |
4448 | 0 | } |
4449 | 4.08k | if (p->error_indicator) { |
4450 | 0 | p->level--; |
4451 | 0 | return NULL; |
4452 | 0 | } |
4453 | 4.08k | stmt_ty _res = NULL; |
4454 | 4.08k | int _mark = p->mark; |
4455 | 4.08k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
4456 | 0 | p->error_indicator = 1; |
4457 | 0 | p->level--; |
4458 | 0 | return NULL; |
4459 | 0 | } |
4460 | 4.08k | int _start_lineno = p->tokens[_mark]->lineno; |
4461 | 4.08k | UNUSED(_start_lineno); // Only used by EXTRA macro |
4462 | 4.08k | int _start_col_offset = p->tokens[_mark]->col_offset; |
4463 | 4.08k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
4464 | 4.08k | if (p->call_invalid_rules) { // invalid_class_def_raw |
4465 | 1.12k | if (p->error_indicator) { |
4466 | 0 | p->level--; |
4467 | 0 | return NULL; |
4468 | 0 | } |
4469 | 1.12k | D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_class_def_raw")); |
4470 | 1.12k | void *invalid_class_def_raw_var; |
4471 | 1.12k | if ( |
4472 | 1.12k | (invalid_class_def_raw_var = invalid_class_def_raw_rule(p)) // invalid_class_def_raw |
4473 | 1.12k | ) |
4474 | 0 | { |
4475 | 0 | D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_class_def_raw")); |
4476 | 0 | _res = invalid_class_def_raw_var; |
4477 | 0 | goto done; |
4478 | 0 | } |
4479 | 1.12k | p->mark = _mark; |
4480 | 1.12k | D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
4481 | 1.12k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_class_def_raw")); |
4482 | 1.12k | } |
4483 | 4.08k | { // 'class' NAME type_params? ['(' arguments? ')'] ':' block |
4484 | 4.08k | if (p->error_indicator) { |
4485 | 18 | p->level--; |
4486 | 18 | return NULL; |
4487 | 18 | } |
4488 | 4.06k | D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' block")); |
4489 | 4.06k | Token * _keyword; |
4490 | 4.06k | Token * _literal; |
4491 | 4.06k | expr_ty a; |
4492 | 4.06k | void *b; |
4493 | 4.06k | asdl_stmt_seq* c; |
4494 | 4.06k | void *t; |
4495 | 4.06k | if ( |
4496 | 4.06k | (_keyword = _PyPegen_expect_token(p, 710)) // token='class' |
4497 | 3.62k | && |
4498 | 3.62k | (a = _PyPegen_name_token(p)) // NAME |
4499 | 3.60k | && |
4500 | 3.60k | (t = type_params_rule(p), !p->error_indicator) // type_params? |
4501 | 3.60k | && |
4502 | 3.60k | (b = _tmp_25_rule(p), !p->error_indicator) // ['(' arguments? ')'] |
4503 | 3.60k | && |
4504 | 3.60k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
4505 | 3.54k | && |
4506 | 3.54k | (c = block_rule(p)) // block |
4507 | 4.06k | ) |
4508 | 3.45k | { |
4509 | 3.45k | D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' block")); |
4510 | 3.45k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4511 | 3.45k | if (_token == NULL) { |
4512 | 0 | p->level--; |
4513 | 0 | return NULL; |
4514 | 0 | } |
4515 | 3.45k | int _end_lineno = _token->end_lineno; |
4516 | 3.45k | UNUSED(_end_lineno); // Only used by EXTRA macro |
4517 | 3.45k | int _end_col_offset = _token->end_col_offset; |
4518 | 3.45k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4519 | 3.45k | _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 , t , EXTRA ); |
4520 | 3.45k | if (_res == NULL && PyErr_Occurred()) { |
4521 | 0 | p->error_indicator = 1; |
4522 | 0 | p->level--; |
4523 | 0 | return NULL; |
4524 | 0 | } |
4525 | 3.45k | goto done; |
4526 | 3.45k | } |
4527 | 610 | p->mark = _mark; |
4528 | 610 | D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
4529 | 610 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' block")); |
4530 | 610 | } |
4531 | 610 | _res = NULL; |
4532 | 4.06k | done: |
4533 | 4.06k | p->level--; |
4534 | 4.06k | return _res; |
4535 | 610 | } |
4536 | | |
4537 | | // function_def: decorators function_def_raw | function_def_raw |
4538 | | static stmt_ty |
4539 | | function_def_rule(Parser *p) |
4540 | 15.4k | { |
4541 | 15.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
4542 | 0 | _Pypegen_stack_overflow(p); |
4543 | 0 | } |
4544 | 15.4k | if (p->error_indicator) { |
4545 | 0 | p->level--; |
4546 | 0 | return NULL; |
4547 | 0 | } |
4548 | 15.4k | stmt_ty _res = NULL; |
4549 | 15.4k | int _mark = p->mark; |
4550 | 15.4k | { // decorators function_def_raw |
4551 | 15.4k | if (p->error_indicator) { |
4552 | 0 | p->level--; |
4553 | 0 | return NULL; |
4554 | 0 | } |
4555 | 15.4k | D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); |
4556 | 15.4k | asdl_expr_seq* d; |
4557 | 15.4k | stmt_ty f; |
4558 | 15.4k | if ( |
4559 | 15.4k | (d = decorators_rule(p)) // decorators |
4560 | 1.67k | && |
4561 | 1.67k | (f = function_def_raw_rule(p)) // function_def_raw |
4562 | 15.4k | ) |
4563 | 1.09k | { |
4564 | 1.09k | D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw")); |
4565 | 1.09k | _res = _PyPegen_function_def_decorators ( p , d , f ); |
4566 | 1.09k | if (_res == NULL && PyErr_Occurred()) { |
4567 | 0 | p->error_indicator = 1; |
4568 | 0 | p->level--; |
4569 | 0 | return NULL; |
4570 | 0 | } |
4571 | 1.09k | goto done; |
4572 | 1.09k | } |
4573 | 14.3k | p->mark = _mark; |
4574 | 14.3k | D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', |
4575 | 14.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw")); |
4576 | 14.3k | } |
4577 | 0 | { // function_def_raw |
4578 | 14.3k | if (p->error_indicator) { |
4579 | 30 | p->level--; |
4580 | 30 | return NULL; |
4581 | 30 | } |
4582 | 14.2k | D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw")); |
4583 | 14.2k | stmt_ty function_def_raw_var; |
4584 | 14.2k | if ( |
4585 | 14.2k | (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw |
4586 | 14.2k | ) |
4587 | 10.8k | { |
4588 | 10.8k | D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw")); |
4589 | 10.8k | _res = function_def_raw_var; |
4590 | 10.8k | goto done; |
4591 | 10.8k | } |
4592 | 3.39k | p->mark = _mark; |
4593 | 3.39k | D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', |
4594 | 3.39k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw")); |
4595 | 3.39k | } |
4596 | 3.39k | _res = NULL; |
4597 | 15.3k | done: |
4598 | 15.3k | p->level--; |
4599 | 15.3k | return _res; |
4600 | 3.39k | } |
4601 | | |
4602 | | // function_def_raw: |
4603 | | // | invalid_def_raw |
4604 | | // | 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block |
4605 | | // | 'async' 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block |
4606 | | static stmt_ty |
4607 | | function_def_raw_rule(Parser *p) |
4608 | 15.9k | { |
4609 | 15.9k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
4610 | 0 | _Pypegen_stack_overflow(p); |
4611 | 0 | } |
4612 | 15.9k | if (p->error_indicator) { |
4613 | 0 | p->level--; |
4614 | 0 | return NULL; |
4615 | 0 | } |
4616 | 15.9k | stmt_ty _res = NULL; |
4617 | 15.9k | int _mark = p->mark; |
4618 | 15.9k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
4619 | 0 | p->error_indicator = 1; |
4620 | 0 | p->level--; |
4621 | 0 | return NULL; |
4622 | 0 | } |
4623 | 15.9k | int _start_lineno = p->tokens[_mark]->lineno; |
4624 | 15.9k | UNUSED(_start_lineno); // Only used by EXTRA macro |
4625 | 15.9k | int _start_col_offset = p->tokens[_mark]->col_offset; |
4626 | 15.9k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
4627 | 15.9k | if (p->call_invalid_rules) { // invalid_def_raw |
4628 | 3.91k | if (p->error_indicator) { |
4629 | 0 | p->level--; |
4630 | 0 | return NULL; |
4631 | 0 | } |
4632 | 3.91k | D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_def_raw")); |
4633 | 3.91k | void *invalid_def_raw_var; |
4634 | 3.91k | if ( |
4635 | 3.91k | (invalid_def_raw_var = invalid_def_raw_rule(p)) // invalid_def_raw |
4636 | 3.91k | ) |
4637 | 2.20k | { |
4638 | 2.20k | D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_def_raw")); |
4639 | 2.20k | _res = invalid_def_raw_var; |
4640 | 2.20k | goto done; |
4641 | 2.20k | } |
4642 | 1.70k | p->mark = _mark; |
4643 | 1.70k | D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
4644 | 1.70k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_def_raw")); |
4645 | 1.70k | } |
4646 | 13.7k | { // 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block |
4647 | 13.7k | if (p->error_indicator) { |
4648 | 222 | p->level--; |
4649 | 222 | return NULL; |
4650 | 222 | } |
4651 | 13.5k | D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block")); |
4652 | 13.5k | Token * _keyword; |
4653 | 13.5k | Token * _literal; |
4654 | 13.5k | Token * _literal_1; |
4655 | 13.5k | Token * _literal_2; |
4656 | 13.5k | void *a; |
4657 | 13.5k | asdl_stmt_seq* b; |
4658 | 13.5k | expr_ty n; |
4659 | 13.5k | void *params; |
4660 | 13.5k | void *t; |
4661 | 13.5k | void *tc; |
4662 | 13.5k | if ( |
4663 | 13.5k | (_keyword = _PyPegen_expect_token(p, 708)) // token='def' |
4664 | 10.0k | && |
4665 | 10.0k | (n = _PyPegen_name_token(p)) // NAME |
4666 | 10.0k | && |
4667 | 10.0k | (t = type_params_rule(p), !p->error_indicator) // type_params? |
4668 | 10.0k | && |
4669 | 10.0k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
4670 | 9.96k | && |
4671 | 9.96k | (params = params_rule(p), !p->error_indicator) // params? |
4672 | 9.93k | && |
4673 | 9.93k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
4674 | 9.58k | && |
4675 | 9.58k | (a = _tmp_26_rule(p), !p->error_indicator) // ['->' expression] |
4676 | 9.58k | && |
4677 | 9.58k | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
4678 | 9.52k | && |
4679 | 9.52k | (tc = func_type_comment_rule(p), !p->error_indicator) // func_type_comment? |
4680 | 9.51k | && |
4681 | 9.51k | (b = block_rule(p)) // block |
4682 | 13.5k | ) |
4683 | 9.36k | { |
4684 | 9.36k | D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block")); |
4685 | 9.36k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4686 | 9.36k | if (_token == NULL) { |
4687 | 0 | p->level--; |
4688 | 0 | return NULL; |
4689 | 0 | } |
4690 | 9.36k | int _end_lineno = _token->end_lineno; |
4691 | 9.36k | UNUSED(_end_lineno); // Only used by EXTRA macro |
4692 | 9.36k | int _end_col_offset = _token->end_col_offset; |
4693 | 9.36k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4694 | 9.36k | _res = _PyAST_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , t , EXTRA ); |
4695 | 9.36k | if (_res == NULL && PyErr_Occurred()) { |
4696 | 0 | p->error_indicator = 1; |
4697 | 0 | p->level--; |
4698 | 0 | return NULL; |
4699 | 0 | } |
4700 | 9.36k | goto done; |
4701 | 9.36k | } |
4702 | 4.18k | p->mark = _mark; |
4703 | 4.18k | D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
4704 | 4.18k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block")); |
4705 | 4.18k | } |
4706 | 0 | { // 'async' 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block |
4707 | 4.18k | if (p->error_indicator) { |
4708 | 77 | p->level--; |
4709 | 77 | return NULL; |
4710 | 77 | } |
4711 | 4.10k | D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async' 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block")); |
4712 | 4.10k | Token * _keyword; |
4713 | 4.10k | Token * _keyword_1; |
4714 | 4.10k | Token * _literal; |
4715 | 4.10k | Token * _literal_1; |
4716 | 4.10k | Token * _literal_2; |
4717 | 4.10k | void *a; |
4718 | 4.10k | asdl_stmt_seq* b; |
4719 | 4.10k | expr_ty n; |
4720 | 4.10k | void *params; |
4721 | 4.10k | void *t; |
4722 | 4.10k | void *tc; |
4723 | 4.10k | if ( |
4724 | 4.10k | (_keyword = _PyPegen_expect_token(p, 707)) // token='async' |
4725 | 2.27k | && |
4726 | 2.27k | (_keyword_1 = _PyPegen_expect_token(p, 708)) // token='def' |
4727 | 465 | && |
4728 | 465 | (n = _PyPegen_name_token(p)) // NAME |
4729 | 460 | && |
4730 | 460 | (t = type_params_rule(p), !p->error_indicator) // type_params? |
4731 | 459 | && |
4732 | 459 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
4733 | 458 | && |
4734 | 458 | (params = params_rule(p), !p->error_indicator) // params? |
4735 | 457 | && |
4736 | 457 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
4737 | 454 | && |
4738 | 454 | (a = _tmp_26_rule(p), !p->error_indicator) // ['->' expression] |
4739 | 453 | && |
4740 | 453 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
4741 | 452 | && |
4742 | 452 | (tc = func_type_comment_rule(p), !p->error_indicator) // func_type_comment? |
4743 | 451 | && |
4744 | 451 | (b = block_rule(p)) // block |
4745 | 4.10k | ) |
4746 | 427 | { |
4747 | 427 | D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async' 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block")); |
4748 | 427 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
4749 | 427 | if (_token == NULL) { |
4750 | 0 | p->level--; |
4751 | 0 | return NULL; |
4752 | 0 | } |
4753 | 427 | int _end_lineno = _token->end_lineno; |
4754 | 427 | UNUSED(_end_lineno); // Only used by EXTRA macro |
4755 | 427 | int _end_col_offset = _token->end_col_offset; |
4756 | 427 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
4757 | 427 | _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 ) , t , EXTRA ) ); |
4758 | 427 | if (_res == NULL && PyErr_Occurred()) { |
4759 | 0 | p->error_indicator = 1; |
4760 | 0 | p->level--; |
4761 | 0 | return NULL; |
4762 | 0 | } |
4763 | 427 | goto done; |
4764 | 427 | } |
4765 | 3.67k | p->mark = _mark; |
4766 | 3.67k | D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
4767 | 3.67k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async' 'def' NAME type_params? '(' params? ')' ['->' expression] ':' func_type_comment? block")); |
4768 | 3.67k | } |
4769 | 3.67k | _res = NULL; |
4770 | 15.6k | done: |
4771 | 15.6k | p->level--; |
4772 | 15.6k | return _res; |
4773 | 3.67k | } |
4774 | | |
4775 | | // params: invalid_parameters | parameters |
4776 | | static arguments_ty |
4777 | | params_rule(Parser *p) |
4778 | 15.4k | { |
4779 | 15.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
4780 | 0 | _Pypegen_stack_overflow(p); |
4781 | 0 | } |
4782 | 15.4k | if (p->error_indicator) { |
4783 | 0 | p->level--; |
4784 | 0 | return NULL; |
4785 | 0 | } |
4786 | 15.4k | arguments_ty _res = NULL; |
4787 | 15.4k | int _mark = p->mark; |
4788 | 15.4k | if (p->call_invalid_rules) { // invalid_parameters |
4789 | 5.28k | if (p->error_indicator) { |
4790 | 0 | p->level--; |
4791 | 0 | return NULL; |
4792 | 0 | } |
4793 | 5.28k | D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters")); |
4794 | 5.28k | void *invalid_parameters_var; |
4795 | 5.28k | if ( |
4796 | 5.28k | (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters |
4797 | 5.28k | ) |
4798 | 0 | { |
4799 | 0 | D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters")); |
4800 | 0 | _res = invalid_parameters_var; |
4801 | 0 | goto done; |
4802 | 0 | } |
4803 | 5.28k | p->mark = _mark; |
4804 | 5.28k | D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', |
4805 | 5.28k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters")); |
4806 | 5.28k | } |
4807 | 15.4k | { // parameters |
4808 | 15.4k | if (p->error_indicator) { |
4809 | 29 | p->level--; |
4810 | 29 | return NULL; |
4811 | 29 | } |
4812 | 15.4k | D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters")); |
4813 | 15.4k | arguments_ty parameters_var; |
4814 | 15.4k | if ( |
4815 | 15.4k | (parameters_var = parameters_rule(p)) // parameters |
4816 | 15.4k | ) |
4817 | 12.7k | { |
4818 | 12.7k | D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters")); |
4819 | 12.7k | _res = parameters_var; |
4820 | 12.7k | goto done; |
4821 | 12.7k | } |
4822 | 2.68k | p->mark = _mark; |
4823 | 2.68k | D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', |
4824 | 2.68k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters")); |
4825 | 2.68k | } |
4826 | 2.68k | _res = NULL; |
4827 | 15.4k | done: |
4828 | 15.4k | p->level--; |
4829 | 15.4k | return _res; |
4830 | 2.68k | } |
4831 | | |
4832 | | // parameters: |
4833 | | // | slash_no_default param_no_default* param_with_default* star_etc? |
4834 | | // | slash_with_default param_with_default* star_etc? |
4835 | | // | param_no_default+ param_with_default* star_etc? |
4836 | | // | param_with_default+ star_etc? |
4837 | | // | star_etc |
4838 | | static arguments_ty |
4839 | | parameters_rule(Parser *p) |
4840 | 15.4k | { |
4841 | 15.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
4842 | 0 | _Pypegen_stack_overflow(p); |
4843 | 0 | } |
4844 | 15.4k | if (p->error_indicator) { |
4845 | 0 | p->level--; |
4846 | 0 | return NULL; |
4847 | 0 | } |
4848 | 15.4k | arguments_ty _res = NULL; |
4849 | 15.4k | int _mark = p->mark; |
4850 | 15.4k | { // slash_no_default param_no_default* param_with_default* star_etc? |
4851 | 15.4k | if (p->error_indicator) { |
4852 | 0 | p->level--; |
4853 | 0 | return NULL; |
4854 | 0 | } |
4855 | 15.4k | 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?")); |
4856 | 15.4k | asdl_arg_seq* a; |
4857 | 15.4k | asdl_arg_seq* b; |
4858 | 15.4k | asdl_seq * c; |
4859 | 15.4k | void *d; |
4860 | 15.4k | if ( |
4861 | 15.4k | (a = slash_no_default_rule(p)) // slash_no_default |
4862 | 683 | && |
4863 | 683 | (b = (asdl_arg_seq*)_loop0_27_rule(p)) // param_no_default* |
4864 | 683 | && |
4865 | 683 | (c = _loop0_28_rule(p)) // param_with_default* |
4866 | 681 | && |
4867 | 681 | (d = star_etc_rule(p), !p->error_indicator) // star_etc? |
4868 | 15.4k | ) |
4869 | 679 | { |
4870 | 679 | 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?")); |
4871 | 679 | _res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , a , NULL , b , c , d ) ); |
4872 | 679 | if (_res == NULL && PyErr_Occurred()) { |
4873 | 0 | p->error_indicator = 1; |
4874 | 0 | p->level--; |
4875 | 0 | return NULL; |
4876 | 0 | } |
4877 | 679 | goto done; |
4878 | 679 | } |
4879 | 14.7k | p->mark = _mark; |
4880 | 14.7k | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
4881 | 14.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?")); |
4882 | 14.7k | } |
4883 | 0 | { // slash_with_default param_with_default* star_etc? |
4884 | 14.7k | if (p->error_indicator) { |
4885 | 16 | p->level--; |
4886 | 16 | return NULL; |
4887 | 16 | } |
4888 | 14.7k | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?")); |
4889 | 14.7k | SlashWithDefault* a; |
4890 | 14.7k | asdl_seq * b; |
4891 | 14.7k | void *c; |
4892 | 14.7k | if ( |
4893 | 14.7k | (a = slash_with_default_rule(p)) // slash_with_default |
4894 | 869 | && |
4895 | 869 | (b = _loop0_28_rule(p)) // param_with_default* |
4896 | 869 | && |
4897 | 869 | (c = star_etc_rule(p), !p->error_indicator) // star_etc? |
4898 | 14.7k | ) |
4899 | 867 | { |
4900 | 867 | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?")); |
4901 | 867 | _res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ) ); |
4902 | 867 | if (_res == NULL && PyErr_Occurred()) { |
4903 | 0 | p->error_indicator = 1; |
4904 | 0 | p->level--; |
4905 | 0 | return NULL; |
4906 | 0 | } |
4907 | 867 | goto done; |
4908 | 867 | } |
4909 | 13.9k | p->mark = _mark; |
4910 | 13.9k | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
4911 | 13.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?")); |
4912 | 13.9k | } |
4913 | 0 | { // param_no_default+ param_with_default* star_etc? |
4914 | 13.9k | if (p->error_indicator) { |
4915 | 8 | p->level--; |
4916 | 8 | return NULL; |
4917 | 8 | } |
4918 | 13.8k | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); |
4919 | 13.8k | asdl_arg_seq* a; |
4920 | 13.8k | asdl_seq * b; |
4921 | 13.8k | void *c; |
4922 | 13.8k | if ( |
4923 | 13.8k | (a = (asdl_arg_seq*)_loop1_29_rule(p)) // param_no_default+ |
4924 | 6.81k | && |
4925 | 6.81k | (b = _loop0_28_rule(p)) // param_with_default* |
4926 | 6.81k | && |
4927 | 6.81k | (c = star_etc_rule(p), !p->error_indicator) // star_etc? |
4928 | 13.8k | ) |
4929 | 6.80k | { |
4930 | 6.80k | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); |
4931 | 6.80k | _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); |
4932 | 6.80k | if (_res == NULL && PyErr_Occurred()) { |
4933 | 0 | p->error_indicator = 1; |
4934 | 0 | p->level--; |
4935 | 0 | return NULL; |
4936 | 0 | } |
4937 | 6.80k | goto done; |
4938 | 6.80k | } |
4939 | 7.08k | p->mark = _mark; |
4940 | 7.08k | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
4941 | 7.08k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?")); |
4942 | 7.08k | } |
4943 | 0 | { // param_with_default+ star_etc? |
4944 | 7.08k | if (p->error_indicator) { |
4945 | 2 | p->level--; |
4946 | 2 | return NULL; |
4947 | 2 | } |
4948 | 7.08k | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?")); |
4949 | 7.08k | asdl_seq * a; |
4950 | 7.08k | void *b; |
4951 | 7.08k | if ( |
4952 | 7.08k | (a = _loop1_30_rule(p)) // param_with_default+ |
4953 | 1.11k | && |
4954 | 1.11k | (b = star_etc_rule(p), !p->error_indicator) // star_etc? |
4955 | 7.08k | ) |
4956 | 1.11k | { |
4957 | 1.11k | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?")); |
4958 | 1.11k | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); |
4959 | 1.11k | if (_res == NULL && PyErr_Occurred()) { |
4960 | 0 | p->error_indicator = 1; |
4961 | 0 | p->level--; |
4962 | 0 | return NULL; |
4963 | 0 | } |
4964 | 1.11k | goto done; |
4965 | 1.11k | } |
4966 | 5.96k | p->mark = _mark; |
4967 | 5.96k | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
4968 | 5.96k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?")); |
4969 | 5.96k | } |
4970 | 0 | { // star_etc |
4971 | 5.96k | if (p->error_indicator) { |
4972 | 1 | p->level--; |
4973 | 1 | return NULL; |
4974 | 1 | } |
4975 | 5.96k | D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc")); |
4976 | 5.96k | StarEtc* a; |
4977 | 5.96k | if ( |
4978 | 5.96k | (a = star_etc_rule(p)) // star_etc |
4979 | 5.96k | ) |
4980 | 3.31k | { |
4981 | 3.31k | D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc")); |
4982 | 3.31k | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); |
4983 | 3.31k | if (_res == NULL && PyErr_Occurred()) { |
4984 | 0 | p->error_indicator = 1; |
4985 | 0 | p->level--; |
4986 | 0 | return NULL; |
4987 | 0 | } |
4988 | 3.31k | goto done; |
4989 | 3.31k | } |
4990 | 2.65k | p->mark = _mark; |
4991 | 2.65k | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
4992 | 2.65k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc")); |
4993 | 2.65k | } |
4994 | 2.65k | _res = NULL; |
4995 | 15.4k | done: |
4996 | 15.4k | p->level--; |
4997 | 15.4k | return _res; |
4998 | 2.65k | } |
4999 | | |
5000 | | // slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')' |
5001 | | static asdl_arg_seq* |
5002 | | slash_no_default_rule(Parser *p) |
5003 | 31.2k | { |
5004 | 31.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5005 | 0 | _Pypegen_stack_overflow(p); |
5006 | 0 | } |
5007 | 31.2k | if (p->error_indicator) { |
5008 | 0 | p->level--; |
5009 | 0 | return NULL; |
5010 | 0 | } |
5011 | 31.2k | asdl_arg_seq* _res = NULL; |
5012 | 31.2k | int _mark = p->mark; |
5013 | 31.2k | { // param_no_default+ '/' ',' |
5014 | 31.2k | if (p->error_indicator) { |
5015 | 0 | p->level--; |
5016 | 0 | return NULL; |
5017 | 0 | } |
5018 | 31.2k | D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','")); |
5019 | 31.2k | Token * _literal; |
5020 | 31.2k | Token * _literal_1; |
5021 | 31.2k | asdl_arg_seq* a; |
5022 | 31.2k | if ( |
5023 | 31.2k | (a = (asdl_arg_seq*)_loop1_29_rule(p)) // param_no_default+ |
5024 | 10.9k | && |
5025 | 10.9k | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
5026 | 1.90k | && |
5027 | 1.90k | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
5028 | 31.2k | ) |
5029 | 451 | { |
5030 | 451 | D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','")); |
5031 | 451 | _res = a; |
5032 | 451 | if (_res == NULL && PyErr_Occurred()) { |
5033 | 0 | p->error_indicator = 1; |
5034 | 0 | p->level--; |
5035 | 0 | return NULL; |
5036 | 0 | } |
5037 | 451 | goto done; |
5038 | 451 | } |
5039 | 30.8k | p->mark = _mark; |
5040 | 30.8k | D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
5041 | 30.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','")); |
5042 | 30.8k | } |
5043 | 0 | { // param_no_default+ '/' &')' |
5044 | 30.8k | if (p->error_indicator) { |
5045 | 13 | p->level--; |
5046 | 13 | return NULL; |
5047 | 13 | } |
5048 | 30.8k | D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'")); |
5049 | 30.8k | Token * _literal; |
5050 | 30.8k | asdl_arg_seq* a; |
5051 | 30.8k | if ( |
5052 | 30.8k | (a = (asdl_arg_seq*)_loop1_29_rule(p)) // param_no_default+ |
5053 | 10.4k | && |
5054 | 10.4k | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
5055 | 1.44k | && |
5056 | 1.44k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
5057 | 30.8k | ) |
5058 | 1.43k | { |
5059 | 1.43k | D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'")); |
5060 | 1.43k | _res = a; |
5061 | 1.43k | if (_res == NULL && PyErr_Occurred()) { |
5062 | 0 | p->error_indicator = 1; |
5063 | 0 | p->level--; |
5064 | 0 | return NULL; |
5065 | 0 | } |
5066 | 1.43k | goto done; |
5067 | 1.43k | } |
5068 | 29.3k | p->mark = _mark; |
5069 | 29.3k | D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
5070 | 29.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'")); |
5071 | 29.3k | } |
5072 | 29.3k | _res = NULL; |
5073 | 31.2k | done: |
5074 | 31.2k | p->level--; |
5075 | 31.2k | return _res; |
5076 | 29.3k | } |
5077 | | |
5078 | | // slash_with_default: |
5079 | | // | param_no_default* param_with_default+ '/' ',' |
5080 | | // | param_no_default* param_with_default+ '/' &')' |
5081 | | static SlashWithDefault* |
5082 | | slash_with_default_rule(Parser *p) |
5083 | 29.7k | { |
5084 | 29.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5085 | 0 | _Pypegen_stack_overflow(p); |
5086 | 0 | } |
5087 | 29.7k | if (p->error_indicator) { |
5088 | 0 | p->level--; |
5089 | 0 | return NULL; |
5090 | 0 | } |
5091 | 29.7k | SlashWithDefault* _res = NULL; |
5092 | 29.7k | int _mark = p->mark; |
5093 | 29.7k | { // param_no_default* param_with_default+ '/' ',' |
5094 | 29.7k | if (p->error_indicator) { |
5095 | 0 | p->level--; |
5096 | 0 | return NULL; |
5097 | 0 | } |
5098 | 29.7k | D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); |
5099 | 29.7k | Token * _literal; |
5100 | 29.7k | Token * _literal_1; |
5101 | 29.7k | asdl_seq * a; |
5102 | 29.7k | asdl_seq * b; |
5103 | 29.7k | if ( |
5104 | 29.7k | (a = _loop0_27_rule(p)) // param_no_default* |
5105 | 29.7k | && |
5106 | 29.7k | (b = _loop1_30_rule(p)) // param_with_default+ |
5107 | 6.23k | && |
5108 | 6.23k | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
5109 | 2.36k | && |
5110 | 2.36k | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
5111 | 29.7k | ) |
5112 | 1.43k | { |
5113 | 1.43k | D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); |
5114 | 1.43k | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b ); |
5115 | 1.43k | if (_res == NULL && PyErr_Occurred()) { |
5116 | 0 | p->error_indicator = 1; |
5117 | 0 | p->level--; |
5118 | 0 | return NULL; |
5119 | 0 | } |
5120 | 1.43k | goto done; |
5121 | 1.43k | } |
5122 | 28.3k | p->mark = _mark; |
5123 | 28.3k | D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
5124 | 28.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','")); |
5125 | 28.3k | } |
5126 | 0 | { // param_no_default* param_with_default+ '/' &')' |
5127 | 28.3k | if (p->error_indicator) { |
5128 | 10 | p->level--; |
5129 | 10 | return NULL; |
5130 | 10 | } |
5131 | 28.3k | D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); |
5132 | 28.3k | Token * _literal; |
5133 | 28.3k | asdl_seq * a; |
5134 | 28.3k | asdl_seq * b; |
5135 | 28.3k | if ( |
5136 | 28.3k | (a = _loop0_27_rule(p)) // param_no_default* |
5137 | 28.3k | && |
5138 | 28.3k | (b = _loop1_30_rule(p)) // param_with_default+ |
5139 | 4.80k | && |
5140 | 4.80k | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
5141 | 929 | && |
5142 | 929 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
5143 | 28.3k | ) |
5144 | 885 | { |
5145 | 885 | D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); |
5146 | 885 | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b ); |
5147 | 885 | if (_res == NULL && PyErr_Occurred()) { |
5148 | 0 | p->error_indicator = 1; |
5149 | 0 | p->level--; |
5150 | 0 | return NULL; |
5151 | 0 | } |
5152 | 885 | goto done; |
5153 | 885 | } |
5154 | 27.4k | p->mark = _mark; |
5155 | 27.4k | D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
5156 | 27.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'")); |
5157 | 27.4k | } |
5158 | 27.4k | _res = NULL; |
5159 | 29.7k | done: |
5160 | 29.7k | p->level--; |
5161 | 29.7k | return _res; |
5162 | 27.4k | } |
5163 | | |
5164 | | // star_etc: |
5165 | | // | invalid_star_etc |
5166 | | // | '*' param_no_default param_maybe_default* kwds? |
5167 | | // | '*' param_no_default_star_annotation param_maybe_default* kwds? |
5168 | | // | '*' ',' param_maybe_default+ kwds? |
5169 | | // | kwds |
5170 | | static StarEtc* |
5171 | | star_etc_rule(Parser *p) |
5172 | 15.4k | { |
5173 | 15.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5174 | 0 | _Pypegen_stack_overflow(p); |
5175 | 0 | } |
5176 | 15.4k | if (p->error_indicator) { |
5177 | 2 | p->level--; |
5178 | 2 | return NULL; |
5179 | 2 | } |
5180 | 15.4k | StarEtc* _res = NULL; |
5181 | 15.4k | int _mark = p->mark; |
5182 | 15.4k | if (p->call_invalid_rules) { // invalid_star_etc |
5183 | 5.25k | if (p->error_indicator) { |
5184 | 0 | p->level--; |
5185 | 0 | return NULL; |
5186 | 0 | } |
5187 | 5.25k | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc")); |
5188 | 5.25k | void *invalid_star_etc_var; |
5189 | 5.25k | if ( |
5190 | 5.25k | (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc |
5191 | 5.25k | ) |
5192 | 0 | { |
5193 | 0 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc")); |
5194 | 0 | _res = invalid_star_etc_var; |
5195 | 0 | goto done; |
5196 | 0 | } |
5197 | 5.25k | p->mark = _mark; |
5198 | 5.25k | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
5199 | 5.25k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc")); |
5200 | 5.25k | } |
5201 | 15.4k | { // '*' param_no_default param_maybe_default* kwds? |
5202 | 15.4k | if (p->error_indicator) { |
5203 | 10 | p->level--; |
5204 | 10 | return NULL; |
5205 | 10 | } |
5206 | 15.4k | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); |
5207 | 15.4k | Token * _literal; |
5208 | 15.4k | arg_ty a; |
5209 | 15.4k | asdl_seq * b; |
5210 | 15.4k | void *c; |
5211 | 15.4k | if ( |
5212 | 15.4k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
5213 | 3.28k | && |
5214 | 3.28k | (a = param_no_default_rule(p)) // param_no_default |
5215 | 1.01k | && |
5216 | 1.01k | (b = _loop0_31_rule(p)) // param_maybe_default* |
5217 | 1.01k | && |
5218 | 1.01k | (c = kwds_rule(p), !p->error_indicator) // kwds? |
5219 | 15.4k | ) |
5220 | 1.01k | { |
5221 | 1.01k | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); |
5222 | 1.01k | _res = _PyPegen_star_etc ( p , a , b , c ); |
5223 | 1.01k | if (_res == NULL && PyErr_Occurred()) { |
5224 | 0 | p->error_indicator = 1; |
5225 | 0 | p->level--; |
5226 | 0 | return NULL; |
5227 | 0 | } |
5228 | 1.01k | goto done; |
5229 | 1.01k | } |
5230 | 14.4k | p->mark = _mark; |
5231 | 14.4k | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
5232 | 14.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?")); |
5233 | 14.4k | } |
5234 | 0 | { // '*' param_no_default_star_annotation param_maybe_default* kwds? |
5235 | 14.4k | if (p->error_indicator) { |
5236 | 6 | p->level--; |
5237 | 6 | return NULL; |
5238 | 6 | } |
5239 | 14.4k | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default_star_annotation param_maybe_default* kwds?")); |
5240 | 14.4k | Token * _literal; |
5241 | 14.4k | arg_ty a; |
5242 | 14.4k | asdl_seq * b; |
5243 | 14.4k | void *c; |
5244 | 14.4k | if ( |
5245 | 14.4k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
5246 | 2.26k | && |
5247 | 2.26k | (a = param_no_default_star_annotation_rule(p)) // param_no_default_star_annotation |
5248 | 892 | && |
5249 | 892 | (b = _loop0_31_rule(p)) // param_maybe_default* |
5250 | 892 | && |
5251 | 892 | (c = kwds_rule(p), !p->error_indicator) // kwds? |
5252 | 14.4k | ) |
5253 | 890 | { |
5254 | 890 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default_star_annotation param_maybe_default* kwds?")); |
5255 | 890 | _res = _PyPegen_star_etc ( p , a , b , c ); |
5256 | 890 | if (_res == NULL && PyErr_Occurred()) { |
5257 | 0 | p->error_indicator = 1; |
5258 | 0 | p->level--; |
5259 | 0 | return NULL; |
5260 | 0 | } |
5261 | 890 | goto done; |
5262 | 890 | } |
5263 | 13.5k | p->mark = _mark; |
5264 | 13.5k | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
5265 | 13.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default_star_annotation param_maybe_default* kwds?")); |
5266 | 13.5k | } |
5267 | 0 | { // '*' ',' param_maybe_default+ kwds? |
5268 | 13.5k | if (p->error_indicator) { |
5269 | 5 | p->level--; |
5270 | 5 | return NULL; |
5271 | 5 | } |
5272 | 13.5k | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
5273 | 13.5k | Token * _literal; |
5274 | 13.5k | Token * _literal_1; |
5275 | 13.5k | asdl_seq * b; |
5276 | 13.5k | void *c; |
5277 | 13.5k | if ( |
5278 | 13.5k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
5279 | 1.36k | && |
5280 | 1.36k | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
5281 | 1.30k | && |
5282 | 1.30k | (b = _loop1_32_rule(p)) // param_maybe_default+ |
5283 | 1.24k | && |
5284 | 1.24k | (c = kwds_rule(p), !p->error_indicator) // kwds? |
5285 | 13.5k | ) |
5286 | 1.24k | { |
5287 | 1.24k | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
5288 | 1.24k | _res = _PyPegen_star_etc ( p , NULL , b , c ); |
5289 | 1.24k | if (_res == NULL && PyErr_Occurred()) { |
5290 | 0 | p->error_indicator = 1; |
5291 | 0 | p->level--; |
5292 | 0 | return NULL; |
5293 | 0 | } |
5294 | 1.24k | goto done; |
5295 | 1.24k | } |
5296 | 12.2k | p->mark = _mark; |
5297 | 12.2k | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
5298 | 12.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
5299 | 12.2k | } |
5300 | 0 | { // kwds |
5301 | 12.2k | if (p->error_indicator) { |
5302 | 5 | p->level--; |
5303 | 5 | return NULL; |
5304 | 5 | } |
5305 | 12.2k | D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds")); |
5306 | 12.2k | arg_ty a; |
5307 | 12.2k | if ( |
5308 | 12.2k | (a = kwds_rule(p)) // kwds |
5309 | 12.2k | ) |
5310 | 726 | { |
5311 | 726 | D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds")); |
5312 | 726 | _res = _PyPegen_star_etc ( p , NULL , NULL , a ); |
5313 | 726 | if (_res == NULL && PyErr_Occurred()) { |
5314 | 0 | p->error_indicator = 1; |
5315 | 0 | p->level--; |
5316 | 0 | return NULL; |
5317 | 0 | } |
5318 | 726 | goto done; |
5319 | 726 | } |
5320 | 11.5k | p->mark = _mark; |
5321 | 11.5k | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
5322 | 11.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds")); |
5323 | 11.5k | } |
5324 | 11.5k | _res = NULL; |
5325 | 15.4k | done: |
5326 | 15.4k | p->level--; |
5327 | 15.4k | return _res; |
5328 | 11.5k | } |
5329 | | |
5330 | | // kwds: invalid_kwds | '**' param_no_default |
5331 | | static arg_ty |
5332 | | kwds_rule(Parser *p) |
5333 | 15.4k | { |
5334 | 15.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5335 | 0 | _Pypegen_stack_overflow(p); |
5336 | 0 | } |
5337 | 15.4k | if (p->error_indicator) { |
5338 | 3 | p->level--; |
5339 | 3 | return NULL; |
5340 | 3 | } |
5341 | 15.4k | arg_ty _res = NULL; |
5342 | 15.4k | int _mark = p->mark; |
5343 | 15.4k | if (p->call_invalid_rules) { // invalid_kwds |
5344 | 5.24k | if (p->error_indicator) { |
5345 | 0 | p->level--; |
5346 | 0 | return NULL; |
5347 | 0 | } |
5348 | 5.24k | D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwds")); |
5349 | 5.24k | void *invalid_kwds_var; |
5350 | 5.24k | if ( |
5351 | 5.24k | (invalid_kwds_var = invalid_kwds_rule(p)) // invalid_kwds |
5352 | 5.24k | ) |
5353 | 0 | { |
5354 | 0 | D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwds")); |
5355 | 0 | _res = invalid_kwds_var; |
5356 | 0 | goto done; |
5357 | 0 | } |
5358 | 5.24k | p->mark = _mark; |
5359 | 5.24k | D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ', |
5360 | 5.24k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwds")); |
5361 | 5.24k | } |
5362 | 15.4k | { // '**' param_no_default |
5363 | 15.4k | if (p->error_indicator) { |
5364 | 6 | p->level--; |
5365 | 6 | return NULL; |
5366 | 6 | } |
5367 | 15.4k | D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default")); |
5368 | 15.4k | Token * _literal; |
5369 | 15.4k | arg_ty a; |
5370 | 15.4k | if ( |
5371 | 15.4k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
5372 | 854 | && |
5373 | 854 | (a = param_no_default_rule(p)) // param_no_default |
5374 | 15.4k | ) |
5375 | 834 | { |
5376 | 834 | D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default")); |
5377 | 834 | _res = a; |
5378 | 834 | if (_res == NULL && PyErr_Occurred()) { |
5379 | 0 | p->error_indicator = 1; |
5380 | 0 | p->level--; |
5381 | 0 | return NULL; |
5382 | 0 | } |
5383 | 834 | goto done; |
5384 | 834 | } |
5385 | 14.5k | p->mark = _mark; |
5386 | 14.5k | D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ', |
5387 | 14.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default")); |
5388 | 14.5k | } |
5389 | 14.5k | _res = NULL; |
5390 | 15.4k | done: |
5391 | 15.4k | p->level--; |
5392 | 15.4k | return _res; |
5393 | 14.5k | } |
5394 | | |
5395 | | // param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')' |
5396 | | static arg_ty |
5397 | | param_no_default_rule(Parser *p) |
5398 | 226k | { |
5399 | 226k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5400 | 0 | _Pypegen_stack_overflow(p); |
5401 | 0 | } |
5402 | 226k | if (p->error_indicator) { |
5403 | 0 | p->level--; |
5404 | 0 | return NULL; |
5405 | 0 | } |
5406 | 226k | arg_ty _res = NULL; |
5407 | 226k | int _mark = p->mark; |
5408 | 226k | { // param ',' TYPE_COMMENT? |
5409 | 226k | if (p->error_indicator) { |
5410 | 0 | p->level--; |
5411 | 0 | return NULL; |
5412 | 0 | } |
5413 | 226k | D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?")); |
5414 | 226k | Token * _literal; |
5415 | 226k | arg_ty a; |
5416 | 226k | void *tc; |
5417 | 226k | if ( |
5418 | 226k | (a = param_rule(p)) // param |
5419 | 108k | && |
5420 | 108k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
5421 | 41.2k | && |
5422 | 41.2k | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
5423 | 226k | ) |
5424 | 41.2k | { |
5425 | 41.2k | D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?")); |
5426 | 41.2k | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
5427 | 41.2k | if (_res == NULL && PyErr_Occurred()) { |
5428 | 0 | p->error_indicator = 1; |
5429 | 0 | p->level--; |
5430 | 0 | return NULL; |
5431 | 0 | } |
5432 | 41.2k | goto done; |
5433 | 41.2k | } |
5434 | 185k | p->mark = _mark; |
5435 | 185k | D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
5436 | 185k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?")); |
5437 | 185k | } |
5438 | 0 | { // param TYPE_COMMENT? &')' |
5439 | 185k | if (p->error_indicator) { |
5440 | 28 | p->level--; |
5441 | 28 | return NULL; |
5442 | 28 | } |
5443 | 185k | D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'")); |
5444 | 185k | arg_ty a; |
5445 | 185k | void *tc; |
5446 | 185k | if ( |
5447 | 185k | (a = param_rule(p)) // param |
5448 | 67.6k | && |
5449 | 67.6k | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
5450 | 67.6k | && |
5451 | 67.6k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
5452 | 185k | ) |
5453 | 35.3k | { |
5454 | 35.3k | D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'")); |
5455 | 35.3k | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
5456 | 35.3k | if (_res == NULL && PyErr_Occurred()) { |
5457 | 0 | p->error_indicator = 1; |
5458 | 0 | p->level--; |
5459 | 0 | return NULL; |
5460 | 0 | } |
5461 | 35.3k | goto done; |
5462 | 35.3k | } |
5463 | 150k | p->mark = _mark; |
5464 | 150k | D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
5465 | 150k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'")); |
5466 | 150k | } |
5467 | 150k | _res = NULL; |
5468 | 226k | done: |
5469 | 226k | p->level--; |
5470 | 226k | return _res; |
5471 | 150k | } |
5472 | | |
5473 | | // param_no_default_star_annotation: |
5474 | | // | param_star_annotation ',' TYPE_COMMENT? |
5475 | | // | param_star_annotation TYPE_COMMENT? &')' |
5476 | | static arg_ty |
5477 | | param_no_default_star_annotation_rule(Parser *p) |
5478 | 2.26k | { |
5479 | 2.26k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5480 | 0 | _Pypegen_stack_overflow(p); |
5481 | 0 | } |
5482 | 2.26k | if (p->error_indicator) { |
5483 | 0 | p->level--; |
5484 | 0 | return NULL; |
5485 | 0 | } |
5486 | 2.26k | arg_ty _res = NULL; |
5487 | 2.26k | int _mark = p->mark; |
5488 | 2.26k | { // param_star_annotation ',' TYPE_COMMENT? |
5489 | 2.26k | if (p->error_indicator) { |
5490 | 0 | p->level--; |
5491 | 0 | return NULL; |
5492 | 0 | } |
5493 | 2.26k | D(fprintf(stderr, "%*c> param_no_default_star_annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_star_annotation ',' TYPE_COMMENT?")); |
5494 | 2.26k | Token * _literal; |
5495 | 2.26k | arg_ty a; |
5496 | 2.26k | void *tc; |
5497 | 2.26k | if ( |
5498 | 2.26k | (a = param_star_annotation_rule(p)) // param_star_annotation |
5499 | 922 | && |
5500 | 922 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
5501 | 130 | && |
5502 | 130 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
5503 | 2.26k | ) |
5504 | 129 | { |
5505 | 129 | D(fprintf(stderr, "%*c+ param_no_default_star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_star_annotation ',' TYPE_COMMENT?")); |
5506 | 129 | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
5507 | 129 | if (_res == NULL && PyErr_Occurred()) { |
5508 | 0 | p->error_indicator = 1; |
5509 | 0 | p->level--; |
5510 | 0 | return NULL; |
5511 | 0 | } |
5512 | 129 | goto done; |
5513 | 129 | } |
5514 | 2.13k | p->mark = _mark; |
5515 | 2.13k | D(fprintf(stderr, "%*c%s param_no_default_star_annotation[%d-%d]: %s failed!\n", p->level, ' ', |
5516 | 2.13k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_star_annotation ',' TYPE_COMMENT?")); |
5517 | 2.13k | } |
5518 | 0 | { // param_star_annotation TYPE_COMMENT? &')' |
5519 | 2.13k | if (p->error_indicator) { |
5520 | 3 | p->level--; |
5521 | 3 | return NULL; |
5522 | 3 | } |
5523 | 2.13k | D(fprintf(stderr, "%*c> param_no_default_star_annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_star_annotation TYPE_COMMENT? &')'")); |
5524 | 2.13k | arg_ty a; |
5525 | 2.13k | void *tc; |
5526 | 2.13k | if ( |
5527 | 2.13k | (a = param_star_annotation_rule(p)) // param_star_annotation |
5528 | 792 | && |
5529 | 792 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
5530 | 792 | && |
5531 | 792 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
5532 | 2.13k | ) |
5533 | 763 | { |
5534 | 763 | D(fprintf(stderr, "%*c+ param_no_default_star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_star_annotation TYPE_COMMENT? &')'")); |
5535 | 763 | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
5536 | 763 | if (_res == NULL && PyErr_Occurred()) { |
5537 | 0 | p->error_indicator = 1; |
5538 | 0 | p->level--; |
5539 | 0 | return NULL; |
5540 | 0 | } |
5541 | 763 | goto done; |
5542 | 763 | } |
5543 | 1.36k | p->mark = _mark; |
5544 | 1.36k | D(fprintf(stderr, "%*c%s param_no_default_star_annotation[%d-%d]: %s failed!\n", p->level, ' ', |
5545 | 1.36k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_star_annotation TYPE_COMMENT? &')'")); |
5546 | 1.36k | } |
5547 | 1.36k | _res = NULL; |
5548 | 2.26k | done: |
5549 | 2.26k | p->level--; |
5550 | 2.26k | return _res; |
5551 | 1.36k | } |
5552 | | |
5553 | | // param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')' |
5554 | | static NameDefaultPair* |
5555 | | param_with_default_rule(Parser *p) |
5556 | 102k | { |
5557 | 102k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5558 | 0 | _Pypegen_stack_overflow(p); |
5559 | 0 | } |
5560 | 102k | if (p->error_indicator) { |
5561 | 0 | p->level--; |
5562 | 0 | return NULL; |
5563 | 0 | } |
5564 | 102k | NameDefaultPair* _res = NULL; |
5565 | 102k | int _mark = p->mark; |
5566 | 102k | { // param default ',' TYPE_COMMENT? |
5567 | 102k | if (p->error_indicator) { |
5568 | 0 | p->level--; |
5569 | 0 | return NULL; |
5570 | 0 | } |
5571 | 102k | D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
5572 | 102k | Token * _literal; |
5573 | 102k | arg_ty a; |
5574 | 102k | expr_ty c; |
5575 | 102k | void *tc; |
5576 | 102k | if ( |
5577 | 102k | (a = param_rule(p)) // param |
5578 | 25.4k | && |
5579 | 25.4k | (c = default_rule(p)) // default |
5580 | 24.3k | && |
5581 | 24.3k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
5582 | 14.9k | && |
5583 | 14.9k | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
5584 | 102k | ) |
5585 | 14.9k | { |
5586 | 14.9k | D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
5587 | 14.9k | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
5588 | 14.9k | if (_res == NULL && PyErr_Occurred()) { |
5589 | 0 | p->error_indicator = 1; |
5590 | 0 | p->level--; |
5591 | 0 | return NULL; |
5592 | 0 | } |
5593 | 14.9k | goto done; |
5594 | 14.9k | } |
5595 | 87.4k | p->mark = _mark; |
5596 | 87.4k | D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
5597 | 87.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
5598 | 87.4k | } |
5599 | 0 | { // param default TYPE_COMMENT? &')' |
5600 | 87.4k | if (p->error_indicator) { |
5601 | 11 | p->level--; |
5602 | 11 | return NULL; |
5603 | 11 | } |
5604 | 87.4k | D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
5605 | 87.4k | arg_ty a; |
5606 | 87.4k | expr_ty c; |
5607 | 87.4k | void *tc; |
5608 | 87.4k | if ( |
5609 | 87.4k | (a = param_rule(p)) // param |
5610 | 10.4k | && |
5611 | 10.4k | (c = default_rule(p)) // default |
5612 | 9.31k | && |
5613 | 9.31k | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
5614 | 9.31k | && |
5615 | 9.31k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
5616 | 87.4k | ) |
5617 | 9.13k | { |
5618 | 9.13k | D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
5619 | 9.13k | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
5620 | 9.13k | if (_res == NULL && PyErr_Occurred()) { |
5621 | 0 | p->error_indicator = 1; |
5622 | 0 | p->level--; |
5623 | 0 | return NULL; |
5624 | 0 | } |
5625 | 9.13k | goto done; |
5626 | 9.13k | } |
5627 | 78.3k | p->mark = _mark; |
5628 | 78.3k | D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
5629 | 78.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
5630 | 78.3k | } |
5631 | 78.3k | _res = NULL; |
5632 | 102k | done: |
5633 | 102k | p->level--; |
5634 | 102k | return _res; |
5635 | 78.3k | } |
5636 | | |
5637 | | // param_maybe_default: |
5638 | | // | param default? ',' TYPE_COMMENT? |
5639 | | // | param default? TYPE_COMMENT? &')' |
5640 | | static NameDefaultPair* |
5641 | | param_maybe_default_rule(Parser *p) |
5642 | 28.8k | { |
5643 | 28.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5644 | 0 | _Pypegen_stack_overflow(p); |
5645 | 0 | } |
5646 | 28.8k | if (p->error_indicator) { |
5647 | 0 | p->level--; |
5648 | 0 | return NULL; |
5649 | 0 | } |
5650 | 28.8k | NameDefaultPair* _res = NULL; |
5651 | 28.8k | int _mark = p->mark; |
5652 | 28.8k | { // param default? ',' TYPE_COMMENT? |
5653 | 28.8k | if (p->error_indicator) { |
5654 | 0 | p->level--; |
5655 | 0 | return NULL; |
5656 | 0 | } |
5657 | 28.8k | D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
5658 | 28.8k | Token * _literal; |
5659 | 28.8k | arg_ty a; |
5660 | 28.8k | void *c; |
5661 | 28.8k | void *tc; |
5662 | 28.8k | if ( |
5663 | 28.8k | (a = param_rule(p)) // param |
5664 | 12.1k | && |
5665 | 12.1k | (c = default_rule(p), !p->error_indicator) // default? |
5666 | 12.1k | && |
5667 | 12.1k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
5668 | 7.21k | && |
5669 | 7.21k | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
5670 | 28.8k | ) |
5671 | 7.21k | { |
5672 | 7.21k | D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
5673 | 7.21k | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
5674 | 7.21k | if (_res == NULL && PyErr_Occurred()) { |
5675 | 0 | p->error_indicator = 1; |
5676 | 0 | p->level--; |
5677 | 0 | return NULL; |
5678 | 0 | } |
5679 | 7.21k | goto done; |
5680 | 7.21k | } |
5681 | 21.6k | p->mark = _mark; |
5682 | 21.6k | D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
5683 | 21.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
5684 | 21.6k | } |
5685 | 0 | { // param default? TYPE_COMMENT? &')' |
5686 | 21.6k | if (p->error_indicator) { |
5687 | 10 | p->level--; |
5688 | 10 | return NULL; |
5689 | 10 | } |
5690 | 21.6k | D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
5691 | 21.6k | arg_ty a; |
5692 | 21.6k | void *c; |
5693 | 21.6k | void *tc; |
5694 | 21.6k | if ( |
5695 | 21.6k | (a = param_rule(p)) // param |
5696 | 4.89k | && |
5697 | 4.89k | (c = default_rule(p), !p->error_indicator) // default? |
5698 | 4.89k | && |
5699 | 4.89k | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
5700 | 4.89k | && |
5701 | 4.89k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
5702 | 21.6k | ) |
5703 | 4.54k | { |
5704 | 4.54k | D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
5705 | 4.54k | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
5706 | 4.54k | if (_res == NULL && PyErr_Occurred()) { |
5707 | 0 | p->error_indicator = 1; |
5708 | 0 | p->level--; |
5709 | 0 | return NULL; |
5710 | 0 | } |
5711 | 4.54k | goto done; |
5712 | 4.54k | } |
5713 | 17.0k | p->mark = _mark; |
5714 | 17.0k | D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
5715 | 17.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
5716 | 17.0k | } |
5717 | 17.0k | _res = NULL; |
5718 | 28.8k | done: |
5719 | 28.8k | p->level--; |
5720 | 28.8k | return _res; |
5721 | 17.0k | } |
5722 | | |
5723 | | // param: NAME annotation? |
5724 | | static arg_ty |
5725 | | param_rule(Parser *p) |
5726 | 655k | { |
5727 | 655k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5728 | 0 | _Pypegen_stack_overflow(p); |
5729 | 0 | } |
5730 | 655k | if (p->error_indicator) { |
5731 | 0 | p->level--; |
5732 | 0 | return NULL; |
5733 | 0 | } |
5734 | 655k | arg_ty _res = NULL; |
5735 | 655k | int _mark = p->mark; |
5736 | 655k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
5737 | 20 | p->error_indicator = 1; |
5738 | 20 | p->level--; |
5739 | 20 | return NULL; |
5740 | 20 | } |
5741 | 655k | int _start_lineno = p->tokens[_mark]->lineno; |
5742 | 655k | UNUSED(_start_lineno); // Only used by EXTRA macro |
5743 | 655k | int _start_col_offset = p->tokens[_mark]->col_offset; |
5744 | 655k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
5745 | 655k | { // NAME annotation? |
5746 | 655k | if (p->error_indicator) { |
5747 | 0 | p->level--; |
5748 | 0 | return NULL; |
5749 | 0 | } |
5750 | 655k | D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?")); |
5751 | 655k | expr_ty a; |
5752 | 655k | void *b; |
5753 | 655k | if ( |
5754 | 655k | (a = _PyPegen_name_token(p)) // NAME |
5755 | 231k | && |
5756 | 231k | (b = annotation_rule(p), !p->error_indicator) // annotation? |
5757 | 655k | ) |
5758 | 231k | { |
5759 | 231k | D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?")); |
5760 | 231k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
5761 | 231k | if (_token == NULL) { |
5762 | 0 | p->level--; |
5763 | 0 | return NULL; |
5764 | 0 | } |
5765 | 231k | int _end_lineno = _token->end_lineno; |
5766 | 231k | UNUSED(_end_lineno); // Only used by EXTRA macro |
5767 | 231k | int _end_col_offset = _token->end_col_offset; |
5768 | 231k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
5769 | 231k | _res = _PyAST_arg ( a -> v . Name . id , b , NULL , EXTRA ); |
5770 | 231k | if (_res == NULL && PyErr_Occurred()) { |
5771 | 0 | p->error_indicator = 1; |
5772 | 0 | p->level--; |
5773 | 0 | return NULL; |
5774 | 0 | } |
5775 | 231k | goto done; |
5776 | 231k | } |
5777 | 424k | p->mark = _mark; |
5778 | 424k | D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ', |
5779 | 424k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?")); |
5780 | 424k | } |
5781 | 424k | _res = NULL; |
5782 | 655k | done: |
5783 | 655k | p->level--; |
5784 | 655k | return _res; |
5785 | 424k | } |
5786 | | |
5787 | | // param_star_annotation: NAME star_annotation |
5788 | | static arg_ty |
5789 | | param_star_annotation_rule(Parser *p) |
5790 | 4.39k | { |
5791 | 4.39k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5792 | 0 | _Pypegen_stack_overflow(p); |
5793 | 0 | } |
5794 | 4.39k | if (p->error_indicator) { |
5795 | 0 | p->level--; |
5796 | 0 | return NULL; |
5797 | 0 | } |
5798 | 4.39k | arg_ty _res = NULL; |
5799 | 4.39k | int _mark = p->mark; |
5800 | 4.39k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
5801 | 0 | p->error_indicator = 1; |
5802 | 0 | p->level--; |
5803 | 0 | return NULL; |
5804 | 0 | } |
5805 | 4.39k | int _start_lineno = p->tokens[_mark]->lineno; |
5806 | 4.39k | UNUSED(_start_lineno); // Only used by EXTRA macro |
5807 | 4.39k | int _start_col_offset = p->tokens[_mark]->col_offset; |
5808 | 4.39k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
5809 | 4.39k | { // NAME star_annotation |
5810 | 4.39k | if (p->error_indicator) { |
5811 | 0 | p->level--; |
5812 | 0 | return NULL; |
5813 | 0 | } |
5814 | 4.39k | D(fprintf(stderr, "%*c> param_star_annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME star_annotation")); |
5815 | 4.39k | expr_ty a; |
5816 | 4.39k | expr_ty b; |
5817 | 4.39k | if ( |
5818 | 4.39k | (a = _PyPegen_name_token(p)) // NAME |
5819 | 1.75k | && |
5820 | 1.75k | (b = star_annotation_rule(p)) // star_annotation |
5821 | 4.39k | ) |
5822 | 1.71k | { |
5823 | 1.71k | D(fprintf(stderr, "%*c+ param_star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME star_annotation")); |
5824 | 1.71k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
5825 | 1.71k | if (_token == NULL) { |
5826 | 0 | p->level--; |
5827 | 0 | return NULL; |
5828 | 0 | } |
5829 | 1.71k | int _end_lineno = _token->end_lineno; |
5830 | 1.71k | UNUSED(_end_lineno); // Only used by EXTRA macro |
5831 | 1.71k | int _end_col_offset = _token->end_col_offset; |
5832 | 1.71k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
5833 | 1.71k | _res = _PyAST_arg ( a -> v . Name . id , b , NULL , EXTRA ); |
5834 | 1.71k | if (_res == NULL && PyErr_Occurred()) { |
5835 | 0 | p->error_indicator = 1; |
5836 | 0 | p->level--; |
5837 | 0 | return NULL; |
5838 | 0 | } |
5839 | 1.71k | goto done; |
5840 | 1.71k | } |
5841 | 2.68k | p->mark = _mark; |
5842 | 2.68k | D(fprintf(stderr, "%*c%s param_star_annotation[%d-%d]: %s failed!\n", p->level, ' ', |
5843 | 2.68k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME star_annotation")); |
5844 | 2.68k | } |
5845 | 2.68k | _res = NULL; |
5846 | 4.39k | done: |
5847 | 4.39k | p->level--; |
5848 | 4.39k | return _res; |
5849 | 2.68k | } |
5850 | | |
5851 | | // annotation: ':' expression |
5852 | | static expr_ty |
5853 | | annotation_rule(Parser *p) |
5854 | 231k | { |
5855 | 231k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5856 | 0 | _Pypegen_stack_overflow(p); |
5857 | 0 | } |
5858 | 231k | if (p->error_indicator) { |
5859 | 0 | p->level--; |
5860 | 0 | return NULL; |
5861 | 0 | } |
5862 | 231k | expr_ty _res = NULL; |
5863 | 231k | int _mark = p->mark; |
5864 | 231k | { // ':' expression |
5865 | 231k | if (p->error_indicator) { |
5866 | 0 | p->level--; |
5867 | 0 | return NULL; |
5868 | 0 | } |
5869 | 231k | D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression")); |
5870 | 231k | Token * _literal; |
5871 | 231k | expr_ty a; |
5872 | 231k | if ( |
5873 | 231k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
5874 | 8.34k | && |
5875 | 8.34k | (a = expression_rule(p)) // expression |
5876 | 231k | ) |
5877 | 3.12k | { |
5878 | 3.12k | D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression")); |
5879 | 3.12k | _res = a; |
5880 | 3.12k | if (_res == NULL && PyErr_Occurred()) { |
5881 | 0 | p->error_indicator = 1; |
5882 | 0 | p->level--; |
5883 | 0 | return NULL; |
5884 | 0 | } |
5885 | 3.12k | goto done; |
5886 | 3.12k | } |
5887 | 228k | p->mark = _mark; |
5888 | 228k | D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ', |
5889 | 228k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression")); |
5890 | 228k | } |
5891 | 228k | _res = NULL; |
5892 | 231k | done: |
5893 | 231k | p->level--; |
5894 | 231k | return _res; |
5895 | 228k | } |
5896 | | |
5897 | | // star_annotation: ':' star_expression |
5898 | | static expr_ty |
5899 | | star_annotation_rule(Parser *p) |
5900 | 1.75k | { |
5901 | 1.75k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5902 | 0 | _Pypegen_stack_overflow(p); |
5903 | 0 | } |
5904 | 1.75k | if (p->error_indicator) { |
5905 | 0 | p->level--; |
5906 | 0 | return NULL; |
5907 | 0 | } |
5908 | 1.75k | expr_ty _res = NULL; |
5909 | 1.75k | int _mark = p->mark; |
5910 | 1.75k | { // ':' star_expression |
5911 | 1.75k | if (p->error_indicator) { |
5912 | 0 | p->level--; |
5913 | 0 | return NULL; |
5914 | 0 | } |
5915 | 1.75k | D(fprintf(stderr, "%*c> star_annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' star_expression")); |
5916 | 1.75k | Token * _literal; |
5917 | 1.75k | expr_ty a; |
5918 | 1.75k | if ( |
5919 | 1.75k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
5920 | 1.72k | && |
5921 | 1.72k | (a = star_expression_rule(p)) // star_expression |
5922 | 1.75k | ) |
5923 | 1.71k | { |
5924 | 1.71k | D(fprintf(stderr, "%*c+ star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' star_expression")); |
5925 | 1.71k | _res = a; |
5926 | 1.71k | if (_res == NULL && PyErr_Occurred()) { |
5927 | 0 | p->error_indicator = 1; |
5928 | 0 | p->level--; |
5929 | 0 | return NULL; |
5930 | 0 | } |
5931 | 1.71k | goto done; |
5932 | 1.71k | } |
5933 | 42 | p->mark = _mark; |
5934 | 42 | D(fprintf(stderr, "%*c%s star_annotation[%d-%d]: %s failed!\n", p->level, ' ', |
5935 | 42 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' star_expression")); |
5936 | 42 | } |
5937 | 42 | _res = NULL; |
5938 | 1.75k | done: |
5939 | 1.75k | p->level--; |
5940 | 1.75k | return _res; |
5941 | 42 | } |
5942 | | |
5943 | | // default: '=' expression | invalid_default |
5944 | | static expr_ty |
5945 | | default_rule(Parser *p) |
5946 | 122k | { |
5947 | 122k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
5948 | 0 | _Pypegen_stack_overflow(p); |
5949 | 0 | } |
5950 | 122k | if (p->error_indicator) { |
5951 | 0 | p->level--; |
5952 | 0 | return NULL; |
5953 | 0 | } |
5954 | 122k | expr_ty _res = NULL; |
5955 | 122k | int _mark = p->mark; |
5956 | 122k | { // '=' expression |
5957 | 122k | if (p->error_indicator) { |
5958 | 0 | p->level--; |
5959 | 0 | return NULL; |
5960 | 0 | } |
5961 | 122k | D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression")); |
5962 | 122k | Token * _literal; |
5963 | 122k | expr_ty a; |
5964 | 122k | if ( |
5965 | 122k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
5966 | 90.4k | && |
5967 | 90.4k | (a = expression_rule(p)) // expression |
5968 | 122k | ) |
5969 | 70.7k | { |
5970 | 70.7k | D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression")); |
5971 | 70.7k | _res = a; |
5972 | 70.7k | if (_res == NULL && PyErr_Occurred()) { |
5973 | 0 | p->error_indicator = 1; |
5974 | 0 | p->level--; |
5975 | 0 | return NULL; |
5976 | 0 | } |
5977 | 70.7k | goto done; |
5978 | 70.7k | } |
5979 | 52.0k | p->mark = _mark; |
5980 | 52.0k | D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ', |
5981 | 52.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression")); |
5982 | 52.0k | } |
5983 | 52.0k | if (p->call_invalid_rules) { // invalid_default |
5984 | 43.4k | if (p->error_indicator) { |
5985 | 720 | p->level--; |
5986 | 720 | return NULL; |
5987 | 720 | } |
5988 | 42.6k | D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_default")); |
5989 | 42.6k | void *invalid_default_var; |
5990 | 42.6k | if ( |
5991 | 42.6k | (invalid_default_var = invalid_default_rule(p)) // invalid_default |
5992 | 42.6k | ) |
5993 | 0 | { |
5994 | 0 | D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_default")); |
5995 | 0 | _res = invalid_default_var; |
5996 | 0 | goto done; |
5997 | 0 | } |
5998 | 42.6k | p->mark = _mark; |
5999 | 42.6k | D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ', |
6000 | 42.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_default")); |
6001 | 42.6k | } |
6002 | 51.3k | _res = NULL; |
6003 | 122k | done: |
6004 | 122k | p->level--; |
6005 | 122k | return _res; |
6006 | 51.3k | } |
6007 | | |
6008 | | // if_stmt: |
6009 | | // | invalid_if_stmt |
6010 | | // | 'if' named_expression ':' block elif_stmt |
6011 | | // | 'if' named_expression ':' block else_block? |
6012 | | static stmt_ty |
6013 | | if_stmt_rule(Parser *p) |
6014 | 9.97k | { |
6015 | 9.97k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
6016 | 0 | _Pypegen_stack_overflow(p); |
6017 | 0 | } |
6018 | 9.97k | if (p->error_indicator) { |
6019 | 0 | p->level--; |
6020 | 0 | return NULL; |
6021 | 0 | } |
6022 | 9.97k | stmt_ty _res = NULL; |
6023 | 9.97k | int _mark = p->mark; |
6024 | 9.97k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
6025 | 0 | p->error_indicator = 1; |
6026 | 0 | p->level--; |
6027 | 0 | return NULL; |
6028 | 0 | } |
6029 | 9.97k | int _start_lineno = p->tokens[_mark]->lineno; |
6030 | 9.97k | UNUSED(_start_lineno); // Only used by EXTRA macro |
6031 | 9.97k | int _start_col_offset = p->tokens[_mark]->col_offset; |
6032 | 9.97k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
6033 | 9.97k | if (p->call_invalid_rules) { // invalid_if_stmt |
6034 | 588 | if (p->error_indicator) { |
6035 | 0 | p->level--; |
6036 | 0 | return NULL; |
6037 | 0 | } |
6038 | 588 | D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_if_stmt")); |
6039 | 588 | void *invalid_if_stmt_var; |
6040 | 588 | if ( |
6041 | 588 | (invalid_if_stmt_var = invalid_if_stmt_rule(p)) // invalid_if_stmt |
6042 | 588 | ) |
6043 | 0 | { |
6044 | 0 | D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_if_stmt")); |
6045 | 0 | _res = invalid_if_stmt_var; |
6046 | 0 | goto done; |
6047 | 0 | } |
6048 | 588 | p->mark = _mark; |
6049 | 588 | D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6050 | 588 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_if_stmt")); |
6051 | 588 | } |
6052 | 9.97k | { // 'if' named_expression ':' block elif_stmt |
6053 | 9.97k | if (p->error_indicator) { |
6054 | 9 | p->level--; |
6055 | 9 | return NULL; |
6056 | 9 | } |
6057 | 9.96k | D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt")); |
6058 | 9.96k | Token * _keyword; |
6059 | 9.96k | Token * _literal; |
6060 | 9.96k | expr_ty a; |
6061 | 9.96k | asdl_stmt_seq* b; |
6062 | 9.96k | stmt_ty c; |
6063 | 9.96k | if ( |
6064 | 9.96k | (_keyword = _PyPegen_expect_token(p, 691)) // token='if' |
6065 | 9.96k | && |
6066 | 9.96k | (a = named_expression_rule(p)) // named_expression |
6067 | 9.94k | && |
6068 | 9.94k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
6069 | 9.94k | && |
6070 | 9.94k | (b = block_rule(p)) // block |
6071 | 9.84k | && |
6072 | 9.84k | (c = elif_stmt_rule(p)) // elif_stmt |
6073 | 9.96k | ) |
6074 | 829 | { |
6075 | 829 | D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt")); |
6076 | 829 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6077 | 829 | if (_token == NULL) { |
6078 | 0 | p->level--; |
6079 | 0 | return NULL; |
6080 | 0 | } |
6081 | 829 | int _end_lineno = _token->end_lineno; |
6082 | 829 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6083 | 829 | int _end_col_offset = _token->end_col_offset; |
6084 | 829 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6085 | 829 | _res = _PyAST_If ( a , b , CHECK ( asdl_stmt_seq* , _PyPegen_singleton_seq ( p , c ) ) , EXTRA ); |
6086 | 829 | if (_res == NULL && PyErr_Occurred()) { |
6087 | 0 | p->error_indicator = 1; |
6088 | 0 | p->level--; |
6089 | 0 | return NULL; |
6090 | 0 | } |
6091 | 829 | goto done; |
6092 | 829 | } |
6093 | 9.14k | p->mark = _mark; |
6094 | 9.14k | D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6095 | 9.14k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt")); |
6096 | 9.14k | } |
6097 | 0 | { // 'if' named_expression ':' block else_block? |
6098 | 9.14k | if (p->error_indicator) { |
6099 | 39 | p->level--; |
6100 | 39 | return NULL; |
6101 | 39 | } |
6102 | 9.10k | D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?")); |
6103 | 9.10k | Token * _keyword; |
6104 | 9.10k | Token * _literal; |
6105 | 9.10k | expr_ty a; |
6106 | 9.10k | asdl_stmt_seq* b; |
6107 | 9.10k | void *c; |
6108 | 9.10k | if ( |
6109 | 9.10k | (_keyword = _PyPegen_expect_token(p, 691)) // token='if' |
6110 | 9.10k | && |
6111 | 9.10k | (a = named_expression_rule(p)) // named_expression |
6112 | 9.08k | && |
6113 | 9.08k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
6114 | 9.07k | && |
6115 | 9.07k | (b = block_rule(p)) // block |
6116 | 9.00k | && |
6117 | 9.00k | (c = else_block_rule(p), !p->error_indicator) // else_block? |
6118 | 9.10k | ) |
6119 | 8.99k | { |
6120 | 8.99k | D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?")); |
6121 | 8.99k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6122 | 8.99k | if (_token == NULL) { |
6123 | 0 | p->level--; |
6124 | 0 | return NULL; |
6125 | 0 | } |
6126 | 8.99k | int _end_lineno = _token->end_lineno; |
6127 | 8.99k | UNUSED(_end_lineno); // Only used by EXTRA macro |
6128 | 8.99k | int _end_col_offset = _token->end_col_offset; |
6129 | 8.99k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6130 | 8.99k | _res = _PyAST_If ( a , b , c , EXTRA ); |
6131 | 8.99k | if (_res == NULL && PyErr_Occurred()) { |
6132 | 0 | p->error_indicator = 1; |
6133 | 0 | p->level--; |
6134 | 0 | return NULL; |
6135 | 0 | } |
6136 | 8.99k | goto done; |
6137 | 8.99k | } |
6138 | 104 | p->mark = _mark; |
6139 | 104 | D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6140 | 104 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?")); |
6141 | 104 | } |
6142 | 104 | _res = NULL; |
6143 | 9.93k | done: |
6144 | 9.93k | p->level--; |
6145 | 9.93k | return _res; |
6146 | 104 | } |
6147 | | |
6148 | | // elif_stmt: |
6149 | | // | invalid_elif_stmt |
6150 | | // | 'elif' named_expression ':' block elif_stmt |
6151 | | // | 'elif' named_expression ':' block else_block? |
6152 | | static stmt_ty |
6153 | | elif_stmt_rule(Parser *p) |
6154 | 12.2k | { |
6155 | 12.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
6156 | 0 | _Pypegen_stack_overflow(p); |
6157 | 0 | } |
6158 | 12.2k | if (p->error_indicator) { |
6159 | 0 | p->level--; |
6160 | 0 | return NULL; |
6161 | 0 | } |
6162 | 12.2k | stmt_ty _res = NULL; |
6163 | 12.2k | int _mark = p->mark; |
6164 | 12.2k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
6165 | 1 | p->error_indicator = 1; |
6166 | 1 | p->level--; |
6167 | 1 | return NULL; |
6168 | 1 | } |
6169 | 12.2k | int _start_lineno = p->tokens[_mark]->lineno; |
6170 | 12.2k | UNUSED(_start_lineno); // Only used by EXTRA macro |
6171 | 12.2k | int _start_col_offset = p->tokens[_mark]->col_offset; |
6172 | 12.2k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
6173 | 12.2k | if (p->call_invalid_rules) { // invalid_elif_stmt |
6174 | 919 | if (p->error_indicator) { |
6175 | 0 | p->level--; |
6176 | 0 | return NULL; |
6177 | 0 | } |
6178 | 919 | D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_elif_stmt")); |
6179 | 919 | void *invalid_elif_stmt_var; |
6180 | 919 | if ( |
6181 | 919 | (invalid_elif_stmt_var = invalid_elif_stmt_rule(p)) // invalid_elif_stmt |
6182 | 919 | ) |
6183 | 0 | { |
6184 | 0 | D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_elif_stmt")); |
6185 | 0 | _res = invalid_elif_stmt_var; |
6186 | 0 | goto done; |
6187 | 0 | } |
6188 | 919 | p->mark = _mark; |
6189 | 919 | D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6190 | 919 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_elif_stmt")); |
6191 | 919 | } |
6192 | 12.2k | { // 'elif' named_expression ':' block elif_stmt |
6193 | 12.2k | if (p->error_indicator) { |
6194 | 9 | p->level--; |
6195 | 9 | return NULL; |
6196 | 9 | } |
6197 | 12.2k | D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt")); |
6198 | 12.2k | Token * _keyword; |
6199 | 12.2k | Token * _literal; |
6200 | 12.2k | expr_ty a; |
6201 | 12.2k | asdl_stmt_seq* b; |
6202 | 12.2k | stmt_ty c; |
6203 | 12.2k | if ( |
6204 | 12.2k | (_keyword = _PyPegen_expect_token(p, 696)) // token='elif' |
6205 | 2.44k | && |
6206 | 2.44k | (a = named_expression_rule(p)) // named_expression |
6207 | 2.43k | && |
6208 | 2.43k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
6209 | 2.42k | && |
6210 | 2.42k | (b = block_rule(p)) // block |
6211 | 2.38k | && |
6212 | 2.38k | (c = elif_stmt_rule(p)) // elif_stmt |
6213 | 12.2k | ) |
6214 | 1.48k | { |
6215 | 1.48k | D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt")); |
6216 | 1.48k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6217 | 1.48k | if (_token == NULL) { |
6218 | 0 | p->level--; |
6219 | 0 | return NULL; |
6220 | 0 | } |
6221 | 1.48k | int _end_lineno = _token->end_lineno; |
6222 | 1.48k | UNUSED(_end_lineno); // Only used by EXTRA macro |
6223 | 1.48k | int _end_col_offset = _token->end_col_offset; |
6224 | 1.48k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6225 | 1.48k | _res = _PyAST_If ( a , b , CHECK ( asdl_stmt_seq* , _PyPegen_singleton_seq ( p , c ) ) , EXTRA ); |
6226 | 1.48k | if (_res == NULL && PyErr_Occurred()) { |
6227 | 0 | p->error_indicator = 1; |
6228 | 0 | p->level--; |
6229 | 0 | return NULL; |
6230 | 0 | } |
6231 | 1.48k | goto done; |
6232 | 1.48k | } |
6233 | 10.7k | p->mark = _mark; |
6234 | 10.7k | D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6235 | 10.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt")); |
6236 | 10.7k | } |
6237 | 0 | { // 'elif' named_expression ':' block else_block? |
6238 | 10.7k | if (p->error_indicator) { |
6239 | 79 | p->level--; |
6240 | 79 | return NULL; |
6241 | 79 | } |
6242 | 10.6k | D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?")); |
6243 | 10.6k | Token * _keyword; |
6244 | 10.6k | Token * _literal; |
6245 | 10.6k | expr_ty a; |
6246 | 10.6k | asdl_stmt_seq* b; |
6247 | 10.6k | void *c; |
6248 | 10.6k | if ( |
6249 | 10.6k | (_keyword = _PyPegen_expect_token(p, 696)) // token='elif' |
6250 | 877 | && |
6251 | 877 | (a = named_expression_rule(p)) // named_expression |
6252 | 870 | && |
6253 | 870 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
6254 | 864 | && |
6255 | 864 | (b = block_rule(p)) // block |
6256 | 830 | && |
6257 | 830 | (c = else_block_rule(p), !p->error_indicator) // else_block? |
6258 | 10.6k | ) |
6259 | 829 | { |
6260 | 829 | D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?")); |
6261 | 829 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6262 | 829 | if (_token == NULL) { |
6263 | 0 | p->level--; |
6264 | 0 | return NULL; |
6265 | 0 | } |
6266 | 829 | int _end_lineno = _token->end_lineno; |
6267 | 829 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6268 | 829 | int _end_col_offset = _token->end_col_offset; |
6269 | 829 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6270 | 829 | _res = _PyAST_If ( a , b , c , EXTRA ); |
6271 | 829 | if (_res == NULL && PyErr_Occurred()) { |
6272 | 0 | p->error_indicator = 1; |
6273 | 0 | p->level--; |
6274 | 0 | return NULL; |
6275 | 0 | } |
6276 | 829 | goto done; |
6277 | 829 | } |
6278 | 9.83k | p->mark = _mark; |
6279 | 9.83k | D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6280 | 9.83k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?")); |
6281 | 9.83k | } |
6282 | 9.83k | _res = NULL; |
6283 | 12.1k | done: |
6284 | 12.1k | p->level--; |
6285 | 12.1k | return _res; |
6286 | 9.83k | } |
6287 | | |
6288 | | // else_block: invalid_else_stmt | 'else' &&':' block |
6289 | | static asdl_stmt_seq* |
6290 | | else_block_rule(Parser *p) |
6291 | 18.5k | { |
6292 | 18.5k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
6293 | 0 | _Pypegen_stack_overflow(p); |
6294 | 0 | } |
6295 | 18.5k | if (p->error_indicator) { |
6296 | 0 | p->level--; |
6297 | 0 | return NULL; |
6298 | 0 | } |
6299 | 18.5k | asdl_stmt_seq* _res = NULL; |
6300 | 18.5k | int _mark = p->mark; |
6301 | 18.5k | if (p->call_invalid_rules) { // invalid_else_stmt |
6302 | 2.76k | if (p->error_indicator) { |
6303 | 0 | p->level--; |
6304 | 0 | return NULL; |
6305 | 0 | } |
6306 | 2.76k | D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_else_stmt")); |
6307 | 2.76k | void *invalid_else_stmt_var; |
6308 | 2.76k | if ( |
6309 | 2.76k | (invalid_else_stmt_var = invalid_else_stmt_rule(p)) // invalid_else_stmt |
6310 | 2.76k | ) |
6311 | 0 | { |
6312 | 0 | D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_else_stmt")); |
6313 | 0 | _res = invalid_else_stmt_var; |
6314 | 0 | goto done; |
6315 | 0 | } |
6316 | 2.76k | p->mark = _mark; |
6317 | 2.76k | D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ', |
6318 | 2.76k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_else_stmt")); |
6319 | 2.76k | } |
6320 | 18.5k | { // 'else' &&':' block |
6321 | 18.5k | if (p->error_indicator) { |
6322 | 6 | p->level--; |
6323 | 6 | return NULL; |
6324 | 6 | } |
6325 | 18.5k | D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' &&':' block")); |
6326 | 18.5k | Token * _keyword; |
6327 | 18.5k | Token * _literal; |
6328 | 18.5k | asdl_stmt_seq* b; |
6329 | 18.5k | if ( |
6330 | 18.5k | (_keyword = _PyPegen_expect_token(p, 695)) // token='else' |
6331 | 2.14k | && |
6332 | 2.14k | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
6333 | 2.14k | && |
6334 | 2.14k | (b = block_rule(p)) // block |
6335 | 18.5k | ) |
6336 | 2.11k | { |
6337 | 2.11k | D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' &&':' block")); |
6338 | 2.11k | _res = b; |
6339 | 2.11k | if (_res == NULL && PyErr_Occurred()) { |
6340 | 0 | p->error_indicator = 1; |
6341 | 0 | p->level--; |
6342 | 0 | return NULL; |
6343 | 0 | } |
6344 | 2.11k | goto done; |
6345 | 2.11k | } |
6346 | 16.3k | p->mark = _mark; |
6347 | 16.3k | D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ', |
6348 | 16.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' &&':' block")); |
6349 | 16.3k | } |
6350 | 16.3k | _res = NULL; |
6351 | 18.5k | done: |
6352 | 18.5k | p->level--; |
6353 | 18.5k | return _res; |
6354 | 16.3k | } |
6355 | | |
6356 | | // while_stmt: invalid_while_stmt | 'while' named_expression ':' block else_block? |
6357 | | static stmt_ty |
6358 | | while_stmt_rule(Parser *p) |
6359 | 1.55k | { |
6360 | 1.55k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
6361 | 0 | _Pypegen_stack_overflow(p); |
6362 | 0 | } |
6363 | 1.55k | if (p->error_indicator) { |
6364 | 0 | p->level--; |
6365 | 0 | return NULL; |
6366 | 0 | } |
6367 | 1.55k | stmt_ty _res = NULL; |
6368 | 1.55k | int _mark = p->mark; |
6369 | 1.55k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
6370 | 0 | p->error_indicator = 1; |
6371 | 0 | p->level--; |
6372 | 0 | return NULL; |
6373 | 0 | } |
6374 | 1.55k | int _start_lineno = p->tokens[_mark]->lineno; |
6375 | 1.55k | UNUSED(_start_lineno); // Only used by EXTRA macro |
6376 | 1.55k | int _start_col_offset = p->tokens[_mark]->col_offset; |
6377 | 1.55k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
6378 | 1.55k | if (p->call_invalid_rules) { // invalid_while_stmt |
6379 | 432 | if (p->error_indicator) { |
6380 | 0 | p->level--; |
6381 | 0 | return NULL; |
6382 | 0 | } |
6383 | 432 | D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_while_stmt")); |
6384 | 432 | void *invalid_while_stmt_var; |
6385 | 432 | if ( |
6386 | 432 | (invalid_while_stmt_var = invalid_while_stmt_rule(p)) // invalid_while_stmt |
6387 | 432 | ) |
6388 | 0 | { |
6389 | 0 | D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_while_stmt")); |
6390 | 0 | _res = invalid_while_stmt_var; |
6391 | 0 | goto done; |
6392 | 0 | } |
6393 | 432 | p->mark = _mark; |
6394 | 432 | D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6395 | 432 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_while_stmt")); |
6396 | 432 | } |
6397 | 1.55k | { // 'while' named_expression ':' block else_block? |
6398 | 1.55k | if (p->error_indicator) { |
6399 | 7 | p->level--; |
6400 | 7 | return NULL; |
6401 | 7 | } |
6402 | 1.54k | D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?")); |
6403 | 1.54k | Token * _keyword; |
6404 | 1.54k | Token * _literal; |
6405 | 1.54k | expr_ty a; |
6406 | 1.54k | asdl_stmt_seq* b; |
6407 | 1.54k | void *c; |
6408 | 1.54k | if ( |
6409 | 1.54k | (_keyword = _PyPegen_expect_token(p, 698)) // token='while' |
6410 | 1.54k | && |
6411 | 1.54k | (a = named_expression_rule(p)) // named_expression |
6412 | 1.53k | && |
6413 | 1.53k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
6414 | 1.52k | && |
6415 | 1.52k | (b = block_rule(p)) // block |
6416 | 1.48k | && |
6417 | 1.48k | (c = else_block_rule(p), !p->error_indicator) // else_block? |
6418 | 1.54k | ) |
6419 | 1.47k | { |
6420 | 1.47k | D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?")); |
6421 | 1.47k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6422 | 1.47k | if (_token == NULL) { |
6423 | 0 | p->level--; |
6424 | 0 | return NULL; |
6425 | 0 | } |
6426 | 1.47k | int _end_lineno = _token->end_lineno; |
6427 | 1.47k | UNUSED(_end_lineno); // Only used by EXTRA macro |
6428 | 1.47k | int _end_col_offset = _token->end_col_offset; |
6429 | 1.47k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6430 | 1.47k | _res = _PyAST_While ( a , b , c , EXTRA ); |
6431 | 1.47k | if (_res == NULL && PyErr_Occurred()) { |
6432 | 0 | p->error_indicator = 1; |
6433 | 0 | p->level--; |
6434 | 0 | return NULL; |
6435 | 0 | } |
6436 | 1.47k | goto done; |
6437 | 1.47k | } |
6438 | 65 | p->mark = _mark; |
6439 | 65 | D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6440 | 65 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?")); |
6441 | 65 | } |
6442 | 65 | _res = NULL; |
6443 | 1.54k | done: |
6444 | 1.54k | p->level--; |
6445 | 1.54k | return _res; |
6446 | 65 | } |
6447 | | |
6448 | | // for_stmt: |
6449 | | // | invalid_for_stmt |
6450 | | // | 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block? |
6451 | | // | 'async' 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block? |
6452 | | // | invalid_for_target |
6453 | | static stmt_ty |
6454 | | for_stmt_rule(Parser *p) |
6455 | 2.93k | { |
6456 | 2.93k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
6457 | 0 | _Pypegen_stack_overflow(p); |
6458 | 0 | } |
6459 | 2.93k | if (p->error_indicator) { |
6460 | 0 | p->level--; |
6461 | 0 | return NULL; |
6462 | 0 | } |
6463 | 2.93k | stmt_ty _res = NULL; |
6464 | 2.93k | int _mark = p->mark; |
6465 | 2.93k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
6466 | 0 | p->error_indicator = 1; |
6467 | 0 | p->level--; |
6468 | 0 | return NULL; |
6469 | 0 | } |
6470 | 2.93k | int _start_lineno = p->tokens[_mark]->lineno; |
6471 | 2.93k | UNUSED(_start_lineno); // Only used by EXTRA macro |
6472 | 2.93k | int _start_col_offset = p->tokens[_mark]->col_offset; |
6473 | 2.93k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
6474 | 2.93k | if (p->call_invalid_rules) { // invalid_for_stmt |
6475 | 668 | if (p->error_indicator) { |
6476 | 0 | p->level--; |
6477 | 0 | return NULL; |
6478 | 0 | } |
6479 | 668 | D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_stmt")); |
6480 | 668 | void *invalid_for_stmt_var; |
6481 | 668 | if ( |
6482 | 668 | (invalid_for_stmt_var = invalid_for_stmt_rule(p)) // invalid_for_stmt |
6483 | 668 | ) |
6484 | 0 | { |
6485 | 0 | D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_stmt")); |
6486 | 0 | _res = invalid_for_stmt_var; |
6487 | 0 | goto done; |
6488 | 0 | } |
6489 | 668 | p->mark = _mark; |
6490 | 668 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6491 | 668 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_stmt")); |
6492 | 668 | } |
6493 | 2.93k | { // 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block? |
6494 | 2.93k | if (p->error_indicator) { |
6495 | 12 | p->level--; |
6496 | 12 | return NULL; |
6497 | 12 | } |
6498 | 2.92k | 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?")); |
6499 | 2.92k | int _cut_var = 0; |
6500 | 2.92k | Token * _keyword; |
6501 | 2.92k | Token * _keyword_1; |
6502 | 2.92k | Token * _literal; |
6503 | 2.92k | asdl_stmt_seq* b; |
6504 | 2.92k | void *el; |
6505 | 2.92k | expr_ty ex; |
6506 | 2.92k | expr_ty t; |
6507 | 2.92k | void *tc; |
6508 | 2.92k | if ( |
6509 | 2.92k | (_keyword = _PyPegen_expect_token(p, 703)) // token='for' |
6510 | 2.13k | && |
6511 | 2.13k | (t = star_targets_rule(p)) // star_targets |
6512 | 2.09k | && |
6513 | 2.09k | (_keyword_1 = _PyPegen_expect_token(p, 704)) // token='in' |
6514 | 2.07k | && |
6515 | 2.07k | (_cut_var = 1) |
6516 | 2.07k | && |
6517 | 2.07k | (ex = star_expressions_rule(p)) // star_expressions |
6518 | 2.06k | && |
6519 | 2.06k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
6520 | 2.06k | && |
6521 | 2.06k | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
6522 | 2.06k | && |
6523 | 2.06k | (b = block_rule(p)) // block |
6524 | 2.00k | && |
6525 | 2.00k | (el = else_block_rule(p), !p->error_indicator) // else_block? |
6526 | 2.92k | ) |
6527 | 2.00k | { |
6528 | 2.00k | 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?")); |
6529 | 2.00k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6530 | 2.00k | if (_token == NULL) { |
6531 | 0 | p->level--; |
6532 | 0 | return NULL; |
6533 | 0 | } |
6534 | 2.00k | int _end_lineno = _token->end_lineno; |
6535 | 2.00k | UNUSED(_end_lineno); // Only used by EXTRA macro |
6536 | 2.00k | int _end_col_offset = _token->end_col_offset; |
6537 | 2.00k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6538 | 2.00k | _res = _PyAST_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
6539 | 2.00k | if (_res == NULL && PyErr_Occurred()) { |
6540 | 0 | p->error_indicator = 1; |
6541 | 0 | p->level--; |
6542 | 0 | return NULL; |
6543 | 0 | } |
6544 | 2.00k | goto done; |
6545 | 2.00k | } |
6546 | 920 | p->mark = _mark; |
6547 | 920 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6548 | 920 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?")); |
6549 | 920 | if (_cut_var) { |
6550 | 67 | p->level--; |
6551 | 67 | return NULL; |
6552 | 67 | } |
6553 | 920 | } |
6554 | 853 | { // 'async' 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block? |
6555 | 853 | if (p->error_indicator) { |
6556 | 6 | p->level--; |
6557 | 6 | return NULL; |
6558 | 6 | } |
6559 | 847 | 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?")); |
6560 | 847 | int _cut_var = 0; |
6561 | 847 | Token * _keyword; |
6562 | 847 | Token * _keyword_1; |
6563 | 847 | Token * _keyword_2; |
6564 | 847 | Token * _literal; |
6565 | 847 | asdl_stmt_seq* b; |
6566 | 847 | void *el; |
6567 | 847 | expr_ty ex; |
6568 | 847 | expr_ty t; |
6569 | 847 | void *tc; |
6570 | 847 | if ( |
6571 | 847 | (_keyword = _PyPegen_expect_token(p, 707)) // token='async' |
6572 | 789 | && |
6573 | 789 | (_keyword_1 = _PyPegen_expect_token(p, 703)) // token='for' |
6574 | 668 | && |
6575 | 668 | (t = star_targets_rule(p)) // star_targets |
6576 | 665 | && |
6577 | 665 | (_keyword_2 = _PyPegen_expect_token(p, 704)) // token='in' |
6578 | 660 | && |
6579 | 660 | (_cut_var = 1) |
6580 | 660 | && |
6581 | 660 | (ex = star_expressions_rule(p)) // star_expressions |
6582 | 655 | && |
6583 | 655 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
6584 | 652 | && |
6585 | 652 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
6586 | 651 | && |
6587 | 651 | (b = block_rule(p)) // block |
6588 | 635 | && |
6589 | 635 | (el = else_block_rule(p), !p->error_indicator) // else_block? |
6590 | 847 | ) |
6591 | 634 | { |
6592 | 634 | 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?")); |
6593 | 634 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6594 | 634 | if (_token == NULL) { |
6595 | 0 | p->level--; |
6596 | 0 | return NULL; |
6597 | 0 | } |
6598 | 634 | int _end_lineno = _token->end_lineno; |
6599 | 634 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6600 | 634 | int _end_col_offset = _token->end_col_offset; |
6601 | 634 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6602 | 634 | _res = CHECK_VERSION ( stmt_ty , 5 , "Async for loops are" , _PyAST_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
6603 | 634 | if (_res == NULL && PyErr_Occurred()) { |
6604 | 0 | p->error_indicator = 1; |
6605 | 0 | p->level--; |
6606 | 0 | return NULL; |
6607 | 0 | } |
6608 | 634 | goto done; |
6609 | 634 | } |
6610 | 213 | p->mark = _mark; |
6611 | 213 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6612 | 213 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async' 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?")); |
6613 | 213 | if (_cut_var) { |
6614 | 26 | p->level--; |
6615 | 26 | return NULL; |
6616 | 26 | } |
6617 | 213 | } |
6618 | 187 | if (p->call_invalid_rules) { // invalid_for_target |
6619 | 78 | if (p->error_indicator) { |
6620 | 0 | p->level--; |
6621 | 0 | return NULL; |
6622 | 0 | } |
6623 | 78 | D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target")); |
6624 | 78 | void *invalid_for_target_var; |
6625 | 78 | if ( |
6626 | 78 | (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target |
6627 | 78 | ) |
6628 | 0 | { |
6629 | 0 | D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target")); |
6630 | 0 | _res = invalid_for_target_var; |
6631 | 0 | goto done; |
6632 | 0 | } |
6633 | 78 | p->mark = _mark; |
6634 | 78 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6635 | 78 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target")); |
6636 | 78 | } |
6637 | 187 | _res = NULL; |
6638 | 2.82k | done: |
6639 | 2.82k | p->level--; |
6640 | 2.82k | return _res; |
6641 | 187 | } |
6642 | | |
6643 | | // with_stmt: |
6644 | | // | invalid_with_stmt_indent |
6645 | | // | 'with' '(' ','.with_item+ ','? ')' ':' TYPE_COMMENT? block |
6646 | | // | 'with' ','.with_item+ ':' TYPE_COMMENT? block |
6647 | | // | 'async' 'with' '(' ','.with_item+ ','? ')' ':' block |
6648 | | // | 'async' 'with' ','.with_item+ ':' TYPE_COMMENT? block |
6649 | | // | invalid_with_stmt |
6650 | | static stmt_ty |
6651 | | with_stmt_rule(Parser *p) |
6652 | 4.45k | { |
6653 | 4.45k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
6654 | 0 | _Pypegen_stack_overflow(p); |
6655 | 0 | } |
6656 | 4.45k | if (p->error_indicator) { |
6657 | 0 | p->level--; |
6658 | 0 | return NULL; |
6659 | 0 | } |
6660 | 4.45k | stmt_ty _res = NULL; |
6661 | 4.45k | int _mark = p->mark; |
6662 | 4.45k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
6663 | 0 | p->error_indicator = 1; |
6664 | 0 | p->level--; |
6665 | 0 | return NULL; |
6666 | 0 | } |
6667 | 4.45k | int _start_lineno = p->tokens[_mark]->lineno; |
6668 | 4.45k | UNUSED(_start_lineno); // Only used by EXTRA macro |
6669 | 4.45k | int _start_col_offset = p->tokens[_mark]->col_offset; |
6670 | 4.45k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
6671 | 4.45k | if (p->call_invalid_rules) { // invalid_with_stmt_indent |
6672 | 1.89k | if (p->error_indicator) { |
6673 | 0 | p->level--; |
6674 | 0 | return NULL; |
6675 | 0 | } |
6676 | 1.89k | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt_indent")); |
6677 | 1.89k | void *invalid_with_stmt_indent_var; |
6678 | 1.89k | if ( |
6679 | 1.89k | (invalid_with_stmt_indent_var = invalid_with_stmt_indent_rule(p)) // invalid_with_stmt_indent |
6680 | 1.89k | ) |
6681 | 0 | { |
6682 | 0 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt_indent")); |
6683 | 0 | _res = invalid_with_stmt_indent_var; |
6684 | 0 | goto done; |
6685 | 0 | } |
6686 | 1.89k | p->mark = _mark; |
6687 | 1.89k | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6688 | 1.89k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_stmt_indent")); |
6689 | 1.89k | } |
6690 | 4.45k | { // 'with' '(' ','.with_item+ ','? ')' ':' TYPE_COMMENT? block |
6691 | 4.45k | if (p->error_indicator) { |
6692 | 45 | p->level--; |
6693 | 45 | return NULL; |
6694 | 45 | } |
6695 | 4.40k | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' TYPE_COMMENT? block")); |
6696 | 4.40k | Token * _keyword; |
6697 | 4.40k | Token * _literal; |
6698 | 4.40k | Token * _literal_1; |
6699 | 4.40k | Token * _literal_2; |
6700 | 4.40k | void *_opt_var; |
6701 | 4.40k | UNUSED(_opt_var); // Silence compiler warnings |
6702 | 4.40k | asdl_withitem_seq* a; |
6703 | 4.40k | asdl_stmt_seq* b; |
6704 | 4.40k | void *tc; |
6705 | 4.40k | if ( |
6706 | 4.40k | (_keyword = _PyPegen_expect_token(p, 656)) // token='with' |
6707 | 2.58k | && |
6708 | 2.58k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
6709 | 1.62k | && |
6710 | 1.62k | (a = (asdl_withitem_seq*)_gather_34_rule(p)) // ','.with_item+ |
6711 | 1.19k | && |
6712 | 1.19k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
6713 | 1.19k | && |
6714 | 1.19k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
6715 | 1.01k | && |
6716 | 1.01k | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
6717 | 349 | && |
6718 | 349 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
6719 | 348 | && |
6720 | 348 | (b = block_rule(p)) // block |
6721 | 4.40k | ) |
6722 | 315 | { |
6723 | 315 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' TYPE_COMMENT? block")); |
6724 | 315 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6725 | 315 | if (_token == NULL) { |
6726 | 0 | p->level--; |
6727 | 0 | return NULL; |
6728 | 0 | } |
6729 | 315 | int _end_lineno = _token->end_lineno; |
6730 | 315 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6731 | 315 | int _end_col_offset = _token->end_col_offset; |
6732 | 315 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6733 | 315 | _res = _PyAST_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
6734 | 315 | if (_res == NULL && PyErr_Occurred()) { |
6735 | 0 | p->error_indicator = 1; |
6736 | 0 | p->level--; |
6737 | 0 | return NULL; |
6738 | 0 | } |
6739 | 315 | goto done; |
6740 | 315 | } |
6741 | 4.09k | p->mark = _mark; |
6742 | 4.09k | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6743 | 4.09k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' TYPE_COMMENT? block")); |
6744 | 4.09k | } |
6745 | 0 | { // 'with' ','.with_item+ ':' TYPE_COMMENT? block |
6746 | 4.09k | if (p->error_indicator) { |
6747 | 17 | p->level--; |
6748 | 17 | return NULL; |
6749 | 17 | } |
6750 | 4.07k | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
6751 | 4.07k | Token * _keyword; |
6752 | 4.07k | Token * _literal; |
6753 | 4.07k | asdl_withitem_seq* a; |
6754 | 4.07k | asdl_stmt_seq* b; |
6755 | 4.07k | void *tc; |
6756 | 4.07k | if ( |
6757 | 4.07k | (_keyword = _PyPegen_expect_token(p, 656)) // token='with' |
6758 | 2.24k | && |
6759 | 2.24k | (a = (asdl_withitem_seq*)_gather_34_rule(p)) // ','.with_item+ |
6760 | 2.07k | && |
6761 | 2.07k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
6762 | 1.95k | && |
6763 | 1.95k | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
6764 | 1.95k | && |
6765 | 1.95k | (b = block_rule(p)) // block |
6766 | 4.07k | ) |
6767 | 1.87k | { |
6768 | 1.87k | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
6769 | 1.87k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6770 | 1.87k | if (_token == NULL) { |
6771 | 0 | p->level--; |
6772 | 0 | return NULL; |
6773 | 0 | } |
6774 | 1.87k | int _end_lineno = _token->end_lineno; |
6775 | 1.87k | UNUSED(_end_lineno); // Only used by EXTRA macro |
6776 | 1.87k | int _end_col_offset = _token->end_col_offset; |
6777 | 1.87k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6778 | 1.87k | _res = _PyAST_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
6779 | 1.87k | if (_res == NULL && PyErr_Occurred()) { |
6780 | 0 | p->error_indicator = 1; |
6781 | 0 | p->level--; |
6782 | 0 | return NULL; |
6783 | 0 | } |
6784 | 1.87k | goto done; |
6785 | 1.87k | } |
6786 | 2.20k | p->mark = _mark; |
6787 | 2.20k | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6788 | 2.20k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
6789 | 2.20k | } |
6790 | 0 | { // 'async' 'with' '(' ','.with_item+ ','? ')' ':' block |
6791 | 2.20k | if (p->error_indicator) { |
6792 | 15 | p->level--; |
6793 | 15 | return NULL; |
6794 | 15 | } |
6795 | 2.18k | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async' 'with' '(' ','.with_item+ ','? ')' ':' block")); |
6796 | 2.18k | Token * _keyword; |
6797 | 2.18k | Token * _keyword_1; |
6798 | 2.18k | Token * _literal; |
6799 | 2.18k | Token * _literal_1; |
6800 | 2.18k | Token * _literal_2; |
6801 | 2.18k | void *_opt_var; |
6802 | 2.18k | UNUSED(_opt_var); // Silence compiler warnings |
6803 | 2.18k | asdl_withitem_seq* a; |
6804 | 2.18k | asdl_stmt_seq* b; |
6805 | 2.18k | if ( |
6806 | 2.18k | (_keyword = _PyPegen_expect_token(p, 707)) // token='async' |
6807 | 1.82k | && |
6808 | 1.82k | (_keyword_1 = _PyPegen_expect_token(p, 656)) // token='with' |
6809 | 1.09k | && |
6810 | 1.09k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
6811 | 744 | && |
6812 | 744 | (a = (asdl_withitem_seq*)_gather_34_rule(p)) // ','.with_item+ |
6813 | 693 | && |
6814 | 693 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
6815 | 692 | && |
6816 | 692 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
6817 | 562 | && |
6818 | 562 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
6819 | 527 | && |
6820 | 527 | (b = block_rule(p)) // block |
6821 | 2.18k | ) |
6822 | 515 | { |
6823 | 515 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async' 'with' '(' ','.with_item+ ','? ')' ':' block")); |
6824 | 515 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6825 | 515 | if (_token == NULL) { |
6826 | 0 | p->level--; |
6827 | 0 | return NULL; |
6828 | 0 | } |
6829 | 515 | int _end_lineno = _token->end_lineno; |
6830 | 515 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6831 | 515 | int _end_col_offset = _token->end_col_offset; |
6832 | 515 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6833 | 515 | _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _PyAST_AsyncWith ( a , b , NULL , EXTRA ) ); |
6834 | 515 | if (_res == NULL && PyErr_Occurred()) { |
6835 | 0 | p->error_indicator = 1; |
6836 | 0 | p->level--; |
6837 | 0 | return NULL; |
6838 | 0 | } |
6839 | 515 | goto done; |
6840 | 515 | } |
6841 | 1.67k | p->mark = _mark; |
6842 | 1.67k | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6843 | 1.67k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async' 'with' '(' ','.with_item+ ','? ')' ':' block")); |
6844 | 1.67k | } |
6845 | 0 | { // 'async' 'with' ','.with_item+ ':' TYPE_COMMENT? block |
6846 | 1.67k | if (p->error_indicator) { |
6847 | 6 | p->level--; |
6848 | 6 | return NULL; |
6849 | 6 | } |
6850 | 1.66k | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async' 'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
6851 | 1.66k | Token * _keyword; |
6852 | 1.66k | Token * _keyword_1; |
6853 | 1.66k | Token * _literal; |
6854 | 1.66k | asdl_withitem_seq* a; |
6855 | 1.66k | asdl_stmt_seq* b; |
6856 | 1.66k | void *tc; |
6857 | 1.66k | if ( |
6858 | 1.66k | (_keyword = _PyPegen_expect_token(p, 707)) // token='async' |
6859 | 1.30k | && |
6860 | 1.30k | (_keyword_1 = _PyPegen_expect_token(p, 656)) // token='with' |
6861 | 571 | && |
6862 | 571 | (a = (asdl_withitem_seq*)_gather_34_rule(p)) // ','.with_item+ |
6863 | 553 | && |
6864 | 553 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
6865 | 535 | && |
6866 | 535 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator) // TYPE_COMMENT? |
6867 | 534 | && |
6868 | 534 | (b = block_rule(p)) // block |
6869 | 1.66k | ) |
6870 | 505 | { |
6871 | 505 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async' 'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
6872 | 505 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
6873 | 505 | if (_token == NULL) { |
6874 | 0 | p->level--; |
6875 | 0 | return NULL; |
6876 | 0 | } |
6877 | 505 | int _end_lineno = _token->end_lineno; |
6878 | 505 | UNUSED(_end_lineno); // Only used by EXTRA macro |
6879 | 505 | int _end_col_offset = _token->end_col_offset; |
6880 | 505 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
6881 | 505 | _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _PyAST_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
6882 | 505 | if (_res == NULL && PyErr_Occurred()) { |
6883 | 0 | p->error_indicator = 1; |
6884 | 0 | p->level--; |
6885 | 0 | return NULL; |
6886 | 0 | } |
6887 | 505 | goto done; |
6888 | 505 | } |
6889 | 1.16k | p->mark = _mark; |
6890 | 1.16k | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6891 | 1.16k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async' 'with' ','.with_item+ ':' TYPE_COMMENT? block")); |
6892 | 1.16k | } |
6893 | 1.16k | if (p->call_invalid_rules) { // invalid_with_stmt |
6894 | 509 | if (p->error_indicator) { |
6895 | 4 | p->level--; |
6896 | 4 | return NULL; |
6897 | 4 | } |
6898 | 505 | D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt")); |
6899 | 505 | void *invalid_with_stmt_var; |
6900 | 505 | if ( |
6901 | 505 | (invalid_with_stmt_var = invalid_with_stmt_rule(p)) // invalid_with_stmt |
6902 | 505 | ) |
6903 | 0 | { |
6904 | 0 | D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt")); |
6905 | 0 | _res = invalid_with_stmt_var; |
6906 | 0 | goto done; |
6907 | 0 | } |
6908 | 505 | p->mark = _mark; |
6909 | 505 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
6910 | 505 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_stmt")); |
6911 | 505 | } |
6912 | 1.15k | _res = NULL; |
6913 | 4.36k | done: |
6914 | 4.36k | p->level--; |
6915 | 4.36k | return _res; |
6916 | 1.15k | } |
6917 | | |
6918 | | // with_item: |
6919 | | // | expression 'as' star_target &(',' | ')' | ':') |
6920 | | // | invalid_with_item |
6921 | | // | expression |
6922 | | static withitem_ty |
6923 | | with_item_rule(Parser *p) |
6924 | 9.97k | { |
6925 | 9.97k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
6926 | 0 | _Pypegen_stack_overflow(p); |
6927 | 0 | } |
6928 | 9.97k | if (p->error_indicator) { |
6929 | 0 | p->level--; |
6930 | 0 | return NULL; |
6931 | 0 | } |
6932 | 9.97k | withitem_ty _res = NULL; |
6933 | 9.97k | int _mark = p->mark; |
6934 | 9.97k | { // expression 'as' star_target &(',' | ')' | ':') |
6935 | 9.97k | if (p->error_indicator) { |
6936 | 0 | p->level--; |
6937 | 0 | return NULL; |
6938 | 0 | } |
6939 | 9.97k | D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')")); |
6940 | 9.97k | Token * _keyword; |
6941 | 9.97k | expr_ty e; |
6942 | 9.97k | expr_ty t; |
6943 | 9.97k | if ( |
6944 | 9.97k | (e = expression_rule(p)) // expression |
6945 | 8.49k | && |
6946 | 8.49k | (_keyword = _PyPegen_expect_token(p, 689)) // token='as' |
6947 | 1.30k | && |
6948 | 1.30k | (t = star_target_rule(p)) // star_target |
6949 | 1.29k | && |
6950 | 1.29k | _PyPegen_lookahead(1, _tmp_35_rule, p) |
6951 | 9.97k | ) |
6952 | 1.28k | { |
6953 | 1.28k | D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')")); |
6954 | 1.28k | _res = _PyAST_withitem ( e , t , p -> arena ); |
6955 | 1.28k | if (_res == NULL && PyErr_Occurred()) { |
6956 | 0 | p->error_indicator = 1; |
6957 | 0 | p->level--; |
6958 | 0 | return NULL; |
6959 | 0 | } |
6960 | 1.28k | goto done; |
6961 | 1.28k | } |
6962 | 8.69k | p->mark = _mark; |
6963 | 8.69k | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ', |
6964 | 8.69k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')")); |
6965 | 8.69k | } |
6966 | 8.69k | if (p->call_invalid_rules) { // invalid_with_item |
6967 | 3.48k | if (p->error_indicator) { |
6968 | 0 | p->level--; |
6969 | 0 | return NULL; |
6970 | 0 | } |
6971 | 3.48k | D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item")); |
6972 | 3.48k | void *invalid_with_item_var; |
6973 | 3.48k | if ( |
6974 | 3.48k | (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item |
6975 | 3.48k | ) |
6976 | 0 | { |
6977 | 0 | D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item")); |
6978 | 0 | _res = invalid_with_item_var; |
6979 | 0 | goto done; |
6980 | 0 | } |
6981 | 3.48k | p->mark = _mark; |
6982 | 3.48k | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ', |
6983 | 3.48k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item")); |
6984 | 3.48k | } |
6985 | 8.69k | { // expression |
6986 | 8.69k | if (p->error_indicator) { |
6987 | 20 | p->level--; |
6988 | 20 | return NULL; |
6989 | 20 | } |
6990 | 8.67k | D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); |
6991 | 8.67k | expr_ty e; |
6992 | 8.67k | if ( |
6993 | 8.67k | (e = expression_rule(p)) // expression |
6994 | 8.67k | ) |
6995 | 7.20k | { |
6996 | 7.20k | D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); |
6997 | 7.20k | _res = _PyAST_withitem ( e , NULL , p -> arena ); |
6998 | 7.20k | if (_res == NULL && PyErr_Occurred()) { |
6999 | 0 | p->error_indicator = 1; |
7000 | 0 | p->level--; |
7001 | 0 | return NULL; |
7002 | 0 | } |
7003 | 7.20k | goto done; |
7004 | 7.20k | } |
7005 | 1.47k | p->mark = _mark; |
7006 | 1.47k | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ', |
7007 | 1.47k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
7008 | 1.47k | } |
7009 | 1.47k | _res = NULL; |
7010 | 9.95k | done: |
7011 | 9.95k | p->level--; |
7012 | 9.95k | return _res; |
7013 | 1.47k | } |
7014 | | |
7015 | | // try_stmt: |
7016 | | // | invalid_try_stmt |
7017 | | // | 'try' &&':' block finally_block |
7018 | | // | 'try' &&':' block except_block+ else_block? finally_block? |
7019 | | // | 'try' &&':' block except_star_block+ else_block? finally_block? |
7020 | | static stmt_ty |
7021 | | try_stmt_rule(Parser *p) |
7022 | 6.23k | { |
7023 | 6.23k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
7024 | 0 | _Pypegen_stack_overflow(p); |
7025 | 0 | } |
7026 | 6.23k | if (p->error_indicator) { |
7027 | 0 | p->level--; |
7028 | 0 | return NULL; |
7029 | 0 | } |
7030 | 6.23k | stmt_ty _res = NULL; |
7031 | 6.23k | int _mark = p->mark; |
7032 | 6.23k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
7033 | 0 | p->error_indicator = 1; |
7034 | 0 | p->level--; |
7035 | 0 | return NULL; |
7036 | 0 | } |
7037 | 6.23k | int _start_lineno = p->tokens[_mark]->lineno; |
7038 | 6.23k | UNUSED(_start_lineno); // Only used by EXTRA macro |
7039 | 6.23k | int _start_col_offset = p->tokens[_mark]->col_offset; |
7040 | 6.23k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
7041 | 6.23k | if (p->call_invalid_rules) { // invalid_try_stmt |
7042 | 2.01k | if (p->error_indicator) { |
7043 | 0 | p->level--; |
7044 | 0 | return NULL; |
7045 | 0 | } |
7046 | 2.01k | D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_try_stmt")); |
7047 | 2.01k | void *invalid_try_stmt_var; |
7048 | 2.01k | if ( |
7049 | 2.01k | (invalid_try_stmt_var = invalid_try_stmt_rule(p)) // invalid_try_stmt |
7050 | 2.01k | ) |
7051 | 0 | { |
7052 | 0 | D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_try_stmt")); |
7053 | 0 | _res = invalid_try_stmt_var; |
7054 | 0 | goto done; |
7055 | 0 | } |
7056 | 2.01k | p->mark = _mark; |
7057 | 2.01k | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
7058 | 2.01k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_try_stmt")); |
7059 | 2.01k | } |
7060 | 6.23k | { // 'try' &&':' block finally_block |
7061 | 6.23k | if (p->error_indicator) { |
7062 | 135 | p->level--; |
7063 | 135 | return NULL; |
7064 | 135 | } |
7065 | 6.10k | D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block finally_block")); |
7066 | 6.10k | Token * _keyword; |
7067 | 6.10k | Token * _literal; |
7068 | 6.10k | asdl_stmt_seq* b; |
7069 | 6.10k | asdl_stmt_seq* f; |
7070 | 6.10k | if ( |
7071 | 6.10k | (_keyword = _PyPegen_expect_token(p, 665)) // token='try' |
7072 | 6.10k | && |
7073 | 6.10k | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
7074 | 6.09k | && |
7075 | 6.09k | (b = block_rule(p)) // block |
7076 | 5.91k | && |
7077 | 5.91k | (f = finally_block_rule(p)) // finally_block |
7078 | 6.10k | ) |
7079 | 1.15k | { |
7080 | 1.15k | D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block finally_block")); |
7081 | 1.15k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7082 | 1.15k | if (_token == NULL) { |
7083 | 0 | p->level--; |
7084 | 0 | return NULL; |
7085 | 0 | } |
7086 | 1.15k | int _end_lineno = _token->end_lineno; |
7087 | 1.15k | UNUSED(_end_lineno); // Only used by EXTRA macro |
7088 | 1.15k | int _end_col_offset = _token->end_col_offset; |
7089 | 1.15k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7090 | 1.15k | _res = _PyAST_Try ( b , NULL , NULL , f , EXTRA ); |
7091 | 1.15k | if (_res == NULL && PyErr_Occurred()) { |
7092 | 0 | p->error_indicator = 1; |
7093 | 0 | p->level--; |
7094 | 0 | return NULL; |
7095 | 0 | } |
7096 | 1.15k | goto done; |
7097 | 1.15k | } |
7098 | 4.94k | p->mark = _mark; |
7099 | 4.94k | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
7100 | 4.94k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block finally_block")); |
7101 | 4.94k | } |
7102 | 0 | { // 'try' &&':' block except_block+ else_block? finally_block? |
7103 | 4.94k | if (p->error_indicator) { |
7104 | 25 | p->level--; |
7105 | 25 | return NULL; |
7106 | 25 | } |
7107 | 4.91k | D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?")); |
7108 | 4.91k | Token * _keyword; |
7109 | 4.91k | Token * _literal; |
7110 | 4.91k | asdl_stmt_seq* b; |
7111 | 4.91k | void *el; |
7112 | 4.91k | asdl_excepthandler_seq* ex; |
7113 | 4.91k | void *f; |
7114 | 4.91k | if ( |
7115 | 4.91k | (_keyword = _PyPegen_expect_token(p, 665)) // token='try' |
7116 | 4.91k | && |
7117 | 4.91k | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
7118 | 4.91k | && |
7119 | 4.91k | (b = block_rule(p)) // block |
7120 | 4.75k | && |
7121 | 4.75k | (ex = (asdl_excepthandler_seq*)_loop1_36_rule(p)) // except_block+ |
7122 | 2.91k | && |
7123 | 2.91k | (el = else_block_rule(p), !p->error_indicator) // else_block? |
7124 | 2.91k | && |
7125 | 2.91k | (f = finally_block_rule(p), !p->error_indicator) // finally_block? |
7126 | 4.91k | ) |
7127 | 2.91k | { |
7128 | 2.91k | D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?")); |
7129 | 2.91k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7130 | 2.91k | if (_token == NULL) { |
7131 | 0 | p->level--; |
7132 | 0 | return NULL; |
7133 | 0 | } |
7134 | 2.91k | int _end_lineno = _token->end_lineno; |
7135 | 2.91k | UNUSED(_end_lineno); // Only used by EXTRA macro |
7136 | 2.91k | int _end_col_offset = _token->end_col_offset; |
7137 | 2.91k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7138 | 2.91k | _res = _PyAST_Try ( b , ex , el , f , EXTRA ); |
7139 | 2.91k | if (_res == NULL && PyErr_Occurred()) { |
7140 | 0 | p->error_indicator = 1; |
7141 | 0 | p->level--; |
7142 | 0 | return NULL; |
7143 | 0 | } |
7144 | 2.91k | goto done; |
7145 | 2.91k | } |
7146 | 2.00k | p->mark = _mark; |
7147 | 2.00k | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
7148 | 2.00k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?")); |
7149 | 2.00k | } |
7150 | 0 | { // 'try' &&':' block except_star_block+ else_block? finally_block? |
7151 | 2.00k | if (p->error_indicator) { |
7152 | 10 | p->level--; |
7153 | 10 | return NULL; |
7154 | 10 | } |
7155 | 1.99k | D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_star_block+ else_block? finally_block?")); |
7156 | 1.99k | Token * _keyword; |
7157 | 1.99k | Token * _literal; |
7158 | 1.99k | asdl_stmt_seq* b; |
7159 | 1.99k | void *el; |
7160 | 1.99k | asdl_excepthandler_seq* ex; |
7161 | 1.99k | void *f; |
7162 | 1.99k | if ( |
7163 | 1.99k | (_keyword = _PyPegen_expect_token(p, 665)) // token='try' |
7164 | 1.99k | && |
7165 | 1.99k | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
7166 | 1.99k | && |
7167 | 1.99k | (b = block_rule(p)) // block |
7168 | 1.83k | && |
7169 | 1.83k | (ex = (asdl_excepthandler_seq*)_loop1_37_rule(p)) // except_star_block+ |
7170 | 1.64k | && |
7171 | 1.64k | (el = else_block_rule(p), !p->error_indicator) // else_block? |
7172 | 1.64k | && |
7173 | 1.64k | (f = finally_block_rule(p), !p->error_indicator) // finally_block? |
7174 | 1.99k | ) |
7175 | 1.63k | { |
7176 | 1.63k | D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_star_block+ else_block? finally_block?")); |
7177 | 1.63k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7178 | 1.63k | if (_token == NULL) { |
7179 | 0 | p->level--; |
7180 | 0 | return NULL; |
7181 | 0 | } |
7182 | 1.63k | int _end_lineno = _token->end_lineno; |
7183 | 1.63k | UNUSED(_end_lineno); // Only used by EXTRA macro |
7184 | 1.63k | int _end_col_offset = _token->end_col_offset; |
7185 | 1.63k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7186 | 1.63k | _res = CHECK_VERSION ( stmt_ty , 11 , "Exception groups are" , _PyAST_TryStar ( b , ex , el , f , EXTRA ) ); |
7187 | 1.63k | if (_res == NULL && PyErr_Occurred()) { |
7188 | 0 | p->error_indicator = 1; |
7189 | 0 | p->level--; |
7190 | 0 | return NULL; |
7191 | 0 | } |
7192 | 1.63k | goto done; |
7193 | 1.63k | } |
7194 | 353 | p->mark = _mark; |
7195 | 353 | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
7196 | 353 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block except_star_block+ else_block? finally_block?")); |
7197 | 353 | } |
7198 | 353 | _res = NULL; |
7199 | 6.06k | done: |
7200 | 6.06k | p->level--; |
7201 | 6.06k | return _res; |
7202 | 353 | } |
7203 | | |
7204 | | // except_block: |
7205 | | // | invalid_except_stmt_indent |
7206 | | // | 'except' expression ':' block |
7207 | | // | 'except' expression 'as' NAME ':' block |
7208 | | // | 'except' expressions ':' block |
7209 | | // | 'except' ':' block |
7210 | | // | invalid_except_stmt |
7211 | | static excepthandler_ty |
7212 | | except_block_rule(Parser *p) |
7213 | 13.2k | { |
7214 | 13.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
7215 | 0 | _Pypegen_stack_overflow(p); |
7216 | 0 | } |
7217 | 13.2k | if (p->error_indicator) { |
7218 | 0 | p->level--; |
7219 | 0 | return NULL; |
7220 | 0 | } |
7221 | 13.2k | excepthandler_ty _res = NULL; |
7222 | 13.2k | int _mark = p->mark; |
7223 | 13.2k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
7224 | 2 | p->error_indicator = 1; |
7225 | 2 | p->level--; |
7226 | 2 | return NULL; |
7227 | 2 | } |
7228 | 13.2k | int _start_lineno = p->tokens[_mark]->lineno; |
7229 | 13.2k | UNUSED(_start_lineno); // Only used by EXTRA macro |
7230 | 13.2k | int _start_col_offset = p->tokens[_mark]->col_offset; |
7231 | 13.2k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
7232 | 13.2k | if (p->call_invalid_rules) { // invalid_except_stmt_indent |
7233 | 6.51k | if (p->error_indicator) { |
7234 | 0 | p->level--; |
7235 | 0 | return NULL; |
7236 | 0 | } |
7237 | 6.51k | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt_indent")); |
7238 | 6.51k | void *invalid_except_stmt_indent_var; |
7239 | 6.51k | if ( |
7240 | 6.51k | (invalid_except_stmt_indent_var = invalid_except_stmt_indent_rule(p)) // invalid_except_stmt_indent |
7241 | 6.51k | ) |
7242 | 0 | { |
7243 | 0 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt_indent")); |
7244 | 0 | _res = invalid_except_stmt_indent_var; |
7245 | 0 | goto done; |
7246 | 0 | } |
7247 | 6.51k | p->mark = _mark; |
7248 | 6.51k | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
7249 | 6.51k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_stmt_indent")); |
7250 | 6.51k | } |
7251 | 13.2k | { // 'except' expression ':' block |
7252 | 13.2k | if (p->error_indicator) { |
7253 | 5 | p->level--; |
7254 | 5 | return NULL; |
7255 | 5 | } |
7256 | 13.2k | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ':' block")); |
7257 | 13.2k | Token * _keyword; |
7258 | 13.2k | Token * _literal; |
7259 | 13.2k | asdl_stmt_seq* b; |
7260 | 13.2k | expr_ty e; |
7261 | 13.2k | if ( |
7262 | 13.2k | (_keyword = _PyPegen_expect_token(p, 686)) // token='except' |
7263 | 9.14k | && |
7264 | 9.14k | (e = expression_rule(p)) // expression |
7265 | 2.54k | && |
7266 | 2.54k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
7267 | 1.49k | && |
7268 | 1.49k | (b = block_rule(p)) // block |
7269 | 13.2k | ) |
7270 | 1.45k | { |
7271 | 1.45k | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ':' block")); |
7272 | 1.45k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7273 | 1.45k | if (_token == NULL) { |
7274 | 0 | p->level--; |
7275 | 0 | return NULL; |
7276 | 0 | } |
7277 | 1.45k | int _end_lineno = _token->end_lineno; |
7278 | 1.45k | UNUSED(_end_lineno); // Only used by EXTRA macro |
7279 | 1.45k | int _end_col_offset = _token->end_col_offset; |
7280 | 1.45k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7281 | 1.45k | _res = _PyAST_ExceptHandler ( e , NULL , b , EXTRA ); |
7282 | 1.45k | if (_res == NULL && PyErr_Occurred()) { |
7283 | 0 | p->error_indicator = 1; |
7284 | 0 | p->level--; |
7285 | 0 | return NULL; |
7286 | 0 | } |
7287 | 1.45k | goto done; |
7288 | 1.45k | } |
7289 | 11.7k | p->mark = _mark; |
7290 | 11.7k | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
7291 | 11.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ':' block")); |
7292 | 11.7k | } |
7293 | 0 | { // 'except' expression 'as' NAME ':' block |
7294 | 11.7k | if (p->error_indicator) { |
7295 | 8 | p->level--; |
7296 | 8 | return NULL; |
7297 | 8 | } |
7298 | 11.7k | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression 'as' NAME ':' block")); |
7299 | 11.7k | Token * _keyword; |
7300 | 11.7k | Token * _keyword_1; |
7301 | 11.7k | Token * _literal; |
7302 | 11.7k | asdl_stmt_seq* b; |
7303 | 11.7k | expr_ty e; |
7304 | 11.7k | expr_ty t; |
7305 | 11.7k | if ( |
7306 | 11.7k | (_keyword = _PyPegen_expect_token(p, 686)) // token='except' |
7307 | 7.67k | && |
7308 | 7.67k | (e = expression_rule(p)) // expression |
7309 | 1.08k | && |
7310 | 1.08k | (_keyword_1 = _PyPegen_expect_token(p, 689)) // token='as' |
7311 | 465 | && |
7312 | 465 | (t = _PyPegen_name_token(p)) // NAME |
7313 | 446 | && |
7314 | 446 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
7315 | 440 | && |
7316 | 440 | (b = block_rule(p)) // block |
7317 | 11.7k | ) |
7318 | 427 | { |
7319 | 427 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression 'as' NAME ':' block")); |
7320 | 427 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7321 | 427 | if (_token == NULL) { |
7322 | 0 | p->level--; |
7323 | 0 | return NULL; |
7324 | 0 | } |
7325 | 427 | int _end_lineno = _token->end_lineno; |
7326 | 427 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7327 | 427 | int _end_col_offset = _token->end_col_offset; |
7328 | 427 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7329 | 427 | _res = _PyAST_ExceptHandler ( e , ( ( expr_ty ) t ) -> v . Name . id , b , EXTRA ); |
7330 | 427 | if (_res == NULL && PyErr_Occurred()) { |
7331 | 0 | p->error_indicator = 1; |
7332 | 0 | p->level--; |
7333 | 0 | return NULL; |
7334 | 0 | } |
7335 | 427 | goto done; |
7336 | 427 | } |
7337 | 11.3k | p->mark = _mark; |
7338 | 11.3k | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
7339 | 11.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression 'as' NAME ':' block")); |
7340 | 11.3k | } |
7341 | 0 | { // 'except' expressions ':' block |
7342 | 11.3k | if (p->error_indicator) { |
7343 | 4 | p->level--; |
7344 | 4 | return NULL; |
7345 | 4 | } |
7346 | 11.3k | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expressions ':' block")); |
7347 | 11.3k | Token * _keyword; |
7348 | 11.3k | Token * _literal; |
7349 | 11.3k | asdl_stmt_seq* b; |
7350 | 11.3k | expr_ty e; |
7351 | 11.3k | if ( |
7352 | 11.3k | (_keyword = _PyPegen_expect_token(p, 686)) // token='except' |
7353 | 7.24k | && |
7354 | 7.24k | (e = expressions_rule(p)) // expressions |
7355 | 652 | && |
7356 | 652 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
7357 | 566 | && |
7358 | 566 | (b = block_rule(p)) // block |
7359 | 11.3k | ) |
7360 | 530 | { |
7361 | 530 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expressions ':' block")); |
7362 | 530 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7363 | 530 | if (_token == NULL) { |
7364 | 0 | p->level--; |
7365 | 0 | return NULL; |
7366 | 0 | } |
7367 | 530 | int _end_lineno = _token->end_lineno; |
7368 | 530 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7369 | 530 | int _end_col_offset = _token->end_col_offset; |
7370 | 530 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7371 | 530 | _res = CHECK_VERSION ( excepthandler_ty , 14 , "except expressions without parentheses are" , _PyAST_ExceptHandler ( e , NULL , b , EXTRA ) ); |
7372 | 530 | if (_res == NULL && PyErr_Occurred()) { |
7373 | 0 | p->error_indicator = 1; |
7374 | 0 | p->level--; |
7375 | 0 | return NULL; |
7376 | 0 | } |
7377 | 530 | goto done; |
7378 | 530 | } |
7379 | 10.7k | p->mark = _mark; |
7380 | 10.7k | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
7381 | 10.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expressions ':' block")); |
7382 | 10.7k | } |
7383 | 0 | { // 'except' ':' block |
7384 | 10.7k | if (p->error_indicator) { |
7385 | 1 | p->level--; |
7386 | 1 | return NULL; |
7387 | 1 | } |
7388 | 10.7k | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block")); |
7389 | 10.7k | Token * _keyword; |
7390 | 10.7k | Token * _literal; |
7391 | 10.7k | asdl_stmt_seq* b; |
7392 | 10.7k | if ( |
7393 | 10.7k | (_keyword = _PyPegen_expect_token(p, 686)) // token='except' |
7394 | 6.71k | && |
7395 | 6.71k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
7396 | 4.17k | && |
7397 | 4.17k | (b = block_rule(p)) // block |
7398 | 10.7k | ) |
7399 | 4.09k | { |
7400 | 4.09k | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block")); |
7401 | 4.09k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7402 | 4.09k | if (_token == NULL) { |
7403 | 0 | p->level--; |
7404 | 0 | return NULL; |
7405 | 0 | } |
7406 | 4.09k | int _end_lineno = _token->end_lineno; |
7407 | 4.09k | UNUSED(_end_lineno); // Only used by EXTRA macro |
7408 | 4.09k | int _end_col_offset = _token->end_col_offset; |
7409 | 4.09k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7410 | 4.09k | _res = _PyAST_ExceptHandler ( NULL , NULL , b , EXTRA ); |
7411 | 4.09k | if (_res == NULL && PyErr_Occurred()) { |
7412 | 0 | p->error_indicator = 1; |
7413 | 0 | p->level--; |
7414 | 0 | return NULL; |
7415 | 0 | } |
7416 | 4.09k | goto done; |
7417 | 4.09k | } |
7418 | 6.68k | p->mark = _mark; |
7419 | 6.68k | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
7420 | 6.68k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block")); |
7421 | 6.68k | } |
7422 | 6.68k | if (p->call_invalid_rules) { // invalid_except_stmt |
7423 | 3.31k | if (p->error_indicator) { |
7424 | 12 | p->level--; |
7425 | 12 | return NULL; |
7426 | 12 | } |
7427 | 3.29k | D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt")); |
7428 | 3.29k | void *invalid_except_stmt_var; |
7429 | 3.29k | if ( |
7430 | 3.29k | (invalid_except_stmt_var = invalid_except_stmt_rule(p)) // invalid_except_stmt |
7431 | 3.29k | ) |
7432 | 0 | { |
7433 | 0 | D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt")); |
7434 | 0 | _res = invalid_except_stmt_var; |
7435 | 0 | goto done; |
7436 | 0 | } |
7437 | 3.29k | p->mark = _mark; |
7438 | 3.29k | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
7439 | 3.29k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_stmt")); |
7440 | 3.29k | } |
7441 | 6.67k | _res = NULL; |
7442 | 13.1k | done: |
7443 | 13.1k | p->level--; |
7444 | 13.1k | return _res; |
7445 | 6.67k | } |
7446 | | |
7447 | | // except_star_block: |
7448 | | // | invalid_except_star_stmt_indent |
7449 | | // | 'except' '*' expression ':' block |
7450 | | // | 'except' '*' expression 'as' NAME ':' block |
7451 | | // | 'except' '*' expressions ':' block |
7452 | | // | invalid_except_star_stmt |
7453 | | static excepthandler_ty |
7454 | | except_star_block_rule(Parser *p) |
7455 | 7.64k | { |
7456 | 7.64k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
7457 | 0 | _Pypegen_stack_overflow(p); |
7458 | 0 | } |
7459 | 7.64k | if (p->error_indicator) { |
7460 | 0 | p->level--; |
7461 | 0 | return NULL; |
7462 | 0 | } |
7463 | 7.64k | excepthandler_ty _res = NULL; |
7464 | 7.64k | int _mark = p->mark; |
7465 | 7.64k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
7466 | 1 | p->error_indicator = 1; |
7467 | 1 | p->level--; |
7468 | 1 | return NULL; |
7469 | 1 | } |
7470 | 7.64k | int _start_lineno = p->tokens[_mark]->lineno; |
7471 | 7.64k | UNUSED(_start_lineno); // Only used by EXTRA macro |
7472 | 7.64k | int _start_col_offset = p->tokens[_mark]->col_offset; |
7473 | 7.64k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
7474 | 7.64k | if (p->call_invalid_rules) { // invalid_except_star_stmt_indent |
7475 | 4.74k | if (p->error_indicator) { |
7476 | 0 | p->level--; |
7477 | 0 | return NULL; |
7478 | 0 | } |
7479 | 4.74k | D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt_indent")); |
7480 | 4.74k | void *invalid_except_star_stmt_indent_var; |
7481 | 4.74k | if ( |
7482 | 4.74k | (invalid_except_star_stmt_indent_var = invalid_except_star_stmt_indent_rule(p)) // invalid_except_star_stmt_indent |
7483 | 4.74k | ) |
7484 | 0 | { |
7485 | 0 | D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt_indent")); |
7486 | 0 | _res = invalid_except_star_stmt_indent_var; |
7487 | 0 | goto done; |
7488 | 0 | } |
7489 | 4.74k | p->mark = _mark; |
7490 | 4.74k | D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ', |
7491 | 4.74k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_star_stmt_indent")); |
7492 | 4.74k | } |
7493 | 7.64k | { // 'except' '*' expression ':' block |
7494 | 7.64k | if (p->error_indicator) { |
7495 | 5 | p->level--; |
7496 | 5 | return NULL; |
7497 | 5 | } |
7498 | 7.63k | D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ':' block")); |
7499 | 7.63k | Token * _keyword; |
7500 | 7.63k | Token * _literal; |
7501 | 7.63k | Token * _literal_1; |
7502 | 7.63k | asdl_stmt_seq* b; |
7503 | 7.63k | expr_ty e; |
7504 | 7.63k | if ( |
7505 | 7.63k | (_keyword = _PyPegen_expect_token(p, 686)) // token='except' |
7506 | 4.89k | && |
7507 | 4.89k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
7508 | 4.04k | && |
7509 | 4.04k | (e = expression_rule(p)) // expression |
7510 | 4.01k | && |
7511 | 4.01k | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
7512 | 3.20k | && |
7513 | 3.20k | (b = block_rule(p)) // block |
7514 | 7.63k | ) |
7515 | 3.17k | { |
7516 | 3.17k | D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ':' block")); |
7517 | 3.17k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7518 | 3.17k | if (_token == NULL) { |
7519 | 0 | p->level--; |
7520 | 0 | return NULL; |
7521 | 0 | } |
7522 | 3.17k | int _end_lineno = _token->end_lineno; |
7523 | 3.17k | UNUSED(_end_lineno); // Only used by EXTRA macro |
7524 | 3.17k | int _end_col_offset = _token->end_col_offset; |
7525 | 3.17k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7526 | 3.17k | _res = _PyAST_ExceptHandler ( e , NULL , b , EXTRA ); |
7527 | 3.17k | if (_res == NULL && PyErr_Occurred()) { |
7528 | 0 | p->error_indicator = 1; |
7529 | 0 | p->level--; |
7530 | 0 | return NULL; |
7531 | 0 | } |
7532 | 3.17k | goto done; |
7533 | 3.17k | } |
7534 | 4.45k | p->mark = _mark; |
7535 | 4.45k | D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ', |
7536 | 4.45k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ':' block")); |
7537 | 4.45k | } |
7538 | 0 | { // 'except' '*' expression 'as' NAME ':' block |
7539 | 4.45k | if (p->error_indicator) { |
7540 | 3 | p->level--; |
7541 | 3 | return NULL; |
7542 | 3 | } |
7543 | 4.45k | D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression 'as' NAME ':' block")); |
7544 | 4.45k | Token * _keyword; |
7545 | 4.45k | Token * _keyword_1; |
7546 | 4.45k | Token * _literal; |
7547 | 4.45k | Token * _literal_1; |
7548 | 4.45k | asdl_stmt_seq* b; |
7549 | 4.45k | expr_ty e; |
7550 | 4.45k | expr_ty t; |
7551 | 4.45k | if ( |
7552 | 4.45k | (_keyword = _PyPegen_expect_token(p, 686)) // token='except' |
7553 | 1.71k | && |
7554 | 1.71k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
7555 | 859 | && |
7556 | 859 | (e = expression_rule(p)) // expression |
7557 | 829 | && |
7558 | 829 | (_keyword_1 = _PyPegen_expect_token(p, 689)) // token='as' |
7559 | 240 | && |
7560 | 240 | (t = _PyPegen_name_token(p)) // NAME |
7561 | 230 | && |
7562 | 230 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
7563 | 224 | && |
7564 | 224 | (b = block_rule(p)) // block |
7565 | 4.45k | ) |
7566 | 218 | { |
7567 | 218 | D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression 'as' NAME ':' block")); |
7568 | 218 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7569 | 218 | if (_token == NULL) { |
7570 | 0 | p->level--; |
7571 | 0 | return NULL; |
7572 | 0 | } |
7573 | 218 | int _end_lineno = _token->end_lineno; |
7574 | 218 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7575 | 218 | int _end_col_offset = _token->end_col_offset; |
7576 | 218 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7577 | 218 | _res = _PyAST_ExceptHandler ( e , ( ( expr_ty ) t ) -> v . Name . id , b , EXTRA ); |
7578 | 218 | if (_res == NULL && PyErr_Occurred()) { |
7579 | 0 | p->error_indicator = 1; |
7580 | 0 | p->level--; |
7581 | 0 | return NULL; |
7582 | 0 | } |
7583 | 218 | goto done; |
7584 | 218 | } |
7585 | 4.23k | p->mark = _mark; |
7586 | 4.23k | D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ', |
7587 | 4.23k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression 'as' NAME ':' block")); |
7588 | 4.23k | } |
7589 | 0 | { // 'except' '*' expressions ':' block |
7590 | 4.23k | if (p->error_indicator) { |
7591 | 2 | p->level--; |
7592 | 2 | return NULL; |
7593 | 2 | } |
7594 | 4.23k | D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expressions ':' block")); |
7595 | 4.23k | Token * _keyword; |
7596 | 4.23k | Token * _literal; |
7597 | 4.23k | Token * _literal_1; |
7598 | 4.23k | asdl_stmt_seq* b; |
7599 | 4.23k | expr_ty e; |
7600 | 4.23k | if ( |
7601 | 4.23k | (_keyword = _PyPegen_expect_token(p, 686)) // token='except' |
7602 | 1.49k | && |
7603 | 1.49k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
7604 | 639 | && |
7605 | 639 | (e = expressions_rule(p)) // expressions |
7606 | 609 | && |
7607 | 609 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
7608 | 532 | && |
7609 | 532 | (b = block_rule(p)) // block |
7610 | 4.23k | ) |
7611 | 505 | { |
7612 | 505 | D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expressions ':' block")); |
7613 | 505 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7614 | 505 | if (_token == NULL) { |
7615 | 0 | p->level--; |
7616 | 0 | return NULL; |
7617 | 0 | } |
7618 | 505 | int _end_lineno = _token->end_lineno; |
7619 | 505 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7620 | 505 | int _end_col_offset = _token->end_col_offset; |
7621 | 505 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7622 | 505 | _res = CHECK_VERSION ( excepthandler_ty , 14 , "except expressions without parentheses are" , _PyAST_ExceptHandler ( e , NULL , b , EXTRA ) ); |
7623 | 505 | if (_res == NULL && PyErr_Occurred()) { |
7624 | 0 | p->error_indicator = 1; |
7625 | 0 | p->level--; |
7626 | 0 | return NULL; |
7627 | 0 | } |
7628 | 505 | goto done; |
7629 | 505 | } |
7630 | 3.72k | p->mark = _mark; |
7631 | 3.72k | D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ', |
7632 | 3.72k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expressions ':' block")); |
7633 | 3.72k | } |
7634 | 3.72k | if (p->call_invalid_rules) { // invalid_except_star_stmt |
7635 | 2.56k | if (p->error_indicator) { |
7636 | 1 | p->level--; |
7637 | 1 | return NULL; |
7638 | 1 | } |
7639 | 2.56k | D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt")); |
7640 | 2.56k | void *invalid_except_star_stmt_var; |
7641 | 2.56k | if ( |
7642 | 2.56k | (invalid_except_star_stmt_var = invalid_except_star_stmt_rule(p)) // invalid_except_star_stmt |
7643 | 2.56k | ) |
7644 | 0 | { |
7645 | 0 | D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt")); |
7646 | 0 | _res = invalid_except_star_stmt_var; |
7647 | 0 | goto done; |
7648 | 0 | } |
7649 | 2.56k | p->mark = _mark; |
7650 | 2.56k | D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ', |
7651 | 2.56k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_star_stmt")); |
7652 | 2.56k | } |
7653 | 3.72k | _res = NULL; |
7654 | 7.63k | done: |
7655 | 7.63k | p->level--; |
7656 | 7.63k | return _res; |
7657 | 3.72k | } |
7658 | | |
7659 | | // finally_block: invalid_finally_stmt | 'finally' &&':' block |
7660 | | static asdl_stmt_seq* |
7661 | | finally_block_rule(Parser *p) |
7662 | 10.4k | { |
7663 | 10.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
7664 | 0 | _Pypegen_stack_overflow(p); |
7665 | 0 | } |
7666 | 10.4k | if (p->error_indicator) { |
7667 | 0 | p->level--; |
7668 | 0 | return NULL; |
7669 | 0 | } |
7670 | 10.4k | asdl_stmt_seq* _res = NULL; |
7671 | 10.4k | int _mark = p->mark; |
7672 | 10.4k | if (p->call_invalid_rules) { // invalid_finally_stmt |
7673 | 3.13k | if (p->error_indicator) { |
7674 | 0 | p->level--; |
7675 | 0 | return NULL; |
7676 | 0 | } |
7677 | 3.13k | D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_finally_stmt")); |
7678 | 3.13k | void *invalid_finally_stmt_var; |
7679 | 3.13k | if ( |
7680 | 3.13k | (invalid_finally_stmt_var = invalid_finally_stmt_rule(p)) // invalid_finally_stmt |
7681 | 3.13k | ) |
7682 | 0 | { |
7683 | 0 | D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_finally_stmt")); |
7684 | 0 | _res = invalid_finally_stmt_var; |
7685 | 0 | goto done; |
7686 | 0 | } |
7687 | 3.13k | p->mark = _mark; |
7688 | 3.13k | D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ', |
7689 | 3.13k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_finally_stmt")); |
7690 | 3.13k | } |
7691 | 10.4k | { // 'finally' &&':' block |
7692 | 10.4k | if (p->error_indicator) { |
7693 | 1 | p->level--; |
7694 | 1 | return NULL; |
7695 | 1 | } |
7696 | 10.4k | D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' &&':' block")); |
7697 | 10.4k | Token * _keyword; |
7698 | 10.4k | Token * _literal; |
7699 | 10.4k | asdl_stmt_seq* a; |
7700 | 10.4k | if ( |
7701 | 10.4k | (_keyword = _PyPegen_expect_token(p, 682)) // token='finally' |
7702 | 1.18k | && |
7703 | 1.18k | (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
7704 | 1.18k | && |
7705 | 1.18k | (a = block_rule(p)) // block |
7706 | 10.4k | ) |
7707 | 1.16k | { |
7708 | 1.16k | D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' &&':' block")); |
7709 | 1.16k | _res = a; |
7710 | 1.16k | if (_res == NULL && PyErr_Occurred()) { |
7711 | 0 | p->error_indicator = 1; |
7712 | 0 | p->level--; |
7713 | 0 | return NULL; |
7714 | 0 | } |
7715 | 1.16k | goto done; |
7716 | 1.16k | } |
7717 | 9.30k | p->mark = _mark; |
7718 | 9.30k | D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ', |
7719 | 9.30k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' &&':' block")); |
7720 | 9.30k | } |
7721 | 9.30k | _res = NULL; |
7722 | 10.4k | done: |
7723 | 10.4k | p->level--; |
7724 | 10.4k | return _res; |
7725 | 9.30k | } |
7726 | | |
7727 | | // match_stmt: |
7728 | | // | "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT |
7729 | | // | invalid_match_stmt |
7730 | | static stmt_ty |
7731 | | match_stmt_rule(Parser *p) |
7732 | 136k | { |
7733 | 136k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
7734 | 0 | _Pypegen_stack_overflow(p); |
7735 | 0 | } |
7736 | 136k | if (p->error_indicator) { |
7737 | 0 | p->level--; |
7738 | 0 | return NULL; |
7739 | 0 | } |
7740 | 136k | stmt_ty _res = NULL; |
7741 | 136k | int _mark = p->mark; |
7742 | 136k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
7743 | 0 | p->error_indicator = 1; |
7744 | 0 | p->level--; |
7745 | 0 | return NULL; |
7746 | 0 | } |
7747 | 136k | int _start_lineno = p->tokens[_mark]->lineno; |
7748 | 136k | UNUSED(_start_lineno); // Only used by EXTRA macro |
7749 | 136k | int _start_col_offset = p->tokens[_mark]->col_offset; |
7750 | 136k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
7751 | 136k | { // "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT |
7752 | 136k | if (p->error_indicator) { |
7753 | 0 | p->level--; |
7754 | 0 | return NULL; |
7755 | 0 | } |
7756 | 136k | D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT")); |
7757 | 136k | expr_ty _keyword; |
7758 | 136k | Token * _literal; |
7759 | 136k | asdl_match_case_seq* cases; |
7760 | 136k | Token * dedent_var; |
7761 | 136k | Token * indent_var; |
7762 | 136k | Token * newline_var; |
7763 | 136k | expr_ty subject; |
7764 | 136k | if ( |
7765 | 136k | (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' |
7766 | 3.90k | && |
7767 | 3.90k | (subject = subject_expr_rule(p)) // subject_expr |
7768 | 3.06k | && |
7769 | 3.06k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
7770 | 2.49k | && |
7771 | 2.49k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
7772 | 1.91k | && |
7773 | 1.91k | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
7774 | 1.90k | && |
7775 | 1.90k | (cases = (asdl_match_case_seq*)_loop1_38_rule(p)) // case_block+ |
7776 | 767 | && |
7777 | 767 | (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' |
7778 | 136k | ) |
7779 | 654 | { |
7780 | 654 | D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT")); |
7781 | 654 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7782 | 654 | if (_token == NULL) { |
7783 | 0 | p->level--; |
7784 | 0 | return NULL; |
7785 | 0 | } |
7786 | 654 | int _end_lineno = _token->end_lineno; |
7787 | 654 | UNUSED(_end_lineno); // Only used by EXTRA macro |
7788 | 654 | int _end_col_offset = _token->end_col_offset; |
7789 | 654 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7790 | 654 | _res = CHECK_VERSION ( stmt_ty , 10 , "Pattern matching is" , _PyAST_Match ( subject , cases , EXTRA ) ); |
7791 | 654 | if (_res == NULL && PyErr_Occurred()) { |
7792 | 0 | p->error_indicator = 1; |
7793 | 0 | p->level--; |
7794 | 0 | return NULL; |
7795 | 0 | } |
7796 | 654 | goto done; |
7797 | 654 | } |
7798 | 136k | p->mark = _mark; |
7799 | 136k | D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
7800 | 136k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT")); |
7801 | 136k | } |
7802 | 136k | if (p->call_invalid_rules) { // invalid_match_stmt |
7803 | 21.2k | if (p->error_indicator) { |
7804 | 139 | p->level--; |
7805 | 139 | return NULL; |
7806 | 139 | } |
7807 | 21.1k | D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_match_stmt")); |
7808 | 21.1k | void *invalid_match_stmt_var; |
7809 | 21.1k | if ( |
7810 | 21.1k | (invalid_match_stmt_var = invalid_match_stmt_rule(p)) // invalid_match_stmt |
7811 | 21.1k | ) |
7812 | 0 | { |
7813 | 0 | D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_match_stmt")); |
7814 | 0 | _res = invalid_match_stmt_var; |
7815 | 0 | goto done; |
7816 | 0 | } |
7817 | 21.1k | p->mark = _mark; |
7818 | 21.1k | D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
7819 | 21.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_match_stmt")); |
7820 | 21.1k | } |
7821 | 136k | _res = NULL; |
7822 | 136k | done: |
7823 | 136k | p->level--; |
7824 | 136k | return _res; |
7825 | 136k | } |
7826 | | |
7827 | | // subject_expr: star_named_expression ',' star_named_expressions? | named_expression |
7828 | | static expr_ty |
7829 | | subject_expr_rule(Parser *p) |
7830 | 6.44k | { |
7831 | 6.44k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
7832 | 0 | _Pypegen_stack_overflow(p); |
7833 | 0 | } |
7834 | 6.44k | if (p->error_indicator) { |
7835 | 0 | p->level--; |
7836 | 0 | return NULL; |
7837 | 0 | } |
7838 | 6.44k | expr_ty _res = NULL; |
7839 | 6.44k | int _mark = p->mark; |
7840 | 6.44k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
7841 | 1 | p->error_indicator = 1; |
7842 | 1 | p->level--; |
7843 | 1 | return NULL; |
7844 | 1 | } |
7845 | 6.44k | int _start_lineno = p->tokens[_mark]->lineno; |
7846 | 6.44k | UNUSED(_start_lineno); // Only used by EXTRA macro |
7847 | 6.44k | int _start_col_offset = p->tokens[_mark]->col_offset; |
7848 | 6.44k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
7849 | 6.44k | { // star_named_expression ',' star_named_expressions? |
7850 | 6.44k | if (p->error_indicator) { |
7851 | 0 | p->level--; |
7852 | 0 | return NULL; |
7853 | 0 | } |
7854 | 6.44k | D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
7855 | 6.44k | Token * _literal; |
7856 | 6.44k | expr_ty value; |
7857 | 6.44k | void *values; |
7858 | 6.44k | if ( |
7859 | 6.44k | (value = star_named_expression_rule(p)) // star_named_expression |
7860 | 4.95k | && |
7861 | 4.95k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
7862 | 1.05k | && |
7863 | 1.05k | (values = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions? |
7864 | 6.44k | ) |
7865 | 1.05k | { |
7866 | 1.05k | D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
7867 | 1.05k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
7868 | 1.05k | if (_token == NULL) { |
7869 | 0 | p->level--; |
7870 | 0 | return NULL; |
7871 | 0 | } |
7872 | 1.05k | int _end_lineno = _token->end_lineno; |
7873 | 1.05k | UNUSED(_end_lineno); // Only used by EXTRA macro |
7874 | 1.05k | int _end_col_offset = _token->end_col_offset; |
7875 | 1.05k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
7876 | 1.05k | _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA ); |
7877 | 1.05k | if (_res == NULL && PyErr_Occurred()) { |
7878 | 0 | p->error_indicator = 1; |
7879 | 0 | p->level--; |
7880 | 0 | return NULL; |
7881 | 0 | } |
7882 | 1.05k | goto done; |
7883 | 1.05k | } |
7884 | 5.39k | p->mark = _mark; |
7885 | 5.39k | D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ', |
7886 | 5.39k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
7887 | 5.39k | } |
7888 | 0 | { // named_expression |
7889 | 5.39k | if (p->error_indicator) { |
7890 | 3 | p->level--; |
7891 | 3 | return NULL; |
7892 | 3 | } |
7893 | 5.38k | D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); |
7894 | 5.38k | expr_ty named_expression_var; |
7895 | 5.38k | if ( |
7896 | 5.38k | (named_expression_var = named_expression_rule(p)) // named_expression |
7897 | 5.38k | ) |
7898 | 3.89k | { |
7899 | 3.89k | D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); |
7900 | 3.89k | _res = named_expression_var; |
7901 | 3.89k | goto done; |
7902 | 3.89k | } |
7903 | 1.49k | p->mark = _mark; |
7904 | 1.49k | D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ', |
7905 | 1.49k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
7906 | 1.49k | } |
7907 | 1.49k | _res = NULL; |
7908 | 6.44k | done: |
7909 | 6.44k | p->level--; |
7910 | 6.44k | return _res; |
7911 | 1.49k | } |
7912 | | |
7913 | | // case_block: invalid_case_block | "case" patterns guard? ':' block |
7914 | | static match_case_ty |
7915 | | case_block_rule(Parser *p) |
7916 | 5.13k | { |
7917 | 5.13k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
7918 | 0 | _Pypegen_stack_overflow(p); |
7919 | 0 | } |
7920 | 5.13k | if (p->error_indicator) { |
7921 | 0 | p->level--; |
7922 | 0 | return NULL; |
7923 | 0 | } |
7924 | 5.13k | match_case_ty _res = NULL; |
7925 | 5.13k | int _mark = p->mark; |
7926 | 5.13k | if (p->call_invalid_rules) { // invalid_case_block |
7927 | 1.95k | if (p->error_indicator) { |
7928 | 0 | p->level--; |
7929 | 0 | return NULL; |
7930 | 0 | } |
7931 | 1.95k | D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_case_block")); |
7932 | 1.95k | void *invalid_case_block_var; |
7933 | 1.95k | if ( |
7934 | 1.95k | (invalid_case_block_var = invalid_case_block_rule(p)) // invalid_case_block |
7935 | 1.95k | ) |
7936 | 0 | { |
7937 | 0 | D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_case_block")); |
7938 | 0 | _res = invalid_case_block_var; |
7939 | 0 | goto done; |
7940 | 0 | } |
7941 | 1.95k | p->mark = _mark; |
7942 | 1.95k | D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ', |
7943 | 1.95k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_case_block")); |
7944 | 1.95k | } |
7945 | 5.13k | { // "case" patterns guard? ':' block |
7946 | 5.13k | if (p->error_indicator) { |
7947 | 136 | p->level--; |
7948 | 136 | return NULL; |
7949 | 136 | } |
7950 | 4.99k | D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block")); |
7951 | 4.99k | expr_ty _keyword; |
7952 | 4.99k | Token * _literal; |
7953 | 4.99k | asdl_stmt_seq* body; |
7954 | 4.99k | void *guard; |
7955 | 4.99k | pattern_ty pattern; |
7956 | 4.99k | if ( |
7957 | 4.99k | (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' |
7958 | 4.28k | && |
7959 | 4.28k | (pattern = patterns_rule(p)) // patterns |
7960 | 3.58k | && |
7961 | 3.58k | (guard = guard_rule(p), !p->error_indicator) // guard? |
7962 | 3.58k | && |
7963 | 3.58k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
7964 | 3.26k | && |
7965 | 3.26k | (body = block_rule(p)) // block |
7966 | 4.99k | ) |
7967 | 3.22k | { |
7968 | 3.22k | D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block")); |
7969 | 3.22k | _res = _PyAST_match_case ( pattern , guard , body , p -> arena ); |
7970 | 3.22k | if (_res == NULL && PyErr_Occurred()) { |
7971 | 0 | p->error_indicator = 1; |
7972 | 0 | p->level--; |
7973 | 0 | return NULL; |
7974 | 0 | } |
7975 | 3.22k | goto done; |
7976 | 3.22k | } |
7977 | 1.77k | p->mark = _mark; |
7978 | 1.77k | D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ', |
7979 | 1.77k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? ':' block")); |
7980 | 1.77k | } |
7981 | 1.77k | _res = NULL; |
7982 | 4.99k | done: |
7983 | 4.99k | p->level--; |
7984 | 4.99k | return _res; |
7985 | 1.77k | } |
7986 | | |
7987 | | // guard: 'if' named_expression |
7988 | | static expr_ty |
7989 | | guard_rule(Parser *p) |
7990 | 6.41k | { |
7991 | 6.41k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
7992 | 0 | _Pypegen_stack_overflow(p); |
7993 | 0 | } |
7994 | 6.41k | if (p->error_indicator) { |
7995 | 0 | p->level--; |
7996 | 0 | return NULL; |
7997 | 0 | } |
7998 | 6.41k | expr_ty _res = NULL; |
7999 | 6.41k | int _mark = p->mark; |
8000 | 6.41k | { // 'if' named_expression |
8001 | 6.41k | if (p->error_indicator) { |
8002 | 0 | p->level--; |
8003 | 0 | return NULL; |
8004 | 0 | } |
8005 | 6.41k | D(fprintf(stderr, "%*c> guard[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); |
8006 | 6.41k | Token * _keyword; |
8007 | 6.41k | expr_ty guard; |
8008 | 6.41k | if ( |
8009 | 6.41k | (_keyword = _PyPegen_expect_token(p, 691)) // token='if' |
8010 | 328 | && |
8011 | 328 | (guard = named_expression_rule(p)) // named_expression |
8012 | 6.41k | ) |
8013 | 321 | { |
8014 | 321 | D(fprintf(stderr, "%*c+ guard[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression")); |
8015 | 321 | _res = guard; |
8016 | 321 | if (_res == NULL && PyErr_Occurred()) { |
8017 | 0 | p->error_indicator = 1; |
8018 | 0 | p->level--; |
8019 | 0 | return NULL; |
8020 | 0 | } |
8021 | 321 | goto done; |
8022 | 321 | } |
8023 | 6.08k | p->mark = _mark; |
8024 | 6.08k | D(fprintf(stderr, "%*c%s guard[%d-%d]: %s failed!\n", p->level, ' ', |
8025 | 6.08k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression")); |
8026 | 6.08k | } |
8027 | 6.08k | _res = NULL; |
8028 | 6.41k | done: |
8029 | 6.41k | p->level--; |
8030 | 6.41k | return _res; |
8031 | 6.08k | } |
8032 | | |
8033 | | // patterns: open_sequence_pattern | pattern |
8034 | | static pattern_ty |
8035 | | patterns_rule(Parser *p) |
8036 | 7.65k | { |
8037 | 7.65k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
8038 | 0 | _Pypegen_stack_overflow(p); |
8039 | 0 | } |
8040 | 7.65k | if (p->error_indicator) { |
8041 | 0 | p->level--; |
8042 | 0 | return NULL; |
8043 | 0 | } |
8044 | 7.65k | pattern_ty _res = NULL; |
8045 | 7.65k | int _mark = p->mark; |
8046 | 7.65k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
8047 | 1 | p->error_indicator = 1; |
8048 | 1 | p->level--; |
8049 | 1 | return NULL; |
8050 | 1 | } |
8051 | 7.65k | int _start_lineno = p->tokens[_mark]->lineno; |
8052 | 7.65k | UNUSED(_start_lineno); // Only used by EXTRA macro |
8053 | 7.65k | int _start_col_offset = p->tokens[_mark]->col_offset; |
8054 | 7.65k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
8055 | 7.65k | { // open_sequence_pattern |
8056 | 7.65k | if (p->error_indicator) { |
8057 | 0 | p->level--; |
8058 | 0 | return NULL; |
8059 | 0 | } |
8060 | 7.65k | D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern")); |
8061 | 7.65k | asdl_pattern_seq* patterns; |
8062 | 7.65k | if ( |
8063 | 7.65k | (patterns = (asdl_pattern_seq*)open_sequence_pattern_rule(p)) // open_sequence_pattern |
8064 | 7.65k | ) |
8065 | 1.68k | { |
8066 | 1.68k | D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern")); |
8067 | 1.68k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8068 | 1.68k | if (_token == NULL) { |
8069 | 0 | p->level--; |
8070 | 0 | return NULL; |
8071 | 0 | } |
8072 | 1.68k | int _end_lineno = _token->end_lineno; |
8073 | 1.68k | UNUSED(_end_lineno); // Only used by EXTRA macro |
8074 | 1.68k | int _end_col_offset = _token->end_col_offset; |
8075 | 1.68k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8076 | 1.68k | _res = _PyAST_MatchSequence ( patterns , EXTRA ); |
8077 | 1.68k | if (_res == NULL && PyErr_Occurred()) { |
8078 | 0 | p->error_indicator = 1; |
8079 | 0 | p->level--; |
8080 | 0 | return NULL; |
8081 | 0 | } |
8082 | 1.68k | goto done; |
8083 | 1.68k | } |
8084 | 5.96k | p->mark = _mark; |
8085 | 5.96k | D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ', |
8086 | 5.96k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "open_sequence_pattern")); |
8087 | 5.96k | } |
8088 | 0 | { // pattern |
8089 | 5.96k | if (p->error_indicator) { |
8090 | 233 | p->level--; |
8091 | 233 | return NULL; |
8092 | 233 | } |
8093 | 5.72k | D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); |
8094 | 5.72k | pattern_ty pattern_var; |
8095 | 5.72k | if ( |
8096 | 5.72k | (pattern_var = pattern_rule(p)) // pattern |
8097 | 5.72k | ) |
8098 | 4.72k | { |
8099 | 4.72k | D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); |
8100 | 4.72k | _res = pattern_var; |
8101 | 4.72k | goto done; |
8102 | 4.72k | } |
8103 | 1.00k | p->mark = _mark; |
8104 | 1.00k | D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ', |
8105 | 1.00k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); |
8106 | 1.00k | } |
8107 | 1.00k | _res = NULL; |
8108 | 7.41k | done: |
8109 | 7.41k | p->level--; |
8110 | 7.41k | return _res; |
8111 | 1.00k | } |
8112 | | |
8113 | | // pattern: as_pattern | or_pattern |
8114 | | static pattern_ty |
8115 | | pattern_rule(Parser *p) |
8116 | 70.5k | { |
8117 | 70.5k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
8118 | 0 | _Pypegen_stack_overflow(p); |
8119 | 0 | } |
8120 | 70.5k | if (p->error_indicator) { |
8121 | 0 | p->level--; |
8122 | 0 | return NULL; |
8123 | 0 | } |
8124 | 70.5k | pattern_ty _res = NULL; |
8125 | 70.5k | int _mark = p->mark; |
8126 | 70.5k | { // as_pattern |
8127 | 70.5k | if (p->error_indicator) { |
8128 | 0 | p->level--; |
8129 | 0 | return NULL; |
8130 | 0 | } |
8131 | 70.5k | D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "as_pattern")); |
8132 | 70.5k | pattern_ty as_pattern_var; |
8133 | 70.5k | if ( |
8134 | 70.5k | (as_pattern_var = as_pattern_rule(p)) // as_pattern |
8135 | 70.5k | ) |
8136 | 279 | { |
8137 | 279 | D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "as_pattern")); |
8138 | 279 | _res = as_pattern_var; |
8139 | 279 | goto done; |
8140 | 279 | } |
8141 | 70.2k | p->mark = _mark; |
8142 | 70.2k | D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8143 | 70.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "as_pattern")); |
8144 | 70.2k | } |
8145 | 0 | { // or_pattern |
8146 | 70.2k | if (p->error_indicator) { |
8147 | 2.87k | p->level--; |
8148 | 2.87k | return NULL; |
8149 | 2.87k | } |
8150 | 67.3k | D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern")); |
8151 | 67.3k | pattern_ty or_pattern_var; |
8152 | 67.3k | if ( |
8153 | 67.3k | (or_pattern_var = or_pattern_rule(p)) // or_pattern |
8154 | 67.3k | ) |
8155 | 43.0k | { |
8156 | 43.0k | D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern")); |
8157 | 43.0k | _res = or_pattern_var; |
8158 | 43.0k | goto done; |
8159 | 43.0k | } |
8160 | 24.3k | p->mark = _mark; |
8161 | 24.3k | D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8162 | 24.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern")); |
8163 | 24.3k | } |
8164 | 24.3k | _res = NULL; |
8165 | 67.6k | done: |
8166 | 67.6k | p->level--; |
8167 | 67.6k | return _res; |
8168 | 24.3k | } |
8169 | | |
8170 | | // as_pattern: or_pattern 'as' pattern_capture_target | invalid_as_pattern |
8171 | | static pattern_ty |
8172 | | as_pattern_rule(Parser *p) |
8173 | 70.5k | { |
8174 | 70.5k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
8175 | 0 | _Pypegen_stack_overflow(p); |
8176 | 0 | } |
8177 | 70.5k | if (p->error_indicator) { |
8178 | 0 | p->level--; |
8179 | 0 | return NULL; |
8180 | 0 | } |
8181 | 70.5k | pattern_ty _res = NULL; |
8182 | 70.5k | int _mark = p->mark; |
8183 | 70.5k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
8184 | 34 | p->error_indicator = 1; |
8185 | 34 | p->level--; |
8186 | 34 | return NULL; |
8187 | 34 | } |
8188 | 70.4k | int _start_lineno = p->tokens[_mark]->lineno; |
8189 | 70.4k | UNUSED(_start_lineno); // Only used by EXTRA macro |
8190 | 70.4k | int _start_col_offset = p->tokens[_mark]->col_offset; |
8191 | 70.4k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
8192 | 70.4k | { // or_pattern 'as' pattern_capture_target |
8193 | 70.4k | if (p->error_indicator) { |
8194 | 0 | p->level--; |
8195 | 0 | return NULL; |
8196 | 0 | } |
8197 | 70.4k | D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' pattern_capture_target")); |
8198 | 70.4k | Token * _keyword; |
8199 | 70.4k | pattern_ty pattern; |
8200 | 70.4k | expr_ty target; |
8201 | 70.4k | if ( |
8202 | 70.4k | (pattern = or_pattern_rule(p)) // or_pattern |
8203 | 43.3k | && |
8204 | 43.3k | (_keyword = _PyPegen_expect_token(p, 689)) // token='as' |
8205 | 316 | && |
8206 | 316 | (target = pattern_capture_target_rule(p)) // pattern_capture_target |
8207 | 70.4k | ) |
8208 | 279 | { |
8209 | 279 | D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' pattern_capture_target")); |
8210 | 279 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8211 | 279 | if (_token == NULL) { |
8212 | 0 | p->level--; |
8213 | 0 | return NULL; |
8214 | 0 | } |
8215 | 279 | int _end_lineno = _token->end_lineno; |
8216 | 279 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8217 | 279 | int _end_col_offset = _token->end_col_offset; |
8218 | 279 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8219 | 279 | _res = _PyAST_MatchAs ( pattern , target -> v . Name . id , EXTRA ); |
8220 | 279 | if (_res == NULL && PyErr_Occurred()) { |
8221 | 0 | p->error_indicator = 1; |
8222 | 0 | p->level--; |
8223 | 0 | return NULL; |
8224 | 0 | } |
8225 | 279 | goto done; |
8226 | 279 | } |
8227 | 70.1k | p->mark = _mark; |
8228 | 70.1k | D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8229 | 70.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' pattern_capture_target")); |
8230 | 70.1k | } |
8231 | 70.1k | if (p->call_invalid_rules) { // invalid_as_pattern |
8232 | 37.4k | if (p->error_indicator) { |
8233 | 1.40k | p->level--; |
8234 | 1.40k | return NULL; |
8235 | 1.40k | } |
8236 | 36.0k | D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_as_pattern")); |
8237 | 36.0k | void *invalid_as_pattern_var; |
8238 | 36.0k | if ( |
8239 | 36.0k | (invalid_as_pattern_var = invalid_as_pattern_rule(p)) // invalid_as_pattern |
8240 | 36.0k | ) |
8241 | 0 | { |
8242 | 0 | D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_as_pattern")); |
8243 | 0 | _res = invalid_as_pattern_var; |
8244 | 0 | goto done; |
8245 | 0 | } |
8246 | 36.0k | p->mark = _mark; |
8247 | 36.0k | D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8248 | 36.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_as_pattern")); |
8249 | 36.0k | } |
8250 | 68.7k | _res = NULL; |
8251 | 69.0k | done: |
8252 | 69.0k | p->level--; |
8253 | 69.0k | return _res; |
8254 | 68.7k | } |
8255 | | |
8256 | | // or_pattern: '|'.closed_pattern+ |
8257 | | static pattern_ty |
8258 | | or_pattern_rule(Parser *p) |
8259 | 210k | { |
8260 | 210k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
8261 | 0 | _Pypegen_stack_overflow(p); |
8262 | 0 | } |
8263 | 210k | if (p->error_indicator) { |
8264 | 0 | p->level--; |
8265 | 0 | return NULL; |
8266 | 0 | } |
8267 | 210k | pattern_ty _res = NULL; |
8268 | 210k | int _mark = p->mark; |
8269 | 210k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
8270 | 0 | p->error_indicator = 1; |
8271 | 0 | p->level--; |
8272 | 0 | return NULL; |
8273 | 0 | } |
8274 | 210k | int _start_lineno = p->tokens[_mark]->lineno; |
8275 | 210k | UNUSED(_start_lineno); // Only used by EXTRA macro |
8276 | 210k | int _start_col_offset = p->tokens[_mark]->col_offset; |
8277 | 210k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
8278 | 210k | { // '|'.closed_pattern+ |
8279 | 210k | if (p->error_indicator) { |
8280 | 0 | p->level--; |
8281 | 0 | return NULL; |
8282 | 0 | } |
8283 | 210k | D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); |
8284 | 210k | asdl_pattern_seq* patterns; |
8285 | 210k | if ( |
8286 | 210k | (patterns = (asdl_pattern_seq*)_gather_40_rule(p)) // '|'.closed_pattern+ |
8287 | 210k | ) |
8288 | 130k | { |
8289 | 130k | D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); |
8290 | 130k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8291 | 130k | if (_token == NULL) { |
8292 | 0 | p->level--; |
8293 | 0 | return NULL; |
8294 | 0 | } |
8295 | 130k | int _end_lineno = _token->end_lineno; |
8296 | 130k | UNUSED(_end_lineno); // Only used by EXTRA macro |
8297 | 130k | int _end_col_offset = _token->end_col_offset; |
8298 | 130k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8299 | 130k | _res = asdl_seq_LEN ( patterns ) == 1 ? asdl_seq_GET ( patterns , 0 ) : _PyAST_MatchOr ( patterns , EXTRA ); |
8300 | 130k | if (_res == NULL && PyErr_Occurred()) { |
8301 | 0 | p->error_indicator = 1; |
8302 | 0 | p->level--; |
8303 | 0 | return NULL; |
8304 | 0 | } |
8305 | 130k | goto done; |
8306 | 130k | } |
8307 | 79.1k | p->mark = _mark; |
8308 | 79.1k | D(fprintf(stderr, "%*c%s or_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8309 | 79.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|'.closed_pattern+")); |
8310 | 79.1k | } |
8311 | 79.1k | _res = NULL; |
8312 | 210k | done: |
8313 | 210k | p->level--; |
8314 | 210k | return _res; |
8315 | 79.1k | } |
8316 | | |
8317 | | // closed_pattern: |
8318 | | // | literal_pattern |
8319 | | // | capture_pattern |
8320 | | // | wildcard_pattern |
8321 | | // | value_pattern |
8322 | | // | group_pattern |
8323 | | // | sequence_pattern |
8324 | | // | mapping_pattern |
8325 | | // | class_pattern |
8326 | | static pattern_ty |
8327 | | closed_pattern_rule(Parser *p) |
8328 | 224k | { |
8329 | 224k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
8330 | 0 | _Pypegen_stack_overflow(p); |
8331 | 0 | } |
8332 | 224k | if (p->error_indicator) { |
8333 | 0 | p->level--; |
8334 | 0 | return NULL; |
8335 | 0 | } |
8336 | 224k | pattern_ty _res = NULL; |
8337 | 224k | if (_PyPegen_is_memoized(p, closed_pattern_type, &_res)) { |
8338 | 179k | p->level--; |
8339 | 179k | return _res; |
8340 | 179k | } |
8341 | 45.3k | int _mark = p->mark; |
8342 | 45.3k | { // literal_pattern |
8343 | 45.3k | if (p->error_indicator) { |
8344 | 0 | p->level--; |
8345 | 0 | return NULL; |
8346 | 0 | } |
8347 | 45.3k | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern")); |
8348 | 45.3k | pattern_ty literal_pattern_var; |
8349 | 45.3k | if ( |
8350 | 45.3k | (literal_pattern_var = literal_pattern_rule(p)) // literal_pattern |
8351 | 45.3k | ) |
8352 | 3.24k | { |
8353 | 3.24k | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern")); |
8354 | 3.24k | _res = literal_pattern_var; |
8355 | 3.24k | goto done; |
8356 | 3.24k | } |
8357 | 42.0k | p->mark = _mark; |
8358 | 42.0k | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8359 | 42.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern")); |
8360 | 42.0k | } |
8361 | 0 | { // capture_pattern |
8362 | 42.0k | if (p->error_indicator) { |
8363 | 22 | p->level--; |
8364 | 22 | return NULL; |
8365 | 22 | } |
8366 | 42.0k | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "capture_pattern")); |
8367 | 42.0k | pattern_ty capture_pattern_var; |
8368 | 42.0k | if ( |
8369 | 42.0k | (capture_pattern_var = capture_pattern_rule(p)) // capture_pattern |
8370 | 42.0k | ) |
8371 | 14.4k | { |
8372 | 14.4k | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "capture_pattern")); |
8373 | 14.4k | _res = capture_pattern_var; |
8374 | 14.4k | goto done; |
8375 | 14.4k | } |
8376 | 27.6k | p->mark = _mark; |
8377 | 27.6k | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8378 | 27.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "capture_pattern")); |
8379 | 27.6k | } |
8380 | 0 | { // wildcard_pattern |
8381 | 27.6k | if (p->error_indicator) { |
8382 | 0 | p->level--; |
8383 | 0 | return NULL; |
8384 | 0 | } |
8385 | 27.6k | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); |
8386 | 27.6k | pattern_ty wildcard_pattern_var; |
8387 | 27.6k | if ( |
8388 | 27.6k | (wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern |
8389 | 27.6k | ) |
8390 | 5.34k | { |
8391 | 5.34k | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "wildcard_pattern")); |
8392 | 5.34k | _res = wildcard_pattern_var; |
8393 | 5.34k | goto done; |
8394 | 5.34k | } |
8395 | 22.2k | p->mark = _mark; |
8396 | 22.2k | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8397 | 22.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "wildcard_pattern")); |
8398 | 22.2k | } |
8399 | 0 | { // value_pattern |
8400 | 22.2k | if (p->error_indicator) { |
8401 | 0 | p->level--; |
8402 | 0 | return NULL; |
8403 | 0 | } |
8404 | 22.2k | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern")); |
8405 | 22.2k | pattern_ty value_pattern_var; |
8406 | 22.2k | if ( |
8407 | 22.2k | (value_pattern_var = value_pattern_rule(p)) // value_pattern |
8408 | 22.2k | ) |
8409 | 330 | { |
8410 | 330 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern")); |
8411 | 330 | _res = value_pattern_var; |
8412 | 330 | goto done; |
8413 | 330 | } |
8414 | 21.9k | p->mark = _mark; |
8415 | 21.9k | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8416 | 21.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern")); |
8417 | 21.9k | } |
8418 | 0 | { // group_pattern |
8419 | 21.9k | if (p->error_indicator) { |
8420 | 2 | p->level--; |
8421 | 2 | return NULL; |
8422 | 2 | } |
8423 | 21.9k | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group_pattern")); |
8424 | 21.9k | pattern_ty group_pattern_var; |
8425 | 21.9k | if ( |
8426 | 21.9k | (group_pattern_var = group_pattern_rule(p)) // group_pattern |
8427 | 21.9k | ) |
8428 | 256 | { |
8429 | 256 | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group_pattern")); |
8430 | 256 | _res = group_pattern_var; |
8431 | 256 | goto done; |
8432 | 256 | } |
8433 | 21.7k | p->mark = _mark; |
8434 | 21.7k | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8435 | 21.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group_pattern")); |
8436 | 21.7k | } |
8437 | 0 | { // sequence_pattern |
8438 | 21.7k | if (p->error_indicator) { |
8439 | 429 | p->level--; |
8440 | 429 | return NULL; |
8441 | 429 | } |
8442 | 21.2k | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sequence_pattern")); |
8443 | 21.2k | pattern_ty sequence_pattern_var; |
8444 | 21.2k | if ( |
8445 | 21.2k | (sequence_pattern_var = sequence_pattern_rule(p)) // sequence_pattern |
8446 | 21.2k | ) |
8447 | 1.87k | { |
8448 | 1.87k | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sequence_pattern")); |
8449 | 1.87k | _res = sequence_pattern_var; |
8450 | 1.87k | goto done; |
8451 | 1.87k | } |
8452 | 19.4k | p->mark = _mark; |
8453 | 19.4k | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8454 | 19.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sequence_pattern")); |
8455 | 19.4k | } |
8456 | 0 | { // mapping_pattern |
8457 | 19.4k | if (p->error_indicator) { |
8458 | 530 | p->level--; |
8459 | 530 | return NULL; |
8460 | 530 | } |
8461 | 18.8k | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "mapping_pattern")); |
8462 | 18.8k | pattern_ty mapping_pattern_var; |
8463 | 18.8k | if ( |
8464 | 18.8k | (mapping_pattern_var = mapping_pattern_rule(p)) // mapping_pattern |
8465 | 18.8k | ) |
8466 | 1.51k | { |
8467 | 1.51k | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "mapping_pattern")); |
8468 | 1.51k | _res = mapping_pattern_var; |
8469 | 1.51k | goto done; |
8470 | 1.51k | } |
8471 | 17.3k | p->mark = _mark; |
8472 | 17.3k | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8473 | 17.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "mapping_pattern")); |
8474 | 17.3k | } |
8475 | 0 | { // class_pattern |
8476 | 17.3k | if (p->error_indicator) { |
8477 | 131 | p->level--; |
8478 | 131 | return NULL; |
8479 | 131 | } |
8480 | 17.2k | D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_pattern")); |
8481 | 17.2k | pattern_ty class_pattern_var; |
8482 | 17.2k | if ( |
8483 | 17.2k | (class_pattern_var = class_pattern_rule(p)) // class_pattern |
8484 | 17.2k | ) |
8485 | 2.43k | { |
8486 | 2.43k | D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_pattern")); |
8487 | 2.43k | _res = class_pattern_var; |
8488 | 2.43k | goto done; |
8489 | 2.43k | } |
8490 | 14.7k | p->mark = _mark; |
8491 | 14.7k | D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8492 | 14.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_pattern")); |
8493 | 14.7k | } |
8494 | 14.7k | _res = NULL; |
8495 | 44.1k | done: |
8496 | 44.1k | _PyPegen_insert_memo(p, _mark, closed_pattern_type, _res); |
8497 | 44.1k | p->level--; |
8498 | 44.1k | return _res; |
8499 | 14.7k | } |
8500 | | |
8501 | | // literal_pattern: |
8502 | | // | signed_number !('+' | '-') |
8503 | | // | complex_number |
8504 | | // | strings |
8505 | | // | 'None' |
8506 | | // | 'True' |
8507 | | // | 'False' |
8508 | | static pattern_ty |
8509 | | literal_pattern_rule(Parser *p) |
8510 | 45.3k | { |
8511 | 45.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
8512 | 0 | _Pypegen_stack_overflow(p); |
8513 | 0 | } |
8514 | 45.3k | if (p->error_indicator) { |
8515 | 0 | p->level--; |
8516 | 0 | return NULL; |
8517 | 0 | } |
8518 | 45.3k | pattern_ty _res = NULL; |
8519 | 45.3k | int _mark = p->mark; |
8520 | 45.3k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
8521 | 0 | p->error_indicator = 1; |
8522 | 0 | p->level--; |
8523 | 0 | return NULL; |
8524 | 0 | } |
8525 | 45.3k | int _start_lineno = p->tokens[_mark]->lineno; |
8526 | 45.3k | UNUSED(_start_lineno); // Only used by EXTRA macro |
8527 | 45.3k | int _start_col_offset = p->tokens[_mark]->col_offset; |
8528 | 45.3k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
8529 | 45.3k | { // signed_number !('+' | '-') |
8530 | 45.3k | if (p->error_indicator) { |
8531 | 0 | p->level--; |
8532 | 0 | return NULL; |
8533 | 0 | } |
8534 | 45.3k | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); |
8535 | 45.3k | expr_ty value; |
8536 | 45.3k | if ( |
8537 | 45.3k | (value = signed_number_rule(p)) // signed_number |
8538 | 2.29k | && |
8539 | 2.29k | _PyPegen_lookahead(0, _tmp_41_rule, p) |
8540 | 45.3k | ) |
8541 | 2.05k | { |
8542 | 2.05k | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); |
8543 | 2.05k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8544 | 2.05k | if (_token == NULL) { |
8545 | 0 | p->level--; |
8546 | 0 | return NULL; |
8547 | 0 | } |
8548 | 2.05k | int _end_lineno = _token->end_lineno; |
8549 | 2.05k | UNUSED(_end_lineno); // Only used by EXTRA macro |
8550 | 2.05k | int _end_col_offset = _token->end_col_offset; |
8551 | 2.05k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8552 | 2.05k | _res = _PyAST_MatchValue ( value , EXTRA ); |
8553 | 2.05k | if (_res == NULL && PyErr_Occurred()) { |
8554 | 0 | p->error_indicator = 1; |
8555 | 0 | p->level--; |
8556 | 0 | return NULL; |
8557 | 0 | } |
8558 | 2.05k | goto done; |
8559 | 2.05k | } |
8560 | 43.2k | p->mark = _mark; |
8561 | 43.2k | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8562 | 43.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number !('+' | '-')")); |
8563 | 43.2k | } |
8564 | 0 | { // complex_number |
8565 | 43.2k | if (p->error_indicator) { |
8566 | 1 | p->level--; |
8567 | 1 | return NULL; |
8568 | 1 | } |
8569 | 43.2k | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "complex_number")); |
8570 | 43.2k | expr_ty value; |
8571 | 43.2k | if ( |
8572 | 43.2k | (value = complex_number_rule(p)) // complex_number |
8573 | 43.2k | ) |
8574 | 218 | { |
8575 | 218 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "complex_number")); |
8576 | 218 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8577 | 218 | if (_token == NULL) { |
8578 | 0 | p->level--; |
8579 | 0 | return NULL; |
8580 | 0 | } |
8581 | 218 | int _end_lineno = _token->end_lineno; |
8582 | 218 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8583 | 218 | int _end_col_offset = _token->end_col_offset; |
8584 | 218 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8585 | 218 | _res = _PyAST_MatchValue ( value , EXTRA ); |
8586 | 218 | if (_res == NULL && PyErr_Occurred()) { |
8587 | 0 | p->error_indicator = 1; |
8588 | 0 | p->level--; |
8589 | 0 | return NULL; |
8590 | 0 | } |
8591 | 218 | goto done; |
8592 | 218 | } |
8593 | 43.0k | p->mark = _mark; |
8594 | 43.0k | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8595 | 43.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "complex_number")); |
8596 | 43.0k | } |
8597 | 0 | { // strings |
8598 | 43.0k | if (p->error_indicator) { |
8599 | 11 | p->level--; |
8600 | 11 | return NULL; |
8601 | 11 | } |
8602 | 43.0k | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "strings")); |
8603 | 43.0k | expr_ty value; |
8604 | 43.0k | if ( |
8605 | 43.0k | (value = strings_rule(p)) // strings |
8606 | 43.0k | ) |
8607 | 198 | { |
8608 | 198 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "strings")); |
8609 | 198 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8610 | 198 | if (_token == NULL) { |
8611 | 0 | p->level--; |
8612 | 0 | return NULL; |
8613 | 0 | } |
8614 | 198 | int _end_lineno = _token->end_lineno; |
8615 | 198 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8616 | 198 | int _end_col_offset = _token->end_col_offset; |
8617 | 198 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8618 | 198 | _res = _PyAST_MatchValue ( value , EXTRA ); |
8619 | 198 | if (_res == NULL && PyErr_Occurred()) { |
8620 | 0 | p->error_indicator = 1; |
8621 | 0 | p->level--; |
8622 | 0 | return NULL; |
8623 | 0 | } |
8624 | 198 | goto done; |
8625 | 198 | } |
8626 | 42.8k | p->mark = _mark; |
8627 | 42.8k | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8628 | 42.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "strings")); |
8629 | 42.8k | } |
8630 | 0 | { // 'None' |
8631 | 42.8k | if (p->error_indicator) { |
8632 | 10 | p->level--; |
8633 | 10 | return NULL; |
8634 | 10 | } |
8635 | 42.8k | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); |
8636 | 42.8k | Token * _keyword; |
8637 | 42.8k | if ( |
8638 | 42.8k | (_keyword = _PyPegen_expect_token(p, 624)) // token='None' |
8639 | 42.8k | ) |
8640 | 500 | { |
8641 | 500 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); |
8642 | 500 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8643 | 500 | if (_token == NULL) { |
8644 | 0 | p->level--; |
8645 | 0 | return NULL; |
8646 | 0 | } |
8647 | 500 | int _end_lineno = _token->end_lineno; |
8648 | 500 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8649 | 500 | int _end_col_offset = _token->end_col_offset; |
8650 | 500 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8651 | 500 | _res = _PyAST_MatchSingleton ( Py_None , EXTRA ); |
8652 | 500 | if (_res == NULL && PyErr_Occurred()) { |
8653 | 0 | p->error_indicator = 1; |
8654 | 0 | p->level--; |
8655 | 0 | return NULL; |
8656 | 0 | } |
8657 | 500 | goto done; |
8658 | 500 | } |
8659 | 42.3k | p->mark = _mark; |
8660 | 42.3k | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8661 | 42.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); |
8662 | 42.3k | } |
8663 | 0 | { // 'True' |
8664 | 42.3k | if (p->error_indicator) { |
8665 | 0 | p->level--; |
8666 | 0 | return NULL; |
8667 | 0 | } |
8668 | 42.3k | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); |
8669 | 42.3k | Token * _keyword; |
8670 | 42.3k | if ( |
8671 | 42.3k | (_keyword = _PyPegen_expect_token(p, 623)) // token='True' |
8672 | 42.3k | ) |
8673 | 221 | { |
8674 | 221 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); |
8675 | 221 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8676 | 221 | if (_token == NULL) { |
8677 | 0 | p->level--; |
8678 | 0 | return NULL; |
8679 | 0 | } |
8680 | 221 | int _end_lineno = _token->end_lineno; |
8681 | 221 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8682 | 221 | int _end_col_offset = _token->end_col_offset; |
8683 | 221 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8684 | 221 | _res = _PyAST_MatchSingleton ( Py_True , EXTRA ); |
8685 | 221 | if (_res == NULL && PyErr_Occurred()) { |
8686 | 0 | p->error_indicator = 1; |
8687 | 0 | p->level--; |
8688 | 0 | return NULL; |
8689 | 0 | } |
8690 | 221 | goto done; |
8691 | 221 | } |
8692 | 42.0k | p->mark = _mark; |
8693 | 42.0k | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8694 | 42.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); |
8695 | 42.0k | } |
8696 | 0 | { // 'False' |
8697 | 42.0k | if (p->error_indicator) { |
8698 | 0 | p->level--; |
8699 | 0 | return NULL; |
8700 | 0 | } |
8701 | 42.0k | D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); |
8702 | 42.0k | Token * _keyword; |
8703 | 42.0k | if ( |
8704 | 42.0k | (_keyword = _PyPegen_expect_token(p, 625)) // token='False' |
8705 | 42.0k | ) |
8706 | 54 | { |
8707 | 54 | D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); |
8708 | 54 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8709 | 54 | if (_token == NULL) { |
8710 | 0 | p->level--; |
8711 | 0 | return NULL; |
8712 | 0 | } |
8713 | 54 | int _end_lineno = _token->end_lineno; |
8714 | 54 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8715 | 54 | int _end_col_offset = _token->end_col_offset; |
8716 | 54 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8717 | 54 | _res = _PyAST_MatchSingleton ( Py_False , EXTRA ); |
8718 | 54 | if (_res == NULL && PyErr_Occurred()) { |
8719 | 0 | p->error_indicator = 1; |
8720 | 0 | p->level--; |
8721 | 0 | return NULL; |
8722 | 0 | } |
8723 | 54 | goto done; |
8724 | 54 | } |
8725 | 42.0k | p->mark = _mark; |
8726 | 42.0k | D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
8727 | 42.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); |
8728 | 42.0k | } |
8729 | 42.0k | _res = NULL; |
8730 | 45.2k | done: |
8731 | 45.2k | p->level--; |
8732 | 45.2k | return _res; |
8733 | 42.0k | } |
8734 | | |
8735 | | // literal_expr: |
8736 | | // | signed_number !('+' | '-') |
8737 | | // | complex_number |
8738 | | // | &(STRING | FSTRING_START | TSTRING_START) strings |
8739 | | // | 'None' |
8740 | | // | 'True' |
8741 | | // | 'False' |
8742 | | static expr_ty |
8743 | | literal_expr_rule(Parser *p) |
8744 | 3.46k | { |
8745 | 3.46k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
8746 | 0 | _Pypegen_stack_overflow(p); |
8747 | 0 | } |
8748 | 3.46k | if (p->error_indicator) { |
8749 | 0 | p->level--; |
8750 | 0 | return NULL; |
8751 | 0 | } |
8752 | 3.46k | expr_ty _res = NULL; |
8753 | 3.46k | int _mark = p->mark; |
8754 | 3.46k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
8755 | 5 | p->error_indicator = 1; |
8756 | 5 | p->level--; |
8757 | 5 | return NULL; |
8758 | 5 | } |
8759 | 3.46k | int _start_lineno = p->tokens[_mark]->lineno; |
8760 | 3.46k | UNUSED(_start_lineno); // Only used by EXTRA macro |
8761 | 3.46k | int _start_col_offset = p->tokens[_mark]->col_offset; |
8762 | 3.46k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
8763 | 3.46k | { // signed_number !('+' | '-') |
8764 | 3.46k | if (p->error_indicator) { |
8765 | 0 | p->level--; |
8766 | 0 | return NULL; |
8767 | 0 | } |
8768 | 3.46k | D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); |
8769 | 3.46k | expr_ty signed_number_var; |
8770 | 3.46k | if ( |
8771 | 3.46k | (signed_number_var = signed_number_rule(p)) // signed_number |
8772 | 2.76k | && |
8773 | 2.76k | _PyPegen_lookahead(0, _tmp_41_rule, p) |
8774 | 3.46k | ) |
8775 | 2.38k | { |
8776 | 2.38k | D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); |
8777 | 2.38k | _res = signed_number_var; |
8778 | 2.38k | goto done; |
8779 | 2.38k | } |
8780 | 1.07k | p->mark = _mark; |
8781 | 1.07k | D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ', |
8782 | 1.07k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number !('+' | '-')")); |
8783 | 1.07k | } |
8784 | 0 | { // complex_number |
8785 | 1.07k | if (p->error_indicator) { |
8786 | 2 | p->level--; |
8787 | 2 | return NULL; |
8788 | 2 | } |
8789 | 1.07k | D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "complex_number")); |
8790 | 1.07k | expr_ty complex_number_var; |
8791 | 1.07k | if ( |
8792 | 1.07k | (complex_number_var = complex_number_rule(p)) // complex_number |
8793 | 1.07k | ) |
8794 | 350 | { |
8795 | 350 | D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "complex_number")); |
8796 | 350 | _res = complex_number_var; |
8797 | 350 | goto done; |
8798 | 350 | } |
8799 | 724 | p->mark = _mark; |
8800 | 724 | D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ', |
8801 | 724 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "complex_number")); |
8802 | 724 | } |
8803 | 0 | { // &(STRING | FSTRING_START | TSTRING_START) strings |
8804 | 724 | if (p->error_indicator) { |
8805 | 4 | p->level--; |
8806 | 4 | return NULL; |
8807 | 4 | } |
8808 | 720 | D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&(STRING | FSTRING_START | TSTRING_START) strings")); |
8809 | 720 | expr_ty strings_var; |
8810 | 720 | if ( |
8811 | 720 | _PyPegen_lookahead(1, _tmp_42_rule, p) |
8812 | 416 | && |
8813 | 416 | (strings_var = strings_rule(p)) // strings |
8814 | 720 | ) |
8815 | 405 | { |
8816 | 405 | D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&(STRING | FSTRING_START | TSTRING_START) strings")); |
8817 | 405 | _res = strings_var; |
8818 | 405 | goto done; |
8819 | 405 | } |
8820 | 315 | p->mark = _mark; |
8821 | 315 | D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ', |
8822 | 315 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&(STRING | FSTRING_START | TSTRING_START) strings")); |
8823 | 315 | } |
8824 | 0 | { // 'None' |
8825 | 315 | if (p->error_indicator) { |
8826 | 5 | p->level--; |
8827 | 5 | return NULL; |
8828 | 5 | } |
8829 | 310 | D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); |
8830 | 310 | Token * _keyword; |
8831 | 310 | if ( |
8832 | 310 | (_keyword = _PyPegen_expect_token(p, 624)) // token='None' |
8833 | 310 | ) |
8834 | 9 | { |
8835 | 9 | D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); |
8836 | 9 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8837 | 9 | if (_token == NULL) { |
8838 | 0 | p->level--; |
8839 | 0 | return NULL; |
8840 | 0 | } |
8841 | 9 | int _end_lineno = _token->end_lineno; |
8842 | 9 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8843 | 9 | int _end_col_offset = _token->end_col_offset; |
8844 | 9 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8845 | 9 | _res = _PyAST_Constant ( Py_None , NULL , EXTRA ); |
8846 | 9 | if (_res == NULL && PyErr_Occurred()) { |
8847 | 0 | p->error_indicator = 1; |
8848 | 0 | p->level--; |
8849 | 0 | return NULL; |
8850 | 0 | } |
8851 | 9 | goto done; |
8852 | 9 | } |
8853 | 301 | p->mark = _mark; |
8854 | 301 | D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ', |
8855 | 301 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); |
8856 | 301 | } |
8857 | 0 | { // 'True' |
8858 | 301 | if (p->error_indicator) { |
8859 | 0 | p->level--; |
8860 | 0 | return NULL; |
8861 | 0 | } |
8862 | 301 | D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); |
8863 | 301 | Token * _keyword; |
8864 | 301 | if ( |
8865 | 301 | (_keyword = _PyPegen_expect_token(p, 623)) // token='True' |
8866 | 301 | ) |
8867 | 21 | { |
8868 | 21 | D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); |
8869 | 21 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8870 | 21 | if (_token == NULL) { |
8871 | 0 | p->level--; |
8872 | 0 | return NULL; |
8873 | 0 | } |
8874 | 21 | int _end_lineno = _token->end_lineno; |
8875 | 21 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8876 | 21 | int _end_col_offset = _token->end_col_offset; |
8877 | 21 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8878 | 21 | _res = _PyAST_Constant ( Py_True , NULL , EXTRA ); |
8879 | 21 | if (_res == NULL && PyErr_Occurred()) { |
8880 | 0 | p->error_indicator = 1; |
8881 | 0 | p->level--; |
8882 | 0 | return NULL; |
8883 | 0 | } |
8884 | 21 | goto done; |
8885 | 21 | } |
8886 | 280 | p->mark = _mark; |
8887 | 280 | D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ', |
8888 | 280 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); |
8889 | 280 | } |
8890 | 0 | { // 'False' |
8891 | 280 | if (p->error_indicator) { |
8892 | 0 | p->level--; |
8893 | 0 | return NULL; |
8894 | 0 | } |
8895 | 280 | D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); |
8896 | 280 | Token * _keyword; |
8897 | 280 | if ( |
8898 | 280 | (_keyword = _PyPegen_expect_token(p, 625)) // token='False' |
8899 | 280 | ) |
8900 | 6 | { |
8901 | 6 | D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); |
8902 | 6 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8903 | 6 | if (_token == NULL) { |
8904 | 0 | p->level--; |
8905 | 0 | return NULL; |
8906 | 0 | } |
8907 | 6 | int _end_lineno = _token->end_lineno; |
8908 | 6 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8909 | 6 | int _end_col_offset = _token->end_col_offset; |
8910 | 6 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8911 | 6 | _res = _PyAST_Constant ( Py_False , NULL , EXTRA ); |
8912 | 6 | if (_res == NULL && PyErr_Occurred()) { |
8913 | 0 | p->error_indicator = 1; |
8914 | 0 | p->level--; |
8915 | 0 | return NULL; |
8916 | 0 | } |
8917 | 6 | goto done; |
8918 | 6 | } |
8919 | 274 | p->mark = _mark; |
8920 | 274 | D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ', |
8921 | 274 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); |
8922 | 274 | } |
8923 | 274 | _res = NULL; |
8924 | 3.44k | done: |
8925 | 3.44k | p->level--; |
8926 | 3.44k | return _res; |
8927 | 274 | } |
8928 | | |
8929 | | // complex_number: |
8930 | | // | signed_real_number '+' imaginary_number |
8931 | | // | signed_real_number '-' imaginary_number |
8932 | | static expr_ty |
8933 | | complex_number_rule(Parser *p) |
8934 | 44.3k | { |
8935 | 44.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
8936 | 0 | _Pypegen_stack_overflow(p); |
8937 | 0 | } |
8938 | 44.3k | if (p->error_indicator) { |
8939 | 0 | p->level--; |
8940 | 0 | return NULL; |
8941 | 0 | } |
8942 | 44.3k | expr_ty _res = NULL; |
8943 | 44.3k | int _mark = p->mark; |
8944 | 44.3k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
8945 | 0 | p->error_indicator = 1; |
8946 | 0 | p->level--; |
8947 | 0 | return NULL; |
8948 | 0 | } |
8949 | 44.3k | int _start_lineno = p->tokens[_mark]->lineno; |
8950 | 44.3k | UNUSED(_start_lineno); // Only used by EXTRA macro |
8951 | 44.3k | int _start_col_offset = p->tokens[_mark]->col_offset; |
8952 | 44.3k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
8953 | 44.3k | { // signed_real_number '+' imaginary_number |
8954 | 44.3k | if (p->error_indicator) { |
8955 | 0 | p->level--; |
8956 | 0 | return NULL; |
8957 | 0 | } |
8958 | 44.3k | D(fprintf(stderr, "%*c> complex_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_real_number '+' imaginary_number")); |
8959 | 44.3k | Token * _literal; |
8960 | 44.3k | expr_ty imag; |
8961 | 44.3k | expr_ty real; |
8962 | 44.3k | if ( |
8963 | 44.3k | (real = signed_real_number_rule(p)) // signed_real_number |
8964 | 623 | && |
8965 | 623 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
8966 | 217 | && |
8967 | 217 | (imag = imaginary_number_rule(p)) // imaginary_number |
8968 | 44.3k | ) |
8969 | 201 | { |
8970 | 201 | D(fprintf(stderr, "%*c+ complex_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_real_number '+' imaginary_number")); |
8971 | 201 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
8972 | 201 | if (_token == NULL) { |
8973 | 0 | p->level--; |
8974 | 0 | return NULL; |
8975 | 0 | } |
8976 | 201 | int _end_lineno = _token->end_lineno; |
8977 | 201 | UNUSED(_end_lineno); // Only used by EXTRA macro |
8978 | 201 | int _end_col_offset = _token->end_col_offset; |
8979 | 201 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
8980 | 201 | _res = _PyAST_BinOp ( real , Add , imag , EXTRA ); |
8981 | 201 | if (_res == NULL && PyErr_Occurred()) { |
8982 | 0 | p->error_indicator = 1; |
8983 | 0 | p->level--; |
8984 | 0 | return NULL; |
8985 | 0 | } |
8986 | 201 | goto done; |
8987 | 201 | } |
8988 | 44.1k | p->mark = _mark; |
8989 | 44.1k | D(fprintf(stderr, "%*c%s complex_number[%d-%d]: %s failed!\n", p->level, ' ', |
8990 | 44.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_real_number '+' imaginary_number")); |
8991 | 44.1k | } |
8992 | 0 | { // signed_real_number '-' imaginary_number |
8993 | 44.1k | if (p->error_indicator) { |
8994 | 9 | p->level--; |
8995 | 9 | return NULL; |
8996 | 9 | } |
8997 | 44.1k | D(fprintf(stderr, "%*c> complex_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_real_number '-' imaginary_number")); |
8998 | 44.1k | Token * _literal; |
8999 | 44.1k | expr_ty imag; |
9000 | 44.1k | expr_ty real; |
9001 | 44.1k | if ( |
9002 | 44.1k | (real = signed_real_number_rule(p)) // signed_real_number |
9003 | 416 | && |
9004 | 416 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
9005 | 406 | && |
9006 | 406 | (imag = imaginary_number_rule(p)) // imaginary_number |
9007 | 44.1k | ) |
9008 | 367 | { |
9009 | 367 | D(fprintf(stderr, "%*c+ complex_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_real_number '-' imaginary_number")); |
9010 | 367 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
9011 | 367 | if (_token == NULL) { |
9012 | 0 | p->level--; |
9013 | 0 | return NULL; |
9014 | 0 | } |
9015 | 367 | int _end_lineno = _token->end_lineno; |
9016 | 367 | UNUSED(_end_lineno); // Only used by EXTRA macro |
9017 | 367 | int _end_col_offset = _token->end_col_offset; |
9018 | 367 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
9019 | 367 | _res = _PyAST_BinOp ( real , Sub , imag , EXTRA ); |
9020 | 367 | if (_res == NULL && PyErr_Occurred()) { |
9021 | 0 | p->error_indicator = 1; |
9022 | 0 | p->level--; |
9023 | 0 | return NULL; |
9024 | 0 | } |
9025 | 367 | goto done; |
9026 | 367 | } |
9027 | 43.7k | p->mark = _mark; |
9028 | 43.7k | D(fprintf(stderr, "%*c%s complex_number[%d-%d]: %s failed!\n", p->level, ' ', |
9029 | 43.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_real_number '-' imaginary_number")); |
9030 | 43.7k | } |
9031 | 43.7k | _res = NULL; |
9032 | 44.3k | done: |
9033 | 44.3k | p->level--; |
9034 | 44.3k | return _res; |
9035 | 43.7k | } |
9036 | | |
9037 | | // signed_number: NUMBER | '-' NUMBER |
9038 | | static expr_ty |
9039 | | signed_number_rule(Parser *p) |
9040 | 48.7k | { |
9041 | 48.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9042 | 0 | _Pypegen_stack_overflow(p); |
9043 | 0 | } |
9044 | 48.7k | if (p->error_indicator) { |
9045 | 0 | p->level--; |
9046 | 0 | return NULL; |
9047 | 0 | } |
9048 | 48.7k | expr_ty _res = NULL; |
9049 | 48.7k | int _mark = p->mark; |
9050 | 48.7k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
9051 | 0 | p->error_indicator = 1; |
9052 | 0 | p->level--; |
9053 | 0 | return NULL; |
9054 | 0 | } |
9055 | 48.7k | int _start_lineno = p->tokens[_mark]->lineno; |
9056 | 48.7k | UNUSED(_start_lineno); // Only used by EXTRA macro |
9057 | 48.7k | int _start_col_offset = p->tokens[_mark]->col_offset; |
9058 | 48.7k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
9059 | 48.7k | { // NUMBER |
9060 | 48.7k | if (p->error_indicator) { |
9061 | 0 | p->level--; |
9062 | 0 | return NULL; |
9063 | 0 | } |
9064 | 48.7k | D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
9065 | 48.7k | expr_ty number_var; |
9066 | 48.7k | if ( |
9067 | 48.7k | (number_var = _PyPegen_number_token(p)) // NUMBER |
9068 | 48.7k | ) |
9069 | 4.10k | { |
9070 | 4.10k | D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
9071 | 4.10k | _res = number_var; |
9072 | 4.10k | goto done; |
9073 | 4.10k | } |
9074 | 44.6k | p->mark = _mark; |
9075 | 44.6k | D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ', |
9076 | 44.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); |
9077 | 44.6k | } |
9078 | 0 | { // '-' NUMBER |
9079 | 44.6k | if (p->error_indicator) { |
9080 | 0 | p->level--; |
9081 | 0 | return NULL; |
9082 | 0 | } |
9083 | 44.6k | D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); |
9084 | 44.6k | Token * _literal; |
9085 | 44.6k | expr_ty number; |
9086 | 44.6k | if ( |
9087 | 44.6k | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
9088 | 989 | && |
9089 | 989 | (number = _PyPegen_number_token(p)) // NUMBER |
9090 | 44.6k | ) |
9091 | 962 | { |
9092 | 962 | D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' NUMBER")); |
9093 | 962 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
9094 | 962 | if (_token == NULL) { |
9095 | 0 | p->level--; |
9096 | 0 | return NULL; |
9097 | 0 | } |
9098 | 962 | int _end_lineno = _token->end_lineno; |
9099 | 962 | UNUSED(_end_lineno); // Only used by EXTRA macro |
9100 | 962 | int _end_col_offset = _token->end_col_offset; |
9101 | 962 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
9102 | 962 | _res = _PyAST_UnaryOp ( USub , number , EXTRA ); |
9103 | 962 | if (_res == NULL && PyErr_Occurred()) { |
9104 | 0 | p->error_indicator = 1; |
9105 | 0 | p->level--; |
9106 | 0 | return NULL; |
9107 | 0 | } |
9108 | 962 | goto done; |
9109 | 962 | } |
9110 | 43.7k | p->mark = _mark; |
9111 | 43.7k | D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ', |
9112 | 43.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' NUMBER")); |
9113 | 43.7k | } |
9114 | 43.7k | _res = NULL; |
9115 | 48.7k | done: |
9116 | 48.7k | p->level--; |
9117 | 48.7k | return _res; |
9118 | 43.7k | } |
9119 | | |
9120 | | // signed_real_number: real_number | '-' real_number |
9121 | | static expr_ty |
9122 | | signed_real_number_rule(Parser *p) |
9123 | 88.4k | { |
9124 | 88.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9125 | 0 | _Pypegen_stack_overflow(p); |
9126 | 0 | } |
9127 | 88.4k | if (p->error_indicator) { |
9128 | 0 | p->level--; |
9129 | 0 | return NULL; |
9130 | 0 | } |
9131 | 88.4k | expr_ty _res = NULL; |
9132 | 88.4k | int _mark = p->mark; |
9133 | 88.4k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
9134 | 0 | p->error_indicator = 1; |
9135 | 0 | p->level--; |
9136 | 0 | return NULL; |
9137 | 0 | } |
9138 | 88.4k | int _start_lineno = p->tokens[_mark]->lineno; |
9139 | 88.4k | UNUSED(_start_lineno); // Only used by EXTRA macro |
9140 | 88.4k | int _start_col_offset = p->tokens[_mark]->col_offset; |
9141 | 88.4k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
9142 | 88.4k | { // real_number |
9143 | 88.4k | if (p->error_indicator) { |
9144 | 0 | p->level--; |
9145 | 0 | return NULL; |
9146 | 0 | } |
9147 | 88.4k | D(fprintf(stderr, "%*c> signed_real_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "real_number")); |
9148 | 88.4k | expr_ty real_number_var; |
9149 | 88.4k | if ( |
9150 | 88.4k | (real_number_var = real_number_rule(p)) // real_number |
9151 | 88.4k | ) |
9152 | 786 | { |
9153 | 786 | D(fprintf(stderr, "%*c+ signed_real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "real_number")); |
9154 | 786 | _res = real_number_var; |
9155 | 786 | goto done; |
9156 | 786 | } |
9157 | 87.6k | p->mark = _mark; |
9158 | 87.6k | D(fprintf(stderr, "%*c%s signed_real_number[%d-%d]: %s failed!\n", p->level, ' ', |
9159 | 87.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "real_number")); |
9160 | 87.6k | } |
9161 | 0 | { // '-' real_number |
9162 | 87.6k | if (p->error_indicator) { |
9163 | 1 | p->level--; |
9164 | 1 | return NULL; |
9165 | 1 | } |
9166 | 87.6k | D(fprintf(stderr, "%*c> signed_real_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' real_number")); |
9167 | 87.6k | Token * _literal; |
9168 | 87.6k | expr_ty real; |
9169 | 87.6k | if ( |
9170 | 87.6k | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
9171 | 303 | && |
9172 | 303 | (real = real_number_rule(p)) // real_number |
9173 | 87.6k | ) |
9174 | 253 | { |
9175 | 253 | D(fprintf(stderr, "%*c+ signed_real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' real_number")); |
9176 | 253 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
9177 | 253 | if (_token == NULL) { |
9178 | 0 | p->level--; |
9179 | 0 | return NULL; |
9180 | 0 | } |
9181 | 253 | int _end_lineno = _token->end_lineno; |
9182 | 253 | UNUSED(_end_lineno); // Only used by EXTRA macro |
9183 | 253 | int _end_col_offset = _token->end_col_offset; |
9184 | 253 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
9185 | 253 | _res = _PyAST_UnaryOp ( USub , real , EXTRA ); |
9186 | 253 | if (_res == NULL && PyErr_Occurred()) { |
9187 | 0 | p->error_indicator = 1; |
9188 | 0 | p->level--; |
9189 | 0 | return NULL; |
9190 | 0 | } |
9191 | 253 | goto done; |
9192 | 253 | } |
9193 | 87.4k | p->mark = _mark; |
9194 | 87.4k | D(fprintf(stderr, "%*c%s signed_real_number[%d-%d]: %s failed!\n", p->level, ' ', |
9195 | 87.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' real_number")); |
9196 | 87.4k | } |
9197 | 87.4k | _res = NULL; |
9198 | 88.4k | done: |
9199 | 88.4k | p->level--; |
9200 | 88.4k | return _res; |
9201 | 87.4k | } |
9202 | | |
9203 | | // real_number: NUMBER |
9204 | | static expr_ty |
9205 | | real_number_rule(Parser *p) |
9206 | 88.7k | { |
9207 | 88.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9208 | 0 | _Pypegen_stack_overflow(p); |
9209 | 0 | } |
9210 | 88.7k | if (p->error_indicator) { |
9211 | 0 | p->level--; |
9212 | 0 | return NULL; |
9213 | 0 | } |
9214 | 88.7k | expr_ty _res = NULL; |
9215 | 88.7k | int _mark = p->mark; |
9216 | 88.7k | { // NUMBER |
9217 | 88.7k | if (p->error_indicator) { |
9218 | 0 | p->level--; |
9219 | 0 | return NULL; |
9220 | 0 | } |
9221 | 88.7k | D(fprintf(stderr, "%*c> real_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
9222 | 88.7k | expr_ty real; |
9223 | 88.7k | if ( |
9224 | 88.7k | (real = _PyPegen_number_token(p)) // NUMBER |
9225 | 88.7k | ) |
9226 | 1.04k | { |
9227 | 1.04k | D(fprintf(stderr, "%*c+ real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
9228 | 1.04k | _res = _PyPegen_ensure_real ( p , real ); |
9229 | 1.04k | if (_res == NULL && PyErr_Occurred()) { |
9230 | 3 | p->error_indicator = 1; |
9231 | 3 | p->level--; |
9232 | 3 | return NULL; |
9233 | 3 | } |
9234 | 1.03k | goto done; |
9235 | 1.04k | } |
9236 | 87.7k | p->mark = _mark; |
9237 | 87.7k | D(fprintf(stderr, "%*c%s real_number[%d-%d]: %s failed!\n", p->level, ' ', |
9238 | 87.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); |
9239 | 87.7k | } |
9240 | 87.7k | _res = NULL; |
9241 | 88.7k | done: |
9242 | 88.7k | p->level--; |
9243 | 88.7k | return _res; |
9244 | 87.7k | } |
9245 | | |
9246 | | // imaginary_number: NUMBER |
9247 | | static expr_ty |
9248 | | imaginary_number_rule(Parser *p) |
9249 | 623 | { |
9250 | 623 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9251 | 0 | _Pypegen_stack_overflow(p); |
9252 | 0 | } |
9253 | 623 | if (p->error_indicator) { |
9254 | 0 | p->level--; |
9255 | 0 | return NULL; |
9256 | 0 | } |
9257 | 623 | expr_ty _res = NULL; |
9258 | 623 | int _mark = p->mark; |
9259 | 623 | { // NUMBER |
9260 | 623 | if (p->error_indicator) { |
9261 | 0 | p->level--; |
9262 | 0 | return NULL; |
9263 | 0 | } |
9264 | 623 | D(fprintf(stderr, "%*c> imaginary_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
9265 | 623 | expr_ty imag; |
9266 | 623 | if ( |
9267 | 623 | (imag = _PyPegen_number_token(p)) // NUMBER |
9268 | 623 | ) |
9269 | 575 | { |
9270 | 575 | D(fprintf(stderr, "%*c+ imaginary_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
9271 | 575 | _res = _PyPegen_ensure_imaginary ( p , imag ); |
9272 | 575 | if (_res == NULL && PyErr_Occurred()) { |
9273 | 7 | p->error_indicator = 1; |
9274 | 7 | p->level--; |
9275 | 7 | return NULL; |
9276 | 7 | } |
9277 | 568 | goto done; |
9278 | 575 | } |
9279 | 48 | p->mark = _mark; |
9280 | 48 | D(fprintf(stderr, "%*c%s imaginary_number[%d-%d]: %s failed!\n", p->level, ' ', |
9281 | 48 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); |
9282 | 48 | } |
9283 | 48 | _res = NULL; |
9284 | 616 | done: |
9285 | 616 | p->level--; |
9286 | 616 | return _res; |
9287 | 48 | } |
9288 | | |
9289 | | // capture_pattern: pattern_capture_target |
9290 | | static pattern_ty |
9291 | | capture_pattern_rule(Parser *p) |
9292 | 42.0k | { |
9293 | 42.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9294 | 0 | _Pypegen_stack_overflow(p); |
9295 | 0 | } |
9296 | 42.0k | if (p->error_indicator) { |
9297 | 0 | p->level--; |
9298 | 0 | return NULL; |
9299 | 0 | } |
9300 | 42.0k | pattern_ty _res = NULL; |
9301 | 42.0k | int _mark = p->mark; |
9302 | 42.0k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
9303 | 0 | p->error_indicator = 1; |
9304 | 0 | p->level--; |
9305 | 0 | return NULL; |
9306 | 0 | } |
9307 | 42.0k | int _start_lineno = p->tokens[_mark]->lineno; |
9308 | 42.0k | UNUSED(_start_lineno); // Only used by EXTRA macro |
9309 | 42.0k | int _start_col_offset = p->tokens[_mark]->col_offset; |
9310 | 42.0k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
9311 | 42.0k | { // pattern_capture_target |
9312 | 42.0k | if (p->error_indicator) { |
9313 | 0 | p->level--; |
9314 | 0 | return NULL; |
9315 | 0 | } |
9316 | 42.0k | D(fprintf(stderr, "%*c> capture_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern_capture_target")); |
9317 | 42.0k | expr_ty target; |
9318 | 42.0k | if ( |
9319 | 42.0k | (target = pattern_capture_target_rule(p)) // pattern_capture_target |
9320 | 42.0k | ) |
9321 | 14.4k | { |
9322 | 14.4k | D(fprintf(stderr, "%*c+ capture_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern_capture_target")); |
9323 | 14.4k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
9324 | 14.4k | if (_token == NULL) { |
9325 | 0 | p->level--; |
9326 | 0 | return NULL; |
9327 | 0 | } |
9328 | 14.4k | int _end_lineno = _token->end_lineno; |
9329 | 14.4k | UNUSED(_end_lineno); // Only used by EXTRA macro |
9330 | 14.4k | int _end_col_offset = _token->end_col_offset; |
9331 | 14.4k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
9332 | 14.4k | _res = _PyAST_MatchAs ( NULL , target -> v . Name . id , EXTRA ); |
9333 | 14.4k | if (_res == NULL && PyErr_Occurred()) { |
9334 | 0 | p->error_indicator = 1; |
9335 | 0 | p->level--; |
9336 | 0 | return NULL; |
9337 | 0 | } |
9338 | 14.4k | goto done; |
9339 | 14.4k | } |
9340 | 27.6k | p->mark = _mark; |
9341 | 27.6k | D(fprintf(stderr, "%*c%s capture_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
9342 | 27.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern_capture_target")); |
9343 | 27.6k | } |
9344 | 27.6k | _res = NULL; |
9345 | 42.0k | done: |
9346 | 42.0k | p->level--; |
9347 | 42.0k | return _res; |
9348 | 27.6k | } |
9349 | | |
9350 | | // pattern_capture_target: !"_" NAME !('.' | '(' | '=') |
9351 | | static expr_ty |
9352 | | pattern_capture_target_rule(Parser *p) |
9353 | 44.0k | { |
9354 | 44.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9355 | 0 | _Pypegen_stack_overflow(p); |
9356 | 0 | } |
9357 | 44.0k | if (p->error_indicator) { |
9358 | 0 | p->level--; |
9359 | 0 | return NULL; |
9360 | 0 | } |
9361 | 44.0k | expr_ty _res = NULL; |
9362 | 44.0k | int _mark = p->mark; |
9363 | 44.0k | { // !"_" NAME !('.' | '(' | '=') |
9364 | 44.0k | if (p->error_indicator) { |
9365 | 0 | p->level--; |
9366 | 0 | return NULL; |
9367 | 0 | } |
9368 | 44.0k | D(fprintf(stderr, "%*c> pattern_capture_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); |
9369 | 44.0k | expr_ty name; |
9370 | 44.0k | if ( |
9371 | 44.0k | _PyPegen_lookahead_with_string(0, _PyPegen_expect_soft_keyword, p, "_") |
9372 | 37.8k | && |
9373 | 37.8k | (name = _PyPegen_name_token(p)) // NAME |
9374 | 27.2k | && |
9375 | 27.2k | _PyPegen_lookahead(0, _tmp_43_rule, p) |
9376 | 44.0k | ) |
9377 | 15.4k | { |
9378 | 15.4k | D(fprintf(stderr, "%*c+ pattern_capture_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); |
9379 | 15.4k | _res = _PyPegen_set_expr_context ( p , name , Store ); |
9380 | 15.4k | if (_res == NULL && PyErr_Occurred()) { |
9381 | 0 | p->error_indicator = 1; |
9382 | 0 | p->level--; |
9383 | 0 | return NULL; |
9384 | 0 | } |
9385 | 15.4k | goto done; |
9386 | 15.4k | } |
9387 | 28.6k | p->mark = _mark; |
9388 | 28.6k | D(fprintf(stderr, "%*c%s pattern_capture_target[%d-%d]: %s failed!\n", p->level, ' ', |
9389 | 28.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); |
9390 | 28.6k | } |
9391 | 28.6k | _res = NULL; |
9392 | 44.0k | done: |
9393 | 44.0k | p->level--; |
9394 | 44.0k | return _res; |
9395 | 28.6k | } |
9396 | | |
9397 | | // wildcard_pattern: "_" |
9398 | | static pattern_ty |
9399 | | wildcard_pattern_rule(Parser *p) |
9400 | 28.5k | { |
9401 | 28.5k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9402 | 0 | _Pypegen_stack_overflow(p); |
9403 | 0 | } |
9404 | 28.5k | if (p->error_indicator) { |
9405 | 0 | p->level--; |
9406 | 0 | return NULL; |
9407 | 0 | } |
9408 | 28.5k | pattern_ty _res = NULL; |
9409 | 28.5k | int _mark = p->mark; |
9410 | 28.5k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
9411 | 0 | p->error_indicator = 1; |
9412 | 0 | p->level--; |
9413 | 0 | return NULL; |
9414 | 0 | } |
9415 | 28.5k | int _start_lineno = p->tokens[_mark]->lineno; |
9416 | 28.5k | UNUSED(_start_lineno); // Only used by EXTRA macro |
9417 | 28.5k | int _start_col_offset = p->tokens[_mark]->col_offset; |
9418 | 28.5k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
9419 | 28.5k | { // "_" |
9420 | 28.5k | if (p->error_indicator) { |
9421 | 0 | p->level--; |
9422 | 0 | return NULL; |
9423 | 0 | } |
9424 | 28.5k | D(fprintf(stderr, "%*c> wildcard_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"_\"")); |
9425 | 28.5k | expr_ty _keyword; |
9426 | 28.5k | if ( |
9427 | 28.5k | (_keyword = _PyPegen_expect_soft_keyword(p, "_")) // soft_keyword='"_"' |
9428 | 28.5k | ) |
9429 | 6.25k | { |
9430 | 6.25k | D(fprintf(stderr, "%*c+ wildcard_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"_\"")); |
9431 | 6.25k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
9432 | 6.25k | if (_token == NULL) { |
9433 | 0 | p->level--; |
9434 | 0 | return NULL; |
9435 | 0 | } |
9436 | 6.25k | int _end_lineno = _token->end_lineno; |
9437 | 6.25k | UNUSED(_end_lineno); // Only used by EXTRA macro |
9438 | 6.25k | int _end_col_offset = _token->end_col_offset; |
9439 | 6.25k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
9440 | 6.25k | _res = _PyAST_MatchAs ( NULL , NULL , EXTRA ); |
9441 | 6.25k | if (_res == NULL && PyErr_Occurred()) { |
9442 | 0 | p->error_indicator = 1; |
9443 | 0 | p->level--; |
9444 | 0 | return NULL; |
9445 | 0 | } |
9446 | 6.25k | goto done; |
9447 | 6.25k | } |
9448 | 22.3k | p->mark = _mark; |
9449 | 22.3k | D(fprintf(stderr, "%*c%s wildcard_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
9450 | 22.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"_\"")); |
9451 | 22.3k | } |
9452 | 22.3k | _res = NULL; |
9453 | 28.5k | done: |
9454 | 28.5k | p->level--; |
9455 | 28.5k | return _res; |
9456 | 22.3k | } |
9457 | | |
9458 | | // value_pattern: attr !('.' | '(' | '=') |
9459 | | static pattern_ty |
9460 | | value_pattern_rule(Parser *p) |
9461 | 22.2k | { |
9462 | 22.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9463 | 0 | _Pypegen_stack_overflow(p); |
9464 | 0 | } |
9465 | 22.2k | if (p->error_indicator) { |
9466 | 0 | p->level--; |
9467 | 0 | return NULL; |
9468 | 0 | } |
9469 | 22.2k | pattern_ty _res = NULL; |
9470 | 22.2k | int _mark = p->mark; |
9471 | 22.2k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
9472 | 0 | p->error_indicator = 1; |
9473 | 0 | p->level--; |
9474 | 0 | return NULL; |
9475 | 0 | } |
9476 | 22.2k | int _start_lineno = p->tokens[_mark]->lineno; |
9477 | 22.2k | UNUSED(_start_lineno); // Only used by EXTRA macro |
9478 | 22.2k | int _start_col_offset = p->tokens[_mark]->col_offset; |
9479 | 22.2k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
9480 | 22.2k | { // attr !('.' | '(' | '=') |
9481 | 22.2k | if (p->error_indicator) { |
9482 | 0 | p->level--; |
9483 | 0 | return NULL; |
9484 | 0 | } |
9485 | 22.2k | D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); |
9486 | 22.2k | expr_ty attr; |
9487 | 22.2k | if ( |
9488 | 22.2k | (attr = attr_rule(p)) // attr |
9489 | 476 | && |
9490 | 476 | _PyPegen_lookahead(0, _tmp_43_rule, p) |
9491 | 22.2k | ) |
9492 | 330 | { |
9493 | 330 | D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); |
9494 | 330 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
9495 | 330 | if (_token == NULL) { |
9496 | 0 | p->level--; |
9497 | 0 | return NULL; |
9498 | 0 | } |
9499 | 330 | int _end_lineno = _token->end_lineno; |
9500 | 330 | UNUSED(_end_lineno); // Only used by EXTRA macro |
9501 | 330 | int _end_col_offset = _token->end_col_offset; |
9502 | 330 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
9503 | 330 | _res = _PyAST_MatchValue ( attr , EXTRA ); |
9504 | 330 | if (_res == NULL && PyErr_Occurred()) { |
9505 | 0 | p->error_indicator = 1; |
9506 | 0 | p->level--; |
9507 | 0 | return NULL; |
9508 | 0 | } |
9509 | 330 | goto done; |
9510 | 330 | } |
9511 | 21.9k | p->mark = _mark; |
9512 | 21.9k | D(fprintf(stderr, "%*c%s value_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
9513 | 21.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr !('.' | '(' | '=')")); |
9514 | 21.9k | } |
9515 | 21.9k | _res = NULL; |
9516 | 22.2k | done: |
9517 | 22.2k | p->level--; |
9518 | 22.2k | return _res; |
9519 | 21.9k | } |
9520 | | |
9521 | | // Left-recursive |
9522 | | // attr: name_or_attr '.' NAME |
9523 | | static expr_ty attr_raw(Parser *); |
9524 | | static expr_ty |
9525 | | attr_rule(Parser *p) |
9526 | 115k | { |
9527 | 115k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9528 | 0 | _Pypegen_stack_overflow(p); |
9529 | 0 | } |
9530 | 115k | expr_ty _res = NULL; |
9531 | 115k | if (_PyPegen_is_memoized(p, attr_type, &_res)) { |
9532 | 92.6k | p->level--; |
9533 | 92.6k | return _res; |
9534 | 92.6k | } |
9535 | 22.4k | int _mark = p->mark; |
9536 | 22.4k | int _resmark = p->mark; |
9537 | 22.9k | while (1) { |
9538 | 22.9k | int tmpvar_1 = _PyPegen_update_memo(p, _mark, attr_type, _res); |
9539 | 22.9k | if (tmpvar_1) { |
9540 | 0 | p->level--; |
9541 | 0 | return _res; |
9542 | 0 | } |
9543 | 22.9k | p->mark = _mark; |
9544 | 22.9k | void *_raw = attr_raw(p); |
9545 | 22.9k | if (p->error_indicator) { |
9546 | 6 | p->level--; |
9547 | 6 | return NULL; |
9548 | 6 | } |
9549 | 22.9k | if (_raw == NULL || p->mark <= _resmark) |
9550 | 22.4k | break; |
9551 | 547 | _resmark = p->mark; |
9552 | 547 | _res = _raw; |
9553 | 547 | } |
9554 | 22.4k | p->mark = _resmark; |
9555 | 22.4k | p->level--; |
9556 | 22.4k | return _res; |
9557 | 22.4k | } |
9558 | | static expr_ty |
9559 | | attr_raw(Parser *p) |
9560 | 22.9k | { |
9561 | 22.9k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9562 | 0 | _Pypegen_stack_overflow(p); |
9563 | 0 | } |
9564 | 22.9k | if (p->error_indicator) { |
9565 | 0 | p->level--; |
9566 | 0 | return NULL; |
9567 | 0 | } |
9568 | 22.9k | expr_ty _res = NULL; |
9569 | 22.9k | int _mark = p->mark; |
9570 | 22.9k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
9571 | 0 | p->error_indicator = 1; |
9572 | 0 | p->level--; |
9573 | 0 | return NULL; |
9574 | 0 | } |
9575 | 22.9k | int _start_lineno = p->tokens[_mark]->lineno; |
9576 | 22.9k | UNUSED(_start_lineno); // Only used by EXTRA macro |
9577 | 22.9k | int _start_col_offset = p->tokens[_mark]->col_offset; |
9578 | 22.9k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
9579 | 22.9k | { // name_or_attr '.' NAME |
9580 | 22.9k | if (p->error_indicator) { |
9581 | 0 | p->level--; |
9582 | 0 | return NULL; |
9583 | 0 | } |
9584 | 22.9k | D(fprintf(stderr, "%*c> attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); |
9585 | 22.9k | Token * _literal; |
9586 | 22.9k | expr_ty attr; |
9587 | 22.9k | expr_ty value; |
9588 | 22.9k | if ( |
9589 | 22.9k | (value = name_or_attr_rule(p)) // name_or_attr |
9590 | 12.3k | && |
9591 | 12.3k | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
9592 | 558 | && |
9593 | 558 | (attr = _PyPegen_name_token(p)) // NAME |
9594 | 22.9k | ) |
9595 | 547 | { |
9596 | 547 | D(fprintf(stderr, "%*c+ attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME")); |
9597 | 547 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
9598 | 547 | if (_token == NULL) { |
9599 | 0 | p->level--; |
9600 | 0 | return NULL; |
9601 | 0 | } |
9602 | 547 | int _end_lineno = _token->end_lineno; |
9603 | 547 | UNUSED(_end_lineno); // Only used by EXTRA macro |
9604 | 547 | int _end_col_offset = _token->end_col_offset; |
9605 | 547 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
9606 | 547 | _res = _PyAST_Attribute ( value , attr -> v . Name . id , Load , EXTRA ); |
9607 | 547 | if (_res == NULL && PyErr_Occurred()) { |
9608 | 0 | p->error_indicator = 1; |
9609 | 0 | p->level--; |
9610 | 0 | return NULL; |
9611 | 0 | } |
9612 | 547 | goto done; |
9613 | 547 | } |
9614 | 22.4k | p->mark = _mark; |
9615 | 22.4k | D(fprintf(stderr, "%*c%s attr[%d-%d]: %s failed!\n", p->level, ' ', |
9616 | 22.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME")); |
9617 | 22.4k | } |
9618 | 22.4k | _res = NULL; |
9619 | 22.9k | done: |
9620 | 22.9k | p->level--; |
9621 | 22.9k | return _res; |
9622 | 22.4k | } |
9623 | | |
9624 | | // Left-recursive |
9625 | | // name_or_attr: attr | NAME |
9626 | | static expr_ty |
9627 | | name_or_attr_rule(Parser *p) |
9628 | 92.4k | { |
9629 | 92.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9630 | 0 | _Pypegen_stack_overflow(p); |
9631 | 0 | } |
9632 | 92.4k | if (p->error_indicator) { |
9633 | 0 | p->level--; |
9634 | 0 | return NULL; |
9635 | 0 | } |
9636 | 92.4k | expr_ty _res = NULL; |
9637 | 92.4k | int _mark = p->mark; |
9638 | 92.4k | { // attr |
9639 | 92.4k | if (p->error_indicator) { |
9640 | 0 | p->level--; |
9641 | 0 | return NULL; |
9642 | 0 | } |
9643 | 92.4k | D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr")); |
9644 | 92.4k | expr_ty attr_var; |
9645 | 92.4k | if ( |
9646 | 92.4k | (attr_var = attr_rule(p)) // attr |
9647 | 92.4k | ) |
9648 | 1.15k | { |
9649 | 1.15k | D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr")); |
9650 | 1.15k | _res = attr_var; |
9651 | 1.15k | goto done; |
9652 | 1.15k | } |
9653 | 91.3k | p->mark = _mark; |
9654 | 91.3k | D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', |
9655 | 91.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr")); |
9656 | 91.3k | } |
9657 | 0 | { // NAME |
9658 | 91.3k | if (p->error_indicator) { |
9659 | 0 | p->level--; |
9660 | 0 | return NULL; |
9661 | 0 | } |
9662 | 91.3k | D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
9663 | 91.3k | expr_ty name_var; |
9664 | 91.3k | if ( |
9665 | 91.3k | (name_var = _PyPegen_name_token(p)) // NAME |
9666 | 91.3k | ) |
9667 | 54.8k | { |
9668 | 54.8k | D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
9669 | 54.8k | _res = name_var; |
9670 | 54.8k | goto done; |
9671 | 54.8k | } |
9672 | 36.4k | p->mark = _mark; |
9673 | 36.4k | D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ', |
9674 | 36.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
9675 | 36.4k | } |
9676 | 36.4k | _res = NULL; |
9677 | 92.4k | done: |
9678 | 92.4k | p->level--; |
9679 | 92.4k | return _res; |
9680 | 36.4k | } |
9681 | | |
9682 | | // group_pattern: '(' pattern ')' |
9683 | | static pattern_ty |
9684 | | group_pattern_rule(Parser *p) |
9685 | 21.9k | { |
9686 | 21.9k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9687 | 0 | _Pypegen_stack_overflow(p); |
9688 | 0 | } |
9689 | 21.9k | if (p->error_indicator) { |
9690 | 0 | p->level--; |
9691 | 0 | return NULL; |
9692 | 0 | } |
9693 | 21.9k | pattern_ty _res = NULL; |
9694 | 21.9k | int _mark = p->mark; |
9695 | 21.9k | { // '(' pattern ')' |
9696 | 21.9k | if (p->error_indicator) { |
9697 | 0 | p->level--; |
9698 | 0 | return NULL; |
9699 | 0 | } |
9700 | 21.9k | D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); |
9701 | 21.9k | Token * _literal; |
9702 | 21.9k | Token * _literal_1; |
9703 | 21.9k | pattern_ty pattern; |
9704 | 21.9k | if ( |
9705 | 21.9k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
9706 | 3.80k | && |
9707 | 3.80k | (pattern = pattern_rule(p)) // pattern |
9708 | 660 | && |
9709 | 660 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
9710 | 21.9k | ) |
9711 | 256 | { |
9712 | 256 | D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'")); |
9713 | 256 | _res = pattern; |
9714 | 256 | if (_res == NULL && PyErr_Occurred()) { |
9715 | 0 | p->error_indicator = 1; |
9716 | 0 | p->level--; |
9717 | 0 | return NULL; |
9718 | 0 | } |
9719 | 256 | goto done; |
9720 | 256 | } |
9721 | 21.7k | p->mark = _mark; |
9722 | 21.7k | D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
9723 | 21.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' pattern ')'")); |
9724 | 21.7k | } |
9725 | 21.7k | _res = NULL; |
9726 | 21.9k | done: |
9727 | 21.9k | p->level--; |
9728 | 21.9k | return _res; |
9729 | 21.7k | } |
9730 | | |
9731 | | // sequence_pattern: '[' maybe_sequence_pattern? ']' | '(' open_sequence_pattern? ')' |
9732 | | static pattern_ty |
9733 | | sequence_pattern_rule(Parser *p) |
9734 | 21.2k | { |
9735 | 21.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9736 | 0 | _Pypegen_stack_overflow(p); |
9737 | 0 | } |
9738 | 21.2k | if (p->error_indicator) { |
9739 | 0 | p->level--; |
9740 | 0 | return NULL; |
9741 | 0 | } |
9742 | 21.2k | pattern_ty _res = NULL; |
9743 | 21.2k | int _mark = p->mark; |
9744 | 21.2k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
9745 | 0 | p->error_indicator = 1; |
9746 | 0 | p->level--; |
9747 | 0 | return NULL; |
9748 | 0 | } |
9749 | 21.2k | int _start_lineno = p->tokens[_mark]->lineno; |
9750 | 21.2k | UNUSED(_start_lineno); // Only used by EXTRA macro |
9751 | 21.2k | int _start_col_offset = p->tokens[_mark]->col_offset; |
9752 | 21.2k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
9753 | 21.2k | { // '[' maybe_sequence_pattern? ']' |
9754 | 21.2k | if (p->error_indicator) { |
9755 | 0 | p->level--; |
9756 | 0 | return NULL; |
9757 | 0 | } |
9758 | 21.2k | D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'")); |
9759 | 21.2k | Token * _literal; |
9760 | 21.2k | Token * _literal_1; |
9761 | 21.2k | void *patterns; |
9762 | 21.2k | if ( |
9763 | 21.2k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
9764 | 2.00k | && |
9765 | 2.00k | (patterns = maybe_sequence_pattern_rule(p), !p->error_indicator) // maybe_sequence_pattern? |
9766 | 1.55k | && |
9767 | 1.55k | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
9768 | 21.2k | ) |
9769 | 223 | { |
9770 | 223 | D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'")); |
9771 | 223 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
9772 | 223 | if (_token == NULL) { |
9773 | 0 | p->level--; |
9774 | 0 | return NULL; |
9775 | 0 | } |
9776 | 223 | int _end_lineno = _token->end_lineno; |
9777 | 223 | UNUSED(_end_lineno); // Only used by EXTRA macro |
9778 | 223 | int _end_col_offset = _token->end_col_offset; |
9779 | 223 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
9780 | 223 | _res = _PyAST_MatchSequence ( patterns , EXTRA ); |
9781 | 223 | if (_res == NULL && PyErr_Occurred()) { |
9782 | 0 | p->error_indicator = 1; |
9783 | 0 | p->level--; |
9784 | 0 | return NULL; |
9785 | 0 | } |
9786 | 223 | goto done; |
9787 | 223 | } |
9788 | 21.0k | p->mark = _mark; |
9789 | 21.0k | D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
9790 | 21.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' maybe_sequence_pattern? ']'")); |
9791 | 21.0k | } |
9792 | 0 | { // '(' open_sequence_pattern? ')' |
9793 | 21.0k | if (p->error_indicator) { |
9794 | 449 | p->level--; |
9795 | 449 | return NULL; |
9796 | 449 | } |
9797 | 20.6k | D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'")); |
9798 | 20.6k | Token * _literal; |
9799 | 20.6k | Token * _literal_1; |
9800 | 20.6k | void *patterns; |
9801 | 20.6k | if ( |
9802 | 20.6k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
9803 | 3.12k | && |
9804 | 3.12k | (patterns = open_sequence_pattern_rule(p), !p->error_indicator) // open_sequence_pattern? |
9805 | 3.04k | && |
9806 | 3.04k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
9807 | 20.6k | ) |
9808 | 1.65k | { |
9809 | 1.65k | D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'")); |
9810 | 1.65k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
9811 | 1.65k | if (_token == NULL) { |
9812 | 0 | p->level--; |
9813 | 0 | return NULL; |
9814 | 0 | } |
9815 | 1.65k | int _end_lineno = _token->end_lineno; |
9816 | 1.65k | UNUSED(_end_lineno); // Only used by EXTRA macro |
9817 | 1.65k | int _end_col_offset = _token->end_col_offset; |
9818 | 1.65k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
9819 | 1.65k | _res = _PyAST_MatchSequence ( patterns , EXTRA ); |
9820 | 1.65k | if (_res == NULL && PyErr_Occurred()) { |
9821 | 0 | p->error_indicator = 1; |
9822 | 0 | p->level--; |
9823 | 0 | return NULL; |
9824 | 0 | } |
9825 | 1.65k | goto done; |
9826 | 1.65k | } |
9827 | 18.9k | p->mark = _mark; |
9828 | 18.9k | D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
9829 | 18.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' open_sequence_pattern? ')'")); |
9830 | 18.9k | } |
9831 | 18.9k | _res = NULL; |
9832 | 20.8k | done: |
9833 | 20.8k | p->level--; |
9834 | 20.8k | return _res; |
9835 | 18.9k | } |
9836 | | |
9837 | | // open_sequence_pattern: maybe_star_pattern ',' maybe_sequence_pattern? |
9838 | | static asdl_seq* |
9839 | | open_sequence_pattern_rule(Parser *p) |
9840 | 10.7k | { |
9841 | 10.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9842 | 0 | _Pypegen_stack_overflow(p); |
9843 | 0 | } |
9844 | 10.7k | if (p->error_indicator) { |
9845 | 0 | p->level--; |
9846 | 0 | return NULL; |
9847 | 0 | } |
9848 | 10.7k | asdl_seq* _res = NULL; |
9849 | 10.7k | int _mark = p->mark; |
9850 | 10.7k | { // maybe_star_pattern ',' maybe_sequence_pattern? |
9851 | 10.7k | if (p->error_indicator) { |
9852 | 0 | p->level--; |
9853 | 0 | return NULL; |
9854 | 0 | } |
9855 | 10.7k | D(fprintf(stderr, "%*c> open_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); |
9856 | 10.7k | Token * _literal; |
9857 | 10.7k | pattern_ty pattern; |
9858 | 10.7k | void *patterns; |
9859 | 10.7k | if ( |
9860 | 10.7k | (pattern = maybe_star_pattern_rule(p)) // maybe_star_pattern |
9861 | 6.85k | && |
9862 | 6.85k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
9863 | 2.07k | && |
9864 | 2.07k | (patterns = maybe_sequence_pattern_rule(p), !p->error_indicator) // maybe_sequence_pattern? |
9865 | 10.7k | ) |
9866 | 1.98k | { |
9867 | 1.98k | D(fprintf(stderr, "%*c+ open_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); |
9868 | 1.98k | _res = _PyPegen_seq_insert_in_front ( p , pattern , patterns ); |
9869 | 1.98k | if (_res == NULL && PyErr_Occurred()) { |
9870 | 0 | p->error_indicator = 1; |
9871 | 0 | p->level--; |
9872 | 0 | return NULL; |
9873 | 0 | } |
9874 | 1.98k | goto done; |
9875 | 1.98k | } |
9876 | 8.79k | p->mark = _mark; |
9877 | 8.79k | D(fprintf(stderr, "%*c%s open_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
9878 | 8.79k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?")); |
9879 | 8.79k | } |
9880 | 8.79k | _res = NULL; |
9881 | 10.7k | done: |
9882 | 10.7k | p->level--; |
9883 | 10.7k | return _res; |
9884 | 8.79k | } |
9885 | | |
9886 | | // maybe_sequence_pattern: ','.maybe_star_pattern+ ','? |
9887 | | static asdl_seq* |
9888 | | maybe_sequence_pattern_rule(Parser *p) |
9889 | 4.08k | { |
9890 | 4.08k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9891 | 0 | _Pypegen_stack_overflow(p); |
9892 | 0 | } |
9893 | 4.08k | if (p->error_indicator) { |
9894 | 0 | p->level--; |
9895 | 0 | return NULL; |
9896 | 0 | } |
9897 | 4.08k | asdl_seq* _res = NULL; |
9898 | 4.08k | int _mark = p->mark; |
9899 | 4.08k | { // ','.maybe_star_pattern+ ','? |
9900 | 4.08k | if (p->error_indicator) { |
9901 | 0 | p->level--; |
9902 | 0 | return NULL; |
9903 | 0 | } |
9904 | 4.08k | D(fprintf(stderr, "%*c> maybe_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?")); |
9905 | 4.08k | void *_opt_var; |
9906 | 4.08k | UNUSED(_opt_var); // Silence compiler warnings |
9907 | 4.08k | asdl_seq * patterns; |
9908 | 4.08k | if ( |
9909 | 4.08k | (patterns = _gather_45_rule(p)) // ','.maybe_star_pattern+ |
9910 | 1.75k | && |
9911 | 1.75k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
9912 | 4.08k | ) |
9913 | 1.47k | { |
9914 | 1.47k | D(fprintf(stderr, "%*c+ maybe_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?")); |
9915 | 1.47k | _res = patterns; |
9916 | 1.47k | if (_res == NULL && PyErr_Occurred()) { |
9917 | 0 | p->error_indicator = 1; |
9918 | 0 | p->level--; |
9919 | 0 | return NULL; |
9920 | 0 | } |
9921 | 1.47k | goto done; |
9922 | 1.47k | } |
9923 | 2.60k | p->mark = _mark; |
9924 | 2.60k | D(fprintf(stderr, "%*c%s maybe_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
9925 | 2.60k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.maybe_star_pattern+ ','?")); |
9926 | 2.60k | } |
9927 | 2.60k | _res = NULL; |
9928 | 4.08k | done: |
9929 | 4.08k | p->level--; |
9930 | 4.08k | return _res; |
9931 | 2.60k | } |
9932 | | |
9933 | | // maybe_star_pattern: star_pattern | pattern |
9934 | | static pattern_ty |
9935 | | maybe_star_pattern_rule(Parser *p) |
9936 | 26.6k | { |
9937 | 26.6k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9938 | 0 | _Pypegen_stack_overflow(p); |
9939 | 0 | } |
9940 | 26.6k | if (p->error_indicator) { |
9941 | 0 | p->level--; |
9942 | 0 | return NULL; |
9943 | 0 | } |
9944 | 26.6k | pattern_ty _res = NULL; |
9945 | 26.6k | int _mark = p->mark; |
9946 | 26.6k | { // star_pattern |
9947 | 26.6k | if (p->error_indicator) { |
9948 | 0 | p->level--; |
9949 | 0 | return NULL; |
9950 | 0 | } |
9951 | 26.6k | D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_pattern")); |
9952 | 26.6k | pattern_ty star_pattern_var; |
9953 | 26.6k | if ( |
9954 | 26.6k | (star_pattern_var = star_pattern_rule(p)) // star_pattern |
9955 | 26.6k | ) |
9956 | 2.29k | { |
9957 | 2.29k | D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_pattern")); |
9958 | 2.29k | _res = star_pattern_var; |
9959 | 2.29k | goto done; |
9960 | 2.29k | } |
9961 | 24.3k | p->mark = _mark; |
9962 | 24.3k | D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
9963 | 24.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_pattern")); |
9964 | 24.3k | } |
9965 | 0 | { // pattern |
9966 | 24.3k | if (p->error_indicator) { |
9967 | 26 | p->level--; |
9968 | 26 | return NULL; |
9969 | 26 | } |
9970 | 24.3k | D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern")); |
9971 | 24.3k | pattern_ty pattern_var; |
9972 | 24.3k | if ( |
9973 | 24.3k | (pattern_var = pattern_rule(p)) // pattern |
9974 | 24.3k | ) |
9975 | 17.0k | { |
9976 | 17.0k | D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern")); |
9977 | 17.0k | _res = pattern_var; |
9978 | 17.0k | goto done; |
9979 | 17.0k | } |
9980 | 7.32k | p->mark = _mark; |
9981 | 7.32k | D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
9982 | 7.32k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern")); |
9983 | 7.32k | } |
9984 | 7.32k | _res = NULL; |
9985 | 26.6k | done: |
9986 | 26.6k | p->level--; |
9987 | 26.6k | return _res; |
9988 | 7.32k | } |
9989 | | |
9990 | | // star_pattern: '*' pattern_capture_target | '*' wildcard_pattern |
9991 | | static pattern_ty |
9992 | | star_pattern_rule(Parser *p) |
9993 | 26.6k | { |
9994 | 26.6k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
9995 | 0 | _Pypegen_stack_overflow(p); |
9996 | 0 | } |
9997 | 26.6k | if (p->error_indicator) { |
9998 | 0 | p->level--; |
9999 | 0 | return NULL; |
10000 | 0 | } |
10001 | 26.6k | pattern_ty _res = NULL; |
10002 | 26.6k | if (_PyPegen_is_memoized(p, star_pattern_type, &_res)) { |
10003 | 5.49k | p->level--; |
10004 | 5.49k | return _res; |
10005 | 5.49k | } |
10006 | 21.1k | int _mark = p->mark; |
10007 | 21.1k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
10008 | 0 | p->error_indicator = 1; |
10009 | 0 | p->level--; |
10010 | 0 | return NULL; |
10011 | 0 | } |
10012 | 21.1k | int _start_lineno = p->tokens[_mark]->lineno; |
10013 | 21.1k | UNUSED(_start_lineno); // Only used by EXTRA macro |
10014 | 21.1k | int _start_col_offset = p->tokens[_mark]->col_offset; |
10015 | 21.1k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
10016 | 21.1k | { // '*' pattern_capture_target |
10017 | 21.1k | if (p->error_indicator) { |
10018 | 0 | p->level--; |
10019 | 0 | return NULL; |
10020 | 0 | } |
10021 | 21.1k | D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' pattern_capture_target")); |
10022 | 21.1k | Token * _literal; |
10023 | 21.1k | expr_ty target; |
10024 | 21.1k | if ( |
10025 | 21.1k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
10026 | 1.44k | && |
10027 | 1.44k | (target = pattern_capture_target_rule(p)) // pattern_capture_target |
10028 | 21.1k | ) |
10029 | 522 | { |
10030 | 522 | D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' pattern_capture_target")); |
10031 | 522 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10032 | 522 | if (_token == NULL) { |
10033 | 0 | p->level--; |
10034 | 0 | return NULL; |
10035 | 0 | } |
10036 | 522 | int _end_lineno = _token->end_lineno; |
10037 | 522 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10038 | 522 | int _end_col_offset = _token->end_col_offset; |
10039 | 522 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10040 | 522 | _res = _PyAST_MatchStar ( target -> v . Name . id , EXTRA ); |
10041 | 522 | if (_res == NULL && PyErr_Occurred()) { |
10042 | 0 | p->error_indicator = 1; |
10043 | 0 | p->level--; |
10044 | 0 | return NULL; |
10045 | 0 | } |
10046 | 522 | goto done; |
10047 | 522 | } |
10048 | 20.6k | p->mark = _mark; |
10049 | 20.6k | D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10050 | 20.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' pattern_capture_target")); |
10051 | 20.6k | } |
10052 | 0 | { // '*' wildcard_pattern |
10053 | 20.6k | if (p->error_indicator) { |
10054 | 2 | p->level--; |
10055 | 2 | return NULL; |
10056 | 2 | } |
10057 | 20.6k | D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' wildcard_pattern")); |
10058 | 20.6k | Token * _literal; |
10059 | 20.6k | pattern_ty wildcard_pattern_var; |
10060 | 20.6k | if ( |
10061 | 20.6k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
10062 | 917 | && |
10063 | 917 | (wildcard_pattern_var = wildcard_pattern_rule(p)) // wildcard_pattern |
10064 | 20.6k | ) |
10065 | 906 | { |
10066 | 906 | D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' wildcard_pattern")); |
10067 | 906 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10068 | 906 | if (_token == NULL) { |
10069 | 0 | p->level--; |
10070 | 0 | return NULL; |
10071 | 0 | } |
10072 | 906 | int _end_lineno = _token->end_lineno; |
10073 | 906 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10074 | 906 | int _end_col_offset = _token->end_col_offset; |
10075 | 906 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10076 | 906 | _res = _PyAST_MatchStar ( NULL , EXTRA ); |
10077 | 906 | if (_res == NULL && PyErr_Occurred()) { |
10078 | 0 | p->error_indicator = 1; |
10079 | 0 | p->level--; |
10080 | 0 | return NULL; |
10081 | 0 | } |
10082 | 906 | goto done; |
10083 | 906 | } |
10084 | 19.7k | p->mark = _mark; |
10085 | 19.7k | D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10086 | 19.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' wildcard_pattern")); |
10087 | 19.7k | } |
10088 | 19.7k | _res = NULL; |
10089 | 21.1k | done: |
10090 | 21.1k | _PyPegen_insert_memo(p, _mark, star_pattern_type, _res); |
10091 | 21.1k | p->level--; |
10092 | 21.1k | return _res; |
10093 | 19.7k | } |
10094 | | |
10095 | | // mapping_pattern: |
10096 | | // | '{' '}' |
10097 | | // | '{' double_star_pattern ','? '}' |
10098 | | // | '{' items_pattern ',' double_star_pattern ','? '}' |
10099 | | // | '{' items_pattern ','? '}' |
10100 | | // | invalid_mapping_pattern |
10101 | | static pattern_ty |
10102 | | mapping_pattern_rule(Parser *p) |
10103 | 18.8k | { |
10104 | 18.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
10105 | 0 | _Pypegen_stack_overflow(p); |
10106 | 0 | } |
10107 | 18.8k | if (p->error_indicator) { |
10108 | 0 | p->level--; |
10109 | 0 | return NULL; |
10110 | 0 | } |
10111 | 18.8k | pattern_ty _res = NULL; |
10112 | 18.8k | int _mark = p->mark; |
10113 | 18.8k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
10114 | 0 | p->error_indicator = 1; |
10115 | 0 | p->level--; |
10116 | 0 | return NULL; |
10117 | 0 | } |
10118 | 18.8k | int _start_lineno = p->tokens[_mark]->lineno; |
10119 | 18.8k | UNUSED(_start_lineno); // Only used by EXTRA macro |
10120 | 18.8k | int _start_col_offset = p->tokens[_mark]->col_offset; |
10121 | 18.8k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
10122 | 18.8k | { // '{' '}' |
10123 | 18.8k | if (p->error_indicator) { |
10124 | 0 | p->level--; |
10125 | 0 | return NULL; |
10126 | 0 | } |
10127 | 18.8k | D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '}'")); |
10128 | 18.8k | Token * _literal; |
10129 | 18.8k | Token * _literal_1; |
10130 | 18.8k | if ( |
10131 | 18.8k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
10132 | 2.14k | && |
10133 | 2.14k | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
10134 | 18.8k | ) |
10135 | 756 | { |
10136 | 756 | D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '}'")); |
10137 | 756 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10138 | 756 | if (_token == NULL) { |
10139 | 0 | p->level--; |
10140 | 0 | return NULL; |
10141 | 0 | } |
10142 | 756 | int _end_lineno = _token->end_lineno; |
10143 | 756 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10144 | 756 | int _end_col_offset = _token->end_col_offset; |
10145 | 756 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10146 | 756 | _res = _PyAST_MatchMapping ( NULL , NULL , NULL , EXTRA ); |
10147 | 756 | if (_res == NULL && PyErr_Occurred()) { |
10148 | 0 | p->error_indicator = 1; |
10149 | 0 | p->level--; |
10150 | 0 | return NULL; |
10151 | 0 | } |
10152 | 756 | goto done; |
10153 | 756 | } |
10154 | 18.1k | p->mark = _mark; |
10155 | 18.1k | D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10156 | 18.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '}'")); |
10157 | 18.1k | } |
10158 | 0 | { // '{' double_star_pattern ','? '}' |
10159 | 18.1k | if (p->error_indicator) { |
10160 | 5 | p->level--; |
10161 | 5 | return NULL; |
10162 | 5 | } |
10163 | 18.1k | D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_star_pattern ','? '}'")); |
10164 | 18.1k | Token * _literal; |
10165 | 18.1k | Token * _literal_1; |
10166 | 18.1k | void *_opt_var; |
10167 | 18.1k | UNUSED(_opt_var); // Silence compiler warnings |
10168 | 18.1k | expr_ty rest; |
10169 | 18.1k | if ( |
10170 | 18.1k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
10171 | 1.38k | && |
10172 | 1.38k | (rest = double_star_pattern_rule(p)) // double_star_pattern |
10173 | 247 | && |
10174 | 247 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
10175 | 246 | && |
10176 | 246 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
10177 | 18.1k | ) |
10178 | 241 | { |
10179 | 241 | D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_star_pattern ','? '}'")); |
10180 | 241 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10181 | 241 | if (_token == NULL) { |
10182 | 0 | p->level--; |
10183 | 0 | return NULL; |
10184 | 0 | } |
10185 | 241 | int _end_lineno = _token->end_lineno; |
10186 | 241 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10187 | 241 | int _end_col_offset = _token->end_col_offset; |
10188 | 241 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10189 | 241 | _res = _PyAST_MatchMapping ( NULL , NULL , rest -> v . Name . id , EXTRA ); |
10190 | 241 | if (_res == NULL && PyErr_Occurred()) { |
10191 | 0 | p->error_indicator = 1; |
10192 | 0 | p->level--; |
10193 | 0 | return NULL; |
10194 | 0 | } |
10195 | 241 | goto done; |
10196 | 241 | } |
10197 | 17.8k | p->mark = _mark; |
10198 | 17.8k | D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10199 | 17.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_star_pattern ','? '}'")); |
10200 | 17.8k | } |
10201 | 0 | { // '{' items_pattern ',' double_star_pattern ','? '}' |
10202 | 17.8k | if (p->error_indicator) { |
10203 | 3 | p->level--; |
10204 | 3 | return NULL; |
10205 | 3 | } |
10206 | 17.8k | D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'")); |
10207 | 17.8k | Token * _literal; |
10208 | 17.8k | Token * _literal_1; |
10209 | 17.8k | Token * _literal_2; |
10210 | 17.8k | void *_opt_var; |
10211 | 17.8k | UNUSED(_opt_var); // Silence compiler warnings |
10212 | 17.8k | asdl_seq* items; |
10213 | 17.8k | expr_ty rest; |
10214 | 17.8k | if ( |
10215 | 17.8k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
10216 | 1.13k | && |
10217 | 1.13k | (items = items_pattern_rule(p)) // items_pattern |
10218 | 607 | && |
10219 | 607 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
10220 | 136 | && |
10221 | 136 | (rest = double_star_pattern_rule(p)) // double_star_pattern |
10222 | 40 | && |
10223 | 40 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
10224 | 39 | && |
10225 | 39 | (_literal_2 = _PyPegen_expect_token(p, 26)) // token='}' |
10226 | 17.8k | ) |
10227 | 34 | { |
10228 | 34 | D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'")); |
10229 | 34 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10230 | 34 | if (_token == NULL) { |
10231 | 0 | p->level--; |
10232 | 0 | return NULL; |
10233 | 0 | } |
10234 | 34 | int _end_lineno = _token->end_lineno; |
10235 | 34 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10236 | 34 | int _end_col_offset = _token->end_col_offset; |
10237 | 34 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10238 | 34 | _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 ); |
10239 | 34 | if (_res == NULL && PyErr_Occurred()) { |
10240 | 0 | p->error_indicator = 1; |
10241 | 0 | p->level--; |
10242 | 0 | return NULL; |
10243 | 0 | } |
10244 | 34 | goto done; |
10245 | 34 | } |
10246 | 17.8k | p->mark = _mark; |
10247 | 17.8k | D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10248 | 17.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'")); |
10249 | 17.8k | } |
10250 | 0 | { // '{' items_pattern ','? '}' |
10251 | 17.8k | if (p->error_indicator) { |
10252 | 123 | p->level--; |
10253 | 123 | return NULL; |
10254 | 123 | } |
10255 | 17.7k | D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ','? '}'")); |
10256 | 17.7k | Token * _literal; |
10257 | 17.7k | Token * _literal_1; |
10258 | 17.7k | void *_opt_var; |
10259 | 17.7k | UNUSED(_opt_var); // Silence compiler warnings |
10260 | 17.7k | asdl_seq* items; |
10261 | 17.7k | if ( |
10262 | 17.7k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
10263 | 981 | && |
10264 | 981 | (items = items_pattern_rule(p)) // items_pattern |
10265 | 548 | && |
10266 | 548 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
10267 | 548 | && |
10268 | 548 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
10269 | 17.7k | ) |
10270 | 488 | { |
10271 | 488 | D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ','? '}'")); |
10272 | 488 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10273 | 488 | if (_token == NULL) { |
10274 | 0 | p->level--; |
10275 | 0 | return NULL; |
10276 | 0 | } |
10277 | 488 | int _end_lineno = _token->end_lineno; |
10278 | 488 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10279 | 488 | int _end_col_offset = _token->end_col_offset; |
10280 | 488 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10281 | 488 | _res = _PyAST_MatchMapping ( CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , items ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , items ) ) , NULL , EXTRA ); |
10282 | 488 | if (_res == NULL && PyErr_Occurred()) { |
10283 | 0 | p->error_indicator = 1; |
10284 | 0 | p->level--; |
10285 | 0 | return NULL; |
10286 | 0 | } |
10287 | 488 | goto done; |
10288 | 488 | } |
10289 | 17.2k | p->mark = _mark; |
10290 | 17.2k | D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10291 | 17.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern ','? '}'")); |
10292 | 17.2k | } |
10293 | 17.2k | if (p->call_invalid_rules) { // invalid_mapping_pattern |
10294 | 8.09k | if (p->error_indicator) { |
10295 | 0 | p->level--; |
10296 | 0 | return NULL; |
10297 | 0 | } |
10298 | 8.09k | D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_mapping_pattern")); |
10299 | 8.09k | void *invalid_mapping_pattern_var; |
10300 | 8.09k | if ( |
10301 | 8.09k | (invalid_mapping_pattern_var = invalid_mapping_pattern_rule(p)) // invalid_mapping_pattern |
10302 | 8.09k | ) |
10303 | 0 | { |
10304 | 0 | D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_mapping_pattern")); |
10305 | 0 | _res = invalid_mapping_pattern_var; |
10306 | 0 | goto done; |
10307 | 0 | } |
10308 | 8.09k | p->mark = _mark; |
10309 | 8.09k | D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10310 | 8.09k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_mapping_pattern")); |
10311 | 8.09k | } |
10312 | 17.2k | _res = NULL; |
10313 | 18.7k | done: |
10314 | 18.7k | p->level--; |
10315 | 18.7k | return _res; |
10316 | 17.2k | } |
10317 | | |
10318 | | // items_pattern: ','.key_value_pattern+ |
10319 | | static asdl_seq* |
10320 | | items_pattern_rule(Parser *p) |
10321 | 2.36k | { |
10322 | 2.36k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
10323 | 0 | _Pypegen_stack_overflow(p); |
10324 | 0 | } |
10325 | 2.36k | if (p->error_indicator) { |
10326 | 0 | p->level--; |
10327 | 0 | return NULL; |
10328 | 0 | } |
10329 | 2.36k | asdl_seq* _res = NULL; |
10330 | 2.36k | int _mark = p->mark; |
10331 | 2.36k | { // ','.key_value_pattern+ |
10332 | 2.36k | if (p->error_indicator) { |
10333 | 0 | p->level--; |
10334 | 0 | return NULL; |
10335 | 0 | } |
10336 | 2.36k | D(fprintf(stderr, "%*c> items_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+")); |
10337 | 2.36k | asdl_seq * _gather_47_var; |
10338 | 2.36k | if ( |
10339 | 2.36k | (_gather_47_var = _gather_47_rule(p)) // ','.key_value_pattern+ |
10340 | 2.36k | ) |
10341 | 1.18k | { |
10342 | 1.18k | D(fprintf(stderr, "%*c+ items_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+")); |
10343 | 1.18k | _res = _gather_47_var; |
10344 | 1.18k | goto done; |
10345 | 1.18k | } |
10346 | 1.18k | p->mark = _mark; |
10347 | 1.18k | D(fprintf(stderr, "%*c%s items_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10348 | 1.18k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.key_value_pattern+")); |
10349 | 1.18k | } |
10350 | 1.18k | _res = NULL; |
10351 | 2.36k | done: |
10352 | 2.36k | p->level--; |
10353 | 2.36k | return _res; |
10354 | 1.18k | } |
10355 | | |
10356 | | // key_value_pattern: (literal_expr | attr) ':' pattern |
10357 | | static KeyPatternPair* |
10358 | | key_value_pattern_rule(Parser *p) |
10359 | 3.46k | { |
10360 | 3.46k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
10361 | 0 | _Pypegen_stack_overflow(p); |
10362 | 0 | } |
10363 | 3.46k | if (p->error_indicator) { |
10364 | 0 | p->level--; |
10365 | 0 | return NULL; |
10366 | 0 | } |
10367 | 3.46k | KeyPatternPair* _res = NULL; |
10368 | 3.46k | int _mark = p->mark; |
10369 | 3.46k | { // (literal_expr | attr) ':' pattern |
10370 | 3.46k | if (p->error_indicator) { |
10371 | 0 | p->level--; |
10372 | 0 | return NULL; |
10373 | 0 | } |
10374 | 3.46k | D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_expr | attr) ':' pattern")); |
10375 | 3.46k | Token * _literal; |
10376 | 3.46k | void *key; |
10377 | 3.46k | pattern_ty pattern; |
10378 | 3.46k | if ( |
10379 | 3.46k | (key = _tmp_48_rule(p)) // literal_expr | attr |
10380 | 3.19k | && |
10381 | 3.19k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
10382 | 3.09k | && |
10383 | 3.09k | (pattern = pattern_rule(p)) // pattern |
10384 | 3.46k | ) |
10385 | 2.05k | { |
10386 | 2.05k | D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_expr | attr) ':' pattern")); |
10387 | 2.05k | _res = _PyPegen_key_pattern_pair ( p , key , pattern ); |
10388 | 2.05k | if (_res == NULL && PyErr_Occurred()) { |
10389 | 0 | p->error_indicator = 1; |
10390 | 0 | p->level--; |
10391 | 0 | return NULL; |
10392 | 0 | } |
10393 | 2.05k | goto done; |
10394 | 2.05k | } |
10395 | 1.41k | p->mark = _mark; |
10396 | 1.41k | D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10397 | 1.41k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_expr | attr) ':' pattern")); |
10398 | 1.41k | } |
10399 | 1.41k | _res = NULL; |
10400 | 3.46k | done: |
10401 | 3.46k | p->level--; |
10402 | 3.46k | return _res; |
10403 | 1.41k | } |
10404 | | |
10405 | | // double_star_pattern: '**' pattern_capture_target |
10406 | | static expr_ty |
10407 | | double_star_pattern_rule(Parser *p) |
10408 | 1.76k | { |
10409 | 1.76k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
10410 | 0 | _Pypegen_stack_overflow(p); |
10411 | 0 | } |
10412 | 1.76k | if (p->error_indicator) { |
10413 | 21 | p->level--; |
10414 | 21 | return NULL; |
10415 | 21 | } |
10416 | 1.73k | expr_ty _res = NULL; |
10417 | 1.73k | int _mark = p->mark; |
10418 | 1.73k | { // '**' pattern_capture_target |
10419 | 1.73k | if (p->error_indicator) { |
10420 | 0 | p->level--; |
10421 | 0 | return NULL; |
10422 | 0 | } |
10423 | 1.73k | D(fprintf(stderr, "%*c> double_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' pattern_capture_target")); |
10424 | 1.73k | Token * _literal; |
10425 | 1.73k | expr_ty target; |
10426 | 1.73k | if ( |
10427 | 1.73k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
10428 | 297 | && |
10429 | 297 | (target = pattern_capture_target_rule(p)) // pattern_capture_target |
10430 | 1.73k | ) |
10431 | 291 | { |
10432 | 291 | D(fprintf(stderr, "%*c+ double_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' pattern_capture_target")); |
10433 | 291 | _res = target; |
10434 | 291 | if (_res == NULL && PyErr_Occurred()) { |
10435 | 0 | p->error_indicator = 1; |
10436 | 0 | p->level--; |
10437 | 0 | return NULL; |
10438 | 0 | } |
10439 | 291 | goto done; |
10440 | 291 | } |
10441 | 1.44k | p->mark = _mark; |
10442 | 1.44k | D(fprintf(stderr, "%*c%s double_star_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10443 | 1.44k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' pattern_capture_target")); |
10444 | 1.44k | } |
10445 | 1.44k | _res = NULL; |
10446 | 1.73k | done: |
10447 | 1.73k | p->level--; |
10448 | 1.73k | return _res; |
10449 | 1.44k | } |
10450 | | |
10451 | | // class_pattern: |
10452 | | // | name_or_attr '(' ')' |
10453 | | // | name_or_attr '(' positional_patterns ','? ')' |
10454 | | // | name_or_attr '(' keyword_patterns ','? ')' |
10455 | | // | name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')' |
10456 | | // | invalid_class_pattern |
10457 | | static pattern_ty |
10458 | | class_pattern_rule(Parser *p) |
10459 | 17.2k | { |
10460 | 17.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
10461 | 0 | _Pypegen_stack_overflow(p); |
10462 | 0 | } |
10463 | 17.2k | if (p->error_indicator) { |
10464 | 0 | p->level--; |
10465 | 0 | return NULL; |
10466 | 0 | } |
10467 | 17.2k | pattern_ty _res = NULL; |
10468 | 17.2k | int _mark = p->mark; |
10469 | 17.2k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
10470 | 0 | p->error_indicator = 1; |
10471 | 0 | p->level--; |
10472 | 0 | return NULL; |
10473 | 0 | } |
10474 | 17.2k | int _start_lineno = p->tokens[_mark]->lineno; |
10475 | 17.2k | UNUSED(_start_lineno); // Only used by EXTRA macro |
10476 | 17.2k | int _start_col_offset = p->tokens[_mark]->col_offset; |
10477 | 17.2k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
10478 | 17.2k | { // name_or_attr '(' ')' |
10479 | 17.2k | if (p->error_indicator) { |
10480 | 0 | p->level--; |
10481 | 0 | return NULL; |
10482 | 0 | } |
10483 | 17.2k | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); |
10484 | 17.2k | Token * _literal; |
10485 | 17.2k | Token * _literal_1; |
10486 | 17.2k | expr_ty cls; |
10487 | 17.2k | if ( |
10488 | 17.2k | (cls = name_or_attr_rule(p)) // name_or_attr |
10489 | 11.4k | && |
10490 | 11.4k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
10491 | 8.43k | && |
10492 | 8.43k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
10493 | 17.2k | ) |
10494 | 783 | { |
10495 | 783 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'")); |
10496 | 783 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10497 | 783 | if (_token == NULL) { |
10498 | 0 | p->level--; |
10499 | 0 | return NULL; |
10500 | 0 | } |
10501 | 783 | int _end_lineno = _token->end_lineno; |
10502 | 783 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10503 | 783 | int _end_col_offset = _token->end_col_offset; |
10504 | 783 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10505 | 783 | _res = _PyAST_MatchClass ( cls , NULL , NULL , NULL , EXTRA ); |
10506 | 783 | if (_res == NULL && PyErr_Occurred()) { |
10507 | 0 | p->error_indicator = 1; |
10508 | 0 | p->level--; |
10509 | 0 | return NULL; |
10510 | 0 | } |
10511 | 783 | goto done; |
10512 | 783 | } |
10513 | 16.4k | p->mark = _mark; |
10514 | 16.4k | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10515 | 16.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ')'")); |
10516 | 16.4k | } |
10517 | 0 | { // name_or_attr '(' positional_patterns ','? ')' |
10518 | 16.4k | if (p->error_indicator) { |
10519 | 9 | p->level--; |
10520 | 9 | return NULL; |
10521 | 9 | } |
10522 | 16.4k | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'")); |
10523 | 16.4k | Token * _literal; |
10524 | 16.4k | Token * _literal_1; |
10525 | 16.4k | void *_opt_var; |
10526 | 16.4k | UNUSED(_opt_var); // Silence compiler warnings |
10527 | 16.4k | expr_ty cls; |
10528 | 16.4k | asdl_pattern_seq* patterns; |
10529 | 16.4k | if ( |
10530 | 16.4k | (cls = name_or_attr_rule(p)) // name_or_attr |
10531 | 10.6k | && |
10532 | 10.6k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
10533 | 7.64k | && |
10534 | 7.64k | (patterns = positional_patterns_rule(p)) // positional_patterns |
10535 | 4.04k | && |
10536 | 4.04k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
10537 | 3.78k | && |
10538 | 3.78k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
10539 | 16.4k | ) |
10540 | 901 | { |
10541 | 901 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'")); |
10542 | 901 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10543 | 901 | if (_token == NULL) { |
10544 | 0 | p->level--; |
10545 | 0 | return NULL; |
10546 | 0 | } |
10547 | 901 | int _end_lineno = _token->end_lineno; |
10548 | 901 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10549 | 901 | int _end_col_offset = _token->end_col_offset; |
10550 | 901 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10551 | 901 | _res = _PyAST_MatchClass ( cls , patterns , NULL , NULL , EXTRA ); |
10552 | 901 | if (_res == NULL && PyErr_Occurred()) { |
10553 | 0 | p->error_indicator = 1; |
10554 | 0 | p->level--; |
10555 | 0 | return NULL; |
10556 | 0 | } |
10557 | 901 | goto done; |
10558 | 901 | } |
10559 | 15.5k | p->mark = _mark; |
10560 | 15.5k | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10561 | 15.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'")); |
10562 | 15.5k | } |
10563 | 0 | { // name_or_attr '(' keyword_patterns ','? ')' |
10564 | 15.5k | if (p->error_indicator) { |
10565 | 573 | p->level--; |
10566 | 573 | return NULL; |
10567 | 573 | } |
10568 | 14.9k | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'")); |
10569 | 14.9k | Token * _literal; |
10570 | 14.9k | Token * _literal_1; |
10571 | 14.9k | void *_opt_var; |
10572 | 14.9k | UNUSED(_opt_var); // Silence compiler warnings |
10573 | 14.9k | expr_ty cls; |
10574 | 14.9k | asdl_seq* keywords; |
10575 | 14.9k | if ( |
10576 | 14.9k | (cls = name_or_attr_rule(p)) // name_or_attr |
10577 | 9.17k | && |
10578 | 9.17k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
10579 | 6.16k | && |
10580 | 6.16k | (keywords = keyword_patterns_rule(p)) // keyword_patterns |
10581 | 2.13k | && |
10582 | 2.13k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
10583 | 2.06k | && |
10584 | 2.06k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
10585 | 14.9k | ) |
10586 | 618 | { |
10587 | 618 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'")); |
10588 | 618 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10589 | 618 | if (_token == NULL) { |
10590 | 0 | p->level--; |
10591 | 0 | return NULL; |
10592 | 0 | } |
10593 | 618 | int _end_lineno = _token->end_lineno; |
10594 | 618 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10595 | 618 | int _end_col_offset = _token->end_col_offset; |
10596 | 618 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10597 | 618 | _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 ); |
10598 | 618 | if (_res == NULL && PyErr_Occurred()) { |
10599 | 0 | p->error_indicator = 1; |
10600 | 0 | p->level--; |
10601 | 0 | return NULL; |
10602 | 0 | } |
10603 | 618 | goto done; |
10604 | 618 | } |
10605 | 14.3k | p->mark = _mark; |
10606 | 14.3k | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10607 | 14.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'")); |
10608 | 14.3k | } |
10609 | 0 | { // name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')' |
10610 | 14.3k | if (p->error_indicator) { |
10611 | 317 | p->level--; |
10612 | 317 | return NULL; |
10613 | 317 | } |
10614 | 14.0k | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'")); |
10615 | 14.0k | Token * _literal; |
10616 | 14.0k | Token * _literal_1; |
10617 | 14.0k | Token * _literal_2; |
10618 | 14.0k | void *_opt_var; |
10619 | 14.0k | UNUSED(_opt_var); // Silence compiler warnings |
10620 | 14.0k | expr_ty cls; |
10621 | 14.0k | asdl_seq* keywords; |
10622 | 14.0k | asdl_pattern_seq* patterns; |
10623 | 14.0k | if ( |
10624 | 14.0k | (cls = name_or_attr_rule(p)) // name_or_attr |
10625 | 8.23k | && |
10626 | 8.23k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
10627 | 5.23k | && |
10628 | 5.23k | (patterns = positional_patterns_rule(p)) // positional_patterns |
10629 | 2.78k | && |
10630 | 2.78k | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
10631 | 1.65k | && |
10632 | 1.65k | (keywords = keyword_patterns_rule(p)) // keyword_patterns |
10633 | 628 | && |
10634 | 628 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
10635 | 427 | && |
10636 | 427 | (_literal_2 = _PyPegen_expect_token(p, 8)) // token=')' |
10637 | 14.0k | ) |
10638 | 132 | { |
10639 | 132 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'")); |
10640 | 132 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10641 | 132 | if (_token == NULL) { |
10642 | 0 | p->level--; |
10643 | 0 | return NULL; |
10644 | 0 | } |
10645 | 132 | int _end_lineno = _token->end_lineno; |
10646 | 132 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10647 | 132 | int _end_col_offset = _token->end_col_offset; |
10648 | 132 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10649 | 132 | _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 ); |
10650 | 132 | if (_res == NULL && PyErr_Occurred()) { |
10651 | 0 | p->error_indicator = 1; |
10652 | 0 | p->level--; |
10653 | 0 | return NULL; |
10654 | 0 | } |
10655 | 132 | goto done; |
10656 | 132 | } |
10657 | 13.8k | p->mark = _mark; |
10658 | 13.8k | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10659 | 13.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'")); |
10660 | 13.8k | } |
10661 | 13.8k | if (p->call_invalid_rules) { // invalid_class_pattern |
10662 | 7.11k | if (p->error_indicator) { |
10663 | 251 | p->level--; |
10664 | 251 | return NULL; |
10665 | 251 | } |
10666 | 6.85k | D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_class_pattern")); |
10667 | 6.85k | void *invalid_class_pattern_var; |
10668 | 6.85k | if ( |
10669 | 6.85k | (invalid_class_pattern_var = invalid_class_pattern_rule(p)) // invalid_class_pattern |
10670 | 6.85k | ) |
10671 | 0 | { |
10672 | 0 | D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_class_pattern")); |
10673 | 0 | _res = invalid_class_pattern_var; |
10674 | 0 | goto done; |
10675 | 0 | } |
10676 | 6.85k | p->mark = _mark; |
10677 | 6.85k | D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10678 | 6.85k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_class_pattern")); |
10679 | 6.85k | } |
10680 | 13.6k | _res = NULL; |
10681 | 16.0k | done: |
10682 | 16.0k | p->level--; |
10683 | 16.0k | return _res; |
10684 | 13.6k | } |
10685 | | |
10686 | | // positional_patterns: ','.pattern+ |
10687 | | static asdl_pattern_seq* |
10688 | | positional_patterns_rule(Parser *p) |
10689 | 16.3k | { |
10690 | 16.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
10691 | 0 | _Pypegen_stack_overflow(p); |
10692 | 0 | } |
10693 | 16.3k | if (p->error_indicator) { |
10694 | 0 | p->level--; |
10695 | 0 | return NULL; |
10696 | 0 | } |
10697 | 16.3k | asdl_pattern_seq* _res = NULL; |
10698 | 16.3k | int _mark = p->mark; |
10699 | 16.3k | { // ','.pattern+ |
10700 | 16.3k | if (p->error_indicator) { |
10701 | 0 | p->level--; |
10702 | 0 | return NULL; |
10703 | 0 | } |
10704 | 16.3k | D(fprintf(stderr, "%*c> positional_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+")); |
10705 | 16.3k | asdl_pattern_seq* args; |
10706 | 16.3k | if ( |
10707 | 16.3k | (args = (asdl_pattern_seq*)_gather_50_rule(p)) // ','.pattern+ |
10708 | 16.3k | ) |
10709 | 8.58k | { |
10710 | 8.58k | D(fprintf(stderr, "%*c+ positional_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+")); |
10711 | 8.58k | _res = args; |
10712 | 8.58k | if (_res == NULL && PyErr_Occurred()) { |
10713 | 0 | p->error_indicator = 1; |
10714 | 0 | p->level--; |
10715 | 0 | return NULL; |
10716 | 0 | } |
10717 | 8.58k | goto done; |
10718 | 8.58k | } |
10719 | 7.74k | p->mark = _mark; |
10720 | 7.74k | D(fprintf(stderr, "%*c%s positional_patterns[%d-%d]: %s failed!\n", p->level, ' ', |
10721 | 7.74k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+")); |
10722 | 7.74k | } |
10723 | 7.74k | _res = NULL; |
10724 | 16.3k | done: |
10725 | 16.3k | p->level--; |
10726 | 16.3k | return _res; |
10727 | 7.74k | } |
10728 | | |
10729 | | // keyword_patterns: ','.keyword_pattern+ |
10730 | | static asdl_seq* |
10731 | | keyword_patterns_rule(Parser *p) |
10732 | 10.4k | { |
10733 | 10.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
10734 | 0 | _Pypegen_stack_overflow(p); |
10735 | 0 | } |
10736 | 10.4k | if (p->error_indicator) { |
10737 | 0 | p->level--; |
10738 | 0 | return NULL; |
10739 | 0 | } |
10740 | 10.4k | asdl_seq* _res = NULL; |
10741 | 10.4k | int _mark = p->mark; |
10742 | 10.4k | { // ','.keyword_pattern+ |
10743 | 10.4k | if (p->error_indicator) { |
10744 | 0 | p->level--; |
10745 | 0 | return NULL; |
10746 | 0 | } |
10747 | 10.4k | D(fprintf(stderr, "%*c> keyword_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+")); |
10748 | 10.4k | asdl_seq * _gather_52_var; |
10749 | 10.4k | if ( |
10750 | 10.4k | (_gather_52_var = _gather_52_rule(p)) // ','.keyword_pattern+ |
10751 | 10.4k | ) |
10752 | 3.93k | { |
10753 | 3.93k | D(fprintf(stderr, "%*c+ keyword_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+")); |
10754 | 3.93k | _res = _gather_52_var; |
10755 | 3.93k | goto done; |
10756 | 3.93k | } |
10757 | 6.53k | p->mark = _mark; |
10758 | 6.53k | D(fprintf(stderr, "%*c%s keyword_patterns[%d-%d]: %s failed!\n", p->level, ' ', |
10759 | 6.53k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.keyword_pattern+")); |
10760 | 6.53k | } |
10761 | 6.53k | _res = NULL; |
10762 | 10.4k | done: |
10763 | 10.4k | p->level--; |
10764 | 10.4k | return _res; |
10765 | 6.53k | } |
10766 | | |
10767 | | // keyword_pattern: NAME '=' pattern |
10768 | | static KeyPatternPair* |
10769 | | keyword_pattern_rule(Parser *p) |
10770 | 14.7k | { |
10771 | 14.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
10772 | 0 | _Pypegen_stack_overflow(p); |
10773 | 0 | } |
10774 | 14.7k | if (p->error_indicator) { |
10775 | 0 | p->level--; |
10776 | 0 | return NULL; |
10777 | 0 | } |
10778 | 14.7k | KeyPatternPair* _res = NULL; |
10779 | 14.7k | int _mark = p->mark; |
10780 | 14.7k | { // NAME '=' pattern |
10781 | 14.7k | if (p->error_indicator) { |
10782 | 0 | p->level--; |
10783 | 0 | return NULL; |
10784 | 0 | } |
10785 | 14.7k | D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern")); |
10786 | 14.7k | Token * _literal; |
10787 | 14.7k | expr_ty arg; |
10788 | 14.7k | pattern_ty value; |
10789 | 14.7k | if ( |
10790 | 14.7k | (arg = _PyPegen_name_token(p)) // NAME |
10791 | 14.1k | && |
10792 | 14.1k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
10793 | 8.34k | && |
10794 | 8.34k | (value = pattern_rule(p)) // pattern |
10795 | 14.7k | ) |
10796 | 5.95k | { |
10797 | 5.95k | D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern")); |
10798 | 5.95k | _res = _PyPegen_key_pattern_pair ( p , arg , value ); |
10799 | 5.95k | if (_res == NULL && PyErr_Occurred()) { |
10800 | 0 | p->error_indicator = 1; |
10801 | 0 | p->level--; |
10802 | 0 | return NULL; |
10803 | 0 | } |
10804 | 5.95k | goto done; |
10805 | 5.95k | } |
10806 | 8.76k | p->mark = _mark; |
10807 | 8.76k | D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
10808 | 8.76k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' pattern")); |
10809 | 8.76k | } |
10810 | 8.76k | _res = NULL; |
10811 | 14.7k | done: |
10812 | 14.7k | p->level--; |
10813 | 14.7k | return _res; |
10814 | 8.76k | } |
10815 | | |
10816 | | // type_alias: "type" NAME type_params? '=' expression |
10817 | | static stmt_ty |
10818 | | type_alias_rule(Parser *p) |
10819 | 482 | { |
10820 | 482 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
10821 | 0 | _Pypegen_stack_overflow(p); |
10822 | 0 | } |
10823 | 482 | if (p->error_indicator) { |
10824 | 0 | p->level--; |
10825 | 0 | return NULL; |
10826 | 0 | } |
10827 | 482 | stmt_ty _res = NULL; |
10828 | 482 | int _mark = p->mark; |
10829 | 482 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
10830 | 0 | p->error_indicator = 1; |
10831 | 0 | p->level--; |
10832 | 0 | return NULL; |
10833 | 0 | } |
10834 | 482 | int _start_lineno = p->tokens[_mark]->lineno; |
10835 | 482 | UNUSED(_start_lineno); // Only used by EXTRA macro |
10836 | 482 | int _start_col_offset = p->tokens[_mark]->col_offset; |
10837 | 482 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
10838 | 482 | { // "type" NAME type_params? '=' expression |
10839 | 482 | if (p->error_indicator) { |
10840 | 0 | p->level--; |
10841 | 0 | return NULL; |
10842 | 0 | } |
10843 | 482 | D(fprintf(stderr, "%*c> type_alias[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"type\" NAME type_params? '=' expression")); |
10844 | 482 | expr_ty _keyword; |
10845 | 482 | Token * _literal; |
10846 | 482 | expr_ty b; |
10847 | 482 | expr_ty n; |
10848 | 482 | void *t; |
10849 | 482 | if ( |
10850 | 482 | (_keyword = _PyPegen_expect_soft_keyword(p, "type")) // soft_keyword='"type"' |
10851 | 482 | && |
10852 | 482 | (n = _PyPegen_name_token(p)) // NAME |
10853 | 286 | && |
10854 | 286 | (t = type_params_rule(p), !p->error_indicator) // type_params? |
10855 | 284 | && |
10856 | 284 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
10857 | 267 | && |
10858 | 267 | (b = expression_rule(p)) // expression |
10859 | 482 | ) |
10860 | 264 | { |
10861 | 264 | D(fprintf(stderr, "%*c+ type_alias[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"type\" NAME type_params? '=' expression")); |
10862 | 264 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
10863 | 264 | if (_token == NULL) { |
10864 | 0 | p->level--; |
10865 | 0 | return NULL; |
10866 | 0 | } |
10867 | 264 | int _end_lineno = _token->end_lineno; |
10868 | 264 | UNUSED(_end_lineno); // Only used by EXTRA macro |
10869 | 264 | int _end_col_offset = _token->end_col_offset; |
10870 | 264 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
10871 | 264 | _res = CHECK_VERSION ( stmt_ty , 12 , "Type statement is" , _PyAST_TypeAlias ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , n , Store ) ) , t , b , EXTRA ) ); |
10872 | 264 | if (_res == NULL && PyErr_Occurred()) { |
10873 | 0 | p->error_indicator = 1; |
10874 | 0 | p->level--; |
10875 | 0 | return NULL; |
10876 | 0 | } |
10877 | 264 | goto done; |
10878 | 264 | } |
10879 | 218 | p->mark = _mark; |
10880 | 218 | D(fprintf(stderr, "%*c%s type_alias[%d-%d]: %s failed!\n", p->level, ' ', |
10881 | 218 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"type\" NAME type_params? '=' expression")); |
10882 | 218 | } |
10883 | 218 | _res = NULL; |
10884 | 482 | done: |
10885 | 482 | p->level--; |
10886 | 482 | return _res; |
10887 | 218 | } |
10888 | | |
10889 | | // type_params: invalid_type_params | '[' type_param_seq ']' |
10890 | | static asdl_type_param_seq* |
10891 | | type_params_rule(Parser *p) |
10892 | 21.4k | { |
10893 | 21.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
10894 | 0 | _Pypegen_stack_overflow(p); |
10895 | 0 | } |
10896 | 21.4k | if (p->error_indicator) { |
10897 | 0 | p->level--; |
10898 | 0 | return NULL; |
10899 | 0 | } |
10900 | 21.4k | asdl_type_param_seq* _res = NULL; |
10901 | 21.4k | int _mark = p->mark; |
10902 | 21.4k | if (p->call_invalid_rules) { // invalid_type_params |
10903 | 8.22k | if (p->error_indicator) { |
10904 | 0 | p->level--; |
10905 | 0 | return NULL; |
10906 | 0 | } |
10907 | 8.22k | D(fprintf(stderr, "%*c> type_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_type_params")); |
10908 | 8.22k | void *invalid_type_params_var; |
10909 | 8.22k | if ( |
10910 | 8.22k | (invalid_type_params_var = invalid_type_params_rule(p)) // invalid_type_params |
10911 | 8.22k | ) |
10912 | 0 | { |
10913 | 0 | D(fprintf(stderr, "%*c+ type_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_type_params")); |
10914 | 0 | _res = invalid_type_params_var; |
10915 | 0 | goto done; |
10916 | 0 | } |
10917 | 8.22k | p->mark = _mark; |
10918 | 8.22k | D(fprintf(stderr, "%*c%s type_params[%d-%d]: %s failed!\n", p->level, ' ', |
10919 | 8.22k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_type_params")); |
10920 | 8.22k | } |
10921 | 21.4k | { // '[' type_param_seq ']' |
10922 | 21.4k | if (p->error_indicator) { |
10923 | 3 | p->level--; |
10924 | 3 | return NULL; |
10925 | 3 | } |
10926 | 21.4k | D(fprintf(stderr, "%*c> type_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' type_param_seq ']'")); |
10927 | 21.4k | Token * _literal; |
10928 | 21.4k | Token * _literal_1; |
10929 | 21.4k | asdl_type_param_seq* t; |
10930 | 21.4k | if ( |
10931 | 21.4k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
10932 | 1.23k | && |
10933 | 1.23k | (t = type_param_seq_rule(p)) // type_param_seq |
10934 | 1.18k | && |
10935 | 1.18k | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
10936 | 21.4k | ) |
10937 | 1.02k | { |
10938 | 1.02k | D(fprintf(stderr, "%*c+ type_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' type_param_seq ']'")); |
10939 | 1.02k | _res = CHECK_VERSION ( asdl_type_param_seq* , 12 , "Type parameter lists are" , t ); |
10940 | 1.02k | if (_res == NULL && PyErr_Occurred()) { |
10941 | 0 | p->error_indicator = 1; |
10942 | 0 | p->level--; |
10943 | 0 | return NULL; |
10944 | 0 | } |
10945 | 1.02k | goto done; |
10946 | 1.02k | } |
10947 | 20.3k | p->mark = _mark; |
10948 | 20.3k | D(fprintf(stderr, "%*c%s type_params[%d-%d]: %s failed!\n", p->level, ' ', |
10949 | 20.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' type_param_seq ']'")); |
10950 | 20.3k | } |
10951 | 20.3k | _res = NULL; |
10952 | 21.4k | done: |
10953 | 21.4k | p->level--; |
10954 | 21.4k | return _res; |
10955 | 20.3k | } |
10956 | | |
10957 | | // type_param_seq: ','.type_param+ ','? |
10958 | | static asdl_type_param_seq* |
10959 | | type_param_seq_rule(Parser *p) |
10960 | 1.23k | { |
10961 | 1.23k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
10962 | 0 | _Pypegen_stack_overflow(p); |
10963 | 0 | } |
10964 | 1.23k | if (p->error_indicator) { |
10965 | 0 | p->level--; |
10966 | 0 | return NULL; |
10967 | 0 | } |
10968 | 1.23k | asdl_type_param_seq* _res = NULL; |
10969 | 1.23k | int _mark = p->mark; |
10970 | 1.23k | { // ','.type_param+ ','? |
10971 | 1.23k | if (p->error_indicator) { |
10972 | 0 | p->level--; |
10973 | 0 | return NULL; |
10974 | 0 | } |
10975 | 1.23k | D(fprintf(stderr, "%*c> type_param_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.type_param+ ','?")); |
10976 | 1.23k | void *_opt_var; |
10977 | 1.23k | UNUSED(_opt_var); // Silence compiler warnings |
10978 | 1.23k | asdl_type_param_seq* a; |
10979 | 1.23k | if ( |
10980 | 1.23k | (a = (asdl_type_param_seq*)_gather_54_rule(p)) // ','.type_param+ |
10981 | 1.19k | && |
10982 | 1.19k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
10983 | 1.23k | ) |
10984 | 1.18k | { |
10985 | 1.18k | D(fprintf(stderr, "%*c+ type_param_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.type_param+ ','?")); |
10986 | 1.18k | _res = a; |
10987 | 1.18k | if (_res == NULL && PyErr_Occurred()) { |
10988 | 0 | p->error_indicator = 1; |
10989 | 0 | p->level--; |
10990 | 0 | return NULL; |
10991 | 0 | } |
10992 | 1.18k | goto done; |
10993 | 1.18k | } |
10994 | 53 | p->mark = _mark; |
10995 | 53 | D(fprintf(stderr, "%*c%s type_param_seq[%d-%d]: %s failed!\n", p->level, ' ', |
10996 | 53 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.type_param+ ','?")); |
10997 | 53 | } |
10998 | 53 | _res = NULL; |
10999 | 1.23k | done: |
11000 | 1.23k | p->level--; |
11001 | 1.23k | return _res; |
11002 | 53 | } |
11003 | | |
11004 | | // type_param: |
11005 | | // | NAME type_param_bound? type_param_default? |
11006 | | // | invalid_type_param |
11007 | | // | '*' NAME type_param_starred_default? |
11008 | | // | '**' NAME type_param_default? |
11009 | | static type_param_ty |
11010 | | type_param_rule(Parser *p) |
11011 | 12.1k | { |
11012 | 12.1k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
11013 | 0 | _Pypegen_stack_overflow(p); |
11014 | 0 | } |
11015 | 12.1k | if (p->error_indicator) { |
11016 | 0 | p->level--; |
11017 | 0 | return NULL; |
11018 | 0 | } |
11019 | 12.1k | type_param_ty _res = NULL; |
11020 | 12.1k | if (_PyPegen_is_memoized(p, type_param_type, &_res)) { |
11021 | 2.64k | p->level--; |
11022 | 2.64k | return _res; |
11023 | 2.64k | } |
11024 | 9.47k | int _mark = p->mark; |
11025 | 9.47k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
11026 | 0 | p->error_indicator = 1; |
11027 | 0 | p->level--; |
11028 | 0 | return NULL; |
11029 | 0 | } |
11030 | 9.47k | int _start_lineno = p->tokens[_mark]->lineno; |
11031 | 9.47k | UNUSED(_start_lineno); // Only used by EXTRA macro |
11032 | 9.47k | int _start_col_offset = p->tokens[_mark]->col_offset; |
11033 | 9.47k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
11034 | 9.47k | { // NAME type_param_bound? type_param_default? |
11035 | 9.47k | if (p->error_indicator) { |
11036 | 0 | p->level--; |
11037 | 0 | return NULL; |
11038 | 0 | } |
11039 | 9.47k | D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME type_param_bound? type_param_default?")); |
11040 | 9.47k | expr_ty a; |
11041 | 9.47k | void *b; |
11042 | 9.47k | void *c; |
11043 | 9.47k | if ( |
11044 | 9.47k | (a = _PyPegen_name_token(p)) // NAME |
11045 | 6.54k | && |
11046 | 6.54k | (b = type_param_bound_rule(p), !p->error_indicator) // type_param_bound? |
11047 | 6.53k | && |
11048 | 6.53k | (c = type_param_default_rule(p), !p->error_indicator) // type_param_default? |
11049 | 9.47k | ) |
11050 | 6.53k | { |
11051 | 6.53k | D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME type_param_bound? type_param_default?")); |
11052 | 6.53k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11053 | 6.53k | if (_token == NULL) { |
11054 | 0 | p->level--; |
11055 | 0 | return NULL; |
11056 | 0 | } |
11057 | 6.53k | int _end_lineno = _token->end_lineno; |
11058 | 6.53k | UNUSED(_end_lineno); // Only used by EXTRA macro |
11059 | 6.53k | int _end_col_offset = _token->end_col_offset; |
11060 | 6.53k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11061 | 6.53k | _res = _PyAST_TypeVar ( a -> v . Name . id , b , c , EXTRA ); |
11062 | 6.53k | if (_res == NULL && PyErr_Occurred()) { |
11063 | 0 | p->error_indicator = 1; |
11064 | 0 | p->level--; |
11065 | 0 | return NULL; |
11066 | 0 | } |
11067 | 6.53k | goto done; |
11068 | 6.53k | } |
11069 | 2.94k | p->mark = _mark; |
11070 | 2.94k | D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ', |
11071 | 2.94k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME type_param_bound? type_param_default?")); |
11072 | 2.94k | } |
11073 | 2.94k | if (p->call_invalid_rules) { // invalid_type_param |
11074 | 907 | if (p->error_indicator) { |
11075 | 3 | p->level--; |
11076 | 3 | return NULL; |
11077 | 3 | } |
11078 | 904 | D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_type_param")); |
11079 | 904 | void *invalid_type_param_var; |
11080 | 904 | if ( |
11081 | 904 | (invalid_type_param_var = invalid_type_param_rule(p)) // invalid_type_param |
11082 | 904 | ) |
11083 | 0 | { |
11084 | 0 | D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_type_param")); |
11085 | 0 | _res = invalid_type_param_var; |
11086 | 0 | goto done; |
11087 | 0 | } |
11088 | 904 | p->mark = _mark; |
11089 | 904 | D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ', |
11090 | 904 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_type_param")); |
11091 | 904 | } |
11092 | 2.93k | { // '*' NAME type_param_starred_default? |
11093 | 2.93k | if (p->error_indicator) { |
11094 | 10 | p->level--; |
11095 | 10 | return NULL; |
11096 | 10 | } |
11097 | 2.92k | D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' NAME type_param_starred_default?")); |
11098 | 2.92k | Token * _literal; |
11099 | 2.92k | expr_ty a; |
11100 | 2.92k | void *b; |
11101 | 2.92k | if ( |
11102 | 2.92k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
11103 | 1.49k | && |
11104 | 1.49k | (a = _PyPegen_name_token(p)) // NAME |
11105 | 1.48k | && |
11106 | 1.48k | (b = type_param_starred_default_rule(p), !p->error_indicator) // type_param_starred_default? |
11107 | 2.92k | ) |
11108 | 1.48k | { |
11109 | 1.48k | D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' NAME type_param_starred_default?")); |
11110 | 1.48k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11111 | 1.48k | if (_token == NULL) { |
11112 | 0 | p->level--; |
11113 | 0 | return NULL; |
11114 | 0 | } |
11115 | 1.48k | int _end_lineno = _token->end_lineno; |
11116 | 1.48k | UNUSED(_end_lineno); // Only used by EXTRA macro |
11117 | 1.48k | int _end_col_offset = _token->end_col_offset; |
11118 | 1.48k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11119 | 1.48k | _res = _PyAST_TypeVarTuple ( a -> v . Name . id , b , EXTRA ); |
11120 | 1.48k | if (_res == NULL && PyErr_Occurred()) { |
11121 | 0 | p->error_indicator = 1; |
11122 | 0 | p->level--; |
11123 | 0 | return NULL; |
11124 | 0 | } |
11125 | 1.48k | goto done; |
11126 | 1.48k | } |
11127 | 1.44k | p->mark = _mark; |
11128 | 1.44k | D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ', |
11129 | 1.44k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' NAME type_param_starred_default?")); |
11130 | 1.44k | } |
11131 | 0 | { // '**' NAME type_param_default? |
11132 | 1.44k | if (p->error_indicator) { |
11133 | 5 | p->level--; |
11134 | 5 | return NULL; |
11135 | 5 | } |
11136 | 1.43k | D(fprintf(stderr, "%*c> type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' NAME type_param_default?")); |
11137 | 1.43k | Token * _literal; |
11138 | 1.43k | expr_ty a; |
11139 | 1.43k | void *b; |
11140 | 1.43k | if ( |
11141 | 1.43k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
11142 | 974 | && |
11143 | 974 | (a = _PyPegen_name_token(p)) // NAME |
11144 | 971 | && |
11145 | 971 | (b = type_param_default_rule(p), !p->error_indicator) // type_param_default? |
11146 | 1.43k | ) |
11147 | 970 | { |
11148 | 970 | D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' NAME type_param_default?")); |
11149 | 970 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11150 | 970 | if (_token == NULL) { |
11151 | 0 | p->level--; |
11152 | 0 | return NULL; |
11153 | 0 | } |
11154 | 970 | int _end_lineno = _token->end_lineno; |
11155 | 970 | UNUSED(_end_lineno); // Only used by EXTRA macro |
11156 | 970 | int _end_col_offset = _token->end_col_offset; |
11157 | 970 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11158 | 970 | _res = _PyAST_ParamSpec ( a -> v . Name . id , b , EXTRA ); |
11159 | 970 | if (_res == NULL && PyErr_Occurred()) { |
11160 | 0 | p->error_indicator = 1; |
11161 | 0 | p->level--; |
11162 | 0 | return NULL; |
11163 | 0 | } |
11164 | 970 | goto done; |
11165 | 970 | } |
11166 | 466 | p->mark = _mark; |
11167 | 466 | D(fprintf(stderr, "%*c%s type_param[%d-%d]: %s failed!\n", p->level, ' ', |
11168 | 466 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' NAME type_param_default?")); |
11169 | 466 | } |
11170 | 466 | _res = NULL; |
11171 | 9.45k | done: |
11172 | 9.45k | _PyPegen_insert_memo(p, _mark, type_param_type, _res); |
11173 | 9.45k | p->level--; |
11174 | 9.45k | return _res; |
11175 | 466 | } |
11176 | | |
11177 | | // type_param_bound: ':' expression |
11178 | | static expr_ty |
11179 | | type_param_bound_rule(Parser *p) |
11180 | 6.54k | { |
11181 | 6.54k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
11182 | 0 | _Pypegen_stack_overflow(p); |
11183 | 0 | } |
11184 | 6.54k | if (p->error_indicator) { |
11185 | 0 | p->level--; |
11186 | 0 | return NULL; |
11187 | 0 | } |
11188 | 6.54k | expr_ty _res = NULL; |
11189 | 6.54k | int _mark = p->mark; |
11190 | 6.54k | { // ':' expression |
11191 | 6.54k | if (p->error_indicator) { |
11192 | 0 | p->level--; |
11193 | 0 | return NULL; |
11194 | 0 | } |
11195 | 6.54k | D(fprintf(stderr, "%*c> type_param_bound[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression")); |
11196 | 6.54k | Token * _literal; |
11197 | 6.54k | expr_ty e; |
11198 | 6.54k | if ( |
11199 | 6.54k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
11200 | 236 | && |
11201 | 236 | (e = expression_rule(p)) // expression |
11202 | 6.54k | ) |
11203 | 232 | { |
11204 | 232 | D(fprintf(stderr, "%*c+ type_param_bound[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression")); |
11205 | 232 | _res = e; |
11206 | 232 | if (_res == NULL && PyErr_Occurred()) { |
11207 | 0 | p->error_indicator = 1; |
11208 | 0 | p->level--; |
11209 | 0 | return NULL; |
11210 | 0 | } |
11211 | 232 | goto done; |
11212 | 232 | } |
11213 | 6.31k | p->mark = _mark; |
11214 | 6.31k | D(fprintf(stderr, "%*c%s type_param_bound[%d-%d]: %s failed!\n", p->level, ' ', |
11215 | 6.31k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression")); |
11216 | 6.31k | } |
11217 | 6.31k | _res = NULL; |
11218 | 6.54k | done: |
11219 | 6.54k | p->level--; |
11220 | 6.54k | return _res; |
11221 | 6.31k | } |
11222 | | |
11223 | | // type_param_default: '=' expression |
11224 | | static expr_ty |
11225 | | type_param_default_rule(Parser *p) |
11226 | 7.50k | { |
11227 | 7.50k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
11228 | 0 | _Pypegen_stack_overflow(p); |
11229 | 0 | } |
11230 | 7.50k | if (p->error_indicator) { |
11231 | 0 | p->level--; |
11232 | 0 | return NULL; |
11233 | 0 | } |
11234 | 7.50k | expr_ty _res = NULL; |
11235 | 7.50k | int _mark = p->mark; |
11236 | 7.50k | { // '=' expression |
11237 | 7.50k | if (p->error_indicator) { |
11238 | 0 | p->level--; |
11239 | 0 | return NULL; |
11240 | 0 | } |
11241 | 7.50k | D(fprintf(stderr, "%*c> type_param_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression")); |
11242 | 7.50k | Token * _literal; |
11243 | 7.50k | expr_ty e; |
11244 | 7.50k | if ( |
11245 | 7.50k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
11246 | 1.55k | && |
11247 | 1.55k | (e = expression_rule(p)) // expression |
11248 | 7.50k | ) |
11249 | 1.54k | { |
11250 | 1.54k | D(fprintf(stderr, "%*c+ type_param_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression")); |
11251 | 1.54k | _res = CHECK_VERSION ( expr_ty , 13 , "Type parameter defaults are" , e ); |
11252 | 1.54k | if (_res == NULL && PyErr_Occurred()) { |
11253 | 0 | p->error_indicator = 1; |
11254 | 0 | p->level--; |
11255 | 0 | return NULL; |
11256 | 0 | } |
11257 | 1.54k | goto done; |
11258 | 1.54k | } |
11259 | 5.96k | p->mark = _mark; |
11260 | 5.96k | D(fprintf(stderr, "%*c%s type_param_default[%d-%d]: %s failed!\n", p->level, ' ', |
11261 | 5.96k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression")); |
11262 | 5.96k | } |
11263 | 5.96k | _res = NULL; |
11264 | 7.50k | done: |
11265 | 7.50k | p->level--; |
11266 | 7.50k | return _res; |
11267 | 5.96k | } |
11268 | | |
11269 | | // type_param_starred_default: '=' star_expression |
11270 | | static expr_ty |
11271 | | type_param_starred_default_rule(Parser *p) |
11272 | 1.48k | { |
11273 | 1.48k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
11274 | 0 | _Pypegen_stack_overflow(p); |
11275 | 0 | } |
11276 | 1.48k | if (p->error_indicator) { |
11277 | 0 | p->level--; |
11278 | 0 | return NULL; |
11279 | 0 | } |
11280 | 1.48k | expr_ty _res = NULL; |
11281 | 1.48k | int _mark = p->mark; |
11282 | 1.48k | { // '=' star_expression |
11283 | 1.48k | if (p->error_indicator) { |
11284 | 0 | p->level--; |
11285 | 0 | return NULL; |
11286 | 0 | } |
11287 | 1.48k | D(fprintf(stderr, "%*c> type_param_starred_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' star_expression")); |
11288 | 1.48k | Token * _literal; |
11289 | 1.48k | expr_ty e; |
11290 | 1.48k | if ( |
11291 | 1.48k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
11292 | 621 | && |
11293 | 621 | (e = star_expression_rule(p)) // star_expression |
11294 | 1.48k | ) |
11295 | 617 | { |
11296 | 617 | D(fprintf(stderr, "%*c+ type_param_starred_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' star_expression")); |
11297 | 617 | _res = CHECK_VERSION ( expr_ty , 13 , "Type parameter defaults are" , e ); |
11298 | 617 | if (_res == NULL && PyErr_Occurred()) { |
11299 | 0 | p->error_indicator = 1; |
11300 | 0 | p->level--; |
11301 | 0 | return NULL; |
11302 | 0 | } |
11303 | 617 | goto done; |
11304 | 617 | } |
11305 | 872 | p->mark = _mark; |
11306 | 872 | D(fprintf(stderr, "%*c%s type_param_starred_default[%d-%d]: %s failed!\n", p->level, ' ', |
11307 | 872 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' star_expression")); |
11308 | 872 | } |
11309 | 872 | _res = NULL; |
11310 | 1.48k | done: |
11311 | 1.48k | p->level--; |
11312 | 1.48k | return _res; |
11313 | 872 | } |
11314 | | |
11315 | | // expressions: expression ((',' expression))+ ','? | expression ',' | expression |
11316 | | static expr_ty |
11317 | | expressions_rule(Parser *p) |
11318 | 10.6k | { |
11319 | 10.6k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
11320 | 0 | _Pypegen_stack_overflow(p); |
11321 | 0 | } |
11322 | 10.6k | if (p->error_indicator) { |
11323 | 0 | p->level--; |
11324 | 0 | return NULL; |
11325 | 0 | } |
11326 | 10.6k | expr_ty _res = NULL; |
11327 | 10.6k | int _mark = p->mark; |
11328 | 10.6k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
11329 | 8 | p->error_indicator = 1; |
11330 | 8 | p->level--; |
11331 | 8 | return NULL; |
11332 | 8 | } |
11333 | 10.6k | int _start_lineno = p->tokens[_mark]->lineno; |
11334 | 10.6k | UNUSED(_start_lineno); // Only used by EXTRA macro |
11335 | 10.6k | int _start_col_offset = p->tokens[_mark]->col_offset; |
11336 | 10.6k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
11337 | 10.6k | { // expression ((',' expression))+ ','? |
11338 | 10.6k | if (p->error_indicator) { |
11339 | 0 | p->level--; |
11340 | 0 | return NULL; |
11341 | 0 | } |
11342 | 10.6k | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?")); |
11343 | 10.6k | void *_opt_var; |
11344 | 10.6k | UNUSED(_opt_var); // Silence compiler warnings |
11345 | 10.6k | expr_ty a; |
11346 | 10.6k | asdl_seq * b; |
11347 | 10.6k | if ( |
11348 | 10.6k | (a = expression_rule(p)) // expression |
11349 | 3.76k | && |
11350 | 3.76k | (b = _loop1_55_rule(p)) // ((',' expression))+ |
11351 | 934 | && |
11352 | 934 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
11353 | 10.6k | ) |
11354 | 934 | { |
11355 | 934 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?")); |
11356 | 934 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11357 | 934 | if (_token == NULL) { |
11358 | 0 | p->level--; |
11359 | 0 | return NULL; |
11360 | 0 | } |
11361 | 934 | int _end_lineno = _token->end_lineno; |
11362 | 934 | UNUSED(_end_lineno); // Only used by EXTRA macro |
11363 | 934 | int _end_col_offset = _token->end_col_offset; |
11364 | 934 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11365 | 934 | _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); |
11366 | 934 | if (_res == NULL && PyErr_Occurred()) { |
11367 | 0 | p->error_indicator = 1; |
11368 | 0 | p->level--; |
11369 | 0 | return NULL; |
11370 | 0 | } |
11371 | 934 | goto done; |
11372 | 934 | } |
11373 | 9.75k | p->mark = _mark; |
11374 | 9.75k | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
11375 | 9.75k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?")); |
11376 | 9.75k | } |
11377 | 0 | { // expression ',' |
11378 | 9.75k | if (p->error_indicator) { |
11379 | 5 | p->level--; |
11380 | 5 | return NULL; |
11381 | 5 | } |
11382 | 9.74k | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','")); |
11383 | 9.74k | Token * _literal; |
11384 | 9.74k | expr_ty a; |
11385 | 9.74k | if ( |
11386 | 9.74k | (a = expression_rule(p)) // expression |
11387 | 2.82k | && |
11388 | 2.82k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
11389 | 9.74k | ) |
11390 | 1.93k | { |
11391 | 1.93k | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','")); |
11392 | 1.93k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11393 | 1.93k | if (_token == NULL) { |
11394 | 0 | p->level--; |
11395 | 0 | return NULL; |
11396 | 0 | } |
11397 | 1.93k | int _end_lineno = _token->end_lineno; |
11398 | 1.93k | UNUSED(_end_lineno); // Only used by EXTRA macro |
11399 | 1.93k | int _end_col_offset = _token->end_col_offset; |
11400 | 1.93k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11401 | 1.93k | _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); |
11402 | 1.93k | if (_res == NULL && PyErr_Occurred()) { |
11403 | 0 | p->error_indicator = 1; |
11404 | 0 | p->level--; |
11405 | 0 | return NULL; |
11406 | 0 | } |
11407 | 1.93k | goto done; |
11408 | 1.93k | } |
11409 | 7.81k | p->mark = _mark; |
11410 | 7.81k | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
11411 | 7.81k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','")); |
11412 | 7.81k | } |
11413 | 0 | { // expression |
11414 | 7.81k | if (p->error_indicator) { |
11415 | 0 | p->level--; |
11416 | 0 | return NULL; |
11417 | 0 | } |
11418 | 7.81k | D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); |
11419 | 7.81k | expr_ty expression_var; |
11420 | 7.81k | if ( |
11421 | 7.81k | (expression_var = expression_rule(p)) // expression |
11422 | 7.81k | ) |
11423 | 886 | { |
11424 | 886 | D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); |
11425 | 886 | _res = expression_var; |
11426 | 886 | goto done; |
11427 | 886 | } |
11428 | 6.92k | p->mark = _mark; |
11429 | 6.92k | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
11430 | 6.92k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
11431 | 6.92k | } |
11432 | 6.92k | _res = NULL; |
11433 | 10.6k | done: |
11434 | 10.6k | p->level--; |
11435 | 10.6k | return _res; |
11436 | 6.92k | } |
11437 | | |
11438 | | // expression: |
11439 | | // | invalid_expression |
11440 | | // | invalid_legacy_expression |
11441 | | // | disjunction 'if' disjunction 'else' expression |
11442 | | // | disjunction |
11443 | | // | lambdef |
11444 | | static expr_ty |
11445 | | expression_rule(Parser *p) |
11446 | 1.64M | { |
11447 | 1.64M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
11448 | 1 | _Pypegen_stack_overflow(p); |
11449 | 1 | } |
11450 | 1.64M | if (p->error_indicator) { |
11451 | 3 | p->level--; |
11452 | 3 | return NULL; |
11453 | 3 | } |
11454 | 1.64M | expr_ty _res = NULL; |
11455 | 1.64M | if (_PyPegen_is_memoized(p, expression_type, &_res)) { |
11456 | 1.01M | p->level--; |
11457 | 1.01M | return _res; |
11458 | 1.01M | } |
11459 | 635k | int _mark = p->mark; |
11460 | 635k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
11461 | 0 | p->error_indicator = 1; |
11462 | 0 | p->level--; |
11463 | 0 | return NULL; |
11464 | 0 | } |
11465 | 635k | int _start_lineno = p->tokens[_mark]->lineno; |
11466 | 635k | UNUSED(_start_lineno); // Only used by EXTRA macro |
11467 | 635k | int _start_col_offset = p->tokens[_mark]->col_offset; |
11468 | 635k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
11469 | 635k | if (p->call_invalid_rules) { // invalid_expression |
11470 | 211k | if (p->error_indicator) { |
11471 | 0 | p->level--; |
11472 | 0 | return NULL; |
11473 | 0 | } |
11474 | 211k | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_expression")); |
11475 | 211k | void *invalid_expression_var; |
11476 | 211k | if ( |
11477 | 211k | (invalid_expression_var = invalid_expression_rule(p)) // invalid_expression |
11478 | 211k | ) |
11479 | 0 | { |
11480 | 0 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_expression")); |
11481 | 0 | _res = invalid_expression_var; |
11482 | 0 | goto done; |
11483 | 0 | } |
11484 | 211k | p->mark = _mark; |
11485 | 211k | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
11486 | 211k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_expression")); |
11487 | 211k | } |
11488 | 635k | if (p->call_invalid_rules) { // invalid_legacy_expression |
11489 | 211k | if (p->error_indicator) { |
11490 | 27.0k | p->level--; |
11491 | 27.0k | return NULL; |
11492 | 27.0k | } |
11493 | 184k | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_legacy_expression")); |
11494 | 184k | void *invalid_legacy_expression_var; |
11495 | 184k | if ( |
11496 | 184k | (invalid_legacy_expression_var = invalid_legacy_expression_rule(p)) // invalid_legacy_expression |
11497 | 184k | ) |
11498 | 0 | { |
11499 | 0 | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_legacy_expression")); |
11500 | 0 | _res = invalid_legacy_expression_var; |
11501 | 0 | goto done; |
11502 | 0 | } |
11503 | 184k | p->mark = _mark; |
11504 | 184k | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
11505 | 184k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_legacy_expression")); |
11506 | 184k | } |
11507 | 608k | { // disjunction 'if' disjunction 'else' expression |
11508 | 608k | if (p->error_indicator) { |
11509 | 894 | p->level--; |
11510 | 894 | return NULL; |
11511 | 894 | } |
11512 | 607k | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
11513 | 607k | Token * _keyword; |
11514 | 607k | Token * _keyword_1; |
11515 | 607k | expr_ty a; |
11516 | 607k | expr_ty b; |
11517 | 607k | expr_ty c; |
11518 | 607k | if ( |
11519 | 607k | (a = disjunction_rule(p)) // disjunction |
11520 | 383k | && |
11521 | 383k | (_keyword = _PyPegen_expect_token(p, 691)) // token='if' |
11522 | 1.99k | && |
11523 | 1.99k | (b = disjunction_rule(p)) // disjunction |
11524 | 1.51k | && |
11525 | 1.51k | (_keyword_1 = _PyPegen_expect_token(p, 695)) // token='else' |
11526 | 1.43k | && |
11527 | 1.43k | (c = expression_rule(p)) // expression |
11528 | 607k | ) |
11529 | 1.23k | { |
11530 | 1.23k | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
11531 | 1.23k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11532 | 1.23k | if (_token == NULL) { |
11533 | 0 | p->level--; |
11534 | 0 | return NULL; |
11535 | 0 | } |
11536 | 1.23k | int _end_lineno = _token->end_lineno; |
11537 | 1.23k | UNUSED(_end_lineno); // Only used by EXTRA macro |
11538 | 1.23k | int _end_col_offset = _token->end_col_offset; |
11539 | 1.23k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11540 | 1.23k | _res = _PyAST_IfExp ( b , a , c , EXTRA ); |
11541 | 1.23k | if (_res == NULL && PyErr_Occurred()) { |
11542 | 0 | p->error_indicator = 1; |
11543 | 0 | p->level--; |
11544 | 0 | return NULL; |
11545 | 0 | } |
11546 | 1.23k | goto done; |
11547 | 1.23k | } |
11548 | 605k | p->mark = _mark; |
11549 | 605k | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
11550 | 605k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
11551 | 605k | } |
11552 | 0 | { // disjunction |
11553 | 605k | if (p->error_indicator) { |
11554 | 8.52k | p->level--; |
11555 | 8.52k | return NULL; |
11556 | 8.52k | } |
11557 | 597k | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction")); |
11558 | 597k | expr_ty disjunction_var; |
11559 | 597k | if ( |
11560 | 597k | (disjunction_var = disjunction_rule(p)) // disjunction |
11561 | 597k | ) |
11562 | 382k | { |
11563 | 382k | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction")); |
11564 | 382k | _res = disjunction_var; |
11565 | 382k | goto done; |
11566 | 382k | } |
11567 | 215k | p->mark = _mark; |
11568 | 215k | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
11569 | 215k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction")); |
11570 | 215k | } |
11571 | 0 | { // lambdef |
11572 | 215k | if (p->error_indicator) { |
11573 | 0 | p->level--; |
11574 | 0 | return NULL; |
11575 | 0 | } |
11576 | 215k | D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef")); |
11577 | 215k | expr_ty lambdef_var; |
11578 | 215k | if ( |
11579 | 215k | (lambdef_var = lambdef_rule(p)) // lambdef |
11580 | 215k | ) |
11581 | 2.65k | { |
11582 | 2.65k | D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef")); |
11583 | 2.65k | _res = lambdef_var; |
11584 | 2.65k | goto done; |
11585 | 2.65k | } |
11586 | 212k | p->mark = _mark; |
11587 | 212k | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
11588 | 212k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef")); |
11589 | 212k | } |
11590 | 212k | _res = NULL; |
11591 | 598k | done: |
11592 | 598k | _PyPegen_insert_memo(p, _mark, expression_type, _res); |
11593 | 598k | p->level--; |
11594 | 598k | return _res; |
11595 | 212k | } |
11596 | | |
11597 | | // yield_expr: 'yield' 'from' expression | 'yield' star_expressions? |
11598 | | static expr_ty |
11599 | | yield_expr_rule(Parser *p) |
11600 | 127k | { |
11601 | 127k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
11602 | 1 | _Pypegen_stack_overflow(p); |
11603 | 1 | } |
11604 | 127k | if (p->error_indicator) { |
11605 | 1 | p->level--; |
11606 | 1 | return NULL; |
11607 | 1 | } |
11608 | 127k | expr_ty _res = NULL; |
11609 | 127k | int _mark = p->mark; |
11610 | 127k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
11611 | 59 | p->error_indicator = 1; |
11612 | 59 | p->level--; |
11613 | 59 | return NULL; |
11614 | 59 | } |
11615 | 127k | int _start_lineno = p->tokens[_mark]->lineno; |
11616 | 127k | UNUSED(_start_lineno); // Only used by EXTRA macro |
11617 | 127k | int _start_col_offset = p->tokens[_mark]->col_offset; |
11618 | 127k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
11619 | 127k | { // 'yield' 'from' expression |
11620 | 127k | if (p->error_indicator) { |
11621 | 0 | p->level--; |
11622 | 0 | return NULL; |
11623 | 0 | } |
11624 | 127k | D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression")); |
11625 | 127k | Token * _keyword; |
11626 | 127k | Token * _keyword_1; |
11627 | 127k | expr_ty a; |
11628 | 127k | if ( |
11629 | 127k | (_keyword = _PyPegen_expect_token(p, 588)) // token='yield' |
11630 | 3.40k | && |
11631 | 3.40k | (_keyword_1 = _PyPegen_expect_token(p, 642)) // token='from' |
11632 | 564 | && |
11633 | 564 | (a = expression_rule(p)) // expression |
11634 | 127k | ) |
11635 | 311 | { |
11636 | 311 | D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression")); |
11637 | 311 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11638 | 311 | if (_token == NULL) { |
11639 | 0 | p->level--; |
11640 | 0 | return NULL; |
11641 | 0 | } |
11642 | 311 | int _end_lineno = _token->end_lineno; |
11643 | 311 | UNUSED(_end_lineno); // Only used by EXTRA macro |
11644 | 311 | int _end_col_offset = _token->end_col_offset; |
11645 | 311 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11646 | 311 | _res = _PyAST_YieldFrom ( a , EXTRA ); |
11647 | 311 | if (_res == NULL && PyErr_Occurred()) { |
11648 | 0 | p->error_indicator = 1; |
11649 | 0 | p->level--; |
11650 | 0 | return NULL; |
11651 | 0 | } |
11652 | 311 | goto done; |
11653 | 311 | } |
11654 | 127k | p->mark = _mark; |
11655 | 127k | D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', |
11656 | 127k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression")); |
11657 | 127k | } |
11658 | 0 | { // 'yield' star_expressions? |
11659 | 127k | if (p->error_indicator) { |
11660 | 72 | p->level--; |
11661 | 72 | return NULL; |
11662 | 72 | } |
11663 | 127k | D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?")); |
11664 | 127k | Token * _keyword; |
11665 | 127k | void *a; |
11666 | 127k | if ( |
11667 | 127k | (_keyword = _PyPegen_expect_token(p, 588)) // token='yield' |
11668 | 3.01k | && |
11669 | 3.01k | (a = star_expressions_rule(p), !p->error_indicator) // star_expressions? |
11670 | 127k | ) |
11671 | 2.68k | { |
11672 | 2.68k | D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?")); |
11673 | 2.68k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11674 | 2.68k | if (_token == NULL) { |
11675 | 0 | p->level--; |
11676 | 0 | return NULL; |
11677 | 0 | } |
11678 | 2.68k | int _end_lineno = _token->end_lineno; |
11679 | 2.68k | UNUSED(_end_lineno); // Only used by EXTRA macro |
11680 | 2.68k | int _end_col_offset = _token->end_col_offset; |
11681 | 2.68k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11682 | 2.68k | _res = _PyAST_Yield ( a , EXTRA ); |
11683 | 2.68k | if (_res == NULL && PyErr_Occurred()) { |
11684 | 0 | p->error_indicator = 1; |
11685 | 0 | p->level--; |
11686 | 0 | return NULL; |
11687 | 0 | } |
11688 | 2.68k | goto done; |
11689 | 2.68k | } |
11690 | 124k | p->mark = _mark; |
11691 | 124k | D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', |
11692 | 124k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?")); |
11693 | 124k | } |
11694 | 124k | _res = NULL; |
11695 | 127k | done: |
11696 | 127k | p->level--; |
11697 | 127k | return _res; |
11698 | 124k | } |
11699 | | |
11700 | | // star_expressions: |
11701 | | // | star_expression ((',' star_expression))+ ','? |
11702 | | // | star_expression ',' |
11703 | | // | star_expression |
11704 | | static expr_ty |
11705 | | star_expressions_rule(Parser *p) |
11706 | 369k | { |
11707 | 369k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
11708 | 1 | _Pypegen_stack_overflow(p); |
11709 | 1 | } |
11710 | 369k | if (p->error_indicator) { |
11711 | 1 | p->level--; |
11712 | 1 | return NULL; |
11713 | 1 | } |
11714 | 369k | expr_ty _res = NULL; |
11715 | 369k | int _mark = p->mark; |
11716 | 369k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
11717 | 7 | p->error_indicator = 1; |
11718 | 7 | p->level--; |
11719 | 7 | return NULL; |
11720 | 7 | } |
11721 | 369k | int _start_lineno = p->tokens[_mark]->lineno; |
11722 | 369k | UNUSED(_start_lineno); // Only used by EXTRA macro |
11723 | 369k | int _start_col_offset = p->tokens[_mark]->col_offset; |
11724 | 369k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
11725 | 369k | { // star_expression ((',' star_expression))+ ','? |
11726 | 369k | if (p->error_indicator) { |
11727 | 0 | p->level--; |
11728 | 0 | return NULL; |
11729 | 0 | } |
11730 | 369k | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
11731 | 369k | void *_opt_var; |
11732 | 369k | UNUSED(_opt_var); // Silence compiler warnings |
11733 | 369k | expr_ty a; |
11734 | 369k | asdl_seq * b; |
11735 | 369k | if ( |
11736 | 369k | (a = star_expression_rule(p)) // star_expression |
11737 | 214k | && |
11738 | 214k | (b = _loop1_56_rule(p)) // ((',' star_expression))+ |
11739 | 5.32k | && |
11740 | 5.32k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
11741 | 369k | ) |
11742 | 5.32k | { |
11743 | 5.32k | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
11744 | 5.32k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11745 | 5.32k | if (_token == NULL) { |
11746 | 0 | p->level--; |
11747 | 0 | return NULL; |
11748 | 0 | } |
11749 | 5.32k | int _end_lineno = _token->end_lineno; |
11750 | 5.32k | UNUSED(_end_lineno); // Only used by EXTRA macro |
11751 | 5.32k | int _end_col_offset = _token->end_col_offset; |
11752 | 5.32k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11753 | 5.32k | _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); |
11754 | 5.32k | if (_res == NULL && PyErr_Occurred()) { |
11755 | 0 | p->error_indicator = 1; |
11756 | 0 | p->level--; |
11757 | 0 | return NULL; |
11758 | 0 | } |
11759 | 5.32k | goto done; |
11760 | 5.32k | } |
11761 | 363k | p->mark = _mark; |
11762 | 363k | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
11763 | 363k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
11764 | 363k | } |
11765 | 0 | { // star_expression ',' |
11766 | 363k | if (p->error_indicator) { |
11767 | 4.99k | p->level--; |
11768 | 4.99k | return NULL; |
11769 | 4.99k | } |
11770 | 358k | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','")); |
11771 | 358k | Token * _literal; |
11772 | 358k | expr_ty a; |
11773 | 358k | if ( |
11774 | 358k | (a = star_expression_rule(p)) // star_expression |
11775 | 208k | && |
11776 | 208k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
11777 | 358k | ) |
11778 | 7.06k | { |
11779 | 7.06k | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','")); |
11780 | 7.06k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11781 | 7.06k | if (_token == NULL) { |
11782 | 0 | p->level--; |
11783 | 0 | return NULL; |
11784 | 0 | } |
11785 | 7.06k | int _end_lineno = _token->end_lineno; |
11786 | 7.06k | UNUSED(_end_lineno); // Only used by EXTRA macro |
11787 | 7.06k | int _end_col_offset = _token->end_col_offset; |
11788 | 7.06k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11789 | 7.06k | _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); |
11790 | 7.06k | if (_res == NULL && PyErr_Occurred()) { |
11791 | 0 | p->error_indicator = 1; |
11792 | 0 | p->level--; |
11793 | 0 | return NULL; |
11794 | 0 | } |
11795 | 7.06k | goto done; |
11796 | 7.06k | } |
11797 | 351k | p->mark = _mark; |
11798 | 351k | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
11799 | 351k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','")); |
11800 | 351k | } |
11801 | 0 | { // star_expression |
11802 | 351k | if (p->error_indicator) { |
11803 | 0 | p->level--; |
11804 | 0 | return NULL; |
11805 | 0 | } |
11806 | 351k | D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression")); |
11807 | 351k | expr_ty star_expression_var; |
11808 | 351k | if ( |
11809 | 351k | (star_expression_var = star_expression_rule(p)) // star_expression |
11810 | 351k | ) |
11811 | 201k | { |
11812 | 201k | D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression")); |
11813 | 201k | _res = star_expression_var; |
11814 | 201k | goto done; |
11815 | 201k | } |
11816 | 150k | p->mark = _mark; |
11817 | 150k | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
11818 | 150k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression")); |
11819 | 150k | } |
11820 | 150k | _res = NULL; |
11821 | 364k | done: |
11822 | 364k | p->level--; |
11823 | 364k | return _res; |
11824 | 150k | } |
11825 | | |
11826 | | // star_expression: '*' bitwise_or | expression |
11827 | | static expr_ty |
11828 | | star_expression_rule(Parser *p) |
11829 | 1.10M | { |
11830 | 1.10M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
11831 | 1 | _Pypegen_stack_overflow(p); |
11832 | 1 | } |
11833 | 1.10M | if (p->error_indicator) { |
11834 | 1 | p->level--; |
11835 | 1 | return NULL; |
11836 | 1 | } |
11837 | 1.10M | expr_ty _res = NULL; |
11838 | 1.10M | if (_PyPegen_is_memoized(p, star_expression_type, &_res)) { |
11839 | 800k | p->level--; |
11840 | 800k | return _res; |
11841 | 800k | } |
11842 | 305k | int _mark = p->mark; |
11843 | 305k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
11844 | 0 | p->error_indicator = 1; |
11845 | 0 | p->level--; |
11846 | 0 | return NULL; |
11847 | 0 | } |
11848 | 305k | int _start_lineno = p->tokens[_mark]->lineno; |
11849 | 305k | UNUSED(_start_lineno); // Only used by EXTRA macro |
11850 | 305k | int _start_col_offset = p->tokens[_mark]->col_offset; |
11851 | 305k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
11852 | 305k | { // '*' bitwise_or |
11853 | 305k | if (p->error_indicator) { |
11854 | 0 | p->level--; |
11855 | 0 | return NULL; |
11856 | 0 | } |
11857 | 305k | D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
11858 | 305k | Token * _literal; |
11859 | 305k | expr_ty a; |
11860 | 305k | if ( |
11861 | 305k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
11862 | 3.09k | && |
11863 | 3.09k | (a = bitwise_or_rule(p)) // bitwise_or |
11864 | 305k | ) |
11865 | 2.38k | { |
11866 | 2.38k | D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
11867 | 2.38k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11868 | 2.38k | if (_token == NULL) { |
11869 | 0 | p->level--; |
11870 | 0 | return NULL; |
11871 | 0 | } |
11872 | 2.38k | int _end_lineno = _token->end_lineno; |
11873 | 2.38k | UNUSED(_end_lineno); // Only used by EXTRA macro |
11874 | 2.38k | int _end_col_offset = _token->end_col_offset; |
11875 | 2.38k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
11876 | 2.38k | _res = _PyAST_Starred ( a , Load , EXTRA ); |
11877 | 2.38k | if (_res == NULL && PyErr_Occurred()) { |
11878 | 0 | p->error_indicator = 1; |
11879 | 0 | p->level--; |
11880 | 0 | return NULL; |
11881 | 0 | } |
11882 | 2.38k | goto done; |
11883 | 2.38k | } |
11884 | 303k | p->mark = _mark; |
11885 | 303k | D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', |
11886 | 303k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); |
11887 | 303k | } |
11888 | 0 | { // expression |
11889 | 303k | if (p->error_indicator) { |
11890 | 335 | p->level--; |
11891 | 335 | return NULL; |
11892 | 335 | } |
11893 | 302k | D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression")); |
11894 | 302k | expr_ty expression_var; |
11895 | 302k | if ( |
11896 | 302k | (expression_var = expression_rule(p)) // expression |
11897 | 302k | ) |
11898 | 165k | { |
11899 | 165k | D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression")); |
11900 | 165k | _res = expression_var; |
11901 | 165k | goto done; |
11902 | 165k | } |
11903 | 137k | p->mark = _mark; |
11904 | 137k | D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', |
11905 | 137k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
11906 | 137k | } |
11907 | 137k | _res = NULL; |
11908 | 305k | done: |
11909 | 305k | _PyPegen_insert_memo(p, _mark, star_expression_type, _res); |
11910 | 305k | p->level--; |
11911 | 305k | return _res; |
11912 | 137k | } |
11913 | | |
11914 | | // star_named_expressions: ','.star_named_expression+ ','? |
11915 | | static asdl_expr_seq* |
11916 | | star_named_expressions_rule(Parser *p) |
11917 | 85.2k | { |
11918 | 85.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
11919 | 1 | _Pypegen_stack_overflow(p); |
11920 | 1 | } |
11921 | 85.2k | if (p->error_indicator) { |
11922 | 1 | p->level--; |
11923 | 1 | return NULL; |
11924 | 1 | } |
11925 | 85.2k | asdl_expr_seq* _res = NULL; |
11926 | 85.2k | int _mark = p->mark; |
11927 | 85.2k | { // ','.star_named_expression+ ','? |
11928 | 85.2k | if (p->error_indicator) { |
11929 | 0 | p->level--; |
11930 | 0 | return NULL; |
11931 | 0 | } |
11932 | 85.2k | D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?")); |
11933 | 85.2k | void *_opt_var; |
11934 | 85.2k | UNUSED(_opt_var); // Silence compiler warnings |
11935 | 85.2k | asdl_expr_seq* a; |
11936 | 85.2k | if ( |
11937 | 85.2k | (a = (asdl_expr_seq*)_gather_58_rule(p)) // ','.star_named_expression+ |
11938 | 40.8k | && |
11939 | 40.8k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
11940 | 85.2k | ) |
11941 | 40.5k | { |
11942 | 40.5k | D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?")); |
11943 | 40.5k | _res = a; |
11944 | 40.5k | if (_res == NULL && PyErr_Occurred()) { |
11945 | 0 | p->error_indicator = 1; |
11946 | 0 | p->level--; |
11947 | 0 | return NULL; |
11948 | 0 | } |
11949 | 40.5k | goto done; |
11950 | 40.5k | } |
11951 | 44.7k | p->mark = _mark; |
11952 | 44.7k | D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
11953 | 44.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?")); |
11954 | 44.7k | } |
11955 | 44.7k | _res = NULL; |
11956 | 85.2k | done: |
11957 | 85.2k | p->level--; |
11958 | 85.2k | return _res; |
11959 | 44.7k | } |
11960 | | |
11961 | | // star_named_expression: '*' bitwise_or | named_expression |
11962 | | static expr_ty |
11963 | | star_named_expression_rule(Parser *p) |
11964 | 313k | { |
11965 | 313k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
11966 | 1 | _Pypegen_stack_overflow(p); |
11967 | 1 | } |
11968 | 313k | if (p->error_indicator) { |
11969 | 1 | p->level--; |
11970 | 1 | return NULL; |
11971 | 1 | } |
11972 | 313k | expr_ty _res = NULL; |
11973 | 313k | int _mark = p->mark; |
11974 | 313k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
11975 | 159 | p->error_indicator = 1; |
11976 | 159 | p->level--; |
11977 | 159 | return NULL; |
11978 | 159 | } |
11979 | 313k | int _start_lineno = p->tokens[_mark]->lineno; |
11980 | 313k | UNUSED(_start_lineno); // Only used by EXTRA macro |
11981 | 313k | int _start_col_offset = p->tokens[_mark]->col_offset; |
11982 | 313k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
11983 | 313k | { // '*' bitwise_or |
11984 | 313k | if (p->error_indicator) { |
11985 | 0 | p->level--; |
11986 | 0 | return NULL; |
11987 | 0 | } |
11988 | 313k | D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
11989 | 313k | Token * _literal; |
11990 | 313k | expr_ty a; |
11991 | 313k | if ( |
11992 | 313k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
11993 | 4.95k | && |
11994 | 4.95k | (a = bitwise_or_rule(p)) // bitwise_or |
11995 | 313k | ) |
11996 | 3.20k | { |
11997 | 3.20k | D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or")); |
11998 | 3.20k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
11999 | 3.20k | if (_token == NULL) { |
12000 | 0 | p->level--; |
12001 | 0 | return NULL; |
12002 | 0 | } |
12003 | 3.20k | int _end_lineno = _token->end_lineno; |
12004 | 3.20k | UNUSED(_end_lineno); // Only used by EXTRA macro |
12005 | 3.20k | int _end_col_offset = _token->end_col_offset; |
12006 | 3.20k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
12007 | 3.20k | _res = _PyAST_Starred ( a , Load , EXTRA ); |
12008 | 3.20k | if (_res == NULL && PyErr_Occurred()) { |
12009 | 0 | p->error_indicator = 1; |
12010 | 0 | p->level--; |
12011 | 0 | return NULL; |
12012 | 0 | } |
12013 | 3.20k | goto done; |
12014 | 3.20k | } |
12015 | 309k | p->mark = _mark; |
12016 | 309k | D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
12017 | 309k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); |
12018 | 309k | } |
12019 | 0 | { // named_expression |
12020 | 309k | if (p->error_indicator) { |
12021 | 703 | p->level--; |
12022 | 703 | return NULL; |
12023 | 703 | } |
12024 | 309k | D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); |
12025 | 309k | expr_ty named_expression_var; |
12026 | 309k | if ( |
12027 | 309k | (named_expression_var = named_expression_rule(p)) // named_expression |
12028 | 309k | ) |
12029 | 189k | { |
12030 | 189k | D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); |
12031 | 189k | _res = named_expression_var; |
12032 | 189k | goto done; |
12033 | 189k | } |
12034 | 119k | p->mark = _mark; |
12035 | 119k | D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
12036 | 119k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
12037 | 119k | } |
12038 | 119k | _res = NULL; |
12039 | 312k | done: |
12040 | 312k | p->level--; |
12041 | 312k | return _res; |
12042 | 119k | } |
12043 | | |
12044 | | // assignment_expression: NAME ':=' ~ expression |
12045 | | static expr_ty |
12046 | | assignment_expression_rule(Parser *p) |
12047 | 618k | { |
12048 | 618k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12049 | 1 | _Pypegen_stack_overflow(p); |
12050 | 1 | } |
12051 | 618k | if (p->error_indicator) { |
12052 | 1 | p->level--; |
12053 | 1 | return NULL; |
12054 | 1 | } |
12055 | 618k | expr_ty _res = NULL; |
12056 | 618k | int _mark = p->mark; |
12057 | 618k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
12058 | 81 | p->error_indicator = 1; |
12059 | 81 | p->level--; |
12060 | 81 | return NULL; |
12061 | 81 | } |
12062 | 618k | int _start_lineno = p->tokens[_mark]->lineno; |
12063 | 618k | UNUSED(_start_lineno); // Only used by EXTRA macro |
12064 | 618k | int _start_col_offset = p->tokens[_mark]->col_offset; |
12065 | 618k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
12066 | 618k | { // NAME ':=' ~ expression |
12067 | 618k | if (p->error_indicator) { |
12068 | 0 | p->level--; |
12069 | 0 | return NULL; |
12070 | 0 | } |
12071 | 618k | D(fprintf(stderr, "%*c> assignment_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression")); |
12072 | 618k | int _cut_var = 0; |
12073 | 618k | Token * _literal; |
12074 | 618k | expr_ty a; |
12075 | 618k | expr_ty b; |
12076 | 618k | if ( |
12077 | 618k | (a = _PyPegen_name_token(p)) // NAME |
12078 | 250k | && |
12079 | 250k | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
12080 | 4.90k | && |
12081 | 4.90k | (_cut_var = 1) |
12082 | 4.90k | && |
12083 | 4.90k | (b = expression_rule(p)) // expression |
12084 | 618k | ) |
12085 | 1.50k | { |
12086 | 1.50k | D(fprintf(stderr, "%*c+ assignment_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression")); |
12087 | 1.50k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
12088 | 1.50k | if (_token == NULL) { |
12089 | 0 | p->level--; |
12090 | 0 | return NULL; |
12091 | 0 | } |
12092 | 1.50k | int _end_lineno = _token->end_lineno; |
12093 | 1.50k | UNUSED(_end_lineno); // Only used by EXTRA macro |
12094 | 1.50k | int _end_col_offset = _token->end_col_offset; |
12095 | 1.50k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
12096 | 1.50k | _res = CHECK_VERSION ( expr_ty , 8 , "Assignment expressions are" , _PyAST_NamedExpr ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ) ); |
12097 | 1.50k | if (_res == NULL && PyErr_Occurred()) { |
12098 | 0 | p->error_indicator = 1; |
12099 | 0 | p->level--; |
12100 | 0 | return NULL; |
12101 | 0 | } |
12102 | 1.50k | goto done; |
12103 | 1.50k | } |
12104 | 616k | p->mark = _mark; |
12105 | 616k | D(fprintf(stderr, "%*c%s assignment_expression[%d-%d]: %s failed!\n", p->level, ' ', |
12106 | 616k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression")); |
12107 | 616k | if (_cut_var) { |
12108 | 3.39k | p->level--; |
12109 | 3.39k | return NULL; |
12110 | 3.39k | } |
12111 | 616k | } |
12112 | 613k | _res = NULL; |
12113 | 614k | done: |
12114 | 614k | p->level--; |
12115 | 614k | return _res; |
12116 | 613k | } |
12117 | | |
12118 | | // named_expression: assignment_expression | invalid_named_expression | expression !':=' |
12119 | | static expr_ty |
12120 | | named_expression_rule(Parser *p) |
12121 | 429k | { |
12122 | 429k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12123 | 1 | _Pypegen_stack_overflow(p); |
12124 | 1 | } |
12125 | 429k | if (p->error_indicator) { |
12126 | 1 | p->level--; |
12127 | 1 | return NULL; |
12128 | 1 | } |
12129 | 429k | expr_ty _res = NULL; |
12130 | 429k | int _mark = p->mark; |
12131 | 429k | { // assignment_expression |
12132 | 429k | if (p->error_indicator) { |
12133 | 0 | p->level--; |
12134 | 0 | return NULL; |
12135 | 0 | } |
12136 | 429k | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression")); |
12137 | 429k | expr_ty assignment_expression_var; |
12138 | 429k | if ( |
12139 | 429k | (assignment_expression_var = assignment_expression_rule(p)) // assignment_expression |
12140 | 429k | ) |
12141 | 911 | { |
12142 | 911 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression")); |
12143 | 911 | _res = assignment_expression_var; |
12144 | 911 | goto done; |
12145 | 911 | } |
12146 | 428k | p->mark = _mark; |
12147 | 428k | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
12148 | 428k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression")); |
12149 | 428k | } |
12150 | 428k | if (p->call_invalid_rules) { // invalid_named_expression |
12151 | 214k | if (p->error_indicator) { |
12152 | 277 | p->level--; |
12153 | 277 | return NULL; |
12154 | 277 | } |
12155 | 214k | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression")); |
12156 | 214k | void *invalid_named_expression_var; |
12157 | 214k | if ( |
12158 | 214k | (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression |
12159 | 214k | ) |
12160 | 0 | { |
12161 | 0 | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression")); |
12162 | 0 | _res = invalid_named_expression_var; |
12163 | 0 | goto done; |
12164 | 0 | } |
12165 | 214k | p->mark = _mark; |
12166 | 214k | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
12167 | 214k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression")); |
12168 | 214k | } |
12169 | 428k | { // expression !':=' |
12170 | 428k | if (p->error_indicator) { |
12171 | 14.3k | p->level--; |
12172 | 14.3k | return NULL; |
12173 | 14.3k | } |
12174 | 414k | D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); |
12175 | 414k | expr_ty expression_var; |
12176 | 414k | if ( |
12177 | 414k | (expression_var = expression_rule(p)) // expression |
12178 | 279k | && |
12179 | 279k | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' |
12180 | 414k | ) |
12181 | 277k | { |
12182 | 277k | D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='")); |
12183 | 277k | _res = expression_var; |
12184 | 277k | goto done; |
12185 | 277k | } |
12186 | 136k | p->mark = _mark; |
12187 | 136k | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
12188 | 136k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='")); |
12189 | 136k | } |
12190 | 136k | _res = NULL; |
12191 | 415k | done: |
12192 | 415k | p->level--; |
12193 | 415k | return _res; |
12194 | 136k | } |
12195 | | |
12196 | | // disjunction: conjunction (('or' conjunction))+ | conjunction |
12197 | | static expr_ty |
12198 | | disjunction_rule(Parser *p) |
12199 | 1.98M | { |
12200 | 1.98M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12201 | 1 | _Pypegen_stack_overflow(p); |
12202 | 1 | } |
12203 | 1.98M | if (p->error_indicator) { |
12204 | 30 | p->level--; |
12205 | 30 | return NULL; |
12206 | 30 | } |
12207 | 1.98M | expr_ty _res = NULL; |
12208 | 1.98M | if (_PyPegen_is_memoized(p, disjunction_type, &_res)) { |
12209 | 1.30M | p->level--; |
12210 | 1.30M | return _res; |
12211 | 1.30M | } |
12212 | 682k | int _mark = p->mark; |
12213 | 682k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
12214 | 0 | p->error_indicator = 1; |
12215 | 0 | p->level--; |
12216 | 0 | return NULL; |
12217 | 0 | } |
12218 | 682k | int _start_lineno = p->tokens[_mark]->lineno; |
12219 | 682k | UNUSED(_start_lineno); // Only used by EXTRA macro |
12220 | 682k | int _start_col_offset = p->tokens[_mark]->col_offset; |
12221 | 682k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
12222 | 682k | { // conjunction (('or' conjunction))+ |
12223 | 682k | if (p->error_indicator) { |
12224 | 0 | p->level--; |
12225 | 0 | return NULL; |
12226 | 0 | } |
12227 | 682k | D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); |
12228 | 682k | expr_ty a; |
12229 | 682k | asdl_seq * b; |
12230 | 682k | if ( |
12231 | 682k | (a = conjunction_rule(p)) // conjunction |
12232 | 398k | && |
12233 | 398k | (b = _loop1_59_rule(p)) // (('or' conjunction))+ |
12234 | 682k | ) |
12235 | 1.74k | { |
12236 | 1.74k | D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); |
12237 | 1.74k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
12238 | 1.74k | if (_token == NULL) { |
12239 | 0 | p->level--; |
12240 | 0 | return NULL; |
12241 | 0 | } |
12242 | 1.74k | int _end_lineno = _token->end_lineno; |
12243 | 1.74k | UNUSED(_end_lineno); // Only used by EXTRA macro |
12244 | 1.74k | int _end_col_offset = _token->end_col_offset; |
12245 | 1.74k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
12246 | 1.74k | _res = _PyAST_BoolOp ( Or , CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); |
12247 | 1.74k | if (_res == NULL && PyErr_Occurred()) { |
12248 | 0 | p->error_indicator = 1; |
12249 | 0 | p->level--; |
12250 | 0 | return NULL; |
12251 | 0 | } |
12252 | 1.74k | goto done; |
12253 | 1.74k | } |
12254 | 680k | p->mark = _mark; |
12255 | 680k | D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', |
12256 | 680k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+")); |
12257 | 680k | } |
12258 | 0 | { // conjunction |
12259 | 680k | if (p->error_indicator) { |
12260 | 33.2k | p->level--; |
12261 | 33.2k | return NULL; |
12262 | 33.2k | } |
12263 | 647k | D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction")); |
12264 | 647k | expr_ty conjunction_var; |
12265 | 647k | if ( |
12266 | 647k | (conjunction_var = conjunction_rule(p)) // conjunction |
12267 | 647k | ) |
12268 | 396k | { |
12269 | 396k | D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction")); |
12270 | 396k | _res = conjunction_var; |
12271 | 396k | goto done; |
12272 | 396k | } |
12273 | 251k | p->mark = _mark; |
12274 | 251k | D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', |
12275 | 251k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction")); |
12276 | 251k | } |
12277 | 251k | _res = NULL; |
12278 | 649k | done: |
12279 | 649k | _PyPegen_insert_memo(p, _mark, disjunction_type, _res); |
12280 | 649k | p->level--; |
12281 | 649k | return _res; |
12282 | 251k | } |
12283 | | |
12284 | | // conjunction: inversion (('and' inversion))+ | inversion |
12285 | | static expr_ty |
12286 | | conjunction_rule(Parser *p) |
12287 | 1.33M | { |
12288 | 1.33M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12289 | 1 | _Pypegen_stack_overflow(p); |
12290 | 1 | } |
12291 | 1.33M | if (p->error_indicator) { |
12292 | 1 | p->level--; |
12293 | 1 | return NULL; |
12294 | 1 | } |
12295 | 1.33M | expr_ty _res = NULL; |
12296 | 1.33M | if (_PyPegen_is_memoized(p, conjunction_type, &_res)) { |
12297 | 647k | p->level--; |
12298 | 647k | return _res; |
12299 | 647k | } |
12300 | 688k | int _mark = p->mark; |
12301 | 688k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
12302 | 0 | p->error_indicator = 1; |
12303 | 0 | p->level--; |
12304 | 0 | return NULL; |
12305 | 0 | } |
12306 | 688k | int _start_lineno = p->tokens[_mark]->lineno; |
12307 | 688k | UNUSED(_start_lineno); // Only used by EXTRA macro |
12308 | 688k | int _start_col_offset = p->tokens[_mark]->col_offset; |
12309 | 688k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
12310 | 688k | { // inversion (('and' inversion))+ |
12311 | 688k | if (p->error_indicator) { |
12312 | 0 | p->level--; |
12313 | 0 | return NULL; |
12314 | 0 | } |
12315 | 688k | D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); |
12316 | 688k | expr_ty a; |
12317 | 688k | asdl_seq * b; |
12318 | 688k | if ( |
12319 | 688k | (a = inversion_rule(p)) // inversion |
12320 | 403k | && |
12321 | 403k | (b = _loop1_60_rule(p)) // (('and' inversion))+ |
12322 | 688k | ) |
12323 | 1.86k | { |
12324 | 1.86k | D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); |
12325 | 1.86k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
12326 | 1.86k | if (_token == NULL) { |
12327 | 0 | p->level--; |
12328 | 0 | return NULL; |
12329 | 0 | } |
12330 | 1.86k | int _end_lineno = _token->end_lineno; |
12331 | 1.86k | UNUSED(_end_lineno); // Only used by EXTRA macro |
12332 | 1.86k | int _end_col_offset = _token->end_col_offset; |
12333 | 1.86k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
12334 | 1.86k | _res = _PyAST_BoolOp ( And , CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); |
12335 | 1.86k | if (_res == NULL && PyErr_Occurred()) { |
12336 | 0 | p->error_indicator = 1; |
12337 | 0 | p->level--; |
12338 | 0 | return NULL; |
12339 | 0 | } |
12340 | 1.86k | goto done; |
12341 | 1.86k | } |
12342 | 686k | p->mark = _mark; |
12343 | 686k | D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', |
12344 | 686k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+")); |
12345 | 686k | } |
12346 | 0 | { // inversion |
12347 | 686k | if (p->error_indicator) { |
12348 | 33.2k | p->level--; |
12349 | 33.2k | return NULL; |
12350 | 33.2k | } |
12351 | 653k | D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion")); |
12352 | 653k | expr_ty inversion_var; |
12353 | 653k | if ( |
12354 | 653k | (inversion_var = inversion_rule(p)) // inversion |
12355 | 653k | ) |
12356 | 401k | { |
12357 | 401k | D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion")); |
12358 | 401k | _res = inversion_var; |
12359 | 401k | goto done; |
12360 | 401k | } |
12361 | 251k | p->mark = _mark; |
12362 | 251k | D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', |
12363 | 251k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion")); |
12364 | 251k | } |
12365 | 251k | _res = NULL; |
12366 | 654k | done: |
12367 | 654k | _PyPegen_insert_memo(p, _mark, conjunction_type, _res); |
12368 | 654k | p->level--; |
12369 | 654k | return _res; |
12370 | 251k | } |
12371 | | |
12372 | | // inversion: 'not' inversion | comparison |
12373 | | static expr_ty |
12374 | | inversion_rule(Parser *p) |
12375 | 1.34M | { |
12376 | 1.34M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12377 | 1 | _Pypegen_stack_overflow(p); |
12378 | 1 | } |
12379 | 1.34M | if (p->error_indicator) { |
12380 | 1 | p->level--; |
12381 | 1 | return NULL; |
12382 | 1 | } |
12383 | 1.34M | expr_ty _res = NULL; |
12384 | 1.34M | if (_PyPegen_is_memoized(p, inversion_type, &_res)) { |
12385 | 653k | p->level--; |
12386 | 653k | return _res; |
12387 | 653k | } |
12388 | 694k | int _mark = p->mark; |
12389 | 694k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
12390 | 0 | p->error_indicator = 1; |
12391 | 0 | p->level--; |
12392 | 0 | return NULL; |
12393 | 0 | } |
12394 | 694k | int _start_lineno = p->tokens[_mark]->lineno; |
12395 | 694k | UNUSED(_start_lineno); // Only used by EXTRA macro |
12396 | 694k | int _start_col_offset = p->tokens[_mark]->col_offset; |
12397 | 694k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
12398 | 694k | { // 'not' inversion |
12399 | 694k | if (p->error_indicator) { |
12400 | 0 | p->level--; |
12401 | 0 | return NULL; |
12402 | 0 | } |
12403 | 694k | D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion")); |
12404 | 694k | Token * _keyword; |
12405 | 694k | expr_ty a; |
12406 | 694k | if ( |
12407 | 694k | (_keyword = _PyPegen_expect_token(p, 712)) // token='not' |
12408 | 2.55k | && |
12409 | 2.55k | (a = inversion_rule(p)) // inversion |
12410 | 694k | ) |
12411 | 2.10k | { |
12412 | 2.10k | D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion")); |
12413 | 2.10k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
12414 | 2.10k | if (_token == NULL) { |
12415 | 0 | p->level--; |
12416 | 0 | return NULL; |
12417 | 0 | } |
12418 | 2.10k | int _end_lineno = _token->end_lineno; |
12419 | 2.10k | UNUSED(_end_lineno); // Only used by EXTRA macro |
12420 | 2.10k | int _end_col_offset = _token->end_col_offset; |
12421 | 2.10k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
12422 | 2.10k | _res = _PyAST_UnaryOp ( Not , a , EXTRA ); |
12423 | 2.10k | if (_res == NULL && PyErr_Occurred()) { |
12424 | 0 | p->error_indicator = 1; |
12425 | 0 | p->level--; |
12426 | 0 | return NULL; |
12427 | 0 | } |
12428 | 2.10k | goto done; |
12429 | 2.10k | } |
12430 | 692k | p->mark = _mark; |
12431 | 692k | D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', |
12432 | 692k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion")); |
12433 | 692k | } |
12434 | 0 | { // comparison |
12435 | 692k | if (p->error_indicator) { |
12436 | 213 | p->level--; |
12437 | 213 | return NULL; |
12438 | 213 | } |
12439 | 692k | D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison")); |
12440 | 692k | expr_ty comparison_var; |
12441 | 692k | if ( |
12442 | 692k | (comparison_var = comparison_rule(p)) // comparison |
12443 | 692k | ) |
12444 | 407k | { |
12445 | 407k | D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison")); |
12446 | 407k | _res = comparison_var; |
12447 | 407k | goto done; |
12448 | 407k | } |
12449 | 285k | p->mark = _mark; |
12450 | 285k | D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', |
12451 | 285k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison")); |
12452 | 285k | } |
12453 | 285k | _res = NULL; |
12454 | 694k | done: |
12455 | 694k | _PyPegen_insert_memo(p, _mark, inversion_type, _res); |
12456 | 694k | p->level--; |
12457 | 694k | return _res; |
12458 | 285k | } |
12459 | | |
12460 | | // comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or |
12461 | | static expr_ty |
12462 | | comparison_rule(Parser *p) |
12463 | 692k | { |
12464 | 692k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12465 | 1 | _Pypegen_stack_overflow(p); |
12466 | 1 | } |
12467 | 692k | if (p->error_indicator) { |
12468 | 1 | p->level--; |
12469 | 1 | return NULL; |
12470 | 1 | } |
12471 | 692k | expr_ty _res = NULL; |
12472 | 692k | int _mark = p->mark; |
12473 | 692k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
12474 | 0 | p->error_indicator = 1; |
12475 | 0 | p->level--; |
12476 | 0 | return NULL; |
12477 | 0 | } |
12478 | 692k | int _start_lineno = p->tokens[_mark]->lineno; |
12479 | 692k | UNUSED(_start_lineno); // Only used by EXTRA macro |
12480 | 692k | int _start_col_offset = p->tokens[_mark]->col_offset; |
12481 | 692k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
12482 | 692k | { // bitwise_or compare_op_bitwise_or_pair+ |
12483 | 692k | if (p->error_indicator) { |
12484 | 0 | p->level--; |
12485 | 0 | return NULL; |
12486 | 0 | } |
12487 | 692k | D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); |
12488 | 692k | expr_ty a; |
12489 | 692k | asdl_seq * b; |
12490 | 692k | if ( |
12491 | 692k | (a = bitwise_or_rule(p)) // bitwise_or |
12492 | 409k | && |
12493 | 409k | (b = _loop1_61_rule(p)) // compare_op_bitwise_or_pair+ |
12494 | 692k | ) |
12495 | 11.1k | { |
12496 | 11.1k | D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); |
12497 | 11.1k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
12498 | 11.1k | if (_token == NULL) { |
12499 | 0 | p->level--; |
12500 | 0 | return NULL; |
12501 | 0 | } |
12502 | 11.1k | int _end_lineno = _token->end_lineno; |
12503 | 11.1k | UNUSED(_end_lineno); // Only used by EXTRA macro |
12504 | 11.1k | int _end_col_offset = _token->end_col_offset; |
12505 | 11.1k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
12506 | 11.1k | _res = _PyAST_Compare ( a , CHECK ( asdl_int_seq* , _PyPegen_get_cmpops ( p , b ) ) , CHECK ( asdl_expr_seq* , _PyPegen_get_exprs ( p , b ) ) , EXTRA ); |
12507 | 11.1k | if (_res == NULL && PyErr_Occurred()) { |
12508 | 0 | p->error_indicator = 1; |
12509 | 0 | p->level--; |
12510 | 0 | return NULL; |
12511 | 0 | } |
12512 | 11.1k | goto done; |
12513 | 11.1k | } |
12514 | 680k | p->mark = _mark; |
12515 | 680k | D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', |
12516 | 680k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+")); |
12517 | 680k | } |
12518 | 0 | { // bitwise_or |
12519 | 680k | if (p->error_indicator) { |
12520 | 33.4k | p->level--; |
12521 | 33.4k | return NULL; |
12522 | 33.4k | } |
12523 | 647k | D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or")); |
12524 | 647k | expr_ty bitwise_or_var; |
12525 | 647k | if ( |
12526 | 647k | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
12527 | 647k | ) |
12528 | 395k | { |
12529 | 395k | D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or")); |
12530 | 395k | _res = bitwise_or_var; |
12531 | 395k | goto done; |
12532 | 395k | } |
12533 | 251k | p->mark = _mark; |
12534 | 251k | D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', |
12535 | 251k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or")); |
12536 | 251k | } |
12537 | 251k | _res = NULL; |
12538 | 658k | done: |
12539 | 658k | p->level--; |
12540 | 658k | return _res; |
12541 | 251k | } |
12542 | | |
12543 | | // compare_op_bitwise_or_pair: |
12544 | | // | eq_bitwise_or |
12545 | | // | noteq_bitwise_or |
12546 | | // | lte_bitwise_or |
12547 | | // | lt_bitwise_or |
12548 | | // | gte_bitwise_or |
12549 | | // | gt_bitwise_or |
12550 | | // | notin_bitwise_or |
12551 | | // | in_bitwise_or |
12552 | | // | isnot_bitwise_or |
12553 | | // | is_bitwise_or |
12554 | | static CmpopExprPair* |
12555 | | compare_op_bitwise_or_pair_rule(Parser *p) |
12556 | 429k | { |
12557 | 429k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12558 | 0 | _Pypegen_stack_overflow(p); |
12559 | 0 | } |
12560 | 429k | if (p->error_indicator) { |
12561 | 0 | p->level--; |
12562 | 0 | return NULL; |
12563 | 0 | } |
12564 | 429k | CmpopExprPair* _res = NULL; |
12565 | 429k | int _mark = p->mark; |
12566 | 429k | { // eq_bitwise_or |
12567 | 429k | if (p->error_indicator) { |
12568 | 0 | p->level--; |
12569 | 0 | return NULL; |
12570 | 0 | } |
12571 | 429k | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or")); |
12572 | 429k | CmpopExprPair* eq_bitwise_or_var; |
12573 | 429k | if ( |
12574 | 429k | (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or |
12575 | 429k | ) |
12576 | 2.39k | { |
12577 | 2.39k | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or")); |
12578 | 2.39k | _res = eq_bitwise_or_var; |
12579 | 2.39k | goto done; |
12580 | 2.39k | } |
12581 | 427k | p->mark = _mark; |
12582 | 427k | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
12583 | 427k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or")); |
12584 | 427k | } |
12585 | 0 | { // noteq_bitwise_or |
12586 | 427k | if (p->error_indicator) { |
12587 | 217 | p->level--; |
12588 | 217 | return NULL; |
12589 | 217 | } |
12590 | 427k | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or")); |
12591 | 427k | CmpopExprPair* noteq_bitwise_or_var; |
12592 | 427k | if ( |
12593 | 427k | (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or |
12594 | 427k | ) |
12595 | 852 | { |
12596 | 852 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or")); |
12597 | 852 | _res = noteq_bitwise_or_var; |
12598 | 852 | goto done; |
12599 | 852 | } |
12600 | 426k | p->mark = _mark; |
12601 | 426k | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
12602 | 426k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or")); |
12603 | 426k | } |
12604 | 0 | { // lte_bitwise_or |
12605 | 426k | if (p->error_indicator) { |
12606 | 197 | p->level--; |
12607 | 197 | return NULL; |
12608 | 197 | } |
12609 | 426k | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or")); |
12610 | 426k | CmpopExprPair* lte_bitwise_or_var; |
12611 | 426k | if ( |
12612 | 426k | (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or |
12613 | 426k | ) |
12614 | 644 | { |
12615 | 644 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or")); |
12616 | 644 | _res = lte_bitwise_or_var; |
12617 | 644 | goto done; |
12618 | 644 | } |
12619 | 425k | p->mark = _mark; |
12620 | 425k | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
12621 | 425k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or")); |
12622 | 425k | } |
12623 | 0 | { // lt_bitwise_or |
12624 | 425k | if (p->error_indicator) { |
12625 | 196 | p->level--; |
12626 | 196 | return NULL; |
12627 | 196 | } |
12628 | 425k | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or")); |
12629 | 425k | CmpopExprPair* lt_bitwise_or_var; |
12630 | 425k | if ( |
12631 | 425k | (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or |
12632 | 425k | ) |
12633 | 2.93k | { |
12634 | 2.93k | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or")); |
12635 | 2.93k | _res = lt_bitwise_or_var; |
12636 | 2.93k | goto done; |
12637 | 2.93k | } |
12638 | 422k | p->mark = _mark; |
12639 | 422k | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
12640 | 422k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or")); |
12641 | 422k | } |
12642 | 0 | { // gte_bitwise_or |
12643 | 422k | if (p->error_indicator) { |
12644 | 277 | p->level--; |
12645 | 277 | return NULL; |
12646 | 277 | } |
12647 | 422k | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or")); |
12648 | 422k | CmpopExprPair* gte_bitwise_or_var; |
12649 | 422k | if ( |
12650 | 422k | (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or |
12651 | 422k | ) |
12652 | 587 | { |
12653 | 587 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or")); |
12654 | 587 | _res = gte_bitwise_or_var; |
12655 | 587 | goto done; |
12656 | 587 | } |
12657 | 421k | p->mark = _mark; |
12658 | 421k | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
12659 | 421k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or")); |
12660 | 421k | } |
12661 | 0 | { // gt_bitwise_or |
12662 | 421k | if (p->error_indicator) { |
12663 | 198 | p->level--; |
12664 | 198 | return NULL; |
12665 | 198 | } |
12666 | 421k | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or")); |
12667 | 421k | CmpopExprPair* gt_bitwise_or_var; |
12668 | 421k | if ( |
12669 | 421k | (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or |
12670 | 421k | ) |
12671 | 7.34k | { |
12672 | 7.34k | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or")); |
12673 | 7.34k | _res = gt_bitwise_or_var; |
12674 | 7.34k | goto done; |
12675 | 7.34k | } |
12676 | 414k | p->mark = _mark; |
12677 | 414k | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
12678 | 414k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or")); |
12679 | 414k | } |
12680 | 0 | { // notin_bitwise_or |
12681 | 414k | if (p->error_indicator) { |
12682 | 378 | p->level--; |
12683 | 378 | return NULL; |
12684 | 378 | } |
12685 | 413k | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or")); |
12686 | 413k | CmpopExprPair* notin_bitwise_or_var; |
12687 | 413k | if ( |
12688 | 413k | (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or |
12689 | 413k | ) |
12690 | 709 | { |
12691 | 709 | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or")); |
12692 | 709 | _res = notin_bitwise_or_var; |
12693 | 709 | goto done; |
12694 | 709 | } |
12695 | 413k | p->mark = _mark; |
12696 | 413k | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
12697 | 413k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or")); |
12698 | 413k | } |
12699 | 0 | { // in_bitwise_or |
12700 | 413k | if (p->error_indicator) { |
12701 | 281 | p->level--; |
12702 | 281 | return NULL; |
12703 | 281 | } |
12704 | 412k | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or")); |
12705 | 412k | CmpopExprPair* in_bitwise_or_var; |
12706 | 412k | if ( |
12707 | 412k | (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or |
12708 | 412k | ) |
12709 | 1.80k | { |
12710 | 1.80k | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or")); |
12711 | 1.80k | _res = in_bitwise_or_var; |
12712 | 1.80k | goto done; |
12713 | 1.80k | } |
12714 | 410k | p->mark = _mark; |
12715 | 410k | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
12716 | 410k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or")); |
12717 | 410k | } |
12718 | 0 | { // isnot_bitwise_or |
12719 | 410k | if (p->error_indicator) { |
12720 | 373 | p->level--; |
12721 | 373 | return NULL; |
12722 | 373 | } |
12723 | 410k | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or")); |
12724 | 410k | CmpopExprPair* isnot_bitwise_or_var; |
12725 | 410k | if ( |
12726 | 410k | (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or |
12727 | 410k | ) |
12728 | 1.06k | { |
12729 | 1.06k | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or")); |
12730 | 1.06k | _res = isnot_bitwise_or_var; |
12731 | 1.06k | goto done; |
12732 | 1.06k | } |
12733 | 409k | p->mark = _mark; |
12734 | 409k | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
12735 | 409k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or")); |
12736 | 409k | } |
12737 | 0 | { // is_bitwise_or |
12738 | 409k | if (p->error_indicator) { |
12739 | 205 | p->level--; |
12740 | 205 | return NULL; |
12741 | 205 | } |
12742 | 409k | D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or")); |
12743 | 409k | CmpopExprPair* is_bitwise_or_var; |
12744 | 409k | if ( |
12745 | 409k | (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or |
12746 | 409k | ) |
12747 | 2.24k | { |
12748 | 2.24k | D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or")); |
12749 | 2.24k | _res = is_bitwise_or_var; |
12750 | 2.24k | goto done; |
12751 | 2.24k | } |
12752 | 407k | p->mark = _mark; |
12753 | 407k | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
12754 | 407k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or")); |
12755 | 407k | } |
12756 | 407k | _res = NULL; |
12757 | 427k | done: |
12758 | 427k | p->level--; |
12759 | 427k | return _res; |
12760 | 407k | } |
12761 | | |
12762 | | // eq_bitwise_or: '==' bitwise_or |
12763 | | static CmpopExprPair* |
12764 | | eq_bitwise_or_rule(Parser *p) |
12765 | 429k | { |
12766 | 429k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12767 | 0 | _Pypegen_stack_overflow(p); |
12768 | 0 | } |
12769 | 429k | if (p->error_indicator) { |
12770 | 0 | p->level--; |
12771 | 0 | return NULL; |
12772 | 0 | } |
12773 | 429k | CmpopExprPair* _res = NULL; |
12774 | 429k | int _mark = p->mark; |
12775 | 429k | { // '==' bitwise_or |
12776 | 429k | if (p->error_indicator) { |
12777 | 0 | p->level--; |
12778 | 0 | return NULL; |
12779 | 0 | } |
12780 | 429k | D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or")); |
12781 | 429k | Token * _literal; |
12782 | 429k | expr_ty a; |
12783 | 429k | if ( |
12784 | 429k | (_literal = _PyPegen_expect_token(p, 27)) // token='==' |
12785 | 2.91k | && |
12786 | 2.91k | (a = bitwise_or_rule(p)) // bitwise_or |
12787 | 429k | ) |
12788 | 2.39k | { |
12789 | 2.39k | D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or")); |
12790 | 2.39k | _res = _PyPegen_cmpop_expr_pair ( p , Eq , a ); |
12791 | 2.39k | if (_res == NULL && PyErr_Occurred()) { |
12792 | 0 | p->error_indicator = 1; |
12793 | 0 | p->level--; |
12794 | 0 | return NULL; |
12795 | 0 | } |
12796 | 2.39k | goto done; |
12797 | 2.39k | } |
12798 | 427k | p->mark = _mark; |
12799 | 427k | D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
12800 | 427k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or")); |
12801 | 427k | } |
12802 | 427k | _res = NULL; |
12803 | 429k | done: |
12804 | 429k | p->level--; |
12805 | 429k | return _res; |
12806 | 427k | } |
12807 | | |
12808 | | // noteq_bitwise_or: ('!=') bitwise_or |
12809 | | static CmpopExprPair* |
12810 | | noteq_bitwise_or_rule(Parser *p) |
12811 | 427k | { |
12812 | 427k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12813 | 0 | _Pypegen_stack_overflow(p); |
12814 | 0 | } |
12815 | 427k | if (p->error_indicator) { |
12816 | 0 | p->level--; |
12817 | 0 | return NULL; |
12818 | 0 | } |
12819 | 427k | CmpopExprPair* _res = NULL; |
12820 | 427k | int _mark = p->mark; |
12821 | 427k | { // ('!=') bitwise_or |
12822 | 427k | if (p->error_indicator) { |
12823 | 0 | p->level--; |
12824 | 0 | return NULL; |
12825 | 0 | } |
12826 | 427k | D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); |
12827 | 427k | void *_tmp_62_var; |
12828 | 427k | expr_ty a; |
12829 | 427k | if ( |
12830 | 427k | (_tmp_62_var = _tmp_62_rule(p)) // '!=' |
12831 | 1.36k | && |
12832 | 1.36k | (a = bitwise_or_rule(p)) // bitwise_or |
12833 | 427k | ) |
12834 | 852 | { |
12835 | 852 | D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or")); |
12836 | 852 | _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a ); |
12837 | 852 | if (_res == NULL && PyErr_Occurred()) { |
12838 | 0 | p->error_indicator = 1; |
12839 | 0 | p->level--; |
12840 | 0 | return NULL; |
12841 | 0 | } |
12842 | 852 | goto done; |
12843 | 852 | } |
12844 | 426k | p->mark = _mark; |
12845 | 426k | D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
12846 | 426k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or")); |
12847 | 426k | } |
12848 | 426k | _res = NULL; |
12849 | 427k | done: |
12850 | 427k | p->level--; |
12851 | 427k | return _res; |
12852 | 426k | } |
12853 | | |
12854 | | // lte_bitwise_or: '<=' bitwise_or |
12855 | | static CmpopExprPair* |
12856 | | lte_bitwise_or_rule(Parser *p) |
12857 | 426k | { |
12858 | 426k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12859 | 0 | _Pypegen_stack_overflow(p); |
12860 | 0 | } |
12861 | 426k | if (p->error_indicator) { |
12862 | 0 | p->level--; |
12863 | 0 | return NULL; |
12864 | 0 | } |
12865 | 426k | CmpopExprPair* _res = NULL; |
12866 | 426k | int _mark = p->mark; |
12867 | 426k | { // '<=' bitwise_or |
12868 | 426k | if (p->error_indicator) { |
12869 | 0 | p->level--; |
12870 | 0 | return NULL; |
12871 | 0 | } |
12872 | 426k | D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or")); |
12873 | 426k | Token * _literal; |
12874 | 426k | expr_ty a; |
12875 | 426k | if ( |
12876 | 426k | (_literal = _PyPegen_expect_token(p, 29)) // token='<=' |
12877 | 1.04k | && |
12878 | 1.04k | (a = bitwise_or_rule(p)) // bitwise_or |
12879 | 426k | ) |
12880 | 644 | { |
12881 | 644 | D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or")); |
12882 | 644 | _res = _PyPegen_cmpop_expr_pair ( p , LtE , a ); |
12883 | 644 | if (_res == NULL && PyErr_Occurred()) { |
12884 | 0 | p->error_indicator = 1; |
12885 | 0 | p->level--; |
12886 | 0 | return NULL; |
12887 | 0 | } |
12888 | 644 | goto done; |
12889 | 644 | } |
12890 | 425k | p->mark = _mark; |
12891 | 425k | D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
12892 | 425k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or")); |
12893 | 425k | } |
12894 | 425k | _res = NULL; |
12895 | 426k | done: |
12896 | 426k | p->level--; |
12897 | 426k | return _res; |
12898 | 425k | } |
12899 | | |
12900 | | // lt_bitwise_or: '<' bitwise_or |
12901 | | static CmpopExprPair* |
12902 | | lt_bitwise_or_rule(Parser *p) |
12903 | 425k | { |
12904 | 425k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12905 | 0 | _Pypegen_stack_overflow(p); |
12906 | 0 | } |
12907 | 425k | if (p->error_indicator) { |
12908 | 0 | p->level--; |
12909 | 0 | return NULL; |
12910 | 0 | } |
12911 | 425k | CmpopExprPair* _res = NULL; |
12912 | 425k | int _mark = p->mark; |
12913 | 425k | { // '<' bitwise_or |
12914 | 425k | if (p->error_indicator) { |
12915 | 0 | p->level--; |
12916 | 0 | return NULL; |
12917 | 0 | } |
12918 | 425k | D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or")); |
12919 | 425k | Token * _literal; |
12920 | 425k | expr_ty a; |
12921 | 425k | if ( |
12922 | 425k | (_literal = _PyPegen_expect_token(p, 20)) // token='<' |
12923 | 3.50k | && |
12924 | 3.50k | (a = bitwise_or_rule(p)) // bitwise_or |
12925 | 425k | ) |
12926 | 2.93k | { |
12927 | 2.93k | D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or")); |
12928 | 2.93k | _res = _PyPegen_cmpop_expr_pair ( p , Lt , a ); |
12929 | 2.93k | if (_res == NULL && PyErr_Occurred()) { |
12930 | 0 | p->error_indicator = 1; |
12931 | 0 | p->level--; |
12932 | 0 | return NULL; |
12933 | 0 | } |
12934 | 2.93k | goto done; |
12935 | 2.93k | } |
12936 | 422k | p->mark = _mark; |
12937 | 422k | D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
12938 | 422k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or")); |
12939 | 422k | } |
12940 | 422k | _res = NULL; |
12941 | 425k | done: |
12942 | 425k | p->level--; |
12943 | 425k | return _res; |
12944 | 422k | } |
12945 | | |
12946 | | // gte_bitwise_or: '>=' bitwise_or |
12947 | | static CmpopExprPair* |
12948 | | gte_bitwise_or_rule(Parser *p) |
12949 | 422k | { |
12950 | 422k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12951 | 0 | _Pypegen_stack_overflow(p); |
12952 | 0 | } |
12953 | 422k | if (p->error_indicator) { |
12954 | 0 | p->level--; |
12955 | 0 | return NULL; |
12956 | 0 | } |
12957 | 422k | CmpopExprPair* _res = NULL; |
12958 | 422k | int _mark = p->mark; |
12959 | 422k | { // '>=' bitwise_or |
12960 | 422k | if (p->error_indicator) { |
12961 | 0 | p->level--; |
12962 | 0 | return NULL; |
12963 | 0 | } |
12964 | 422k | D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or")); |
12965 | 422k | Token * _literal; |
12966 | 422k | expr_ty a; |
12967 | 422k | if ( |
12968 | 422k | (_literal = _PyPegen_expect_token(p, 30)) // token='>=' |
12969 | 994 | && |
12970 | 994 | (a = bitwise_or_rule(p)) // bitwise_or |
12971 | 422k | ) |
12972 | 587 | { |
12973 | 587 | D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or")); |
12974 | 587 | _res = _PyPegen_cmpop_expr_pair ( p , GtE , a ); |
12975 | 587 | if (_res == NULL && PyErr_Occurred()) { |
12976 | 0 | p->error_indicator = 1; |
12977 | 0 | p->level--; |
12978 | 0 | return NULL; |
12979 | 0 | } |
12980 | 587 | goto done; |
12981 | 587 | } |
12982 | 421k | p->mark = _mark; |
12983 | 421k | D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
12984 | 421k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or")); |
12985 | 421k | } |
12986 | 421k | _res = NULL; |
12987 | 422k | done: |
12988 | 422k | p->level--; |
12989 | 422k | return _res; |
12990 | 421k | } |
12991 | | |
12992 | | // gt_bitwise_or: '>' bitwise_or |
12993 | | static CmpopExprPair* |
12994 | | gt_bitwise_or_rule(Parser *p) |
12995 | 421k | { |
12996 | 421k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
12997 | 0 | _Pypegen_stack_overflow(p); |
12998 | 0 | } |
12999 | 421k | if (p->error_indicator) { |
13000 | 0 | p->level--; |
13001 | 0 | return NULL; |
13002 | 0 | } |
13003 | 421k | CmpopExprPair* _res = NULL; |
13004 | 421k | int _mark = p->mark; |
13005 | 421k | { // '>' bitwise_or |
13006 | 421k | if (p->error_indicator) { |
13007 | 0 | p->level--; |
13008 | 0 | return NULL; |
13009 | 0 | } |
13010 | 421k | D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or")); |
13011 | 421k | Token * _literal; |
13012 | 421k | expr_ty a; |
13013 | 421k | if ( |
13014 | 421k | (_literal = _PyPegen_expect_token(p, 21)) // token='>' |
13015 | 7.98k | && |
13016 | 7.98k | (a = bitwise_or_rule(p)) // bitwise_or |
13017 | 421k | ) |
13018 | 7.34k | { |
13019 | 7.34k | D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or")); |
13020 | 7.34k | _res = _PyPegen_cmpop_expr_pair ( p , Gt , a ); |
13021 | 7.34k | if (_res == NULL && PyErr_Occurred()) { |
13022 | 0 | p->error_indicator = 1; |
13023 | 0 | p->level--; |
13024 | 0 | return NULL; |
13025 | 0 | } |
13026 | 7.34k | goto done; |
13027 | 7.34k | } |
13028 | 414k | p->mark = _mark; |
13029 | 414k | D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
13030 | 414k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or")); |
13031 | 414k | } |
13032 | 414k | _res = NULL; |
13033 | 421k | done: |
13034 | 421k | p->level--; |
13035 | 421k | return _res; |
13036 | 414k | } |
13037 | | |
13038 | | // notin_bitwise_or: 'not' 'in' bitwise_or |
13039 | | static CmpopExprPair* |
13040 | | notin_bitwise_or_rule(Parser *p) |
13041 | 413k | { |
13042 | 413k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13043 | 0 | _Pypegen_stack_overflow(p); |
13044 | 0 | } |
13045 | 413k | if (p->error_indicator) { |
13046 | 0 | p->level--; |
13047 | 0 | return NULL; |
13048 | 0 | } |
13049 | 413k | CmpopExprPair* _res = NULL; |
13050 | 413k | int _mark = p->mark; |
13051 | 413k | { // 'not' 'in' bitwise_or |
13052 | 413k | if (p->error_indicator) { |
13053 | 0 | p->level--; |
13054 | 0 | return NULL; |
13055 | 0 | } |
13056 | 413k | D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or")); |
13057 | 413k | Token * _keyword; |
13058 | 413k | Token * _keyword_1; |
13059 | 413k | expr_ty a; |
13060 | 413k | if ( |
13061 | 413k | (_keyword = _PyPegen_expect_token(p, 712)) // token='not' |
13062 | 1.43k | && |
13063 | 1.43k | (_keyword_1 = _PyPegen_expect_token(p, 704)) // token='in' |
13064 | 1.20k | && |
13065 | 1.20k | (a = bitwise_or_rule(p)) // bitwise_or |
13066 | 413k | ) |
13067 | 709 | { |
13068 | 709 | D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or")); |
13069 | 709 | _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a ); |
13070 | 709 | if (_res == NULL && PyErr_Occurred()) { |
13071 | 0 | p->error_indicator = 1; |
13072 | 0 | p->level--; |
13073 | 0 | return NULL; |
13074 | 0 | } |
13075 | 709 | goto done; |
13076 | 709 | } |
13077 | 413k | p->mark = _mark; |
13078 | 413k | D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
13079 | 413k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or")); |
13080 | 413k | } |
13081 | 413k | _res = NULL; |
13082 | 413k | done: |
13083 | 413k | p->level--; |
13084 | 413k | return _res; |
13085 | 413k | } |
13086 | | |
13087 | | // in_bitwise_or: 'in' bitwise_or |
13088 | | static CmpopExprPair* |
13089 | | in_bitwise_or_rule(Parser *p) |
13090 | 412k | { |
13091 | 412k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13092 | 0 | _Pypegen_stack_overflow(p); |
13093 | 0 | } |
13094 | 412k | if (p->error_indicator) { |
13095 | 0 | p->level--; |
13096 | 0 | return NULL; |
13097 | 0 | } |
13098 | 412k | CmpopExprPair* _res = NULL; |
13099 | 412k | int _mark = p->mark; |
13100 | 412k | { // 'in' bitwise_or |
13101 | 412k | if (p->error_indicator) { |
13102 | 0 | p->level--; |
13103 | 0 | return NULL; |
13104 | 0 | } |
13105 | 412k | D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or")); |
13106 | 412k | Token * _keyword; |
13107 | 412k | expr_ty a; |
13108 | 412k | if ( |
13109 | 412k | (_keyword = _PyPegen_expect_token(p, 704)) // token='in' |
13110 | 2.54k | && |
13111 | 2.54k | (a = bitwise_or_rule(p)) // bitwise_or |
13112 | 412k | ) |
13113 | 1.80k | { |
13114 | 1.80k | D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or")); |
13115 | 1.80k | _res = _PyPegen_cmpop_expr_pair ( p , In , a ); |
13116 | 1.80k | if (_res == NULL && PyErr_Occurred()) { |
13117 | 0 | p->error_indicator = 1; |
13118 | 0 | p->level--; |
13119 | 0 | return NULL; |
13120 | 0 | } |
13121 | 1.80k | goto done; |
13122 | 1.80k | } |
13123 | 410k | p->mark = _mark; |
13124 | 410k | D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
13125 | 410k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or")); |
13126 | 410k | } |
13127 | 410k | _res = NULL; |
13128 | 412k | done: |
13129 | 412k | p->level--; |
13130 | 412k | return _res; |
13131 | 410k | } |
13132 | | |
13133 | | // isnot_bitwise_or: 'is' 'not' bitwise_or |
13134 | | static CmpopExprPair* |
13135 | | isnot_bitwise_or_rule(Parser *p) |
13136 | 410k | { |
13137 | 410k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13138 | 0 | _Pypegen_stack_overflow(p); |
13139 | 0 | } |
13140 | 410k | if (p->error_indicator) { |
13141 | 0 | p->level--; |
13142 | 0 | return NULL; |
13143 | 0 | } |
13144 | 410k | CmpopExprPair* _res = NULL; |
13145 | 410k | int _mark = p->mark; |
13146 | 410k | { // 'is' 'not' bitwise_or |
13147 | 410k | if (p->error_indicator) { |
13148 | 0 | p->level--; |
13149 | 0 | return NULL; |
13150 | 0 | } |
13151 | 410k | D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or")); |
13152 | 410k | Token * _keyword; |
13153 | 410k | Token * _keyword_1; |
13154 | 410k | expr_ty a; |
13155 | 410k | if ( |
13156 | 410k | (_keyword = _PyPegen_expect_token(p, 597)) // token='is' |
13157 | 4.03k | && |
13158 | 4.03k | (_keyword_1 = _PyPegen_expect_token(p, 712)) // token='not' |
13159 | 1.62k | && |
13160 | 1.62k | (a = bitwise_or_rule(p)) // bitwise_or |
13161 | 410k | ) |
13162 | 1.06k | { |
13163 | 1.06k | D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or")); |
13164 | 1.06k | _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a ); |
13165 | 1.06k | if (_res == NULL && PyErr_Occurred()) { |
13166 | 0 | p->error_indicator = 1; |
13167 | 0 | p->level--; |
13168 | 0 | return NULL; |
13169 | 0 | } |
13170 | 1.06k | goto done; |
13171 | 1.06k | } |
13172 | 409k | p->mark = _mark; |
13173 | 409k | D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
13174 | 409k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or")); |
13175 | 409k | } |
13176 | 409k | _res = NULL; |
13177 | 410k | done: |
13178 | 410k | p->level--; |
13179 | 410k | return _res; |
13180 | 409k | } |
13181 | | |
13182 | | // is_bitwise_or: 'is' bitwise_or |
13183 | | static CmpopExprPair* |
13184 | | is_bitwise_or_rule(Parser *p) |
13185 | 409k | { |
13186 | 409k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13187 | 0 | _Pypegen_stack_overflow(p); |
13188 | 0 | } |
13189 | 409k | if (p->error_indicator) { |
13190 | 0 | p->level--; |
13191 | 0 | return NULL; |
13192 | 0 | } |
13193 | 409k | CmpopExprPair* _res = NULL; |
13194 | 409k | int _mark = p->mark; |
13195 | 409k | { // 'is' bitwise_or |
13196 | 409k | if (p->error_indicator) { |
13197 | 0 | p->level--; |
13198 | 0 | return NULL; |
13199 | 0 | } |
13200 | 409k | D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or")); |
13201 | 409k | Token * _keyword; |
13202 | 409k | expr_ty a; |
13203 | 409k | if ( |
13204 | 409k | (_keyword = _PyPegen_expect_token(p, 597)) // token='is' |
13205 | 2.76k | && |
13206 | 2.76k | (a = bitwise_or_rule(p)) // bitwise_or |
13207 | 409k | ) |
13208 | 2.24k | { |
13209 | 2.24k | D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or")); |
13210 | 2.24k | _res = _PyPegen_cmpop_expr_pair ( p , Is , a ); |
13211 | 2.24k | if (_res == NULL && PyErr_Occurred()) { |
13212 | 0 | p->error_indicator = 1; |
13213 | 0 | p->level--; |
13214 | 0 | return NULL; |
13215 | 0 | } |
13216 | 2.24k | goto done; |
13217 | 2.24k | } |
13218 | 407k | p->mark = _mark; |
13219 | 407k | D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
13220 | 407k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or")); |
13221 | 407k | } |
13222 | 407k | _res = NULL; |
13223 | 409k | done: |
13224 | 409k | p->level--; |
13225 | 409k | return _res; |
13226 | 407k | } |
13227 | | |
13228 | | // Left-recursive |
13229 | | // bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor |
13230 | | static expr_ty bitwise_or_raw(Parser *); |
13231 | | static expr_ty |
13232 | | bitwise_or_rule(Parser *p) |
13233 | 2.62M | { |
13234 | 2.62M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13235 | 1 | _Pypegen_stack_overflow(p); |
13236 | 1 | } |
13237 | 2.62M | expr_ty _res = NULL; |
13238 | 2.62M | if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) { |
13239 | 1.89M | p->level--; |
13240 | 1.89M | return _res; |
13241 | 1.89M | } |
13242 | 727k | int _mark = p->mark; |
13243 | 727k | int _resmark = p->mark; |
13244 | 1.16M | while (1) { |
13245 | 1.16M | int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res); |
13246 | 1.16M | if (tmpvar_2) { |
13247 | 0 | p->level--; |
13248 | 0 | return _res; |
13249 | 0 | } |
13250 | 1.16M | p->mark = _mark; |
13251 | 1.16M | void *_raw = bitwise_or_raw(p); |
13252 | 1.16M | if (p->error_indicator) { |
13253 | 35.7k | p->level--; |
13254 | 35.7k | return NULL; |
13255 | 35.7k | } |
13256 | 1.12M | if (_raw == NULL || p->mark <= _resmark) |
13257 | 692k | break; |
13258 | 436k | _resmark = p->mark; |
13259 | 436k | _res = _raw; |
13260 | 436k | } |
13261 | 692k | p->mark = _resmark; |
13262 | 692k | p->level--; |
13263 | 692k | return _res; |
13264 | 727k | } |
13265 | | static expr_ty |
13266 | | bitwise_or_raw(Parser *p) |
13267 | 1.16M | { |
13268 | 1.16M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13269 | 3 | _Pypegen_stack_overflow(p); |
13270 | 3 | } |
13271 | 1.16M | if (p->error_indicator) { |
13272 | 4 | p->level--; |
13273 | 4 | return NULL; |
13274 | 4 | } |
13275 | 1.16M | expr_ty _res = NULL; |
13276 | 1.16M | int _mark = p->mark; |
13277 | 1.16M | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
13278 | 0 | p->error_indicator = 1; |
13279 | 0 | p->level--; |
13280 | 0 | return NULL; |
13281 | 0 | } |
13282 | 1.16M | int _start_lineno = p->tokens[_mark]->lineno; |
13283 | 1.16M | UNUSED(_start_lineno); // Only used by EXTRA macro |
13284 | 1.16M | int _start_col_offset = p->tokens[_mark]->col_offset; |
13285 | 1.16M | UNUSED(_start_col_offset); // Only used by EXTRA macro |
13286 | 1.16M | { // bitwise_or '|' bitwise_xor |
13287 | 1.16M | if (p->error_indicator) { |
13288 | 0 | p->level--; |
13289 | 0 | return NULL; |
13290 | 0 | } |
13291 | 1.16M | D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
13292 | 1.16M | Token * _literal; |
13293 | 1.16M | expr_ty a; |
13294 | 1.16M | expr_ty b; |
13295 | 1.16M | if ( |
13296 | 1.16M | (a = bitwise_or_rule(p)) // bitwise_or |
13297 | 436k | && |
13298 | 436k | (_literal = _PyPegen_expect_token(p, 18)) // token='|' |
13299 | 1.90k | && |
13300 | 1.90k | (b = bitwise_xor_rule(p)) // bitwise_xor |
13301 | 1.16M | ) |
13302 | 1.43k | { |
13303 | 1.43k | D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
13304 | 1.43k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13305 | 1.43k | if (_token == NULL) { |
13306 | 0 | p->level--; |
13307 | 0 | return NULL; |
13308 | 0 | } |
13309 | 1.43k | int _end_lineno = _token->end_lineno; |
13310 | 1.43k | UNUSED(_end_lineno); // Only used by EXTRA macro |
13311 | 1.43k | int _end_col_offset = _token->end_col_offset; |
13312 | 1.43k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13313 | 1.43k | _res = _PyAST_BinOp ( a , BitOr , b , EXTRA ); |
13314 | 1.43k | if (_res == NULL && PyErr_Occurred()) { |
13315 | 0 | p->error_indicator = 1; |
13316 | 0 | p->level--; |
13317 | 0 | return NULL; |
13318 | 0 | } |
13319 | 1.43k | goto done; |
13320 | 1.43k | } |
13321 | 1.16M | p->mark = _mark; |
13322 | 1.16M | D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
13323 | 1.16M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
13324 | 1.16M | } |
13325 | 0 | { // bitwise_xor |
13326 | 1.16M | if (p->error_indicator) { |
13327 | 300 | p->level--; |
13328 | 300 | return NULL; |
13329 | 300 | } |
13330 | 1.16M | D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor")); |
13331 | 1.16M | expr_ty bitwise_xor_var; |
13332 | 1.16M | if ( |
13333 | 1.16M | (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor |
13334 | 1.16M | ) |
13335 | 870k | { |
13336 | 870k | D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor")); |
13337 | 870k | _res = bitwise_xor_var; |
13338 | 870k | goto done; |
13339 | 870k | } |
13340 | 292k | p->mark = _mark; |
13341 | 292k | D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
13342 | 292k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor")); |
13343 | 292k | } |
13344 | 292k | _res = NULL; |
13345 | 1.16M | done: |
13346 | 1.16M | p->level--; |
13347 | 1.16M | return _res; |
13348 | 292k | } |
13349 | | |
13350 | | // Left-recursive |
13351 | | // bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and |
13352 | | static expr_ty bitwise_xor_raw(Parser *); |
13353 | | static expr_ty |
13354 | | bitwise_xor_rule(Parser *p) |
13355 | 2.33M | { |
13356 | 2.33M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13357 | 1 | _Pypegen_stack_overflow(p); |
13358 | 1 | } |
13359 | 2.33M | expr_ty _res = NULL; |
13360 | 2.33M | if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) { |
13361 | 1.60M | p->level--; |
13362 | 1.60M | return _res; |
13363 | 1.60M | } |
13364 | 729k | int _mark = p->mark; |
13365 | 729k | int _resmark = p->mark; |
13366 | 1.16M | while (1) { |
13367 | 1.16M | int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res); |
13368 | 1.16M | if (tmpvar_3) { |
13369 | 0 | p->level--; |
13370 | 0 | return _res; |
13371 | 0 | } |
13372 | 1.16M | p->mark = _mark; |
13373 | 1.16M | void *_raw = bitwise_xor_raw(p); |
13374 | 1.16M | if (p->error_indicator) { |
13375 | 35.7k | p->level--; |
13376 | 35.7k | return NULL; |
13377 | 35.7k | } |
13378 | 1.13M | if (_raw == NULL || p->mark <= _resmark) |
13379 | 694k | break; |
13380 | 438k | _resmark = p->mark; |
13381 | 438k | _res = _raw; |
13382 | 438k | } |
13383 | 694k | p->mark = _resmark; |
13384 | 694k | p->level--; |
13385 | 694k | return _res; |
13386 | 729k | } |
13387 | | static expr_ty |
13388 | | bitwise_xor_raw(Parser *p) |
13389 | 1.16M | { |
13390 | 1.16M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13391 | 1 | _Pypegen_stack_overflow(p); |
13392 | 1 | } |
13393 | 1.16M | if (p->error_indicator) { |
13394 | 1 | p->level--; |
13395 | 1 | return NULL; |
13396 | 1 | } |
13397 | 1.16M | expr_ty _res = NULL; |
13398 | 1.16M | int _mark = p->mark; |
13399 | 1.16M | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
13400 | 0 | p->error_indicator = 1; |
13401 | 0 | p->level--; |
13402 | 0 | return NULL; |
13403 | 0 | } |
13404 | 1.16M | int _start_lineno = p->tokens[_mark]->lineno; |
13405 | 1.16M | UNUSED(_start_lineno); // Only used by EXTRA macro |
13406 | 1.16M | int _start_col_offset = p->tokens[_mark]->col_offset; |
13407 | 1.16M | UNUSED(_start_col_offset); // Only used by EXTRA macro |
13408 | 1.16M | { // bitwise_xor '^' bitwise_and |
13409 | 1.16M | if (p->error_indicator) { |
13410 | 0 | p->level--; |
13411 | 0 | return NULL; |
13412 | 0 | } |
13413 | 1.16M | D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
13414 | 1.16M | Token * _literal; |
13415 | 1.16M | expr_ty a; |
13416 | 1.16M | expr_ty b; |
13417 | 1.16M | if ( |
13418 | 1.16M | (a = bitwise_xor_rule(p)) // bitwise_xor |
13419 | 438k | && |
13420 | 438k | (_literal = _PyPegen_expect_token(p, 32)) // token='^' |
13421 | 1.65k | && |
13422 | 1.65k | (b = bitwise_and_rule(p)) // bitwise_and |
13423 | 1.16M | ) |
13424 | 1.03k | { |
13425 | 1.03k | D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
13426 | 1.03k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13427 | 1.03k | if (_token == NULL) { |
13428 | 0 | p->level--; |
13429 | 0 | return NULL; |
13430 | 0 | } |
13431 | 1.03k | int _end_lineno = _token->end_lineno; |
13432 | 1.03k | UNUSED(_end_lineno); // Only used by EXTRA macro |
13433 | 1.03k | int _end_col_offset = _token->end_col_offset; |
13434 | 1.03k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13435 | 1.03k | _res = _PyAST_BinOp ( a , BitXor , b , EXTRA ); |
13436 | 1.03k | if (_res == NULL && PyErr_Occurred()) { |
13437 | 0 | p->error_indicator = 1; |
13438 | 0 | p->level--; |
13439 | 0 | return NULL; |
13440 | 0 | } |
13441 | 1.03k | goto done; |
13442 | 1.03k | } |
13443 | 1.16M | p->mark = _mark; |
13444 | 1.16M | D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', |
13445 | 1.16M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
13446 | 1.16M | } |
13447 | 0 | { // bitwise_and |
13448 | 1.16M | if (p->error_indicator) { |
13449 | 201 | p->level--; |
13450 | 201 | return NULL; |
13451 | 201 | } |
13452 | 1.16M | D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and")); |
13453 | 1.16M | expr_ty bitwise_and_var; |
13454 | 1.16M | if ( |
13455 | 1.16M | (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and |
13456 | 1.16M | ) |
13457 | 873k | { |
13458 | 873k | D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and")); |
13459 | 873k | _res = bitwise_and_var; |
13460 | 873k | goto done; |
13461 | 873k | } |
13462 | 292k | p->mark = _mark; |
13463 | 292k | D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', |
13464 | 292k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and")); |
13465 | 292k | } |
13466 | 292k | _res = NULL; |
13467 | 1.16M | done: |
13468 | 1.16M | p->level--; |
13469 | 1.16M | return _res; |
13470 | 292k | } |
13471 | | |
13472 | | // Left-recursive |
13473 | | // bitwise_and: bitwise_and '&' shift_expr | shift_expr |
13474 | | static expr_ty bitwise_and_raw(Parser *); |
13475 | | static expr_ty |
13476 | | bitwise_and_rule(Parser *p) |
13477 | 2.34M | { |
13478 | 2.34M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13479 | 1 | _Pypegen_stack_overflow(p); |
13480 | 1 | } |
13481 | 2.34M | expr_ty _res = NULL; |
13482 | 2.34M | if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) { |
13483 | 1.60M | p->level--; |
13484 | 1.60M | return _res; |
13485 | 1.60M | } |
13486 | 731k | int _mark = p->mark; |
13487 | 731k | int _resmark = p->mark; |
13488 | 1.17M | while (1) { |
13489 | 1.17M | int tmpvar_4 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res); |
13490 | 1.17M | if (tmpvar_4) { |
13491 | 0 | p->level--; |
13492 | 0 | return _res; |
13493 | 0 | } |
13494 | 1.17M | p->mark = _mark; |
13495 | 1.17M | void *_raw = bitwise_and_raw(p); |
13496 | 1.17M | if (p->error_indicator) { |
13497 | 35.7k | p->level--; |
13498 | 35.7k | return NULL; |
13499 | 35.7k | } |
13500 | 1.13M | if (_raw == NULL || p->mark <= _resmark) |
13501 | 695k | break; |
13502 | 440k | _resmark = p->mark; |
13503 | 440k | _res = _raw; |
13504 | 440k | } |
13505 | 695k | p->mark = _resmark; |
13506 | 695k | p->level--; |
13507 | 695k | return _res; |
13508 | 731k | } |
13509 | | static expr_ty |
13510 | | bitwise_and_raw(Parser *p) |
13511 | 1.17M | { |
13512 | 1.17M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13513 | 1 | _Pypegen_stack_overflow(p); |
13514 | 1 | } |
13515 | 1.17M | if (p->error_indicator) { |
13516 | 1 | p->level--; |
13517 | 1 | return NULL; |
13518 | 1 | } |
13519 | 1.17M | expr_ty _res = NULL; |
13520 | 1.17M | int _mark = p->mark; |
13521 | 1.17M | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
13522 | 0 | p->error_indicator = 1; |
13523 | 0 | p->level--; |
13524 | 0 | return NULL; |
13525 | 0 | } |
13526 | 1.17M | int _start_lineno = p->tokens[_mark]->lineno; |
13527 | 1.17M | UNUSED(_start_lineno); // Only used by EXTRA macro |
13528 | 1.17M | int _start_col_offset = p->tokens[_mark]->col_offset; |
13529 | 1.17M | UNUSED(_start_col_offset); // Only used by EXTRA macro |
13530 | 1.17M | { // bitwise_and '&' shift_expr |
13531 | 1.17M | if (p->error_indicator) { |
13532 | 0 | p->level--; |
13533 | 0 | return NULL; |
13534 | 0 | } |
13535 | 1.17M | D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr")); |
13536 | 1.17M | Token * _literal; |
13537 | 1.17M | expr_ty a; |
13538 | 1.17M | expr_ty b; |
13539 | 1.17M | if ( |
13540 | 1.17M | (a = bitwise_and_rule(p)) // bitwise_and |
13541 | 440k | && |
13542 | 440k | (_literal = _PyPegen_expect_token(p, 19)) // token='&' |
13543 | 2.82k | && |
13544 | 2.82k | (b = shift_expr_rule(p)) // shift_expr |
13545 | 1.17M | ) |
13546 | 2.05k | { |
13547 | 2.05k | D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr")); |
13548 | 2.05k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13549 | 2.05k | if (_token == NULL) { |
13550 | 0 | p->level--; |
13551 | 0 | return NULL; |
13552 | 0 | } |
13553 | 2.05k | int _end_lineno = _token->end_lineno; |
13554 | 2.05k | UNUSED(_end_lineno); // Only used by EXTRA macro |
13555 | 2.05k | int _end_col_offset = _token->end_col_offset; |
13556 | 2.05k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13557 | 2.05k | _res = _PyAST_BinOp ( a , BitAnd , b , EXTRA ); |
13558 | 2.05k | if (_res == NULL && PyErr_Occurred()) { |
13559 | 0 | p->error_indicator = 1; |
13560 | 0 | p->level--; |
13561 | 0 | return NULL; |
13562 | 0 | } |
13563 | 2.05k | goto done; |
13564 | 2.05k | } |
13565 | 1.16M | p->mark = _mark; |
13566 | 1.16M | D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', |
13567 | 1.16M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr")); |
13568 | 1.16M | } |
13569 | 0 | { // shift_expr |
13570 | 1.16M | if (p->error_indicator) { |
13571 | 276 | p->level--; |
13572 | 276 | return NULL; |
13573 | 276 | } |
13574 | 1.16M | D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr")); |
13575 | 1.16M | expr_ty shift_expr_var; |
13576 | 1.16M | if ( |
13577 | 1.16M | (shift_expr_var = shift_expr_rule(p)) // shift_expr |
13578 | 1.16M | ) |
13579 | 876k | { |
13580 | 876k | D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr")); |
13581 | 876k | _res = shift_expr_var; |
13582 | 876k | goto done; |
13583 | 876k | } |
13584 | 293k | p->mark = _mark; |
13585 | 293k | D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', |
13586 | 293k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr")); |
13587 | 293k | } |
13588 | 293k | _res = NULL; |
13589 | 1.17M | done: |
13590 | 1.17M | p->level--; |
13591 | 1.17M | return _res; |
13592 | 293k | } |
13593 | | |
13594 | | // Left-recursive |
13595 | | // shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | invalid_arithmetic | sum |
13596 | | static expr_ty shift_expr_raw(Parser *); |
13597 | | static expr_ty |
13598 | | shift_expr_rule(Parser *p) |
13599 | 3.52M | { |
13600 | 3.52M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13601 | 1 | _Pypegen_stack_overflow(p); |
13602 | 1 | } |
13603 | 3.52M | expr_ty _res = NULL; |
13604 | 3.52M | if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) { |
13605 | 2.78M | p->level--; |
13606 | 2.78M | return _res; |
13607 | 2.78M | } |
13608 | 734k | int _mark = p->mark; |
13609 | 734k | int _resmark = p->mark; |
13610 | 1.17M | while (1) { |
13611 | 1.17M | int tmpvar_5 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res); |
13612 | 1.17M | if (tmpvar_5) { |
13613 | 0 | p->level--; |
13614 | 0 | return _res; |
13615 | 0 | } |
13616 | 1.17M | p->mark = _mark; |
13617 | 1.17M | void *_raw = shift_expr_raw(p); |
13618 | 1.17M | if (p->error_indicator) { |
13619 | 35.7k | p->level--; |
13620 | 35.7k | return NULL; |
13621 | 35.7k | } |
13622 | 1.14M | if (_raw == NULL || p->mark <= _resmark) |
13623 | 698k | break; |
13624 | 442k | _resmark = p->mark; |
13625 | 442k | _res = _raw; |
13626 | 442k | } |
13627 | 698k | p->mark = _resmark; |
13628 | 698k | p->level--; |
13629 | 698k | return _res; |
13630 | 734k | } |
13631 | | static expr_ty |
13632 | | shift_expr_raw(Parser *p) |
13633 | 1.17M | { |
13634 | 1.17M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13635 | 1 | _Pypegen_stack_overflow(p); |
13636 | 1 | } |
13637 | 1.17M | if (p->error_indicator) { |
13638 | 1 | p->level--; |
13639 | 1 | return NULL; |
13640 | 1 | } |
13641 | 1.17M | expr_ty _res = NULL; |
13642 | 1.17M | int _mark = p->mark; |
13643 | 1.17M | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
13644 | 0 | p->error_indicator = 1; |
13645 | 0 | p->level--; |
13646 | 0 | return NULL; |
13647 | 0 | } |
13648 | 1.17M | int _start_lineno = p->tokens[_mark]->lineno; |
13649 | 1.17M | UNUSED(_start_lineno); // Only used by EXTRA macro |
13650 | 1.17M | int _start_col_offset = p->tokens[_mark]->col_offset; |
13651 | 1.17M | UNUSED(_start_col_offset); // Only used by EXTRA macro |
13652 | 1.17M | { // shift_expr '<<' sum |
13653 | 1.17M | if (p->error_indicator) { |
13654 | 0 | p->level--; |
13655 | 0 | return NULL; |
13656 | 0 | } |
13657 | 1.17M | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum")); |
13658 | 1.17M | Token * _literal; |
13659 | 1.17M | expr_ty a; |
13660 | 1.17M | expr_ty b; |
13661 | 1.17M | if ( |
13662 | 1.17M | (a = shift_expr_rule(p)) // shift_expr |
13663 | 442k | && |
13664 | 442k | (_literal = _PyPegen_expect_token(p, 33)) // token='<<' |
13665 | 1.12k | && |
13666 | 1.12k | (b = sum_rule(p)) // sum |
13667 | 1.17M | ) |
13668 | 682 | { |
13669 | 682 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum")); |
13670 | 682 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13671 | 682 | if (_token == NULL) { |
13672 | 0 | p->level--; |
13673 | 0 | return NULL; |
13674 | 0 | } |
13675 | 682 | int _end_lineno = _token->end_lineno; |
13676 | 682 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13677 | 682 | int _end_col_offset = _token->end_col_offset; |
13678 | 682 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13679 | 682 | _res = _PyAST_BinOp ( a , LShift , b , EXTRA ); |
13680 | 682 | if (_res == NULL && PyErr_Occurred()) { |
13681 | 0 | p->error_indicator = 1; |
13682 | 0 | p->level--; |
13683 | 0 | return NULL; |
13684 | 0 | } |
13685 | 682 | goto done; |
13686 | 682 | } |
13687 | 1.17M | p->mark = _mark; |
13688 | 1.17M | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
13689 | 1.17M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum")); |
13690 | 1.17M | } |
13691 | 0 | { // shift_expr '>>' sum |
13692 | 1.17M | if (p->error_indicator) { |
13693 | 203 | p->level--; |
13694 | 203 | return NULL; |
13695 | 203 | } |
13696 | 1.17M | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum")); |
13697 | 1.17M | Token * _literal; |
13698 | 1.17M | expr_ty a; |
13699 | 1.17M | expr_ty b; |
13700 | 1.17M | if ( |
13701 | 1.17M | (a = shift_expr_rule(p)) // shift_expr |
13702 | 441k | && |
13703 | 441k | (_literal = _PyPegen_expect_token(p, 34)) // token='>>' |
13704 | 1.07k | && |
13705 | 1.07k | (b = sum_rule(p)) // sum |
13706 | 1.17M | ) |
13707 | 653 | { |
13708 | 653 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum")); |
13709 | 653 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13710 | 653 | if (_token == NULL) { |
13711 | 0 | p->level--; |
13712 | 0 | return NULL; |
13713 | 0 | } |
13714 | 653 | int _end_lineno = _token->end_lineno; |
13715 | 653 | UNUSED(_end_lineno); // Only used by EXTRA macro |
13716 | 653 | int _end_col_offset = _token->end_col_offset; |
13717 | 653 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13718 | 653 | _res = _PyAST_BinOp ( a , RShift , b , EXTRA ); |
13719 | 653 | if (_res == NULL && PyErr_Occurred()) { |
13720 | 0 | p->error_indicator = 1; |
13721 | 0 | p->level--; |
13722 | 0 | return NULL; |
13723 | 0 | } |
13724 | 653 | goto done; |
13725 | 653 | } |
13726 | 1.17M | p->mark = _mark; |
13727 | 1.17M | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
13728 | 1.17M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum")); |
13729 | 1.17M | } |
13730 | 1.17M | if (p->call_invalid_rules) { // invalid_arithmetic |
13731 | 281k | if (p->error_indicator) { |
13732 | 316 | p->level--; |
13733 | 316 | return NULL; |
13734 | 316 | } |
13735 | 280k | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_arithmetic")); |
13736 | 280k | void *invalid_arithmetic_var; |
13737 | 280k | if ( |
13738 | 280k | (invalid_arithmetic_var = invalid_arithmetic_rule(p)) // invalid_arithmetic |
13739 | 280k | ) |
13740 | 0 | { |
13741 | 0 | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_arithmetic")); |
13742 | 0 | _res = invalid_arithmetic_var; |
13743 | 0 | goto done; |
13744 | 0 | } |
13745 | 280k | p->mark = _mark; |
13746 | 280k | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
13747 | 280k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_arithmetic")); |
13748 | 280k | } |
13749 | 1.17M | { // sum |
13750 | 1.17M | if (p->error_indicator) { |
13751 | 25.8k | p->level--; |
13752 | 25.8k | return NULL; |
13753 | 25.8k | } |
13754 | 1.14M | D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum")); |
13755 | 1.14M | expr_ty sum_var; |
13756 | 1.14M | if ( |
13757 | 1.14M | (sum_var = sum_rule(p)) // sum |
13758 | 1.14M | ) |
13759 | 881k | { |
13760 | 881k | D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum")); |
13761 | 881k | _res = sum_var; |
13762 | 881k | goto done; |
13763 | 881k | } |
13764 | 267k | p->mark = _mark; |
13765 | 267k | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
13766 | 267k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum")); |
13767 | 267k | } |
13768 | 267k | _res = NULL; |
13769 | 1.14M | done: |
13770 | 1.14M | p->level--; |
13771 | 1.14M | return _res; |
13772 | 267k | } |
13773 | | |
13774 | | // Left-recursive |
13775 | | // sum: sum '+' term | sum '-' term | term |
13776 | | static expr_ty sum_raw(Parser *); |
13777 | | static expr_ty |
13778 | | sum_rule(Parser *p) |
13779 | 3.82M | { |
13780 | 3.82M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13781 | 1 | _Pypegen_stack_overflow(p); |
13782 | 1 | } |
13783 | 3.82M | expr_ty _res = NULL; |
13784 | 3.82M | if (_PyPegen_is_memoized(p, sum_type, &_res)) { |
13785 | 3.09M | p->level--; |
13786 | 3.09M | return _res; |
13787 | 3.09M | } |
13788 | 736k | int _mark = p->mark; |
13789 | 736k | int _resmark = p->mark; |
13790 | 1.20M | while (1) { |
13791 | 1.20M | int tmpvar_6 = _PyPegen_update_memo(p, _mark, sum_type, _res); |
13792 | 1.20M | if (tmpvar_6) { |
13793 | 0 | p->level--; |
13794 | 0 | return _res; |
13795 | 0 | } |
13796 | 1.20M | p->mark = _mark; |
13797 | 1.20M | void *_raw = sum_raw(p); |
13798 | 1.20M | if (p->error_indicator) { |
13799 | 35.5k | p->level--; |
13800 | 35.5k | return NULL; |
13801 | 35.5k | } |
13802 | 1.16M | if (_raw == NULL || p->mark <= _resmark) |
13803 | 700k | break; |
13804 | 467k | _resmark = p->mark; |
13805 | 467k | _res = _raw; |
13806 | 467k | } |
13807 | 700k | p->mark = _resmark; |
13808 | 700k | p->level--; |
13809 | 700k | return _res; |
13810 | 736k | } |
13811 | | static expr_ty |
13812 | | sum_raw(Parser *p) |
13813 | 1.20M | { |
13814 | 1.20M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13815 | 1 | _Pypegen_stack_overflow(p); |
13816 | 1 | } |
13817 | 1.20M | if (p->error_indicator) { |
13818 | 1 | p->level--; |
13819 | 1 | return NULL; |
13820 | 1 | } |
13821 | 1.20M | expr_ty _res = NULL; |
13822 | 1.20M | int _mark = p->mark; |
13823 | 1.20M | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
13824 | 0 | p->error_indicator = 1; |
13825 | 0 | p->level--; |
13826 | 0 | return NULL; |
13827 | 0 | } |
13828 | 1.20M | int _start_lineno = p->tokens[_mark]->lineno; |
13829 | 1.20M | UNUSED(_start_lineno); // Only used by EXTRA macro |
13830 | 1.20M | int _start_col_offset = p->tokens[_mark]->col_offset; |
13831 | 1.20M | UNUSED(_start_col_offset); // Only used by EXTRA macro |
13832 | 1.20M | { // sum '+' term |
13833 | 1.20M | if (p->error_indicator) { |
13834 | 0 | p->level--; |
13835 | 0 | return NULL; |
13836 | 0 | } |
13837 | 1.20M | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term")); |
13838 | 1.20M | Token * _literal; |
13839 | 1.20M | expr_ty a; |
13840 | 1.20M | expr_ty b; |
13841 | 1.20M | if ( |
13842 | 1.20M | (a = sum_rule(p)) // sum |
13843 | 467k | && |
13844 | 467k | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
13845 | 11.6k | && |
13846 | 11.6k | (b = term_rule(p)) // term |
13847 | 1.20M | ) |
13848 | 10.2k | { |
13849 | 10.2k | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term")); |
13850 | 10.2k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13851 | 10.2k | if (_token == NULL) { |
13852 | 0 | p->level--; |
13853 | 0 | return NULL; |
13854 | 0 | } |
13855 | 10.2k | int _end_lineno = _token->end_lineno; |
13856 | 10.2k | UNUSED(_end_lineno); // Only used by EXTRA macro |
13857 | 10.2k | int _end_col_offset = _token->end_col_offset; |
13858 | 10.2k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13859 | 10.2k | _res = _PyAST_BinOp ( a , Add , b , EXTRA ); |
13860 | 10.2k | if (_res == NULL && PyErr_Occurred()) { |
13861 | 0 | p->error_indicator = 1; |
13862 | 0 | p->level--; |
13863 | 0 | return NULL; |
13864 | 0 | } |
13865 | 10.2k | goto done; |
13866 | 10.2k | } |
13867 | 1.19M | p->mark = _mark; |
13868 | 1.19M | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
13869 | 1.19M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term")); |
13870 | 1.19M | } |
13871 | 0 | { // sum '-' term |
13872 | 1.19M | if (p->error_indicator) { |
13873 | 238 | p->level--; |
13874 | 238 | return NULL; |
13875 | 238 | } |
13876 | 1.19M | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term")); |
13877 | 1.19M | Token * _literal; |
13878 | 1.19M | expr_ty a; |
13879 | 1.19M | expr_ty b; |
13880 | 1.19M | if ( |
13881 | 1.19M | (a = sum_rule(p)) // sum |
13882 | 456k | && |
13883 | 456k | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
13884 | 14.6k | && |
13885 | 14.6k | (b = term_rule(p)) // term |
13886 | 1.19M | ) |
13887 | 13.2k | { |
13888 | 13.2k | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term")); |
13889 | 13.2k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
13890 | 13.2k | if (_token == NULL) { |
13891 | 0 | p->level--; |
13892 | 0 | return NULL; |
13893 | 0 | } |
13894 | 13.2k | int _end_lineno = _token->end_lineno; |
13895 | 13.2k | UNUSED(_end_lineno); // Only used by EXTRA macro |
13896 | 13.2k | int _end_col_offset = _token->end_col_offset; |
13897 | 13.2k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
13898 | 13.2k | _res = _PyAST_BinOp ( a , Sub , b , EXTRA ); |
13899 | 13.2k | if (_res == NULL && PyErr_Occurred()) { |
13900 | 0 | p->error_indicator = 1; |
13901 | 0 | p->level--; |
13902 | 0 | return NULL; |
13903 | 0 | } |
13904 | 13.2k | goto done; |
13905 | 13.2k | } |
13906 | 1.17M | p->mark = _mark; |
13907 | 1.17M | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
13908 | 1.17M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term")); |
13909 | 1.17M | } |
13910 | 0 | { // term |
13911 | 1.17M | if (p->error_indicator) { |
13912 | 859 | p->level--; |
13913 | 859 | return NULL; |
13914 | 859 | } |
13915 | 1.17M | D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term")); |
13916 | 1.17M | expr_ty term_var; |
13917 | 1.17M | if ( |
13918 | 1.17M | (term_var = term_rule(p)) // term |
13919 | 1.17M | ) |
13920 | 885k | { |
13921 | 885k | D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term")); |
13922 | 885k | _res = term_var; |
13923 | 885k | goto done; |
13924 | 885k | } |
13925 | 292k | p->mark = _mark; |
13926 | 292k | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
13927 | 292k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term")); |
13928 | 292k | } |
13929 | 292k | _res = NULL; |
13930 | 1.20M | done: |
13931 | 1.20M | p->level--; |
13932 | 1.20M | return _res; |
13933 | 292k | } |
13934 | | |
13935 | | // Left-recursive |
13936 | | // term: |
13937 | | // | term '*' factor |
13938 | | // | term '/' factor |
13939 | | // | term '//' factor |
13940 | | // | term '%' factor |
13941 | | // | term '@' factor |
13942 | | // | invalid_factor |
13943 | | // | factor |
13944 | | static expr_ty term_raw(Parser *); |
13945 | | static expr_ty |
13946 | | term_rule(Parser *p) |
13947 | 7.39M | { |
13948 | 7.39M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13949 | 1 | _Pypegen_stack_overflow(p); |
13950 | 1 | } |
13951 | 7.39M | expr_ty _res = NULL; |
13952 | 7.39M | if (_PyPegen_is_memoized(p, term_type, &_res)) { |
13953 | 6.63M | p->level--; |
13954 | 6.63M | return _res; |
13955 | 6.63M | } |
13956 | 761k | int _mark = p->mark; |
13957 | 761k | int _resmark = p->mark; |
13958 | 1.24M | while (1) { |
13959 | 1.24M | int tmpvar_7 = _PyPegen_update_memo(p, _mark, term_type, _res); |
13960 | 1.24M | if (tmpvar_7) { |
13961 | 0 | p->level--; |
13962 | 0 | return _res; |
13963 | 0 | } |
13964 | 1.24M | p->mark = _mark; |
13965 | 1.24M | void *_raw = term_raw(p); |
13966 | 1.24M | if (p->error_indicator) { |
13967 | 35.5k | p->level--; |
13968 | 35.5k | return NULL; |
13969 | 35.5k | } |
13970 | 1.21M | if (_raw == NULL || p->mark <= _resmark) |
13971 | 726k | break; |
13972 | 484k | _resmark = p->mark; |
13973 | 484k | _res = _raw; |
13974 | 484k | } |
13975 | 726k | p->mark = _resmark; |
13976 | 726k | p->level--; |
13977 | 726k | return _res; |
13978 | 761k | } |
13979 | | static expr_ty |
13980 | | term_raw(Parser *p) |
13981 | 1.24M | { |
13982 | 1.24M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
13983 | 1 | _Pypegen_stack_overflow(p); |
13984 | 1 | } |
13985 | 1.24M | if (p->error_indicator) { |
13986 | 1 | p->level--; |
13987 | 1 | return NULL; |
13988 | 1 | } |
13989 | 1.24M | expr_ty _res = NULL; |
13990 | 1.24M | int _mark = p->mark; |
13991 | 1.24M | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
13992 | 0 | p->error_indicator = 1; |
13993 | 0 | p->level--; |
13994 | 0 | return NULL; |
13995 | 0 | } |
13996 | 1.24M | int _start_lineno = p->tokens[_mark]->lineno; |
13997 | 1.24M | UNUSED(_start_lineno); // Only used by EXTRA macro |
13998 | 1.24M | int _start_col_offset = p->tokens[_mark]->col_offset; |
13999 | 1.24M | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14000 | 1.24M | { // term '*' factor |
14001 | 1.24M | if (p->error_indicator) { |
14002 | 0 | p->level--; |
14003 | 0 | return NULL; |
14004 | 0 | } |
14005 | 1.24M | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor")); |
14006 | 1.24M | Token * _literal; |
14007 | 1.24M | expr_ty a; |
14008 | 1.24M | expr_ty b; |
14009 | 1.24M | if ( |
14010 | 1.24M | (a = term_rule(p)) // term |
14011 | 484k | && |
14012 | 484k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
14013 | 6.53k | && |
14014 | 6.53k | (b = factor_rule(p)) // factor |
14015 | 1.24M | ) |
14016 | 5.48k | { |
14017 | 5.48k | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor")); |
14018 | 5.48k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14019 | 5.48k | if (_token == NULL) { |
14020 | 0 | p->level--; |
14021 | 0 | return NULL; |
14022 | 0 | } |
14023 | 5.48k | int _end_lineno = _token->end_lineno; |
14024 | 5.48k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14025 | 5.48k | int _end_col_offset = _token->end_col_offset; |
14026 | 5.48k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14027 | 5.48k | _res = _PyAST_BinOp ( a , Mult , b , EXTRA ); |
14028 | 5.48k | if (_res == NULL && PyErr_Occurred()) { |
14029 | 0 | p->error_indicator = 1; |
14030 | 0 | p->level--; |
14031 | 0 | return NULL; |
14032 | 0 | } |
14033 | 5.48k | goto done; |
14034 | 5.48k | } |
14035 | 1.24M | p->mark = _mark; |
14036 | 1.24M | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
14037 | 1.24M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor")); |
14038 | 1.24M | } |
14039 | 0 | { // term '/' factor |
14040 | 1.24M | if (p->error_indicator) { |
14041 | 357 | p->level--; |
14042 | 357 | return NULL; |
14043 | 357 | } |
14044 | 1.24M | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor")); |
14045 | 1.24M | Token * _literal; |
14046 | 1.24M | expr_ty a; |
14047 | 1.24M | expr_ty b; |
14048 | 1.24M | if ( |
14049 | 1.24M | (a = term_rule(p)) // term |
14050 | 478k | && |
14051 | 478k | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
14052 | 5.00k | && |
14053 | 5.00k | (b = factor_rule(p)) // factor |
14054 | 1.24M | ) |
14055 | 4.25k | { |
14056 | 4.25k | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor")); |
14057 | 4.25k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14058 | 4.25k | if (_token == NULL) { |
14059 | 0 | p->level--; |
14060 | 0 | return NULL; |
14061 | 0 | } |
14062 | 4.25k | int _end_lineno = _token->end_lineno; |
14063 | 4.25k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14064 | 4.25k | int _end_col_offset = _token->end_col_offset; |
14065 | 4.25k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14066 | 4.25k | _res = _PyAST_BinOp ( a , Div , b , EXTRA ); |
14067 | 4.25k | if (_res == NULL && PyErr_Occurred()) { |
14068 | 0 | p->error_indicator = 1; |
14069 | 0 | p->level--; |
14070 | 0 | return NULL; |
14071 | 0 | } |
14072 | 4.25k | goto done; |
14073 | 4.25k | } |
14074 | 1.23M | p->mark = _mark; |
14075 | 1.23M | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
14076 | 1.23M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor")); |
14077 | 1.23M | } |
14078 | 0 | { // term '//' factor |
14079 | 1.23M | if (p->error_indicator) { |
14080 | 295 | p->level--; |
14081 | 295 | return NULL; |
14082 | 295 | } |
14083 | 1.23M | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor")); |
14084 | 1.23M | Token * _literal; |
14085 | 1.23M | expr_ty a; |
14086 | 1.23M | expr_ty b; |
14087 | 1.23M | if ( |
14088 | 1.23M | (a = term_rule(p)) // term |
14089 | 473k | && |
14090 | 473k | (_literal = _PyPegen_expect_token(p, 47)) // token='//' |
14091 | 975 | && |
14092 | 975 | (b = factor_rule(p)) // factor |
14093 | 1.23M | ) |
14094 | 567 | { |
14095 | 567 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor")); |
14096 | 567 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14097 | 567 | if (_token == NULL) { |
14098 | 0 | p->level--; |
14099 | 0 | return NULL; |
14100 | 0 | } |
14101 | 567 | int _end_lineno = _token->end_lineno; |
14102 | 567 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14103 | 567 | int _end_col_offset = _token->end_col_offset; |
14104 | 567 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14105 | 567 | _res = _PyAST_BinOp ( a , FloorDiv , b , EXTRA ); |
14106 | 567 | if (_res == NULL && PyErr_Occurred()) { |
14107 | 0 | p->error_indicator = 1; |
14108 | 0 | p->level--; |
14109 | 0 | return NULL; |
14110 | 0 | } |
14111 | 567 | goto done; |
14112 | 567 | } |
14113 | 1.23M | p->mark = _mark; |
14114 | 1.23M | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
14115 | 1.23M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor")); |
14116 | 1.23M | } |
14117 | 0 | { // term '%' factor |
14118 | 1.23M | if (p->error_indicator) { |
14119 | 196 | p->level--; |
14120 | 196 | return NULL; |
14121 | 196 | } |
14122 | 1.23M | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor")); |
14123 | 1.23M | Token * _literal; |
14124 | 1.23M | expr_ty a; |
14125 | 1.23M | expr_ty b; |
14126 | 1.23M | if ( |
14127 | 1.23M | (a = term_rule(p)) // term |
14128 | 473k | && |
14129 | 473k | (_literal = _PyPegen_expect_token(p, 24)) // token='%' |
14130 | 3.86k | && |
14131 | 3.86k | (b = factor_rule(p)) // factor |
14132 | 1.23M | ) |
14133 | 3.44k | { |
14134 | 3.44k | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor")); |
14135 | 3.44k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14136 | 3.44k | if (_token == NULL) { |
14137 | 0 | p->level--; |
14138 | 0 | return NULL; |
14139 | 0 | } |
14140 | 3.44k | int _end_lineno = _token->end_lineno; |
14141 | 3.44k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14142 | 3.44k | int _end_col_offset = _token->end_col_offset; |
14143 | 3.44k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14144 | 3.44k | _res = _PyAST_BinOp ( a , Mod , b , EXTRA ); |
14145 | 3.44k | if (_res == NULL && PyErr_Occurred()) { |
14146 | 0 | p->error_indicator = 1; |
14147 | 0 | p->level--; |
14148 | 0 | return NULL; |
14149 | 0 | } |
14150 | 3.44k | goto done; |
14151 | 3.44k | } |
14152 | 1.23M | p->mark = _mark; |
14153 | 1.23M | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
14154 | 1.23M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor")); |
14155 | 1.23M | } |
14156 | 0 | { // term '@' factor |
14157 | 1.23M | if (p->error_indicator) { |
14158 | 81 | p->level--; |
14159 | 81 | return NULL; |
14160 | 81 | } |
14161 | 1.23M | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor")); |
14162 | 1.23M | Token * _literal; |
14163 | 1.23M | expr_ty a; |
14164 | 1.23M | expr_ty b; |
14165 | 1.23M | if ( |
14166 | 1.23M | (a = term_rule(p)) // term |
14167 | 469k | && |
14168 | 469k | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
14169 | 3.61k | && |
14170 | 3.61k | (b = factor_rule(p)) // factor |
14171 | 1.23M | ) |
14172 | 2.66k | { |
14173 | 2.66k | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor")); |
14174 | 2.66k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14175 | 2.66k | if (_token == NULL) { |
14176 | 0 | p->level--; |
14177 | 0 | return NULL; |
14178 | 0 | } |
14179 | 2.66k | int _end_lineno = _token->end_lineno; |
14180 | 2.66k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14181 | 2.66k | int _end_col_offset = _token->end_col_offset; |
14182 | 2.66k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14183 | 2.66k | _res = CHECK_VERSION ( expr_ty , 5 , "The '@' operator is" , _PyAST_BinOp ( a , MatMult , b , EXTRA ) ); |
14184 | 2.66k | if (_res == NULL && PyErr_Occurred()) { |
14185 | 0 | p->error_indicator = 1; |
14186 | 0 | p->level--; |
14187 | 0 | return NULL; |
14188 | 0 | } |
14189 | 2.66k | goto done; |
14190 | 2.66k | } |
14191 | 1.22M | p->mark = _mark; |
14192 | 1.22M | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
14193 | 1.22M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor")); |
14194 | 1.22M | } |
14195 | 1.22M | if (p->call_invalid_rules) { // invalid_factor |
14196 | 292k | if (p->error_indicator) { |
14197 | 201 | p->level--; |
14198 | 201 | return NULL; |
14199 | 201 | } |
14200 | 292k | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_factor")); |
14201 | 292k | void *invalid_factor_var; |
14202 | 292k | if ( |
14203 | 292k | (invalid_factor_var = invalid_factor_rule(p)) // invalid_factor |
14204 | 292k | ) |
14205 | 0 | { |
14206 | 0 | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_factor")); |
14207 | 0 | _res = invalid_factor_var; |
14208 | 0 | goto done; |
14209 | 0 | } |
14210 | 292k | p->mark = _mark; |
14211 | 292k | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
14212 | 292k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_factor")); |
14213 | 292k | } |
14214 | 1.22M | { // factor |
14215 | 1.22M | if (p->error_indicator) { |
14216 | 311 | p->level--; |
14217 | 311 | return NULL; |
14218 | 311 | } |
14219 | 1.22M | D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor")); |
14220 | 1.22M | expr_ty factor_var; |
14221 | 1.22M | if ( |
14222 | 1.22M | (factor_var = factor_rule(p)) // factor |
14223 | 1.22M | ) |
14224 | 934k | { |
14225 | 934k | D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor")); |
14226 | 934k | _res = factor_var; |
14227 | 934k | goto done; |
14228 | 934k | } |
14229 | 293k | p->mark = _mark; |
14230 | 293k | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
14231 | 293k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor")); |
14232 | 293k | } |
14233 | 293k | _res = NULL; |
14234 | 1.24M | done: |
14235 | 1.24M | p->level--; |
14236 | 1.24M | return _res; |
14237 | 293k | } |
14238 | | |
14239 | | // factor: '+' factor | '-' factor | '~' factor | power |
14240 | | static expr_ty |
14241 | | factor_rule(Parser *p) |
14242 | 1.34M | { |
14243 | 1.34M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
14244 | 1 | _Pypegen_stack_overflow(p); |
14245 | 1 | } |
14246 | 1.34M | if (p->error_indicator) { |
14247 | 1 | p->level--; |
14248 | 1 | return NULL; |
14249 | 1 | } |
14250 | 1.34M | expr_ty _res = NULL; |
14251 | 1.34M | if (_PyPegen_is_memoized(p, factor_type, &_res)) { |
14252 | 469k | p->level--; |
14253 | 469k | return _res; |
14254 | 469k | } |
14255 | 873k | int _mark = p->mark; |
14256 | 873k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14257 | 0 | p->error_indicator = 1; |
14258 | 0 | p->level--; |
14259 | 0 | return NULL; |
14260 | 0 | } |
14261 | 873k | int _start_lineno = p->tokens[_mark]->lineno; |
14262 | 873k | UNUSED(_start_lineno); // Only used by EXTRA macro |
14263 | 873k | int _start_col_offset = p->tokens[_mark]->col_offset; |
14264 | 873k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14265 | 873k | { // '+' factor |
14266 | 873k | if (p->error_indicator) { |
14267 | 0 | p->level--; |
14268 | 0 | return NULL; |
14269 | 0 | } |
14270 | 873k | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor")); |
14271 | 873k | Token * _literal; |
14272 | 873k | expr_ty a; |
14273 | 873k | if ( |
14274 | 873k | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
14275 | 36.9k | && |
14276 | 36.9k | (a = factor_rule(p)) // factor |
14277 | 873k | ) |
14278 | 35.3k | { |
14279 | 35.3k | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor")); |
14280 | 35.3k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14281 | 35.3k | if (_token == NULL) { |
14282 | 0 | p->level--; |
14283 | 0 | return NULL; |
14284 | 0 | } |
14285 | 35.3k | int _end_lineno = _token->end_lineno; |
14286 | 35.3k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14287 | 35.3k | int _end_col_offset = _token->end_col_offset; |
14288 | 35.3k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14289 | 35.3k | _res = _PyAST_UnaryOp ( UAdd , a , EXTRA ); |
14290 | 35.3k | if (_res == NULL && PyErr_Occurred()) { |
14291 | 0 | p->error_indicator = 1; |
14292 | 0 | p->level--; |
14293 | 0 | return NULL; |
14294 | 0 | } |
14295 | 35.3k | goto done; |
14296 | 35.3k | } |
14297 | 838k | p->mark = _mark; |
14298 | 838k | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
14299 | 838k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor")); |
14300 | 838k | } |
14301 | 0 | { // '-' factor |
14302 | 838k | if (p->error_indicator) { |
14303 | 566 | p->level--; |
14304 | 566 | return NULL; |
14305 | 566 | } |
14306 | 837k | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor")); |
14307 | 837k | Token * _literal; |
14308 | 837k | expr_ty a; |
14309 | 837k | if ( |
14310 | 837k | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
14311 | 40.1k | && |
14312 | 40.1k | (a = factor_rule(p)) // factor |
14313 | 837k | ) |
14314 | 37.8k | { |
14315 | 37.8k | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor")); |
14316 | 37.8k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14317 | 37.8k | if (_token == NULL) { |
14318 | 0 | p->level--; |
14319 | 0 | return NULL; |
14320 | 0 | } |
14321 | 37.8k | int _end_lineno = _token->end_lineno; |
14322 | 37.8k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14323 | 37.8k | int _end_col_offset = _token->end_col_offset; |
14324 | 37.8k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14325 | 37.8k | _res = _PyAST_UnaryOp ( USub , a , EXTRA ); |
14326 | 37.8k | if (_res == NULL && PyErr_Occurred()) { |
14327 | 0 | p->error_indicator = 1; |
14328 | 0 | p->level--; |
14329 | 0 | return NULL; |
14330 | 0 | } |
14331 | 37.8k | goto done; |
14332 | 37.8k | } |
14333 | 799k | p->mark = _mark; |
14334 | 799k | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
14335 | 799k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor")); |
14336 | 799k | } |
14337 | 0 | { // '~' factor |
14338 | 799k | if (p->error_indicator) { |
14339 | 1.33k | p->level--; |
14340 | 1.33k | return NULL; |
14341 | 1.33k | } |
14342 | 798k | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor")); |
14343 | 798k | Token * _literal; |
14344 | 798k | expr_ty a; |
14345 | 798k | if ( |
14346 | 798k | (_literal = _PyPegen_expect_token(p, 31)) // token='~' |
14347 | 15.9k | && |
14348 | 15.9k | (a = factor_rule(p)) // factor |
14349 | 798k | ) |
14350 | 15.0k | { |
14351 | 15.0k | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor")); |
14352 | 15.0k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14353 | 15.0k | if (_token == NULL) { |
14354 | 0 | p->level--; |
14355 | 0 | return NULL; |
14356 | 0 | } |
14357 | 15.0k | int _end_lineno = _token->end_lineno; |
14358 | 15.0k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14359 | 15.0k | int _end_col_offset = _token->end_col_offset; |
14360 | 15.0k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14361 | 15.0k | _res = _PyAST_UnaryOp ( Invert , a , EXTRA ); |
14362 | 15.0k | if (_res == NULL && PyErr_Occurred()) { |
14363 | 0 | p->error_indicator = 1; |
14364 | 0 | p->level--; |
14365 | 0 | return NULL; |
14366 | 0 | } |
14367 | 15.0k | goto done; |
14368 | 15.0k | } |
14369 | 783k | p->mark = _mark; |
14370 | 783k | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
14371 | 783k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor")); |
14372 | 783k | } |
14373 | 0 | { // power |
14374 | 783k | if (p->error_indicator) { |
14375 | 257 | p->level--; |
14376 | 257 | return NULL; |
14377 | 257 | } |
14378 | 783k | D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power")); |
14379 | 783k | expr_ty power_var; |
14380 | 783k | if ( |
14381 | 783k | (power_var = power_rule(p)) // power |
14382 | 783k | ) |
14383 | 483k | { |
14384 | 483k | D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power")); |
14385 | 483k | _res = power_var; |
14386 | 483k | goto done; |
14387 | 483k | } |
14388 | 299k | p->mark = _mark; |
14389 | 299k | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
14390 | 299k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power")); |
14391 | 299k | } |
14392 | 299k | _res = NULL; |
14393 | 871k | done: |
14394 | 871k | _PyPegen_insert_memo(p, _mark, factor_type, _res); |
14395 | 871k | p->level--; |
14396 | 871k | return _res; |
14397 | 299k | } |
14398 | | |
14399 | | // power: await_primary '**' factor | await_primary |
14400 | | static expr_ty |
14401 | | power_rule(Parser *p) |
14402 | 783k | { |
14403 | 783k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
14404 | 2 | _Pypegen_stack_overflow(p); |
14405 | 2 | } |
14406 | 783k | if (p->error_indicator) { |
14407 | 2 | p->level--; |
14408 | 2 | return NULL; |
14409 | 2 | } |
14410 | 783k | expr_ty _res = NULL; |
14411 | 783k | int _mark = p->mark; |
14412 | 783k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14413 | 0 | p->error_indicator = 1; |
14414 | 0 | p->level--; |
14415 | 0 | return NULL; |
14416 | 0 | } |
14417 | 783k | int _start_lineno = p->tokens[_mark]->lineno; |
14418 | 783k | UNUSED(_start_lineno); // Only used by EXTRA macro |
14419 | 783k | int _start_col_offset = p->tokens[_mark]->col_offset; |
14420 | 783k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14421 | 783k | { // await_primary '**' factor |
14422 | 783k | if (p->error_indicator) { |
14423 | 0 | p->level--; |
14424 | 0 | return NULL; |
14425 | 0 | } |
14426 | 783k | D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor")); |
14427 | 783k | Token * _literal; |
14428 | 783k | expr_ty a; |
14429 | 783k | expr_ty b; |
14430 | 783k | if ( |
14431 | 783k | (a = await_primary_rule(p)) // await_primary |
14432 | 483k | && |
14433 | 483k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
14434 | 1.45k | && |
14435 | 1.45k | (b = factor_rule(p)) // factor |
14436 | 783k | ) |
14437 | 1.14k | { |
14438 | 1.14k | D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor")); |
14439 | 1.14k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14440 | 1.14k | if (_token == NULL) { |
14441 | 0 | p->level--; |
14442 | 0 | return NULL; |
14443 | 0 | } |
14444 | 1.14k | int _end_lineno = _token->end_lineno; |
14445 | 1.14k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14446 | 1.14k | int _end_col_offset = _token->end_col_offset; |
14447 | 1.14k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14448 | 1.14k | _res = _PyAST_BinOp ( a , Pow , b , EXTRA ); |
14449 | 1.14k | if (_res == NULL && PyErr_Occurred()) { |
14450 | 0 | p->error_indicator = 1; |
14451 | 0 | p->level--; |
14452 | 0 | return NULL; |
14453 | 0 | } |
14454 | 1.14k | goto done; |
14455 | 1.14k | } |
14456 | 782k | p->mark = _mark; |
14457 | 782k | D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', |
14458 | 782k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor")); |
14459 | 782k | } |
14460 | 0 | { // await_primary |
14461 | 782k | if (p->error_indicator) { |
14462 | 35.5k | p->level--; |
14463 | 35.5k | return NULL; |
14464 | 35.5k | } |
14465 | 746k | D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary")); |
14466 | 746k | expr_ty await_primary_var; |
14467 | 746k | if ( |
14468 | 746k | (await_primary_var = await_primary_rule(p)) // await_primary |
14469 | 746k | ) |
14470 | 482k | { |
14471 | 482k | D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary")); |
14472 | 482k | _res = await_primary_var; |
14473 | 482k | goto done; |
14474 | 482k | } |
14475 | 263k | p->mark = _mark; |
14476 | 263k | D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', |
14477 | 263k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary")); |
14478 | 263k | } |
14479 | 263k | _res = NULL; |
14480 | 747k | done: |
14481 | 747k | p->level--; |
14482 | 747k | return _res; |
14483 | 263k | } |
14484 | | |
14485 | | // await_primary: 'await' primary | primary |
14486 | | static expr_ty |
14487 | | await_primary_rule(Parser *p) |
14488 | 1.52M | { |
14489 | 1.52M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
14490 | 1 | _Pypegen_stack_overflow(p); |
14491 | 1 | } |
14492 | 1.52M | if (p->error_indicator) { |
14493 | 1 | p->level--; |
14494 | 1 | return NULL; |
14495 | 1 | } |
14496 | 1.52M | expr_ty _res = NULL; |
14497 | 1.52M | if (_PyPegen_is_memoized(p, await_primary_type, &_res)) { |
14498 | 746k | p->level--; |
14499 | 746k | return _res; |
14500 | 746k | } |
14501 | 783k | int _mark = p->mark; |
14502 | 783k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14503 | 0 | p->error_indicator = 1; |
14504 | 0 | p->level--; |
14505 | 0 | return NULL; |
14506 | 0 | } |
14507 | 783k | int _start_lineno = p->tokens[_mark]->lineno; |
14508 | 783k | UNUSED(_start_lineno); // Only used by EXTRA macro |
14509 | 783k | int _start_col_offset = p->tokens[_mark]->col_offset; |
14510 | 783k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14511 | 783k | { // 'await' primary |
14512 | 783k | if (p->error_indicator) { |
14513 | 0 | p->level--; |
14514 | 0 | return NULL; |
14515 | 0 | } |
14516 | 783k | D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'await' primary")); |
14517 | 783k | Token * _keyword; |
14518 | 783k | expr_ty a; |
14519 | 783k | if ( |
14520 | 783k | (_keyword = _PyPegen_expect_token(p, 598)) // token='await' |
14521 | 783 | && |
14522 | 783 | (a = primary_rule(p)) // primary |
14523 | 783k | ) |
14524 | 404 | { |
14525 | 404 | D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'await' primary")); |
14526 | 404 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14527 | 404 | if (_token == NULL) { |
14528 | 0 | p->level--; |
14529 | 0 | return NULL; |
14530 | 0 | } |
14531 | 404 | int _end_lineno = _token->end_lineno; |
14532 | 404 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14533 | 404 | int _end_col_offset = _token->end_col_offset; |
14534 | 404 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14535 | 404 | _res = CHECK_VERSION ( expr_ty , 5 , "Await expressions are" , _PyAST_Await ( a , EXTRA ) ); |
14536 | 404 | if (_res == NULL && PyErr_Occurred()) { |
14537 | 0 | p->error_indicator = 1; |
14538 | 0 | p->level--; |
14539 | 0 | return NULL; |
14540 | 0 | } |
14541 | 404 | goto done; |
14542 | 404 | } |
14543 | 782k | p->mark = _mark; |
14544 | 782k | D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', |
14545 | 782k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'await' primary")); |
14546 | 782k | } |
14547 | 0 | { // primary |
14548 | 782k | if (p->error_indicator) { |
14549 | 195 | p->level--; |
14550 | 195 | return NULL; |
14551 | 195 | } |
14552 | 782k | D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary")); |
14553 | 782k | expr_ty primary_var; |
14554 | 782k | if ( |
14555 | 782k | (primary_var = primary_rule(p)) // primary |
14556 | 782k | ) |
14557 | 483k | { |
14558 | 483k | D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary")); |
14559 | 483k | _res = primary_var; |
14560 | 483k | goto done; |
14561 | 483k | } |
14562 | 299k | p->mark = _mark; |
14563 | 299k | D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', |
14564 | 299k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary")); |
14565 | 299k | } |
14566 | 299k | _res = NULL; |
14567 | 783k | done: |
14568 | 783k | _PyPegen_insert_memo(p, _mark, await_primary_type, _res); |
14569 | 783k | p->level--; |
14570 | 783k | return _res; |
14571 | 299k | } |
14572 | | |
14573 | | // Left-recursive |
14574 | | // primary: |
14575 | | // | primary '.' NAME |
14576 | | // | primary genexp |
14577 | | // | primary '(' arguments? ')' |
14578 | | // | primary '[' slices ']' |
14579 | | // | atom |
14580 | | static expr_ty primary_raw(Parser *); |
14581 | | static expr_ty |
14582 | | primary_rule(Parser *p) |
14583 | 6.03M | { |
14584 | 6.03M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
14585 | 2 | _Pypegen_stack_overflow(p); |
14586 | 2 | } |
14587 | 6.03M | expr_ty _res = NULL; |
14588 | 6.03M | if (_PyPegen_is_memoized(p, primary_type, &_res)) { |
14589 | 5.24M | p->level--; |
14590 | 5.24M | return _res; |
14591 | 5.24M | } |
14592 | 783k | int _mark = p->mark; |
14593 | 783k | int _resmark = p->mark; |
14594 | 1.34M | while (1) { |
14595 | 1.34M | int tmpvar_8 = _PyPegen_update_memo(p, _mark, primary_type, _res); |
14596 | 1.34M | if (tmpvar_8) { |
14597 | 0 | p->level--; |
14598 | 0 | return _res; |
14599 | 0 | } |
14600 | 1.34M | p->mark = _mark; |
14601 | 1.34M | void *_raw = primary_raw(p); |
14602 | 1.34M | if (p->error_indicator) { |
14603 | 35.3k | p->level--; |
14604 | 35.3k | return NULL; |
14605 | 35.3k | } |
14606 | 1.31M | if (_raw == NULL || p->mark <= _resmark) |
14607 | 748k | break; |
14608 | 563k | _resmark = p->mark; |
14609 | 563k | _res = _raw; |
14610 | 563k | } |
14611 | 748k | p->mark = _resmark; |
14612 | 748k | p->level--; |
14613 | 748k | return _res; |
14614 | 783k | } |
14615 | | static expr_ty |
14616 | | primary_raw(Parser *p) |
14617 | 1.34M | { |
14618 | 1.34M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
14619 | 1 | _Pypegen_stack_overflow(p); |
14620 | 1 | } |
14621 | 1.34M | if (p->error_indicator) { |
14622 | 2 | p->level--; |
14623 | 2 | return NULL; |
14624 | 2 | } |
14625 | 1.34M | expr_ty _res = NULL; |
14626 | 1.34M | int _mark = p->mark; |
14627 | 1.34M | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14628 | 0 | p->error_indicator = 1; |
14629 | 0 | p->level--; |
14630 | 0 | return NULL; |
14631 | 0 | } |
14632 | 1.34M | int _start_lineno = p->tokens[_mark]->lineno; |
14633 | 1.34M | UNUSED(_start_lineno); // Only used by EXTRA macro |
14634 | 1.34M | int _start_col_offset = p->tokens[_mark]->col_offset; |
14635 | 1.34M | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14636 | 1.34M | { // primary '.' NAME |
14637 | 1.34M | if (p->error_indicator) { |
14638 | 0 | p->level--; |
14639 | 0 | return NULL; |
14640 | 0 | } |
14641 | 1.34M | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME")); |
14642 | 1.34M | Token * _literal; |
14643 | 1.34M | expr_ty a; |
14644 | 1.34M | expr_ty b; |
14645 | 1.34M | if ( |
14646 | 1.34M | (a = primary_rule(p)) // primary |
14647 | 563k | && |
14648 | 563k | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
14649 | 29.9k | && |
14650 | 29.9k | (b = _PyPegen_name_token(p)) // NAME |
14651 | 1.34M | ) |
14652 | 29.3k | { |
14653 | 29.3k | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME")); |
14654 | 29.3k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14655 | 29.3k | if (_token == NULL) { |
14656 | 0 | p->level--; |
14657 | 0 | return NULL; |
14658 | 0 | } |
14659 | 29.3k | int _end_lineno = _token->end_lineno; |
14660 | 29.3k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14661 | 29.3k | int _end_col_offset = _token->end_col_offset; |
14662 | 29.3k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14663 | 29.3k | _res = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA ); |
14664 | 29.3k | if (_res == NULL && PyErr_Occurred()) { |
14665 | 0 | p->error_indicator = 1; |
14666 | 0 | p->level--; |
14667 | 0 | return NULL; |
14668 | 0 | } |
14669 | 29.3k | goto done; |
14670 | 29.3k | } |
14671 | 1.31M | p->mark = _mark; |
14672 | 1.31M | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
14673 | 1.31M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME")); |
14674 | 1.31M | } |
14675 | 0 | { // primary genexp |
14676 | 1.31M | if (p->error_indicator) { |
14677 | 383 | p->level--; |
14678 | 383 | return NULL; |
14679 | 383 | } |
14680 | 1.31M | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp")); |
14681 | 1.31M | expr_ty a; |
14682 | 1.31M | expr_ty b; |
14683 | 1.31M | if ( |
14684 | 1.31M | (a = primary_rule(p)) // primary |
14685 | 533k | && |
14686 | 533k | (b = genexp_rule(p)) // genexp |
14687 | 1.31M | ) |
14688 | 887 | { |
14689 | 887 | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp")); |
14690 | 887 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14691 | 887 | if (_token == NULL) { |
14692 | 0 | p->level--; |
14693 | 0 | return NULL; |
14694 | 0 | } |
14695 | 887 | int _end_lineno = _token->end_lineno; |
14696 | 887 | UNUSED(_end_lineno); // Only used by EXTRA macro |
14697 | 887 | int _end_col_offset = _token->end_col_offset; |
14698 | 887 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14699 | 887 | _res = _PyAST_Call ( a , CHECK ( asdl_expr_seq* , ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); |
14700 | 887 | if (_res == NULL && PyErr_Occurred()) { |
14701 | 0 | p->error_indicator = 1; |
14702 | 0 | p->level--; |
14703 | 0 | return NULL; |
14704 | 0 | } |
14705 | 887 | goto done; |
14706 | 887 | } |
14707 | 1.31M | p->mark = _mark; |
14708 | 1.31M | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
14709 | 1.31M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp")); |
14710 | 1.31M | } |
14711 | 0 | { // primary '(' arguments? ')' |
14712 | 1.31M | if (p->error_indicator) { |
14713 | 3.56k | p->level--; |
14714 | 3.56k | return NULL; |
14715 | 3.56k | } |
14716 | 1.31M | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'")); |
14717 | 1.31M | Token * _literal; |
14718 | 1.31M | Token * _literal_1; |
14719 | 1.31M | expr_ty a; |
14720 | 1.31M | void *b; |
14721 | 1.31M | if ( |
14722 | 1.31M | (a = primary_rule(p)) // primary |
14723 | 528k | && |
14724 | 528k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
14725 | 45.7k | && |
14726 | 45.7k | (b = arguments_rule(p), !p->error_indicator) // arguments? |
14727 | 42.9k | && |
14728 | 42.9k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
14729 | 1.31M | ) |
14730 | 35.6k | { |
14731 | 35.6k | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'")); |
14732 | 35.6k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14733 | 35.6k | if (_token == NULL) { |
14734 | 0 | p->level--; |
14735 | 0 | return NULL; |
14736 | 0 | } |
14737 | 35.6k | int _end_lineno = _token->end_lineno; |
14738 | 35.6k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14739 | 35.6k | int _end_col_offset = _token->end_col_offset; |
14740 | 35.6k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14741 | 35.6k | _res = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
14742 | 35.6k | if (_res == NULL && PyErr_Occurred()) { |
14743 | 0 | p->error_indicator = 1; |
14744 | 0 | p->level--; |
14745 | 0 | return NULL; |
14746 | 0 | } |
14747 | 35.6k | goto done; |
14748 | 35.6k | } |
14749 | 1.27M | p->mark = _mark; |
14750 | 1.27M | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
14751 | 1.27M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'")); |
14752 | 1.27M | } |
14753 | 0 | { // primary '[' slices ']' |
14754 | 1.27M | if (p->error_indicator) { |
14755 | 2.81k | p->level--; |
14756 | 2.81k | return NULL; |
14757 | 2.81k | } |
14758 | 1.27M | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'")); |
14759 | 1.27M | Token * _literal; |
14760 | 1.27M | Token * _literal_1; |
14761 | 1.27M | expr_ty a; |
14762 | 1.27M | expr_ty b; |
14763 | 1.27M | if ( |
14764 | 1.27M | (a = primary_rule(p)) // primary |
14765 | 490k | && |
14766 | 490k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
14767 | 9.36k | && |
14768 | 9.36k | (b = slices_rule(p)) // slices |
14769 | 7.44k | && |
14770 | 7.44k | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
14771 | 1.27M | ) |
14772 | 5.46k | { |
14773 | 5.46k | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'")); |
14774 | 5.46k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14775 | 5.46k | if (_token == NULL) { |
14776 | 0 | p->level--; |
14777 | 0 | return NULL; |
14778 | 0 | } |
14779 | 5.46k | int _end_lineno = _token->end_lineno; |
14780 | 5.46k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14781 | 5.46k | int _end_col_offset = _token->end_col_offset; |
14782 | 5.46k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14783 | 5.46k | _res = _PyAST_Subscript ( a , b , Load , EXTRA ); |
14784 | 5.46k | if (_res == NULL && PyErr_Occurred()) { |
14785 | 0 | p->error_indicator = 1; |
14786 | 0 | p->level--; |
14787 | 0 | return NULL; |
14788 | 0 | } |
14789 | 5.46k | goto done; |
14790 | 5.46k | } |
14791 | 1.26M | p->mark = _mark; |
14792 | 1.26M | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
14793 | 1.26M | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'")); |
14794 | 1.26M | } |
14795 | 0 | { // atom |
14796 | 1.26M | if (p->error_indicator) { |
14797 | 894 | p->level--; |
14798 | 894 | return NULL; |
14799 | 894 | } |
14800 | 1.26M | D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom")); |
14801 | 1.26M | expr_ty atom_var; |
14802 | 1.26M | if ( |
14803 | 1.26M | (atom_var = atom_rule(p)) // atom |
14804 | 1.26M | ) |
14805 | 975k | { |
14806 | 975k | D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom")); |
14807 | 975k | _res = atom_var; |
14808 | 975k | goto done; |
14809 | 975k | } |
14810 | 291k | p->mark = _mark; |
14811 | 291k | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
14812 | 291k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom")); |
14813 | 291k | } |
14814 | 291k | _res = NULL; |
14815 | 1.33M | done: |
14816 | 1.33M | p->level--; |
14817 | 1.33M | return _res; |
14818 | 291k | } |
14819 | | |
14820 | | // slices: slice !',' | ','.(slice | starred_expression)+ ','? |
14821 | | static expr_ty |
14822 | | slices_rule(Parser *p) |
14823 | 18.9k | { |
14824 | 18.9k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
14825 | 0 | _Pypegen_stack_overflow(p); |
14826 | 0 | } |
14827 | 18.9k | if (p->error_indicator) { |
14828 | 0 | p->level--; |
14829 | 0 | return NULL; |
14830 | 0 | } |
14831 | 18.9k | expr_ty _res = NULL; |
14832 | 18.9k | int _mark = p->mark; |
14833 | 18.9k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14834 | 43 | p->error_indicator = 1; |
14835 | 43 | p->level--; |
14836 | 43 | return NULL; |
14837 | 43 | } |
14838 | 18.9k | int _start_lineno = p->tokens[_mark]->lineno; |
14839 | 18.9k | UNUSED(_start_lineno); // Only used by EXTRA macro |
14840 | 18.9k | int _start_col_offset = p->tokens[_mark]->col_offset; |
14841 | 18.9k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14842 | 18.9k | { // slice !',' |
14843 | 18.9k | if (p->error_indicator) { |
14844 | 0 | p->level--; |
14845 | 0 | return NULL; |
14846 | 0 | } |
14847 | 18.9k | D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','")); |
14848 | 18.9k | expr_ty a; |
14849 | 18.9k | if ( |
14850 | 18.9k | (a = slice_rule(p)) // slice |
14851 | 15.9k | && |
14852 | 15.9k | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
14853 | 18.9k | ) |
14854 | 13.7k | { |
14855 | 13.7k | D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','")); |
14856 | 13.7k | _res = a; |
14857 | 13.7k | if (_res == NULL && PyErr_Occurred()) { |
14858 | 0 | p->error_indicator = 1; |
14859 | 0 | p->level--; |
14860 | 0 | return NULL; |
14861 | 0 | } |
14862 | 13.7k | goto done; |
14863 | 13.7k | } |
14864 | 5.13k | p->mark = _mark; |
14865 | 5.13k | D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', |
14866 | 5.13k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','")); |
14867 | 5.13k | } |
14868 | 0 | { // ','.(slice | starred_expression)+ ','? |
14869 | 5.13k | if (p->error_indicator) { |
14870 | 890 | p->level--; |
14871 | 890 | return NULL; |
14872 | 890 | } |
14873 | 4.24k | D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(slice | starred_expression)+ ','?")); |
14874 | 4.24k | void *_opt_var; |
14875 | 4.24k | UNUSED(_opt_var); // Silence compiler warnings |
14876 | 4.24k | asdl_expr_seq* a; |
14877 | 4.24k | if ( |
14878 | 4.24k | (a = (asdl_expr_seq*)_gather_64_rule(p)) // ','.(slice | starred_expression)+ |
14879 | 2.34k | && |
14880 | 2.34k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
14881 | 4.24k | ) |
14882 | 2.14k | { |
14883 | 2.14k | D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(slice | starred_expression)+ ','?")); |
14884 | 2.14k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14885 | 2.14k | if (_token == NULL) { |
14886 | 0 | p->level--; |
14887 | 0 | return NULL; |
14888 | 0 | } |
14889 | 2.14k | int _end_lineno = _token->end_lineno; |
14890 | 2.14k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14891 | 2.14k | int _end_col_offset = _token->end_col_offset; |
14892 | 2.14k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14893 | 2.14k | _res = _PyAST_Tuple ( a , Load , EXTRA ); |
14894 | 2.14k | if (_res == NULL && PyErr_Occurred()) { |
14895 | 0 | p->error_indicator = 1; |
14896 | 0 | p->level--; |
14897 | 0 | return NULL; |
14898 | 0 | } |
14899 | 2.14k | goto done; |
14900 | 2.14k | } |
14901 | 2.10k | p->mark = _mark; |
14902 | 2.10k | D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', |
14903 | 2.10k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(slice | starred_expression)+ ','?")); |
14904 | 2.10k | } |
14905 | 2.10k | _res = NULL; |
14906 | 18.0k | done: |
14907 | 18.0k | p->level--; |
14908 | 18.0k | return _res; |
14909 | 2.10k | } |
14910 | | |
14911 | | // slice: expression? ':' expression? [':' expression?] | named_expression |
14912 | | static expr_ty |
14913 | | slice_rule(Parser *p) |
14914 | 38.9k | { |
14915 | 38.9k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
14916 | 1 | _Pypegen_stack_overflow(p); |
14917 | 1 | } |
14918 | 38.9k | if (p->error_indicator) { |
14919 | 1 | p->level--; |
14920 | 1 | return NULL; |
14921 | 1 | } |
14922 | 38.9k | expr_ty _res = NULL; |
14923 | 38.9k | int _mark = p->mark; |
14924 | 38.9k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
14925 | 15 | p->error_indicator = 1; |
14926 | 15 | p->level--; |
14927 | 15 | return NULL; |
14928 | 15 | } |
14929 | 38.9k | int _start_lineno = p->tokens[_mark]->lineno; |
14930 | 38.9k | UNUSED(_start_lineno); // Only used by EXTRA macro |
14931 | 38.9k | int _start_col_offset = p->tokens[_mark]->col_offset; |
14932 | 38.9k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
14933 | 38.9k | { // expression? ':' expression? [':' expression?] |
14934 | 38.9k | if (p->error_indicator) { |
14935 | 0 | p->level--; |
14936 | 0 | return NULL; |
14937 | 0 | } |
14938 | 38.9k | D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
14939 | 38.9k | Token * _literal; |
14940 | 38.9k | void *a; |
14941 | 38.9k | void *b; |
14942 | 38.9k | void *c; |
14943 | 38.9k | if ( |
14944 | 38.9k | (a = expression_rule(p), !p->error_indicator) // expression? |
14945 | 38.2k | && |
14946 | 38.2k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
14947 | 13.9k | && |
14948 | 13.9k | (b = expression_rule(p), !p->error_indicator) // expression? |
14949 | 13.7k | && |
14950 | 13.7k | (c = _tmp_65_rule(p), !p->error_indicator) // [':' expression?] |
14951 | 38.9k | ) |
14952 | 13.4k | { |
14953 | 13.4k | D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
14954 | 13.4k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
14955 | 13.4k | if (_token == NULL) { |
14956 | 0 | p->level--; |
14957 | 0 | return NULL; |
14958 | 0 | } |
14959 | 13.4k | int _end_lineno = _token->end_lineno; |
14960 | 13.4k | UNUSED(_end_lineno); // Only used by EXTRA macro |
14961 | 13.4k | int _end_col_offset = _token->end_col_offset; |
14962 | 13.4k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
14963 | 13.4k | _res = _PyAST_Slice ( a , b , c , EXTRA ); |
14964 | 13.4k | if (_res == NULL && PyErr_Occurred()) { |
14965 | 0 | p->error_indicator = 1; |
14966 | 0 | p->level--; |
14967 | 0 | return NULL; |
14968 | 0 | } |
14969 | 13.4k | goto done; |
14970 | 13.4k | } |
14971 | 25.4k | p->mark = _mark; |
14972 | 25.4k | D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', |
14973 | 25.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
14974 | 25.4k | } |
14975 | 0 | { // named_expression |
14976 | 25.4k | if (p->error_indicator) { |
14977 | 1.07k | p->level--; |
14978 | 1.07k | return NULL; |
14979 | 1.07k | } |
14980 | 24.3k | D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); |
14981 | 24.3k | expr_ty a; |
14982 | 24.3k | if ( |
14983 | 24.3k | (a = named_expression_rule(p)) // named_expression |
14984 | 24.3k | ) |
14985 | 19.0k | { |
14986 | 19.0k | D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); |
14987 | 19.0k | _res = a; |
14988 | 19.0k | if (_res == NULL && PyErr_Occurred()) { |
14989 | 0 | p->error_indicator = 1; |
14990 | 0 | p->level--; |
14991 | 0 | return NULL; |
14992 | 0 | } |
14993 | 19.0k | goto done; |
14994 | 19.0k | } |
14995 | 5.25k | p->mark = _mark; |
14996 | 5.25k | D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', |
14997 | 5.25k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
14998 | 5.25k | } |
14999 | 5.25k | _res = NULL; |
15000 | 37.8k | done: |
15001 | 37.8k | p->level--; |
15002 | 37.8k | return _res; |
15003 | 5.25k | } |
15004 | | |
15005 | | // atom: |
15006 | | // | NAME |
15007 | | // | 'True' |
15008 | | // | 'False' |
15009 | | // | 'None' |
15010 | | // | &(STRING | FSTRING_START | TSTRING_START) strings |
15011 | | // | NUMBER |
15012 | | // | &'(' (tuple | group | genexp) |
15013 | | // | &'[' (list | listcomp) |
15014 | | // | &'{' (dict | set | dictcomp | setcomp) |
15015 | | // | '...' |
15016 | | static expr_ty |
15017 | | atom_rule(Parser *p) |
15018 | 1.56M | { |
15019 | 1.56M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
15020 | 0 | _Pypegen_stack_overflow(p); |
15021 | 0 | } |
15022 | 1.56M | if (p->error_indicator) { |
15023 | 0 | p->level--; |
15024 | 0 | return NULL; |
15025 | 0 | } |
15026 | 1.56M | expr_ty _res = NULL; |
15027 | 1.56M | int _mark = p->mark; |
15028 | 1.56M | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
15029 | 0 | p->error_indicator = 1; |
15030 | 0 | p->level--; |
15031 | 0 | return NULL; |
15032 | 0 | } |
15033 | 1.56M | int _start_lineno = p->tokens[_mark]->lineno; |
15034 | 1.56M | UNUSED(_start_lineno); // Only used by EXTRA macro |
15035 | 1.56M | int _start_col_offset = p->tokens[_mark]->col_offset; |
15036 | 1.56M | UNUSED(_start_col_offset); // Only used by EXTRA macro |
15037 | 1.56M | { // NAME |
15038 | 1.56M | if (p->error_indicator) { |
15039 | 0 | p->level--; |
15040 | 0 | return NULL; |
15041 | 0 | } |
15042 | 1.56M | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
15043 | 1.56M | expr_ty name_var; |
15044 | 1.56M | if ( |
15045 | 1.56M | (name_var = _PyPegen_name_token(p)) // NAME |
15046 | 1.56M | ) |
15047 | 727k | { |
15048 | 727k | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
15049 | 727k | _res = name_var; |
15050 | 727k | goto done; |
15051 | 727k | } |
15052 | 832k | p->mark = _mark; |
15053 | 832k | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
15054 | 832k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
15055 | 832k | } |
15056 | 0 | { // 'True' |
15057 | 832k | if (p->error_indicator) { |
15058 | 1 | p->level--; |
15059 | 1 | return NULL; |
15060 | 1 | } |
15061 | 832k | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); |
15062 | 832k | Token * _keyword; |
15063 | 832k | if ( |
15064 | 832k | (_keyword = _PyPegen_expect_token(p, 623)) // token='True' |
15065 | 832k | ) |
15066 | 4.16k | { |
15067 | 4.16k | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); |
15068 | 4.16k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15069 | 4.16k | if (_token == NULL) { |
15070 | 0 | p->level--; |
15071 | 0 | return NULL; |
15072 | 0 | } |
15073 | 4.16k | int _end_lineno = _token->end_lineno; |
15074 | 4.16k | UNUSED(_end_lineno); // Only used by EXTRA macro |
15075 | 4.16k | int _end_col_offset = _token->end_col_offset; |
15076 | 4.16k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15077 | 4.16k | _res = _PyAST_Constant ( Py_True , NULL , EXTRA ); |
15078 | 4.16k | if (_res == NULL && PyErr_Occurred()) { |
15079 | 0 | p->error_indicator = 1; |
15080 | 0 | p->level--; |
15081 | 0 | return NULL; |
15082 | 0 | } |
15083 | 4.16k | goto done; |
15084 | 4.16k | } |
15085 | 828k | p->mark = _mark; |
15086 | 828k | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
15087 | 828k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); |
15088 | 828k | } |
15089 | 0 | { // 'False' |
15090 | 828k | if (p->error_indicator) { |
15091 | 0 | p->level--; |
15092 | 0 | return NULL; |
15093 | 0 | } |
15094 | 828k | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); |
15095 | 828k | Token * _keyword; |
15096 | 828k | if ( |
15097 | 828k | (_keyword = _PyPegen_expect_token(p, 625)) // token='False' |
15098 | 828k | ) |
15099 | 3.13k | { |
15100 | 3.13k | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); |
15101 | 3.13k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15102 | 3.13k | if (_token == NULL) { |
15103 | 0 | p->level--; |
15104 | 0 | return NULL; |
15105 | 0 | } |
15106 | 3.13k | int _end_lineno = _token->end_lineno; |
15107 | 3.13k | UNUSED(_end_lineno); // Only used by EXTRA macro |
15108 | 3.13k | int _end_col_offset = _token->end_col_offset; |
15109 | 3.13k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15110 | 3.13k | _res = _PyAST_Constant ( Py_False , NULL , EXTRA ); |
15111 | 3.13k | if (_res == NULL && PyErr_Occurred()) { |
15112 | 0 | p->error_indicator = 1; |
15113 | 0 | p->level--; |
15114 | 0 | return NULL; |
15115 | 0 | } |
15116 | 3.13k | goto done; |
15117 | 3.13k | } |
15118 | 825k | p->mark = _mark; |
15119 | 825k | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
15120 | 825k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); |
15121 | 825k | } |
15122 | 0 | { // 'None' |
15123 | 825k | if (p->error_indicator) { |
15124 | 0 | p->level--; |
15125 | 0 | return NULL; |
15126 | 0 | } |
15127 | 825k | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); |
15128 | 825k | Token * _keyword; |
15129 | 825k | if ( |
15130 | 825k | (_keyword = _PyPegen_expect_token(p, 624)) // token='None' |
15131 | 825k | ) |
15132 | 10.6k | { |
15133 | 10.6k | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); |
15134 | 10.6k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15135 | 10.6k | if (_token == NULL) { |
15136 | 0 | p->level--; |
15137 | 0 | return NULL; |
15138 | 0 | } |
15139 | 10.6k | int _end_lineno = _token->end_lineno; |
15140 | 10.6k | UNUSED(_end_lineno); // Only used by EXTRA macro |
15141 | 10.6k | int _end_col_offset = _token->end_col_offset; |
15142 | 10.6k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15143 | 10.6k | _res = _PyAST_Constant ( Py_None , NULL , EXTRA ); |
15144 | 10.6k | if (_res == NULL && PyErr_Occurred()) { |
15145 | 0 | p->error_indicator = 1; |
15146 | 0 | p->level--; |
15147 | 0 | return NULL; |
15148 | 0 | } |
15149 | 10.6k | goto done; |
15150 | 10.6k | } |
15151 | 814k | p->mark = _mark; |
15152 | 814k | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
15153 | 814k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); |
15154 | 814k | } |
15155 | 0 | { // &(STRING | FSTRING_START | TSTRING_START) strings |
15156 | 814k | if (p->error_indicator) { |
15157 | 0 | p->level--; |
15158 | 0 | return NULL; |
15159 | 0 | } |
15160 | 814k | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&(STRING | FSTRING_START | TSTRING_START) strings")); |
15161 | 814k | expr_ty strings_var; |
15162 | 814k | if ( |
15163 | 814k | _PyPegen_lookahead(1, _tmp_42_rule, p) |
15164 | 115k | && |
15165 | 115k | (strings_var = strings_rule(p)) // strings |
15166 | 814k | ) |
15167 | 109k | { |
15168 | 109k | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&(STRING | FSTRING_START | TSTRING_START) strings")); |
15169 | 109k | _res = strings_var; |
15170 | 109k | goto done; |
15171 | 109k | } |
15172 | 705k | p->mark = _mark; |
15173 | 705k | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
15174 | 705k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&(STRING | FSTRING_START | TSTRING_START) strings")); |
15175 | 705k | } |
15176 | 0 | { // NUMBER |
15177 | 705k | if (p->error_indicator) { |
15178 | 4.14k | p->level--; |
15179 | 4.14k | return NULL; |
15180 | 4.14k | } |
15181 | 701k | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
15182 | 701k | expr_ty number_var; |
15183 | 701k | if ( |
15184 | 701k | (number_var = _PyPegen_number_token(p)) // NUMBER |
15185 | 701k | ) |
15186 | 241k | { |
15187 | 241k | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER")); |
15188 | 241k | _res = number_var; |
15189 | 241k | goto done; |
15190 | 241k | } |
15191 | 459k | p->mark = _mark; |
15192 | 459k | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
15193 | 459k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); |
15194 | 459k | } |
15195 | 0 | { // &'(' (tuple | group | genexp) |
15196 | 459k | if (p->error_indicator) { |
15197 | 11 | p->level--; |
15198 | 11 | return NULL; |
15199 | 11 | } |
15200 | 459k | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); |
15201 | 459k | void *_tmp_66_var; |
15202 | 459k | if ( |
15203 | 459k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' |
15204 | 76.0k | && |
15205 | 76.0k | (_tmp_66_var = _tmp_66_rule(p)) // tuple | group | genexp |
15206 | 459k | ) |
15207 | 52.1k | { |
15208 | 52.1k | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)")); |
15209 | 52.1k | _res = _tmp_66_var; |
15210 | 52.1k | goto done; |
15211 | 52.1k | } |
15212 | 407k | p->mark = _mark; |
15213 | 407k | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
15214 | 407k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)")); |
15215 | 407k | } |
15216 | 0 | { // &'[' (list | listcomp) |
15217 | 407k | if (p->error_indicator) { |
15218 | 7.13k | p->level--; |
15219 | 7.13k | return NULL; |
15220 | 7.13k | } |
15221 | 400k | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); |
15222 | 400k | void *_tmp_67_var; |
15223 | 400k | if ( |
15224 | 400k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' |
15225 | 47.4k | && |
15226 | 47.4k | (_tmp_67_var = _tmp_67_rule(p)) // list | listcomp |
15227 | 400k | ) |
15228 | 16.8k | { |
15229 | 16.8k | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); |
15230 | 16.8k | _res = _tmp_67_var; |
15231 | 16.8k | goto done; |
15232 | 16.8k | } |
15233 | 383k | p->mark = _mark; |
15234 | 383k | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
15235 | 383k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)")); |
15236 | 383k | } |
15237 | 0 | { // &'{' (dict | set | dictcomp | setcomp) |
15238 | 383k | if (p->error_indicator) { |
15239 | 12.1k | p->level--; |
15240 | 12.1k | return NULL; |
15241 | 12.1k | } |
15242 | 371k | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); |
15243 | 371k | void *_tmp_68_var; |
15244 | 371k | if ( |
15245 | 371k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' |
15246 | 21.8k | && |
15247 | 21.8k | (_tmp_68_var = _tmp_68_rule(p)) // dict | set | dictcomp | setcomp |
15248 | 371k | ) |
15249 | 7.82k | { |
15250 | 7.82k | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); |
15251 | 7.82k | _res = _tmp_68_var; |
15252 | 7.82k | goto done; |
15253 | 7.82k | } |
15254 | 363k | p->mark = _mark; |
15255 | 363k | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
15256 | 363k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); |
15257 | 363k | } |
15258 | 0 | { // '...' |
15259 | 363k | if (p->error_indicator) { |
15260 | 7.01k | p->level--; |
15261 | 7.01k | return NULL; |
15262 | 7.01k | } |
15263 | 356k | D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); |
15264 | 356k | Token * _literal; |
15265 | 356k | if ( |
15266 | 356k | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
15267 | 356k | ) |
15268 | 613 | { |
15269 | 613 | D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); |
15270 | 613 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15271 | 613 | if (_token == NULL) { |
15272 | 0 | p->level--; |
15273 | 0 | return NULL; |
15274 | 0 | } |
15275 | 613 | int _end_lineno = _token->end_lineno; |
15276 | 613 | UNUSED(_end_lineno); // Only used by EXTRA macro |
15277 | 613 | int _end_col_offset = _token->end_col_offset; |
15278 | 613 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15279 | 613 | _res = _PyAST_Constant ( Py_Ellipsis , NULL , EXTRA ); |
15280 | 613 | if (_res == NULL && PyErr_Occurred()) { |
15281 | 0 | p->error_indicator = 1; |
15282 | 0 | p->level--; |
15283 | 0 | return NULL; |
15284 | 0 | } |
15285 | 613 | goto done; |
15286 | 613 | } |
15287 | 355k | p->mark = _mark; |
15288 | 355k | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
15289 | 355k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
15290 | 355k | } |
15291 | 355k | _res = NULL; |
15292 | 1.53M | done: |
15293 | 1.53M | p->level--; |
15294 | 1.53M | return _res; |
15295 | 355k | } |
15296 | | |
15297 | | // group: '(' (yield_expr | named_expression) ')' | invalid_group |
15298 | | static expr_ty |
15299 | | group_rule(Parser *p) |
15300 | 31.8k | { |
15301 | 31.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
15302 | 0 | _Pypegen_stack_overflow(p); |
15303 | 0 | } |
15304 | 31.8k | if (p->error_indicator) { |
15305 | 0 | p->level--; |
15306 | 0 | return NULL; |
15307 | 0 | } |
15308 | 31.8k | expr_ty _res = NULL; |
15309 | 31.8k | int _mark = p->mark; |
15310 | 31.8k | { // '(' (yield_expr | named_expression) ')' |
15311 | 31.8k | if (p->error_indicator) { |
15312 | 0 | p->level--; |
15313 | 0 | return NULL; |
15314 | 0 | } |
15315 | 31.8k | D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
15316 | 31.8k | Token * _literal; |
15317 | 31.8k | Token * _literal_1; |
15318 | 31.8k | void *a; |
15319 | 31.8k | if ( |
15320 | 31.8k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
15321 | 31.8k | && |
15322 | 31.8k | (a = _tmp_69_rule(p)) // yield_expr | named_expression |
15323 | 23.3k | && |
15324 | 23.3k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
15325 | 31.8k | ) |
15326 | 10.2k | { |
15327 | 10.2k | D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
15328 | 10.2k | _res = a; |
15329 | 10.2k | if (_res == NULL && PyErr_Occurred()) { |
15330 | 0 | p->error_indicator = 1; |
15331 | 0 | p->level--; |
15332 | 0 | return NULL; |
15333 | 0 | } |
15334 | 10.2k | goto done; |
15335 | 10.2k | } |
15336 | 21.6k | p->mark = _mark; |
15337 | 21.6k | D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ', |
15338 | 21.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
15339 | 21.6k | } |
15340 | 21.6k | if (p->call_invalid_rules) { // invalid_group |
15341 | 8.00k | if (p->error_indicator) { |
15342 | 212 | p->level--; |
15343 | 212 | return NULL; |
15344 | 212 | } |
15345 | 7.79k | D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group")); |
15346 | 7.79k | void *invalid_group_var; |
15347 | 7.79k | if ( |
15348 | 7.79k | (invalid_group_var = invalid_group_rule(p)) // invalid_group |
15349 | 7.79k | ) |
15350 | 0 | { |
15351 | 0 | D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group")); |
15352 | 0 | _res = invalid_group_var; |
15353 | 0 | goto done; |
15354 | 0 | } |
15355 | 7.79k | p->mark = _mark; |
15356 | 7.79k | D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ', |
15357 | 7.79k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group")); |
15358 | 7.79k | } |
15359 | 21.3k | _res = NULL; |
15360 | 31.6k | done: |
15361 | 31.6k | p->level--; |
15362 | 31.6k | return _res; |
15363 | 21.3k | } |
15364 | | |
15365 | | // lambdef: 'lambda' lambda_params? ':' expression |
15366 | | static expr_ty |
15367 | | lambdef_rule(Parser *p) |
15368 | 300k | { |
15369 | 300k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
15370 | 0 | _Pypegen_stack_overflow(p); |
15371 | 0 | } |
15372 | 300k | if (p->error_indicator) { |
15373 | 0 | p->level--; |
15374 | 0 | return NULL; |
15375 | 0 | } |
15376 | 300k | expr_ty _res = NULL; |
15377 | 300k | int _mark = p->mark; |
15378 | 300k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
15379 | 0 | p->error_indicator = 1; |
15380 | 0 | p->level--; |
15381 | 0 | return NULL; |
15382 | 0 | } |
15383 | 300k | int _start_lineno = p->tokens[_mark]->lineno; |
15384 | 300k | UNUSED(_start_lineno); // Only used by EXTRA macro |
15385 | 300k | int _start_col_offset = p->tokens[_mark]->col_offset; |
15386 | 300k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
15387 | 300k | { // 'lambda' lambda_params? ':' expression |
15388 | 300k | if (p->error_indicator) { |
15389 | 0 | p->level--; |
15390 | 0 | return NULL; |
15391 | 0 | } |
15392 | 300k | D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression")); |
15393 | 300k | Token * _keyword; |
15394 | 300k | Token * _literal; |
15395 | 300k | void *a; |
15396 | 300k | expr_ty b; |
15397 | 300k | if ( |
15398 | 300k | (_keyword = _PyPegen_expect_token(p, 622)) // token='lambda' |
15399 | 6.70k | && |
15400 | 6.70k | (a = lambda_params_rule(p), !p->error_indicator) // lambda_params? |
15401 | 6.04k | && |
15402 | 6.04k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
15403 | 3.64k | && |
15404 | 3.64k | (b = expression_rule(p)) // expression |
15405 | 300k | ) |
15406 | 2.73k | { |
15407 | 2.73k | D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression")); |
15408 | 2.73k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
15409 | 2.73k | if (_token == NULL) { |
15410 | 0 | p->level--; |
15411 | 0 | return NULL; |
15412 | 0 | } |
15413 | 2.73k | int _end_lineno = _token->end_lineno; |
15414 | 2.73k | UNUSED(_end_lineno); // Only used by EXTRA macro |
15415 | 2.73k | int _end_col_offset = _token->end_col_offset; |
15416 | 2.73k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
15417 | 2.73k | _res = _PyAST_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA ); |
15418 | 2.73k | if (_res == NULL && PyErr_Occurred()) { |
15419 | 0 | p->error_indicator = 1; |
15420 | 0 | p->level--; |
15421 | 0 | return NULL; |
15422 | 0 | } |
15423 | 2.73k | goto done; |
15424 | 2.73k | } |
15425 | 297k | p->mark = _mark; |
15426 | 297k | D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ', |
15427 | 297k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression")); |
15428 | 297k | } |
15429 | 297k | _res = NULL; |
15430 | 300k | done: |
15431 | 300k | p->level--; |
15432 | 300k | return _res; |
15433 | 297k | } |
15434 | | |
15435 | | // lambda_params: invalid_lambda_parameters | lambda_parameters |
15436 | | static arguments_ty |
15437 | | lambda_params_rule(Parser *p) |
15438 | 11.7k | { |
15439 | 11.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
15440 | 0 | _Pypegen_stack_overflow(p); |
15441 | 0 | } |
15442 | 11.7k | if (p->error_indicator) { |
15443 | 0 | p->level--; |
15444 | 0 | return NULL; |
15445 | 0 | } |
15446 | 11.7k | arguments_ty _res = NULL; |
15447 | 11.7k | int _mark = p->mark; |
15448 | 11.7k | if (p->call_invalid_rules) { // invalid_lambda_parameters |
15449 | 7.21k | if (p->error_indicator) { |
15450 | 0 | p->level--; |
15451 | 0 | return NULL; |
15452 | 0 | } |
15453 | 7.21k | D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters")); |
15454 | 7.21k | void *invalid_lambda_parameters_var; |
15455 | 7.21k | if ( |
15456 | 7.21k | (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters |
15457 | 7.21k | ) |
15458 | 0 | { |
15459 | 0 | D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters")); |
15460 | 0 | _res = invalid_lambda_parameters_var; |
15461 | 0 | goto done; |
15462 | 0 | } |
15463 | 7.21k | p->mark = _mark; |
15464 | 7.21k | D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ', |
15465 | 7.21k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters")); |
15466 | 7.21k | } |
15467 | 11.7k | { // lambda_parameters |
15468 | 11.7k | if (p->error_indicator) { |
15469 | 761 | p->level--; |
15470 | 761 | return NULL; |
15471 | 761 | } |
15472 | 11.0k | D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters")); |
15473 | 11.0k | arguments_ty lambda_parameters_var; |
15474 | 11.0k | if ( |
15475 | 11.0k | (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters |
15476 | 11.0k | ) |
15477 | 6.17k | { |
15478 | 6.17k | D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters")); |
15479 | 6.17k | _res = lambda_parameters_var; |
15480 | 6.17k | goto done; |
15481 | 6.17k | } |
15482 | 4.85k | p->mark = _mark; |
15483 | 4.85k | D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ', |
15484 | 4.85k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters")); |
15485 | 4.85k | } |
15486 | 4.85k | _res = NULL; |
15487 | 11.0k | done: |
15488 | 11.0k | p->level--; |
15489 | 11.0k | return _res; |
15490 | 4.85k | } |
15491 | | |
15492 | | // lambda_parameters: |
15493 | | // | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? |
15494 | | // | lambda_slash_with_default lambda_param_with_default* lambda_star_etc? |
15495 | | // | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? |
15496 | | // | lambda_param_with_default+ lambda_star_etc? |
15497 | | // | lambda_star_etc |
15498 | | static arguments_ty |
15499 | | lambda_parameters_rule(Parser *p) |
15500 | 11.0k | { |
15501 | 11.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
15502 | 0 | _Pypegen_stack_overflow(p); |
15503 | 0 | } |
15504 | 11.0k | if (p->error_indicator) { |
15505 | 0 | p->level--; |
15506 | 0 | return NULL; |
15507 | 0 | } |
15508 | 11.0k | arguments_ty _res = NULL; |
15509 | 11.0k | int _mark = p->mark; |
15510 | 11.0k | { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? |
15511 | 11.0k | if (p->error_indicator) { |
15512 | 0 | p->level--; |
15513 | 0 | return NULL; |
15514 | 0 | } |
15515 | 11.0k | 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?")); |
15516 | 11.0k | asdl_arg_seq* a; |
15517 | 11.0k | asdl_arg_seq* b; |
15518 | 11.0k | asdl_seq * c; |
15519 | 11.0k | void *d; |
15520 | 11.0k | if ( |
15521 | 11.0k | (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default |
15522 | 518 | && |
15523 | 518 | (b = (asdl_arg_seq*)_loop0_70_rule(p)) // lambda_param_no_default* |
15524 | 518 | && |
15525 | 518 | (c = _loop0_71_rule(p)) // lambda_param_with_default* |
15526 | 515 | && |
15527 | 515 | (d = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc? |
15528 | 11.0k | ) |
15529 | 452 | { |
15530 | 452 | 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?")); |
15531 | 452 | _res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , a , NULL , b , c , d ) ); |
15532 | 452 | if (_res == NULL && PyErr_Occurred()) { |
15533 | 0 | p->error_indicator = 1; |
15534 | 0 | p->level--; |
15535 | 0 | return NULL; |
15536 | 0 | } |
15537 | 452 | goto done; |
15538 | 452 | } |
15539 | 10.5k | p->mark = _mark; |
15540 | 10.5k | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
15541 | 10.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?")); |
15542 | 10.5k | } |
15543 | 0 | { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc? |
15544 | 10.5k | if (p->error_indicator) { |
15545 | 82 | p->level--; |
15546 | 82 | return NULL; |
15547 | 82 | } |
15548 | 10.4k | 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?")); |
15549 | 10.4k | SlashWithDefault* a; |
15550 | 10.4k | asdl_seq * b; |
15551 | 10.4k | void *c; |
15552 | 10.4k | if ( |
15553 | 10.4k | (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default |
15554 | 1.27k | && |
15555 | 1.27k | (b = _loop0_71_rule(p)) // lambda_param_with_default* |
15556 | 1.27k | && |
15557 | 1.27k | (c = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc? |
15558 | 10.4k | ) |
15559 | 1.14k | { |
15560 | 1.14k | 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?")); |
15561 | 1.14k | _res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ) ); |
15562 | 1.14k | if (_res == NULL && PyErr_Occurred()) { |
15563 | 0 | p->error_indicator = 1; |
15564 | 0 | p->level--; |
15565 | 0 | return NULL; |
15566 | 0 | } |
15567 | 1.14k | goto done; |
15568 | 1.14k | } |
15569 | 9.34k | p->mark = _mark; |
15570 | 9.34k | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
15571 | 9.34k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?")); |
15572 | 9.34k | } |
15573 | 0 | { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? |
15574 | 9.34k | if (p->error_indicator) { |
15575 | 323 | p->level--; |
15576 | 323 | return NULL; |
15577 | 323 | } |
15578 | 9.02k | 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?")); |
15579 | 9.02k | asdl_arg_seq* a; |
15580 | 9.02k | asdl_seq * b; |
15581 | 9.02k | void *c; |
15582 | 9.02k | if ( |
15583 | 9.02k | (a = (asdl_arg_seq*)_loop1_72_rule(p)) // lambda_param_no_default+ |
15584 | 1.45k | && |
15585 | 1.45k | (b = _loop0_71_rule(p)) // lambda_param_with_default* |
15586 | 1.45k | && |
15587 | 1.45k | (c = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc? |
15588 | 9.02k | ) |
15589 | 1.44k | { |
15590 | 1.44k | 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?")); |
15591 | 1.44k | _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); |
15592 | 1.44k | if (_res == NULL && PyErr_Occurred()) { |
15593 | 0 | p->error_indicator = 1; |
15594 | 0 | p->level--; |
15595 | 0 | return NULL; |
15596 | 0 | } |
15597 | 1.44k | goto done; |
15598 | 1.44k | } |
15599 | 7.58k | p->mark = _mark; |
15600 | 7.58k | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
15601 | 7.58k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?")); |
15602 | 7.58k | } |
15603 | 0 | { // lambda_param_with_default+ lambda_star_etc? |
15604 | 7.58k | if (p->error_indicator) { |
15605 | 12 | p->level--; |
15606 | 12 | return NULL; |
15607 | 12 | } |
15608 | 7.57k | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); |
15609 | 7.57k | asdl_seq * a; |
15610 | 7.57k | void *b; |
15611 | 7.57k | if ( |
15612 | 7.57k | (a = _loop1_73_rule(p)) // lambda_param_with_default+ |
15613 | 830 | && |
15614 | 830 | (b = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc? |
15615 | 7.57k | ) |
15616 | 828 | { |
15617 | 828 | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); |
15618 | 828 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); |
15619 | 828 | if (_res == NULL && PyErr_Occurred()) { |
15620 | 0 | p->error_indicator = 1; |
15621 | 0 | p->level--; |
15622 | 0 | return NULL; |
15623 | 0 | } |
15624 | 828 | goto done; |
15625 | 828 | } |
15626 | 6.74k | p->mark = _mark; |
15627 | 6.74k | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
15628 | 6.74k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?")); |
15629 | 6.74k | } |
15630 | 0 | { // lambda_star_etc |
15631 | 6.74k | if (p->error_indicator) { |
15632 | 2 | p->level--; |
15633 | 2 | return NULL; |
15634 | 2 | } |
15635 | 6.74k | D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc")); |
15636 | 6.74k | StarEtc* a; |
15637 | 6.74k | if ( |
15638 | 6.74k | (a = lambda_star_etc_rule(p)) // lambda_star_etc |
15639 | 6.74k | ) |
15640 | 2.31k | { |
15641 | 2.31k | D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc")); |
15642 | 2.31k | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); |
15643 | 2.31k | if (_res == NULL && PyErr_Occurred()) { |
15644 | 0 | p->error_indicator = 1; |
15645 | 0 | p->level--; |
15646 | 0 | return NULL; |
15647 | 0 | } |
15648 | 2.31k | goto done; |
15649 | 2.31k | } |
15650 | 4.43k | p->mark = _mark; |
15651 | 4.43k | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
15652 | 4.43k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc")); |
15653 | 4.43k | } |
15654 | 4.43k | _res = NULL; |
15655 | 10.6k | done: |
15656 | 10.6k | p->level--; |
15657 | 10.6k | return _res; |
15658 | 4.43k | } |
15659 | | |
15660 | | // lambda_slash_no_default: |
15661 | | // | lambda_param_no_default+ '/' ',' |
15662 | | // | lambda_param_no_default+ '/' &':' |
15663 | | static asdl_arg_seq* |
15664 | | lambda_slash_no_default_rule(Parser *p) |
15665 | 31.6k | { |
15666 | 31.6k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
15667 | 0 | _Pypegen_stack_overflow(p); |
15668 | 0 | } |
15669 | 31.6k | if (p->error_indicator) { |
15670 | 0 | p->level--; |
15671 | 0 | return NULL; |
15672 | 0 | } |
15673 | 31.6k | asdl_arg_seq* _res = NULL; |
15674 | 31.6k | int _mark = p->mark; |
15675 | 31.6k | { // lambda_param_no_default+ '/' ',' |
15676 | 31.6k | if (p->error_indicator) { |
15677 | 0 | p->level--; |
15678 | 0 | return NULL; |
15679 | 0 | } |
15680 | 31.6k | D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
15681 | 31.6k | Token * _literal; |
15682 | 31.6k | Token * _literal_1; |
15683 | 31.6k | asdl_arg_seq* a; |
15684 | 31.6k | if ( |
15685 | 31.6k | (a = (asdl_arg_seq*)_loop1_72_rule(p)) // lambda_param_no_default+ |
15686 | 5.55k | && |
15687 | 5.55k | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
15688 | 1.67k | && |
15689 | 1.67k | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
15690 | 31.6k | ) |
15691 | 611 | { |
15692 | 611 | D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
15693 | 611 | _res = a; |
15694 | 611 | if (_res == NULL && PyErr_Occurred()) { |
15695 | 0 | p->error_indicator = 1; |
15696 | 0 | p->level--; |
15697 | 0 | return NULL; |
15698 | 0 | } |
15699 | 611 | goto done; |
15700 | 611 | } |
15701 | 30.9k | p->mark = _mark; |
15702 | 30.9k | D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
15703 | 30.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
15704 | 30.9k | } |
15705 | 0 | { // lambda_param_no_default+ '/' &':' |
15706 | 30.9k | if (p->error_indicator) { |
15707 | 18 | p->level--; |
15708 | 18 | return NULL; |
15709 | 18 | } |
15710 | 30.9k | D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
15711 | 30.9k | Token * _literal; |
15712 | 30.9k | asdl_arg_seq* a; |
15713 | 30.9k | if ( |
15714 | 30.9k | (a = (asdl_arg_seq*)_loop1_72_rule(p)) // lambda_param_no_default+ |
15715 | 4.94k | && |
15716 | 4.94k | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
15717 | 1.05k | && |
15718 | 1.05k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
15719 | 30.9k | ) |
15720 | 1.03k | { |
15721 | 1.03k | D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
15722 | 1.03k | _res = a; |
15723 | 1.03k | if (_res == NULL && PyErr_Occurred()) { |
15724 | 0 | p->error_indicator = 1; |
15725 | 0 | p->level--; |
15726 | 0 | return NULL; |
15727 | 0 | } |
15728 | 1.03k | goto done; |
15729 | 1.03k | } |
15730 | 29.9k | p->mark = _mark; |
15731 | 29.9k | D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
15732 | 29.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
15733 | 29.9k | } |
15734 | 29.9k | _res = NULL; |
15735 | 31.5k | done: |
15736 | 31.5k | p->level--; |
15737 | 31.5k | return _res; |
15738 | 29.9k | } |
15739 | | |
15740 | | // lambda_slash_with_default: |
15741 | | // | lambda_param_no_default* lambda_param_with_default+ '/' ',' |
15742 | | // | lambda_param_no_default* lambda_param_with_default+ '/' &':' |
15743 | | static SlashWithDefault* |
15744 | | lambda_slash_with_default_rule(Parser *p) |
15745 | 30.3k | { |
15746 | 30.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
15747 | 0 | _Pypegen_stack_overflow(p); |
15748 | 0 | } |
15749 | 30.3k | if (p->error_indicator) { |
15750 | 0 | p->level--; |
15751 | 0 | return NULL; |
15752 | 0 | } |
15753 | 30.3k | SlashWithDefault* _res = NULL; |
15754 | 30.3k | int _mark = p->mark; |
15755 | 30.3k | { // lambda_param_no_default* lambda_param_with_default+ '/' ',' |
15756 | 30.3k | if (p->error_indicator) { |
15757 | 0 | p->level--; |
15758 | 0 | return NULL; |
15759 | 0 | } |
15760 | 30.3k | 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+ '/' ','")); |
15761 | 30.3k | Token * _literal; |
15762 | 30.3k | Token * _literal_1; |
15763 | 30.3k | asdl_seq * a; |
15764 | 30.3k | asdl_seq * b; |
15765 | 30.3k | if ( |
15766 | 30.3k | (a = _loop0_70_rule(p)) // lambda_param_no_default* |
15767 | 30.3k | && |
15768 | 30.3k | (b = _loop1_73_rule(p)) // lambda_param_with_default+ |
15769 | 6.72k | && |
15770 | 6.72k | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
15771 | 3.66k | && |
15772 | 3.66k | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
15773 | 30.3k | ) |
15774 | 2.28k | { |
15775 | 2.28k | 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+ '/' ','")); |
15776 | 2.28k | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b ); |
15777 | 2.28k | if (_res == NULL && PyErr_Occurred()) { |
15778 | 0 | p->error_indicator = 1; |
15779 | 0 | p->level--; |
15780 | 0 | return NULL; |
15781 | 0 | } |
15782 | 2.28k | goto done; |
15783 | 2.28k | } |
15784 | 28.0k | p->mark = _mark; |
15785 | 28.0k | D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
15786 | 28.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','")); |
15787 | 28.0k | } |
15788 | 0 | { // lambda_param_no_default* lambda_param_with_default+ '/' &':' |
15789 | 28.0k | if (p->error_indicator) { |
15790 | 550 | p->level--; |
15791 | 550 | return NULL; |
15792 | 550 | } |
15793 | 27.4k | 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+ '/' &':'")); |
15794 | 27.4k | Token * _literal; |
15795 | 27.4k | asdl_seq * a; |
15796 | 27.4k | asdl_seq * b; |
15797 | 27.4k | if ( |
15798 | 27.4k | (a = _loop0_70_rule(p)) // lambda_param_no_default* |
15799 | 27.4k | && |
15800 | 27.4k | (b = _loop1_73_rule(p)) // lambda_param_with_default+ |
15801 | 4.43k | && |
15802 | 4.43k | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
15803 | 1.38k | && |
15804 | 1.38k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
15805 | 27.4k | ) |
15806 | 1.35k | { |
15807 | 1.35k | 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+ '/' &':'")); |
15808 | 1.35k | _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b ); |
15809 | 1.35k | if (_res == NULL && PyErr_Occurred()) { |
15810 | 0 | p->error_indicator = 1; |
15811 | 0 | p->level--; |
15812 | 0 | return NULL; |
15813 | 0 | } |
15814 | 1.35k | goto done; |
15815 | 1.35k | } |
15816 | 26.1k | p->mark = _mark; |
15817 | 26.1k | D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
15818 | 26.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'")); |
15819 | 26.1k | } |
15820 | 26.1k | _res = NULL; |
15821 | 29.7k | done: |
15822 | 29.7k | p->level--; |
15823 | 29.7k | return _res; |
15824 | 26.1k | } |
15825 | | |
15826 | | // lambda_star_etc: |
15827 | | // | invalid_lambda_star_etc |
15828 | | // | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? |
15829 | | // | '*' ',' lambda_param_maybe_default+ lambda_kwds? |
15830 | | // | lambda_kwds |
15831 | | static StarEtc* |
15832 | | lambda_star_etc_rule(Parser *p) |
15833 | 10.8k | { |
15834 | 10.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
15835 | 0 | _Pypegen_stack_overflow(p); |
15836 | 0 | } |
15837 | 10.8k | if (p->error_indicator) { |
15838 | 195 | p->level--; |
15839 | 195 | return NULL; |
15840 | 195 | } |
15841 | 10.6k | StarEtc* _res = NULL; |
15842 | 10.6k | int _mark = p->mark; |
15843 | 10.6k | if (p->call_invalid_rules) { // invalid_lambda_star_etc |
15844 | 6.45k | if (p->error_indicator) { |
15845 | 0 | p->level--; |
15846 | 0 | return NULL; |
15847 | 0 | } |
15848 | 6.45k | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc")); |
15849 | 6.45k | void *invalid_lambda_star_etc_var; |
15850 | 6.45k | if ( |
15851 | 6.45k | (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc |
15852 | 6.45k | ) |
15853 | 0 | { |
15854 | 0 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc")); |
15855 | 0 | _res = invalid_lambda_star_etc_var; |
15856 | 0 | goto done; |
15857 | 0 | } |
15858 | 6.45k | p->mark = _mark; |
15859 | 6.45k | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
15860 | 6.45k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc")); |
15861 | 6.45k | } |
15862 | 10.6k | { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? |
15863 | 10.6k | if (p->error_indicator) { |
15864 | 15 | p->level--; |
15865 | 15 | return NULL; |
15866 | 15 | } |
15867 | 10.6k | 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?")); |
15868 | 10.6k | Token * _literal; |
15869 | 10.6k | arg_ty a; |
15870 | 10.6k | asdl_seq * b; |
15871 | 10.6k | void *c; |
15872 | 10.6k | if ( |
15873 | 10.6k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
15874 | 4.04k | && |
15875 | 4.04k | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
15876 | 1.81k | && |
15877 | 1.81k | (b = _loop0_74_rule(p)) // lambda_param_maybe_default* |
15878 | 1.81k | && |
15879 | 1.81k | (c = lambda_kwds_rule(p), !p->error_indicator) // lambda_kwds? |
15880 | 10.6k | ) |
15881 | 1.79k | { |
15882 | 1.79k | 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?")); |
15883 | 1.79k | _res = _PyPegen_star_etc ( p , a , b , c ); |
15884 | 1.79k | if (_res == NULL && PyErr_Occurred()) { |
15885 | 0 | p->error_indicator = 1; |
15886 | 0 | p->level--; |
15887 | 0 | return NULL; |
15888 | 0 | } |
15889 | 1.79k | goto done; |
15890 | 1.79k | } |
15891 | 8.81k | p->mark = _mark; |
15892 | 8.81k | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
15893 | 8.81k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?")); |
15894 | 8.81k | } |
15895 | 0 | { // '*' ',' lambda_param_maybe_default+ lambda_kwds? |
15896 | 8.81k | if (p->error_indicator) { |
15897 | 23 | p->level--; |
15898 | 23 | return NULL; |
15899 | 23 | } |
15900 | 8.79k | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); |
15901 | 8.79k | Token * _literal; |
15902 | 8.79k | Token * _literal_1; |
15903 | 8.79k | asdl_seq * b; |
15904 | 8.79k | void *c; |
15905 | 8.79k | if ( |
15906 | 8.79k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
15907 | 2.22k | && |
15908 | 2.22k | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
15909 | 2.13k | && |
15910 | 2.13k | (b = _loop1_75_rule(p)) // lambda_param_maybe_default+ |
15911 | 222 | && |
15912 | 222 | (c = lambda_kwds_rule(p), !p->error_indicator) // lambda_kwds? |
15913 | 8.79k | ) |
15914 | 221 | { |
15915 | 221 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); |
15916 | 221 | _res = _PyPegen_star_etc ( p , NULL , b , c ); |
15917 | 221 | if (_res == NULL && PyErr_Occurred()) { |
15918 | 0 | p->error_indicator = 1; |
15919 | 0 | p->level--; |
15920 | 0 | return NULL; |
15921 | 0 | } |
15922 | 221 | goto done; |
15923 | 221 | } |
15924 | 8.57k | p->mark = _mark; |
15925 | 8.57k | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
15926 | 8.57k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?")); |
15927 | 8.57k | } |
15928 | 0 | { // lambda_kwds |
15929 | 8.57k | if (p->error_indicator) { |
15930 | 236 | p->level--; |
15931 | 236 | return NULL; |
15932 | 236 | } |
15933 | 8.33k | D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds")); |
15934 | 8.33k | arg_ty a; |
15935 | 8.33k | if ( |
15936 | 8.33k | (a = lambda_kwds_rule(p)) // lambda_kwds |
15937 | 8.33k | ) |
15938 | 402 | { |
15939 | 402 | D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds")); |
15940 | 402 | _res = _PyPegen_star_etc ( p , NULL , NULL , a ); |
15941 | 402 | if (_res == NULL && PyErr_Occurred()) { |
15942 | 0 | p->error_indicator = 1; |
15943 | 0 | p->level--; |
15944 | 0 | return NULL; |
15945 | 0 | } |
15946 | 402 | goto done; |
15947 | 402 | } |
15948 | 7.93k | p->mark = _mark; |
15949 | 7.93k | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
15950 | 7.93k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds")); |
15951 | 7.93k | } |
15952 | 7.93k | _res = NULL; |
15953 | 10.3k | done: |
15954 | 10.3k | p->level--; |
15955 | 10.3k | return _res; |
15956 | 7.93k | } |
15957 | | |
15958 | | // lambda_kwds: invalid_lambda_kwds | '**' lambda_param_no_default |
15959 | | static arg_ty |
15960 | | lambda_kwds_rule(Parser *p) |
15961 | 10.3k | { |
15962 | 10.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
15963 | 0 | _Pypegen_stack_overflow(p); |
15964 | 0 | } |
15965 | 10.3k | if (p->error_indicator) { |
15966 | 20 | p->level--; |
15967 | 20 | return NULL; |
15968 | 20 | } |
15969 | 10.3k | arg_ty _res = NULL; |
15970 | 10.3k | int _mark = p->mark; |
15971 | 10.3k | if (p->call_invalid_rules) { // invalid_lambda_kwds |
15972 | 6.43k | if (p->error_indicator) { |
15973 | 0 | p->level--; |
15974 | 0 | return NULL; |
15975 | 0 | } |
15976 | 6.43k | D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_kwds")); |
15977 | 6.43k | void *invalid_lambda_kwds_var; |
15978 | 6.43k | if ( |
15979 | 6.43k | (invalid_lambda_kwds_var = invalid_lambda_kwds_rule(p)) // invalid_lambda_kwds |
15980 | 6.43k | ) |
15981 | 0 | { |
15982 | 0 | D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_kwds")); |
15983 | 0 | _res = invalid_lambda_kwds_var; |
15984 | 0 | goto done; |
15985 | 0 | } |
15986 | 6.43k | p->mark = _mark; |
15987 | 6.43k | D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ', |
15988 | 6.43k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_kwds")); |
15989 | 6.43k | } |
15990 | 10.3k | { // '**' lambda_param_no_default |
15991 | 10.3k | if (p->error_indicator) { |
15992 | 5 | p->level--; |
15993 | 5 | return NULL; |
15994 | 5 | } |
15995 | 10.3k | D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default")); |
15996 | 10.3k | Token * _literal; |
15997 | 10.3k | arg_ty a; |
15998 | 10.3k | if ( |
15999 | 10.3k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
16000 | 441 | && |
16001 | 441 | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
16002 | 10.3k | ) |
16003 | 402 | { |
16004 | 402 | D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default")); |
16005 | 402 | _res = a; |
16006 | 402 | if (_res == NULL && PyErr_Occurred()) { |
16007 | 0 | p->error_indicator = 1; |
16008 | 0 | p->level--; |
16009 | 0 | return NULL; |
16010 | 0 | } |
16011 | 402 | goto done; |
16012 | 402 | } |
16013 | 9.94k | p->mark = _mark; |
16014 | 9.94k | D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ', |
16015 | 9.94k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default")); |
16016 | 9.94k | } |
16017 | 9.94k | _res = NULL; |
16018 | 10.3k | done: |
16019 | 10.3k | p->level--; |
16020 | 10.3k | return _res; |
16021 | 9.94k | } |
16022 | | |
16023 | | // lambda_param_no_default: lambda_param ',' | lambda_param &':' |
16024 | | static arg_ty |
16025 | | lambda_param_no_default_rule(Parser *p) |
16026 | 265k | { |
16027 | 265k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16028 | 0 | _Pypegen_stack_overflow(p); |
16029 | 0 | } |
16030 | 265k | if (p->error_indicator) { |
16031 | 0 | p->level--; |
16032 | 0 | return NULL; |
16033 | 0 | } |
16034 | 265k | arg_ty _res = NULL; |
16035 | 265k | int _mark = p->mark; |
16036 | 265k | { // lambda_param ',' |
16037 | 265k | if (p->error_indicator) { |
16038 | 0 | p->level--; |
16039 | 0 | return NULL; |
16040 | 0 | } |
16041 | 265k | D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','")); |
16042 | 265k | Token * _literal; |
16043 | 265k | arg_ty a; |
16044 | 265k | if ( |
16045 | 265k | (a = lambda_param_rule(p)) // lambda_param |
16046 | 154k | && |
16047 | 154k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
16048 | 265k | ) |
16049 | 101k | { |
16050 | 101k | D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','")); |
16051 | 101k | _res = a; |
16052 | 101k | if (_res == NULL && PyErr_Occurred()) { |
16053 | 0 | p->error_indicator = 1; |
16054 | 0 | p->level--; |
16055 | 0 | return NULL; |
16056 | 0 | } |
16057 | 101k | goto done; |
16058 | 101k | } |
16059 | 163k | p->mark = _mark; |
16060 | 163k | D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
16061 | 163k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','")); |
16062 | 163k | } |
16063 | 0 | { // lambda_param &':' |
16064 | 163k | if (p->error_indicator) { |
16065 | 24 | p->level--; |
16066 | 24 | return NULL; |
16067 | 24 | } |
16068 | 163k | D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); |
16069 | 163k | arg_ty a; |
16070 | 163k | if ( |
16071 | 163k | (a = lambda_param_rule(p)) // lambda_param |
16072 | 52.6k | && |
16073 | 52.6k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
16074 | 163k | ) |
16075 | 15.4k | { |
16076 | 15.4k | D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); |
16077 | 15.4k | _res = a; |
16078 | 15.4k | if (_res == NULL && PyErr_Occurred()) { |
16079 | 0 | p->error_indicator = 1; |
16080 | 0 | p->level--; |
16081 | 0 | return NULL; |
16082 | 0 | } |
16083 | 15.4k | goto done; |
16084 | 15.4k | } |
16085 | 148k | p->mark = _mark; |
16086 | 148k | D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
16087 | 148k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'")); |
16088 | 148k | } |
16089 | 148k | _res = NULL; |
16090 | 265k | done: |
16091 | 265k | p->level--; |
16092 | 265k | return _res; |
16093 | 148k | } |
16094 | | |
16095 | | // lambda_param_with_default: lambda_param default ',' | lambda_param default &':' |
16096 | | static NameDefaultPair* |
16097 | | lambda_param_with_default_rule(Parser *p) |
16098 | 94.9k | { |
16099 | 94.9k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16100 | 0 | _Pypegen_stack_overflow(p); |
16101 | 0 | } |
16102 | 94.9k | if (p->error_indicator) { |
16103 | 0 | p->level--; |
16104 | 0 | return NULL; |
16105 | 0 | } |
16106 | 94.9k | NameDefaultPair* _res = NULL; |
16107 | 94.9k | int _mark = p->mark; |
16108 | 94.9k | { // lambda_param default ',' |
16109 | 94.9k | if (p->error_indicator) { |
16110 | 0 | p->level--; |
16111 | 0 | return NULL; |
16112 | 0 | } |
16113 | 94.9k | D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','")); |
16114 | 94.9k | Token * _literal; |
16115 | 94.9k | arg_ty a; |
16116 | 94.9k | expr_ty c; |
16117 | 94.9k | if ( |
16118 | 94.9k | (a = lambda_param_rule(p)) // lambda_param |
16119 | 27.1k | && |
16120 | 27.1k | (c = default_rule(p)) // default |
16121 | 20.9k | && |
16122 | 20.9k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
16123 | 94.9k | ) |
16124 | 15.8k | { |
16125 | 15.8k | D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','")); |
16126 | 15.8k | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
16127 | 15.8k | if (_res == NULL && PyErr_Occurred()) { |
16128 | 0 | p->error_indicator = 1; |
16129 | 0 | p->level--; |
16130 | 0 | return NULL; |
16131 | 0 | } |
16132 | 15.8k | goto done; |
16133 | 15.8k | } |
16134 | 79.0k | p->mark = _mark; |
16135 | 79.0k | D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
16136 | 79.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','")); |
16137 | 79.0k | } |
16138 | 0 | { // lambda_param default &':' |
16139 | 79.0k | if (p->error_indicator) { |
16140 | 744 | p->level--; |
16141 | 744 | return NULL; |
16142 | 744 | } |
16143 | 78.3k | D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'")); |
16144 | 78.3k | arg_ty a; |
16145 | 78.3k | expr_ty c; |
16146 | 78.3k | if ( |
16147 | 78.3k | (a = lambda_param_rule(p)) // lambda_param |
16148 | 10.5k | && |
16149 | 10.5k | (c = default_rule(p)) // default |
16150 | 5.10k | && |
16151 | 5.10k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
16152 | 78.3k | ) |
16153 | 4.54k | { |
16154 | 4.54k | D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'")); |
16155 | 4.54k | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
16156 | 4.54k | if (_res == NULL && PyErr_Occurred()) { |
16157 | 0 | p->error_indicator = 1; |
16158 | 0 | p->level--; |
16159 | 0 | return NULL; |
16160 | 0 | } |
16161 | 4.54k | goto done; |
16162 | 4.54k | } |
16163 | 73.7k | p->mark = _mark; |
16164 | 73.7k | D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
16165 | 73.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'")); |
16166 | 73.7k | } |
16167 | 73.7k | _res = NULL; |
16168 | 94.1k | done: |
16169 | 94.1k | p->level--; |
16170 | 94.1k | return _res; |
16171 | 73.7k | } |
16172 | | |
16173 | | // lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':' |
16174 | | static NameDefaultPair* |
16175 | | lambda_param_maybe_default_rule(Parser *p) |
16176 | 41.4k | { |
16177 | 41.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16178 | 0 | _Pypegen_stack_overflow(p); |
16179 | 0 | } |
16180 | 41.4k | if (p->error_indicator) { |
16181 | 0 | p->level--; |
16182 | 0 | return NULL; |
16183 | 0 | } |
16184 | 41.4k | NameDefaultPair* _res = NULL; |
16185 | 41.4k | int _mark = p->mark; |
16186 | 41.4k | { // lambda_param default? ',' |
16187 | 41.4k | if (p->error_indicator) { |
16188 | 0 | p->level--; |
16189 | 0 | return NULL; |
16190 | 0 | } |
16191 | 41.4k | D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','")); |
16192 | 41.4k | Token * _literal; |
16193 | 41.4k | arg_ty a; |
16194 | 41.4k | void *c; |
16195 | 41.4k | if ( |
16196 | 41.4k | (a = lambda_param_rule(p)) // lambda_param |
16197 | 24.2k | && |
16198 | 24.2k | (c = default_rule(p), !p->error_indicator) // default? |
16199 | 23.6k | && |
16200 | 23.6k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
16201 | 41.4k | ) |
16202 | 15.8k | { |
16203 | 15.8k | D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','")); |
16204 | 15.8k | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
16205 | 15.8k | if (_res == NULL && PyErr_Occurred()) { |
16206 | 0 | p->error_indicator = 1; |
16207 | 0 | p->level--; |
16208 | 0 | return NULL; |
16209 | 0 | } |
16210 | 15.8k | goto done; |
16211 | 15.8k | } |
16212 | 25.5k | p->mark = _mark; |
16213 | 25.5k | D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
16214 | 25.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','")); |
16215 | 25.5k | } |
16216 | 0 | { // lambda_param default? &':' |
16217 | 25.5k | if (p->error_indicator) { |
16218 | 623 | p->level--; |
16219 | 623 | return NULL; |
16220 | 623 | } |
16221 | 24.9k | D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'")); |
16222 | 24.9k | arg_ty a; |
16223 | 24.9k | void *c; |
16224 | 24.9k | if ( |
16225 | 24.9k | (a = lambda_param_rule(p)) // lambda_param |
16226 | 7.79k | && |
16227 | 7.79k | (c = default_rule(p), !p->error_indicator) // default? |
16228 | 7.79k | && |
16229 | 7.79k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
16230 | 24.9k | ) |
16231 | 2.04k | { |
16232 | 2.04k | D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'")); |
16233 | 2.04k | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
16234 | 2.04k | if (_res == NULL && PyErr_Occurred()) { |
16235 | 0 | p->error_indicator = 1; |
16236 | 0 | p->level--; |
16237 | 0 | return NULL; |
16238 | 0 | } |
16239 | 2.04k | goto done; |
16240 | 2.04k | } |
16241 | 22.8k | p->mark = _mark; |
16242 | 22.8k | D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
16243 | 22.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'")); |
16244 | 22.8k | } |
16245 | 22.8k | _res = NULL; |
16246 | 40.7k | done: |
16247 | 40.7k | p->level--; |
16248 | 40.7k | return _res; |
16249 | 22.8k | } |
16250 | | |
16251 | | // lambda_param: NAME |
16252 | | static arg_ty |
16253 | | lambda_param_rule(Parser *p) |
16254 | 676k | { |
16255 | 676k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16256 | 0 | _Pypegen_stack_overflow(p); |
16257 | 0 | } |
16258 | 676k | if (p->error_indicator) { |
16259 | 0 | p->level--; |
16260 | 0 | return NULL; |
16261 | 0 | } |
16262 | 676k | arg_ty _res = NULL; |
16263 | 676k | int _mark = p->mark; |
16264 | 676k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
16265 | 34 | p->error_indicator = 1; |
16266 | 34 | p->level--; |
16267 | 34 | return NULL; |
16268 | 34 | } |
16269 | 676k | int _start_lineno = p->tokens[_mark]->lineno; |
16270 | 676k | UNUSED(_start_lineno); // Only used by EXTRA macro |
16271 | 676k | int _start_col_offset = p->tokens[_mark]->col_offset; |
16272 | 676k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
16273 | 676k | { // NAME |
16274 | 676k | if (p->error_indicator) { |
16275 | 0 | p->level--; |
16276 | 0 | return NULL; |
16277 | 0 | } |
16278 | 676k | D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
16279 | 676k | expr_ty a; |
16280 | 676k | if ( |
16281 | 676k | (a = _PyPegen_name_token(p)) // NAME |
16282 | 676k | ) |
16283 | 282k | { |
16284 | 282k | D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
16285 | 282k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16286 | 282k | if (_token == NULL) { |
16287 | 0 | p->level--; |
16288 | 0 | return NULL; |
16289 | 0 | } |
16290 | 282k | int _end_lineno = _token->end_lineno; |
16291 | 282k | UNUSED(_end_lineno); // Only used by EXTRA macro |
16292 | 282k | int _end_col_offset = _token->end_col_offset; |
16293 | 282k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16294 | 282k | _res = _PyAST_arg ( a -> v . Name . id , NULL , NULL , EXTRA ); |
16295 | 282k | if (_res == NULL && PyErr_Occurred()) { |
16296 | 0 | p->error_indicator = 1; |
16297 | 0 | p->level--; |
16298 | 0 | return NULL; |
16299 | 0 | } |
16300 | 282k | goto done; |
16301 | 282k | } |
16302 | 393k | p->mark = _mark; |
16303 | 393k | D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ', |
16304 | 393k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
16305 | 393k | } |
16306 | 393k | _res = NULL; |
16307 | 676k | done: |
16308 | 676k | p->level--; |
16309 | 676k | return _res; |
16310 | 393k | } |
16311 | | |
16312 | | // fstring_middle: fstring_replacement_field | FSTRING_MIDDLE |
16313 | | static expr_ty |
16314 | | fstring_middle_rule(Parser *p) |
16315 | 54.4k | { |
16316 | 54.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16317 | 1 | _Pypegen_stack_overflow(p); |
16318 | 1 | } |
16319 | 54.4k | if (p->error_indicator) { |
16320 | 1 | p->level--; |
16321 | 1 | return NULL; |
16322 | 1 | } |
16323 | 54.4k | expr_ty _res = NULL; |
16324 | 54.4k | int _mark = p->mark; |
16325 | 54.4k | { // fstring_replacement_field |
16326 | 54.4k | if (p->error_indicator) { |
16327 | 0 | p->level--; |
16328 | 0 | return NULL; |
16329 | 0 | } |
16330 | 54.4k | D(fprintf(stderr, "%*c> fstring_middle[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_replacement_field")); |
16331 | 54.4k | expr_ty fstring_replacement_field_var; |
16332 | 54.4k | if ( |
16333 | 54.4k | (fstring_replacement_field_var = fstring_replacement_field_rule(p)) // fstring_replacement_field |
16334 | 54.4k | ) |
16335 | 15.3k | { |
16336 | 15.3k | D(fprintf(stderr, "%*c+ fstring_middle[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "fstring_replacement_field")); |
16337 | 15.3k | _res = fstring_replacement_field_var; |
16338 | 15.3k | goto done; |
16339 | 15.3k | } |
16340 | 39.0k | p->mark = _mark; |
16341 | 39.0k | D(fprintf(stderr, "%*c%s fstring_middle[%d-%d]: %s failed!\n", p->level, ' ', |
16342 | 39.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_replacement_field")); |
16343 | 39.0k | } |
16344 | 0 | { // FSTRING_MIDDLE |
16345 | 39.0k | if (p->error_indicator) { |
16346 | 2.44k | p->level--; |
16347 | 2.44k | return NULL; |
16348 | 2.44k | } |
16349 | 36.6k | D(fprintf(stderr, "%*c> fstring_middle[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE")); |
16350 | 36.6k | Token * t; |
16351 | 36.6k | if ( |
16352 | 36.6k | (t = _PyPegen_expect_token(p, FSTRING_MIDDLE)) // token='FSTRING_MIDDLE' |
16353 | 36.6k | ) |
16354 | 22.8k | { |
16355 | 22.8k | D(fprintf(stderr, "%*c+ fstring_middle[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE")); |
16356 | 22.8k | _res = _PyPegen_constant_from_token ( p , t ); |
16357 | 22.8k | if (_res == NULL && PyErr_Occurred()) { |
16358 | 0 | p->error_indicator = 1; |
16359 | 0 | p->level--; |
16360 | 0 | return NULL; |
16361 | 0 | } |
16362 | 22.8k | goto done; |
16363 | 22.8k | } |
16364 | 13.7k | p->mark = _mark; |
16365 | 13.7k | D(fprintf(stderr, "%*c%s fstring_middle[%d-%d]: %s failed!\n", p->level, ' ', |
16366 | 13.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "FSTRING_MIDDLE")); |
16367 | 13.7k | } |
16368 | 13.7k | _res = NULL; |
16369 | 52.0k | done: |
16370 | 52.0k | p->level--; |
16371 | 52.0k | return _res; |
16372 | 13.7k | } |
16373 | | |
16374 | | // fstring_replacement_field: |
16375 | | // | '{' annotated_rhs '='? fstring_conversion? fstring_full_format_spec? '}' |
16376 | | // | invalid_fstring_replacement_field |
16377 | | static expr_ty |
16378 | | fstring_replacement_field_rule(Parser *p) |
16379 | 61.3k | { |
16380 | 61.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16381 | 2 | _Pypegen_stack_overflow(p); |
16382 | 2 | } |
16383 | 61.3k | if (p->error_indicator) { |
16384 | 2 | p->level--; |
16385 | 2 | return NULL; |
16386 | 2 | } |
16387 | 61.3k | expr_ty _res = NULL; |
16388 | 61.3k | int _mark = p->mark; |
16389 | 61.3k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
16390 | 149 | p->error_indicator = 1; |
16391 | 149 | p->level--; |
16392 | 149 | return NULL; |
16393 | 149 | } |
16394 | 61.2k | int _start_lineno = p->tokens[_mark]->lineno; |
16395 | 61.2k | UNUSED(_start_lineno); // Only used by EXTRA macro |
16396 | 61.2k | int _start_col_offset = p->tokens[_mark]->col_offset; |
16397 | 61.2k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
16398 | 61.2k | { // '{' annotated_rhs '='? fstring_conversion? fstring_full_format_spec? '}' |
16399 | 61.2k | if (p->error_indicator) { |
16400 | 0 | p->level--; |
16401 | 0 | return NULL; |
16402 | 0 | } |
16403 | 61.2k | D(fprintf(stderr, "%*c> fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? fstring_conversion? fstring_full_format_spec? '}'")); |
16404 | 61.2k | Token * _literal; |
16405 | 61.2k | expr_ty a; |
16406 | 61.2k | void *conversion; |
16407 | 61.2k | void *debug_expr; |
16408 | 61.2k | void *format; |
16409 | 61.2k | Token * rbrace; |
16410 | 61.2k | if ( |
16411 | 61.2k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
16412 | 22.5k | && |
16413 | 22.5k | (a = annotated_rhs_rule(p)) // annotated_rhs |
16414 | 20.0k | && |
16415 | 20.0k | (debug_expr = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='? |
16416 | 20.0k | && |
16417 | 20.0k | (conversion = fstring_conversion_rule(p), !p->error_indicator) // fstring_conversion? |
16418 | 19.9k | && |
16419 | 19.9k | (format = fstring_full_format_spec_rule(p), !p->error_indicator) // fstring_full_format_spec? |
16420 | 19.6k | && |
16421 | 19.6k | (rbrace = _PyPegen_expect_token(p, 26)) // token='}' |
16422 | 61.2k | ) |
16423 | 18.7k | { |
16424 | 18.7k | D(fprintf(stderr, "%*c+ fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? fstring_conversion? fstring_full_format_spec? '}'")); |
16425 | 18.7k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16426 | 18.7k | if (_token == NULL) { |
16427 | 0 | p->level--; |
16428 | 0 | return NULL; |
16429 | 0 | } |
16430 | 18.7k | int _end_lineno = _token->end_lineno; |
16431 | 18.7k | UNUSED(_end_lineno); // Only used by EXTRA macro |
16432 | 18.7k | int _end_col_offset = _token->end_col_offset; |
16433 | 18.7k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16434 | 18.7k | _res = _PyPegen_formatted_value ( p , a , debug_expr , conversion , format , rbrace , EXTRA ); |
16435 | 18.7k | if (_res == NULL && PyErr_Occurred()) { |
16436 | 1 | p->error_indicator = 1; |
16437 | 1 | p->level--; |
16438 | 1 | return NULL; |
16439 | 1 | } |
16440 | 18.7k | goto done; |
16441 | 18.7k | } |
16442 | 42.4k | p->mark = _mark; |
16443 | 42.4k | D(fprintf(stderr, "%*c%s fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
16444 | 42.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? fstring_conversion? fstring_full_format_spec? '}'")); |
16445 | 42.4k | } |
16446 | 42.4k | if (p->call_invalid_rules) { // invalid_fstring_replacement_field |
16447 | 11.5k | if (p->error_indicator) { |
16448 | 1.60k | p->level--; |
16449 | 1.60k | return NULL; |
16450 | 1.60k | } |
16451 | 9.99k | D(fprintf(stderr, "%*c> fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_fstring_replacement_field")); |
16452 | 9.99k | void *invalid_fstring_replacement_field_var; |
16453 | 9.99k | if ( |
16454 | 9.99k | (invalid_fstring_replacement_field_var = invalid_fstring_replacement_field_rule(p)) // invalid_fstring_replacement_field |
16455 | 9.99k | ) |
16456 | 0 | { |
16457 | 0 | D(fprintf(stderr, "%*c+ fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_fstring_replacement_field")); |
16458 | 0 | _res = invalid_fstring_replacement_field_var; |
16459 | 0 | goto done; |
16460 | 0 | } |
16461 | 9.99k | p->mark = _mark; |
16462 | 9.99k | D(fprintf(stderr, "%*c%s fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
16463 | 9.99k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_fstring_replacement_field")); |
16464 | 9.99k | } |
16465 | 40.8k | _res = NULL; |
16466 | 59.5k | done: |
16467 | 59.5k | p->level--; |
16468 | 59.5k | return _res; |
16469 | 40.8k | } |
16470 | | |
16471 | | // fstring_conversion: "!" NAME |
16472 | | static ResultTokenWithMetadata* |
16473 | | fstring_conversion_rule(Parser *p) |
16474 | 28.7k | { |
16475 | 28.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16476 | 0 | _Pypegen_stack_overflow(p); |
16477 | 0 | } |
16478 | 28.7k | if (p->error_indicator) { |
16479 | 0 | p->level--; |
16480 | 0 | return NULL; |
16481 | 0 | } |
16482 | 28.7k | ResultTokenWithMetadata* _res = NULL; |
16483 | 28.7k | int _mark = p->mark; |
16484 | 28.7k | { // "!" NAME |
16485 | 28.7k | if (p->error_indicator) { |
16486 | 0 | p->level--; |
16487 | 0 | return NULL; |
16488 | 0 | } |
16489 | 28.7k | D(fprintf(stderr, "%*c> fstring_conversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"!\" NAME")); |
16490 | 28.7k | expr_ty conv; |
16491 | 28.7k | Token * conv_token; |
16492 | 28.7k | if ( |
16493 | 28.7k | (conv_token = _PyPegen_expect_token(p, 54)) // token='!' |
16494 | 2.07k | && |
16495 | 2.07k | (conv = _PyPegen_name_token(p)) // NAME |
16496 | 28.7k | ) |
16497 | 2.02k | { |
16498 | 2.02k | D(fprintf(stderr, "%*c+ fstring_conversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"!\" NAME")); |
16499 | 2.02k | _res = _PyPegen_check_fstring_conversion ( p , conv_token , conv ); |
16500 | 2.02k | if (_res == NULL && PyErr_Occurred()) { |
16501 | 13 | p->error_indicator = 1; |
16502 | 13 | p->level--; |
16503 | 13 | return NULL; |
16504 | 13 | } |
16505 | 2.00k | goto done; |
16506 | 2.02k | } |
16507 | 26.7k | p->mark = _mark; |
16508 | 26.7k | D(fprintf(stderr, "%*c%s fstring_conversion[%d-%d]: %s failed!\n", p->level, ' ', |
16509 | 26.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"!\" NAME")); |
16510 | 26.7k | } |
16511 | 26.7k | _res = NULL; |
16512 | 28.7k | done: |
16513 | 28.7k | p->level--; |
16514 | 28.7k | return _res; |
16515 | 26.7k | } |
16516 | | |
16517 | | // fstring_full_format_spec: ':' fstring_format_spec* |
16518 | | static ResultTokenWithMetadata* |
16519 | | fstring_full_format_spec_rule(Parser *p) |
16520 | 19.9k | { |
16521 | 19.9k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16522 | 0 | _Pypegen_stack_overflow(p); |
16523 | 0 | } |
16524 | 19.9k | if (p->error_indicator) { |
16525 | 0 | p->level--; |
16526 | 0 | return NULL; |
16527 | 0 | } |
16528 | 19.9k | ResultTokenWithMetadata* _res = NULL; |
16529 | 19.9k | int _mark = p->mark; |
16530 | 19.9k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
16531 | 2 | p->error_indicator = 1; |
16532 | 2 | p->level--; |
16533 | 2 | return NULL; |
16534 | 2 | } |
16535 | 19.9k | int _start_lineno = p->tokens[_mark]->lineno; |
16536 | 19.9k | UNUSED(_start_lineno); // Only used by EXTRA macro |
16537 | 19.9k | int _start_col_offset = p->tokens[_mark]->col_offset; |
16538 | 19.9k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
16539 | 19.9k | { // ':' fstring_format_spec* |
16540 | 19.9k | if (p->error_indicator) { |
16541 | 0 | p->level--; |
16542 | 0 | return NULL; |
16543 | 0 | } |
16544 | 19.9k | D(fprintf(stderr, "%*c> fstring_full_format_spec[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' fstring_format_spec*")); |
16545 | 19.9k | Token * colon; |
16546 | 19.9k | asdl_seq * spec; |
16547 | 19.9k | if ( |
16548 | 19.9k | (colon = _PyPegen_expect_token(p, 11)) // token=':' |
16549 | 3.43k | && |
16550 | 3.43k | (spec = _loop0_76_rule(p)) // fstring_format_spec* |
16551 | 19.9k | ) |
16552 | 3.43k | { |
16553 | 3.43k | D(fprintf(stderr, "%*c+ fstring_full_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' fstring_format_spec*")); |
16554 | 3.43k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16555 | 3.43k | if (_token == NULL) { |
16556 | 0 | p->level--; |
16557 | 0 | return NULL; |
16558 | 0 | } |
16559 | 3.43k | int _end_lineno = _token->end_lineno; |
16560 | 3.43k | UNUSED(_end_lineno); // Only used by EXTRA macro |
16561 | 3.43k | int _end_col_offset = _token->end_col_offset; |
16562 | 3.43k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16563 | 3.43k | _res = _PyPegen_setup_full_format_spec ( p , colon , ( asdl_expr_seq* ) spec , EXTRA ); |
16564 | 3.43k | if (_res == NULL && PyErr_Occurred()) { |
16565 | 0 | p->error_indicator = 1; |
16566 | 0 | p->level--; |
16567 | 0 | return NULL; |
16568 | 0 | } |
16569 | 3.43k | goto done; |
16570 | 3.43k | } |
16571 | 16.5k | p->mark = _mark; |
16572 | 16.5k | D(fprintf(stderr, "%*c%s fstring_full_format_spec[%d-%d]: %s failed!\n", p->level, ' ', |
16573 | 16.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' fstring_format_spec*")); |
16574 | 16.5k | } |
16575 | 16.5k | _res = NULL; |
16576 | 19.9k | done: |
16577 | 19.9k | p->level--; |
16578 | 19.9k | return _res; |
16579 | 16.5k | } |
16580 | | |
16581 | | // fstring_format_spec: FSTRING_MIDDLE | fstring_replacement_field |
16582 | | static expr_ty |
16583 | | fstring_format_spec_rule(Parser *p) |
16584 | 12.7k | { |
16585 | 12.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16586 | 0 | _Pypegen_stack_overflow(p); |
16587 | 0 | } |
16588 | 12.7k | if (p->error_indicator) { |
16589 | 0 | p->level--; |
16590 | 0 | return NULL; |
16591 | 0 | } |
16592 | 12.7k | expr_ty _res = NULL; |
16593 | 12.7k | int _mark = p->mark; |
16594 | 12.7k | { // FSTRING_MIDDLE |
16595 | 12.7k | if (p->error_indicator) { |
16596 | 0 | p->level--; |
16597 | 0 | return NULL; |
16598 | 0 | } |
16599 | 12.7k | D(fprintf(stderr, "%*c> fstring_format_spec[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE")); |
16600 | 12.7k | Token * t; |
16601 | 12.7k | if ( |
16602 | 12.7k | (t = _PyPegen_expect_token(p, FSTRING_MIDDLE)) // token='FSTRING_MIDDLE' |
16603 | 12.7k | ) |
16604 | 5.84k | { |
16605 | 5.84k | D(fprintf(stderr, "%*c+ fstring_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE")); |
16606 | 5.84k | _res = _PyPegen_decoded_constant_from_token ( p , t ); |
16607 | 5.84k | if (_res == NULL && PyErr_Occurred()) { |
16608 | 2 | p->error_indicator = 1; |
16609 | 2 | p->level--; |
16610 | 2 | return NULL; |
16611 | 2 | } |
16612 | 5.84k | goto done; |
16613 | 5.84k | } |
16614 | 6.91k | p->mark = _mark; |
16615 | 6.91k | D(fprintf(stderr, "%*c%s fstring_format_spec[%d-%d]: %s failed!\n", p->level, ' ', |
16616 | 6.91k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "FSTRING_MIDDLE")); |
16617 | 6.91k | } |
16618 | 0 | { // fstring_replacement_field |
16619 | 6.91k | if (p->error_indicator) { |
16620 | 15 | p->level--; |
16621 | 15 | return NULL; |
16622 | 15 | } |
16623 | 6.89k | D(fprintf(stderr, "%*c> fstring_format_spec[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_replacement_field")); |
16624 | 6.89k | expr_ty fstring_replacement_field_var; |
16625 | 6.89k | if ( |
16626 | 6.89k | (fstring_replacement_field_var = fstring_replacement_field_rule(p)) // fstring_replacement_field |
16627 | 6.89k | ) |
16628 | 3.32k | { |
16629 | 3.32k | D(fprintf(stderr, "%*c+ fstring_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "fstring_replacement_field")); |
16630 | 3.32k | _res = fstring_replacement_field_var; |
16631 | 3.32k | goto done; |
16632 | 3.32k | } |
16633 | 3.57k | p->mark = _mark; |
16634 | 3.57k | D(fprintf(stderr, "%*c%s fstring_format_spec[%d-%d]: %s failed!\n", p->level, ' ', |
16635 | 3.57k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_replacement_field")); |
16636 | 3.57k | } |
16637 | 3.57k | _res = NULL; |
16638 | 12.7k | done: |
16639 | 12.7k | p->level--; |
16640 | 12.7k | return _res; |
16641 | 3.57k | } |
16642 | | |
16643 | | // fstring: FSTRING_START fstring_middle* FSTRING_END |
16644 | | static expr_ty |
16645 | | fstring_rule(Parser *p) |
16646 | 203k | { |
16647 | 203k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16648 | 1 | _Pypegen_stack_overflow(p); |
16649 | 1 | } |
16650 | 203k | if (p->error_indicator) { |
16651 | 1 | p->level--; |
16652 | 1 | return NULL; |
16653 | 1 | } |
16654 | 203k | expr_ty _res = NULL; |
16655 | 203k | int _mark = p->mark; |
16656 | 203k | { // FSTRING_START fstring_middle* FSTRING_END |
16657 | 203k | if (p->error_indicator) { |
16658 | 0 | p->level--; |
16659 | 0 | return NULL; |
16660 | 0 | } |
16661 | 203k | D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "FSTRING_START fstring_middle* FSTRING_END")); |
16662 | 203k | Token * a; |
16663 | 203k | asdl_seq * b; |
16664 | 203k | Token * c; |
16665 | 203k | if ( |
16666 | 203k | (a = _PyPegen_expect_token(p, FSTRING_START)) // token='FSTRING_START' |
16667 | 16.1k | && |
16668 | 16.1k | (b = _loop0_77_rule(p)) // fstring_middle* |
16669 | 16.1k | && |
16670 | 16.1k | (c = _PyPegen_expect_token(p, FSTRING_END)) // token='FSTRING_END' |
16671 | 203k | ) |
16672 | 12.6k | { |
16673 | 12.6k | D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_START fstring_middle* FSTRING_END")); |
16674 | 12.6k | _res = _PyPegen_joined_str ( p , a , ( asdl_expr_seq* ) b , c ); |
16675 | 12.6k | if (_res == NULL && PyErr_Occurred()) { |
16676 | 0 | p->error_indicator = 1; |
16677 | 0 | p->level--; |
16678 | 0 | return NULL; |
16679 | 0 | } |
16680 | 12.6k | goto done; |
16681 | 12.6k | } |
16682 | 190k | p->mark = _mark; |
16683 | 190k | D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ', |
16684 | 190k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "FSTRING_START fstring_middle* FSTRING_END")); |
16685 | 190k | } |
16686 | 190k | _res = NULL; |
16687 | 203k | done: |
16688 | 203k | p->level--; |
16689 | 203k | return _res; |
16690 | 190k | } |
16691 | | |
16692 | | // tstring_format_spec_replacement_field: |
16693 | | // | '{' annotated_rhs '='? fstring_conversion? tstring_full_format_spec? '}' |
16694 | | // | invalid_tstring_replacement_field |
16695 | | static expr_ty |
16696 | | tstring_format_spec_replacement_field_rule(Parser *p) |
16697 | 3.66k | { |
16698 | 3.66k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16699 | 0 | _Pypegen_stack_overflow(p); |
16700 | 0 | } |
16701 | 3.66k | if (p->error_indicator) { |
16702 | 0 | p->level--; |
16703 | 0 | return NULL; |
16704 | 0 | } |
16705 | 3.66k | expr_ty _res = NULL; |
16706 | 3.66k | int _mark = p->mark; |
16707 | 3.66k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
16708 | 0 | p->error_indicator = 1; |
16709 | 0 | p->level--; |
16710 | 0 | return NULL; |
16711 | 0 | } |
16712 | 3.66k | int _start_lineno = p->tokens[_mark]->lineno; |
16713 | 3.66k | UNUSED(_start_lineno); // Only used by EXTRA macro |
16714 | 3.66k | int _start_col_offset = p->tokens[_mark]->col_offset; |
16715 | 3.66k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
16716 | 3.66k | { // '{' annotated_rhs '='? fstring_conversion? tstring_full_format_spec? '}' |
16717 | 3.66k | if (p->error_indicator) { |
16718 | 0 | p->level--; |
16719 | 0 | return NULL; |
16720 | 0 | } |
16721 | 3.66k | D(fprintf(stderr, "%*c> tstring_format_spec_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? fstring_conversion? tstring_full_format_spec? '}'")); |
16722 | 3.66k | Token * _literal; |
16723 | 3.66k | expr_ty a; |
16724 | 3.66k | void *conversion; |
16725 | 3.66k | void *debug_expr; |
16726 | 3.66k | void *format; |
16727 | 3.66k | Token * rbrace; |
16728 | 3.66k | if ( |
16729 | 3.66k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
16730 | 2.11k | && |
16731 | 2.11k | (a = annotated_rhs_rule(p)) // annotated_rhs |
16732 | 1.35k | && |
16733 | 1.35k | (debug_expr = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='? |
16734 | 1.35k | && |
16735 | 1.35k | (conversion = fstring_conversion_rule(p), !p->error_indicator) // fstring_conversion? |
16736 | 1.35k | && |
16737 | 1.35k | (format = tstring_full_format_spec_rule(p), !p->error_indicator) // tstring_full_format_spec? |
16738 | 1.17k | && |
16739 | 1.17k | (rbrace = _PyPegen_expect_token(p, 26)) // token='}' |
16740 | 3.66k | ) |
16741 | 931 | { |
16742 | 931 | D(fprintf(stderr, "%*c+ tstring_format_spec_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? fstring_conversion? tstring_full_format_spec? '}'")); |
16743 | 931 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16744 | 931 | if (_token == NULL) { |
16745 | 0 | p->level--; |
16746 | 0 | return NULL; |
16747 | 0 | } |
16748 | 931 | int _end_lineno = _token->end_lineno; |
16749 | 931 | UNUSED(_end_lineno); // Only used by EXTRA macro |
16750 | 931 | int _end_col_offset = _token->end_col_offset; |
16751 | 931 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16752 | 931 | _res = _PyPegen_formatted_value ( p , a , debug_expr , conversion , format , rbrace , EXTRA ); |
16753 | 931 | if (_res == NULL && PyErr_Occurred()) { |
16754 | 1 | p->error_indicator = 1; |
16755 | 1 | p->level--; |
16756 | 1 | return NULL; |
16757 | 1 | } |
16758 | 930 | goto done; |
16759 | 931 | } |
16760 | 2.73k | p->mark = _mark; |
16761 | 2.73k | D(fprintf(stderr, "%*c%s tstring_format_spec_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
16762 | 2.73k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? fstring_conversion? tstring_full_format_spec? '}'")); |
16763 | 2.73k | } |
16764 | 2.73k | if (p->call_invalid_rules) { // invalid_tstring_replacement_field |
16765 | 1.07k | if (p->error_indicator) { |
16766 | 397 | p->level--; |
16767 | 397 | return NULL; |
16768 | 397 | } |
16769 | 676 | D(fprintf(stderr, "%*c> tstring_format_spec_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_tstring_replacement_field")); |
16770 | 676 | void *invalid_tstring_replacement_field_var; |
16771 | 676 | if ( |
16772 | 676 | (invalid_tstring_replacement_field_var = invalid_tstring_replacement_field_rule(p)) // invalid_tstring_replacement_field |
16773 | 676 | ) |
16774 | 0 | { |
16775 | 0 | D(fprintf(stderr, "%*c+ tstring_format_spec_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_tstring_replacement_field")); |
16776 | 0 | _res = invalid_tstring_replacement_field_var; |
16777 | 0 | goto done; |
16778 | 0 | } |
16779 | 676 | p->mark = _mark; |
16780 | 676 | D(fprintf(stderr, "%*c%s tstring_format_spec_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
16781 | 676 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_tstring_replacement_field")); |
16782 | 676 | } |
16783 | 2.33k | _res = NULL; |
16784 | 3.26k | done: |
16785 | 3.26k | p->level--; |
16786 | 3.26k | return _res; |
16787 | 2.33k | } |
16788 | | |
16789 | | // tstring_format_spec: TSTRING_MIDDLE | tstring_format_spec_replacement_field |
16790 | | static expr_ty |
16791 | | tstring_format_spec_rule(Parser *p) |
16792 | 5.78k | { |
16793 | 5.78k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16794 | 0 | _Pypegen_stack_overflow(p); |
16795 | 0 | } |
16796 | 5.78k | if (p->error_indicator) { |
16797 | 0 | p->level--; |
16798 | 0 | return NULL; |
16799 | 0 | } |
16800 | 5.78k | expr_ty _res = NULL; |
16801 | 5.78k | int _mark = p->mark; |
16802 | 5.78k | { // TSTRING_MIDDLE |
16803 | 5.78k | if (p->error_indicator) { |
16804 | 0 | p->level--; |
16805 | 0 | return NULL; |
16806 | 0 | } |
16807 | 5.78k | D(fprintf(stderr, "%*c> tstring_format_spec[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TSTRING_MIDDLE")); |
16808 | 5.78k | Token * t; |
16809 | 5.78k | if ( |
16810 | 5.78k | (t = _PyPegen_expect_token(p, TSTRING_MIDDLE)) // token='TSTRING_MIDDLE' |
16811 | 5.78k | ) |
16812 | 2.10k | { |
16813 | 2.10k | D(fprintf(stderr, "%*c+ tstring_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TSTRING_MIDDLE")); |
16814 | 2.10k | _res = _PyPegen_decoded_constant_from_token ( p , t ); |
16815 | 2.10k | if (_res == NULL && PyErr_Occurred()) { |
16816 | 1 | p->error_indicator = 1; |
16817 | 1 | p->level--; |
16818 | 1 | return NULL; |
16819 | 1 | } |
16820 | 2.10k | goto done; |
16821 | 2.10k | } |
16822 | 3.67k | p->mark = _mark; |
16823 | 3.67k | D(fprintf(stderr, "%*c%s tstring_format_spec[%d-%d]: %s failed!\n", p->level, ' ', |
16824 | 3.67k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TSTRING_MIDDLE")); |
16825 | 3.67k | } |
16826 | 0 | { // tstring_format_spec_replacement_field |
16827 | 3.67k | if (p->error_indicator) { |
16828 | 10 | p->level--; |
16829 | 10 | return NULL; |
16830 | 10 | } |
16831 | 3.66k | D(fprintf(stderr, "%*c> tstring_format_spec[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tstring_format_spec_replacement_field")); |
16832 | 3.66k | expr_ty tstring_format_spec_replacement_field_var; |
16833 | 3.66k | if ( |
16834 | 3.66k | (tstring_format_spec_replacement_field_var = tstring_format_spec_replacement_field_rule(p)) // tstring_format_spec_replacement_field |
16835 | 3.66k | ) |
16836 | 930 | { |
16837 | 930 | D(fprintf(stderr, "%*c+ tstring_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tstring_format_spec_replacement_field")); |
16838 | 930 | _res = tstring_format_spec_replacement_field_var; |
16839 | 930 | goto done; |
16840 | 930 | } |
16841 | 2.73k | p->mark = _mark; |
16842 | 2.73k | D(fprintf(stderr, "%*c%s tstring_format_spec[%d-%d]: %s failed!\n", p->level, ' ', |
16843 | 2.73k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tstring_format_spec_replacement_field")); |
16844 | 2.73k | } |
16845 | 2.73k | _res = NULL; |
16846 | 5.77k | done: |
16847 | 5.77k | p->level--; |
16848 | 5.77k | return _res; |
16849 | 2.73k | } |
16850 | | |
16851 | | // tstring_full_format_spec: ':' tstring_format_spec* |
16852 | | static ResultTokenWithMetadata* |
16853 | | tstring_full_format_spec_rule(Parser *p) |
16854 | 8.73k | { |
16855 | 8.73k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16856 | 0 | _Pypegen_stack_overflow(p); |
16857 | 0 | } |
16858 | 8.73k | if (p->error_indicator) { |
16859 | 0 | p->level--; |
16860 | 0 | return NULL; |
16861 | 0 | } |
16862 | 8.73k | ResultTokenWithMetadata* _res = NULL; |
16863 | 8.73k | int _mark = p->mark; |
16864 | 8.73k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
16865 | 1 | p->error_indicator = 1; |
16866 | 1 | p->level--; |
16867 | 1 | return NULL; |
16868 | 1 | } |
16869 | 8.73k | int _start_lineno = p->tokens[_mark]->lineno; |
16870 | 8.73k | UNUSED(_start_lineno); // Only used by EXTRA macro |
16871 | 8.73k | int _start_col_offset = p->tokens[_mark]->col_offset; |
16872 | 8.73k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
16873 | 8.73k | { // ':' tstring_format_spec* |
16874 | 8.73k | if (p->error_indicator) { |
16875 | 0 | p->level--; |
16876 | 0 | return NULL; |
16877 | 0 | } |
16878 | 8.73k | D(fprintf(stderr, "%*c> tstring_full_format_spec[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' tstring_format_spec*")); |
16879 | 8.73k | Token * colon; |
16880 | 8.73k | asdl_seq * spec; |
16881 | 8.73k | if ( |
16882 | 8.73k | (colon = _PyPegen_expect_token(p, 11)) // token=':' |
16883 | 2.74k | && |
16884 | 2.74k | (spec = _loop0_78_rule(p)) // tstring_format_spec* |
16885 | 8.73k | ) |
16886 | 2.74k | { |
16887 | 2.74k | D(fprintf(stderr, "%*c+ tstring_full_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' tstring_format_spec*")); |
16888 | 2.74k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16889 | 2.74k | if (_token == NULL) { |
16890 | 0 | p->level--; |
16891 | 0 | return NULL; |
16892 | 0 | } |
16893 | 2.74k | int _end_lineno = _token->end_lineno; |
16894 | 2.74k | UNUSED(_end_lineno); // Only used by EXTRA macro |
16895 | 2.74k | int _end_col_offset = _token->end_col_offset; |
16896 | 2.74k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16897 | 2.74k | _res = _PyPegen_setup_full_format_spec ( p , colon , ( asdl_expr_seq* ) spec , EXTRA ); |
16898 | 2.74k | if (_res == NULL && PyErr_Occurred()) { |
16899 | 0 | p->error_indicator = 1; |
16900 | 0 | p->level--; |
16901 | 0 | return NULL; |
16902 | 0 | } |
16903 | 2.74k | goto done; |
16904 | 2.74k | } |
16905 | 5.99k | p->mark = _mark; |
16906 | 5.99k | D(fprintf(stderr, "%*c%s tstring_full_format_spec[%d-%d]: %s failed!\n", p->level, ' ', |
16907 | 5.99k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' tstring_format_spec*")); |
16908 | 5.99k | } |
16909 | 5.99k | _res = NULL; |
16910 | 8.73k | done: |
16911 | 8.73k | p->level--; |
16912 | 8.73k | return _res; |
16913 | 5.99k | } |
16914 | | |
16915 | | // tstring_replacement_field: |
16916 | | // | '{' annotated_rhs '='? fstring_conversion? tstring_full_format_spec? '}' |
16917 | | // | invalid_tstring_replacement_field |
16918 | | static expr_ty |
16919 | | tstring_replacement_field_rule(Parser *p) |
16920 | 19.8k | { |
16921 | 19.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
16922 | 1 | _Pypegen_stack_overflow(p); |
16923 | 1 | } |
16924 | 19.8k | if (p->error_indicator) { |
16925 | 1 | p->level--; |
16926 | 1 | return NULL; |
16927 | 1 | } |
16928 | 19.8k | expr_ty _res = NULL; |
16929 | 19.8k | int _mark = p->mark; |
16930 | 19.8k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
16931 | 171 | p->error_indicator = 1; |
16932 | 171 | p->level--; |
16933 | 171 | return NULL; |
16934 | 171 | } |
16935 | 19.6k | int _start_lineno = p->tokens[_mark]->lineno; |
16936 | 19.6k | UNUSED(_start_lineno); // Only used by EXTRA macro |
16937 | 19.6k | int _start_col_offset = p->tokens[_mark]->col_offset; |
16938 | 19.6k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
16939 | 19.6k | { // '{' annotated_rhs '='? fstring_conversion? tstring_full_format_spec? '}' |
16940 | 19.6k | if (p->error_indicator) { |
16941 | 0 | p->level--; |
16942 | 0 | return NULL; |
16943 | 0 | } |
16944 | 19.6k | D(fprintf(stderr, "%*c> tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? fstring_conversion? tstring_full_format_spec? '}'")); |
16945 | 19.6k | Token * _literal; |
16946 | 19.6k | expr_ty a; |
16947 | 19.6k | void *conversion; |
16948 | 19.6k | void *debug_expr; |
16949 | 19.6k | void *format; |
16950 | 19.6k | Token * rbrace; |
16951 | 19.6k | if ( |
16952 | 19.6k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
16953 | 8.61k | && |
16954 | 8.61k | (a = annotated_rhs_rule(p)) // annotated_rhs |
16955 | 7.39k | && |
16956 | 7.39k | (debug_expr = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='? |
16957 | 7.39k | && |
16958 | 7.39k | (conversion = fstring_conversion_rule(p), !p->error_indicator) // fstring_conversion? |
16959 | 7.38k | && |
16960 | 7.38k | (format = tstring_full_format_spec_rule(p), !p->error_indicator) // tstring_full_format_spec? |
16961 | 6.99k | && |
16962 | 6.99k | (rbrace = _PyPegen_expect_token(p, 26)) // token='}' |
16963 | 19.6k | ) |
16964 | 6.34k | { |
16965 | 6.34k | D(fprintf(stderr, "%*c+ tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? fstring_conversion? tstring_full_format_spec? '}'")); |
16966 | 6.34k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
16967 | 6.34k | if (_token == NULL) { |
16968 | 0 | p->level--; |
16969 | 0 | return NULL; |
16970 | 0 | } |
16971 | 6.34k | int _end_lineno = _token->end_lineno; |
16972 | 6.34k | UNUSED(_end_lineno); // Only used by EXTRA macro |
16973 | 6.34k | int _end_col_offset = _token->end_col_offset; |
16974 | 6.34k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
16975 | 6.34k | _res = _PyPegen_interpolation ( p , a , debug_expr , conversion , format , rbrace , EXTRA ); |
16976 | 6.34k | if (_res == NULL && PyErr_Occurred()) { |
16977 | 0 | p->error_indicator = 1; |
16978 | 0 | p->level--; |
16979 | 0 | return NULL; |
16980 | 0 | } |
16981 | 6.34k | goto done; |
16982 | 6.34k | } |
16983 | 13.3k | p->mark = _mark; |
16984 | 13.3k | D(fprintf(stderr, "%*c%s tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
16985 | 13.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? fstring_conversion? tstring_full_format_spec? '}'")); |
16986 | 13.3k | } |
16987 | 13.3k | if (p->call_invalid_rules) { // invalid_tstring_replacement_field |
16988 | 5.26k | if (p->error_indicator) { |
16989 | 1.01k | p->level--; |
16990 | 1.01k | return NULL; |
16991 | 1.01k | } |
16992 | 4.25k | D(fprintf(stderr, "%*c> tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_tstring_replacement_field")); |
16993 | 4.25k | void *invalid_tstring_replacement_field_var; |
16994 | 4.25k | if ( |
16995 | 4.25k | (invalid_tstring_replacement_field_var = invalid_tstring_replacement_field_rule(p)) // invalid_tstring_replacement_field |
16996 | 4.25k | ) |
16997 | 0 | { |
16998 | 0 | D(fprintf(stderr, "%*c+ tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_tstring_replacement_field")); |
16999 | 0 | _res = invalid_tstring_replacement_field_var; |
17000 | 0 | goto done; |
17001 | 0 | } |
17002 | 4.25k | p->mark = _mark; |
17003 | 4.25k | D(fprintf(stderr, "%*c%s tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
17004 | 4.25k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_tstring_replacement_field")); |
17005 | 4.25k | } |
17006 | 12.3k | _res = NULL; |
17007 | 18.6k | done: |
17008 | 18.6k | p->level--; |
17009 | 18.6k | return _res; |
17010 | 12.3k | } |
17011 | | |
17012 | | // tstring_middle: tstring_replacement_field | TSTRING_MIDDLE |
17013 | | static expr_ty |
17014 | | tstring_middle_rule(Parser *p) |
17015 | 19.8k | { |
17016 | 19.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17017 | 1 | _Pypegen_stack_overflow(p); |
17018 | 1 | } |
17019 | 19.8k | if (p->error_indicator) { |
17020 | 1 | p->level--; |
17021 | 1 | return NULL; |
17022 | 1 | } |
17023 | 19.8k | expr_ty _res = NULL; |
17024 | 19.8k | int _mark = p->mark; |
17025 | 19.8k | { // tstring_replacement_field |
17026 | 19.8k | if (p->error_indicator) { |
17027 | 0 | p->level--; |
17028 | 0 | return NULL; |
17029 | 0 | } |
17030 | 19.8k | D(fprintf(stderr, "%*c> tstring_middle[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tstring_replacement_field")); |
17031 | 19.8k | expr_ty tstring_replacement_field_var; |
17032 | 19.8k | if ( |
17033 | 19.8k | (tstring_replacement_field_var = tstring_replacement_field_rule(p)) // tstring_replacement_field |
17034 | 19.8k | ) |
17035 | 6.34k | { |
17036 | 6.34k | D(fprintf(stderr, "%*c+ tstring_middle[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tstring_replacement_field")); |
17037 | 6.34k | _res = tstring_replacement_field_var; |
17038 | 6.34k | goto done; |
17039 | 6.34k | } |
17040 | 13.5k | p->mark = _mark; |
17041 | 13.5k | D(fprintf(stderr, "%*c%s tstring_middle[%d-%d]: %s failed!\n", p->level, ' ', |
17042 | 13.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tstring_replacement_field")); |
17043 | 13.5k | } |
17044 | 0 | { // TSTRING_MIDDLE |
17045 | 13.5k | if (p->error_indicator) { |
17046 | 1.50k | p->level--; |
17047 | 1.50k | return NULL; |
17048 | 1.50k | } |
17049 | 12.0k | D(fprintf(stderr, "%*c> tstring_middle[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TSTRING_MIDDLE")); |
17050 | 12.0k | Token * t; |
17051 | 12.0k | if ( |
17052 | 12.0k | (t = _PyPegen_expect_token(p, TSTRING_MIDDLE)) // token='TSTRING_MIDDLE' |
17053 | 12.0k | ) |
17054 | 7.07k | { |
17055 | 7.07k | D(fprintf(stderr, "%*c+ tstring_middle[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TSTRING_MIDDLE")); |
17056 | 7.07k | _res = _PyPegen_constant_from_token ( p , t ); |
17057 | 7.07k | if (_res == NULL && PyErr_Occurred()) { |
17058 | 0 | p->error_indicator = 1; |
17059 | 0 | p->level--; |
17060 | 0 | return NULL; |
17061 | 0 | } |
17062 | 7.07k | goto done; |
17063 | 7.07k | } |
17064 | 4.93k | p->mark = _mark; |
17065 | 4.93k | D(fprintf(stderr, "%*c%s tstring_middle[%d-%d]: %s failed!\n", p->level, ' ', |
17066 | 4.93k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TSTRING_MIDDLE")); |
17067 | 4.93k | } |
17068 | 4.93k | _res = NULL; |
17069 | 18.3k | done: |
17070 | 18.3k | p->level--; |
17071 | 18.3k | return _res; |
17072 | 4.93k | } |
17073 | | |
17074 | | // tstring: TSTRING_START tstring_middle* TSTRING_END |
17075 | | static expr_ty |
17076 | | tstring_rule(Parser *p) |
17077 | 82.0k | { |
17078 | 82.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17079 | 0 | _Pypegen_stack_overflow(p); |
17080 | 0 | } |
17081 | 82.0k | if (p->error_indicator) { |
17082 | 3 | p->level--; |
17083 | 3 | return NULL; |
17084 | 3 | } |
17085 | 82.0k | expr_ty _res = NULL; |
17086 | 82.0k | if (_PyPegen_is_memoized(p, tstring_type, &_res)) { |
17087 | 19.6k | p->level--; |
17088 | 19.6k | return _res; |
17089 | 19.6k | } |
17090 | 62.3k | int _mark = p->mark; |
17091 | 62.3k | { // TSTRING_START tstring_middle* TSTRING_END |
17092 | 62.3k | if (p->error_indicator) { |
17093 | 0 | p->level--; |
17094 | 0 | return NULL; |
17095 | 0 | } |
17096 | 62.3k | D(fprintf(stderr, "%*c> tstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TSTRING_START tstring_middle* TSTRING_END")); |
17097 | 62.3k | Token * a; |
17098 | 62.3k | asdl_seq * b; |
17099 | 62.3k | Token * c; |
17100 | 62.3k | if ( |
17101 | 62.3k | (a = _PyPegen_expect_token(p, TSTRING_START)) // token='TSTRING_START' |
17102 | 6.43k | && |
17103 | 6.43k | (b = _loop0_79_rule(p)) // tstring_middle* |
17104 | 6.43k | && |
17105 | 6.43k | (c = _PyPegen_expect_token(p, TSTRING_END)) // token='TSTRING_END' |
17106 | 62.3k | ) |
17107 | 3.99k | { |
17108 | 3.99k | D(fprintf(stderr, "%*c+ tstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TSTRING_START tstring_middle* TSTRING_END")); |
17109 | 3.99k | _res = CHECK_VERSION ( expr_ty , 14 , "t-strings are" , _PyPegen_template_str ( p , a , ( asdl_expr_seq* ) b , c ) ); |
17110 | 3.99k | if (_res == NULL && PyErr_Occurred()) { |
17111 | 0 | p->error_indicator = 1; |
17112 | 0 | p->level--; |
17113 | 0 | return NULL; |
17114 | 0 | } |
17115 | 3.99k | goto done; |
17116 | 3.99k | } |
17117 | 58.3k | p->mark = _mark; |
17118 | 58.3k | D(fprintf(stderr, "%*c%s tstring[%d-%d]: %s failed!\n", p->level, ' ', |
17119 | 58.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TSTRING_START tstring_middle* TSTRING_END")); |
17120 | 58.3k | } |
17121 | 58.3k | _res = NULL; |
17122 | 62.3k | done: |
17123 | 62.3k | _PyPegen_insert_memo(p, _mark, tstring_type, _res); |
17124 | 62.3k | p->level--; |
17125 | 62.3k | return _res; |
17126 | 58.3k | } |
17127 | | |
17128 | | // string: STRING |
17129 | | static expr_ty |
17130 | | string_rule(Parser *p) |
17131 | 187k | { |
17132 | 187k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17133 | 0 | _Pypegen_stack_overflow(p); |
17134 | 0 | } |
17135 | 187k | if (p->error_indicator) { |
17136 | 0 | p->level--; |
17137 | 0 | return NULL; |
17138 | 0 | } |
17139 | 187k | expr_ty _res = NULL; |
17140 | 187k | int _mark = p->mark; |
17141 | 187k | { // STRING |
17142 | 187k | if (p->error_indicator) { |
17143 | 0 | p->level--; |
17144 | 0 | return NULL; |
17145 | 0 | } |
17146 | 187k | D(fprintf(stderr, "%*c> string[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); |
17147 | 187k | Token* s; |
17148 | 187k | if ( |
17149 | 187k | (s = (Token*)_PyPegen_string_token(p)) // STRING |
17150 | 187k | ) |
17151 | 68.6k | { |
17152 | 68.6k | D(fprintf(stderr, "%*c+ string[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING")); |
17153 | 68.6k | _res = _PyPegen_constant_from_string ( p , s ); |
17154 | 68.6k | if (_res == NULL && PyErr_Occurred()) { |
17155 | 104 | p->error_indicator = 1; |
17156 | 104 | p->level--; |
17157 | 104 | return NULL; |
17158 | 104 | } |
17159 | 68.5k | goto done; |
17160 | 68.6k | } |
17161 | 119k | p->mark = _mark; |
17162 | 119k | D(fprintf(stderr, "%*c%s string[%d-%d]: %s failed!\n", p->level, ' ', |
17163 | 119k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); |
17164 | 119k | } |
17165 | 119k | _res = NULL; |
17166 | 187k | done: |
17167 | 187k | p->level--; |
17168 | 187k | return _res; |
17169 | 119k | } |
17170 | | |
17171 | | // strings: invalid_string_tstring_concat | ((fstring | string))+ | tstring+ |
17172 | | static expr_ty |
17173 | | strings_rule(Parser *p) |
17174 | 159k | { |
17175 | 159k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17176 | 0 | _Pypegen_stack_overflow(p); |
17177 | 0 | } |
17178 | 159k | if (p->error_indicator) { |
17179 | 0 | p->level--; |
17180 | 0 | return NULL; |
17181 | 0 | } |
17182 | 159k | expr_ty _res = NULL; |
17183 | 159k | if (_PyPegen_is_memoized(p, strings_type, &_res)) { |
17184 | 61.2k | p->level--; |
17185 | 61.2k | return _res; |
17186 | 61.2k | } |
17187 | 97.9k | int _mark = p->mark; |
17188 | 97.9k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
17189 | 0 | p->error_indicator = 1; |
17190 | 0 | p->level--; |
17191 | 0 | return NULL; |
17192 | 0 | } |
17193 | 97.9k | int _start_lineno = p->tokens[_mark]->lineno; |
17194 | 97.9k | UNUSED(_start_lineno); // Only used by EXTRA macro |
17195 | 97.9k | int _start_col_offset = p->tokens[_mark]->col_offset; |
17196 | 97.9k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
17197 | 97.9k | if (p->call_invalid_rules) { // invalid_string_tstring_concat |
17198 | 25.4k | if (p->error_indicator) { |
17199 | 0 | p->level--; |
17200 | 0 | return NULL; |
17201 | 0 | } |
17202 | 25.4k | D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_string_tstring_concat")); |
17203 | 25.4k | void *invalid_string_tstring_concat_var; |
17204 | 25.4k | if ( |
17205 | 25.4k | (invalid_string_tstring_concat_var = invalid_string_tstring_concat_rule(p)) // invalid_string_tstring_concat |
17206 | 25.4k | ) |
17207 | 0 | { |
17208 | 0 | D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_string_tstring_concat")); |
17209 | 0 | _res = invalid_string_tstring_concat_var; |
17210 | 0 | goto done; |
17211 | 0 | } |
17212 | 25.4k | p->mark = _mark; |
17213 | 25.4k | D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ', |
17214 | 25.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_string_tstring_concat")); |
17215 | 25.4k | } |
17216 | 97.9k | { // ((fstring | string))+ |
17217 | 97.9k | if (p->error_indicator) { |
17218 | 2.86k | p->level--; |
17219 | 2.86k | return NULL; |
17220 | 2.86k | } |
17221 | 95.0k | D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((fstring | string))+")); |
17222 | 95.0k | asdl_expr_seq* a; |
17223 | 95.0k | if ( |
17224 | 95.0k | (a = (asdl_expr_seq*)_loop1_80_rule(p)) // ((fstring | string))+ |
17225 | 95.0k | ) |
17226 | 46.1k | { |
17227 | 46.1k | D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((fstring | string))+")); |
17228 | 46.1k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17229 | 46.1k | if (_token == NULL) { |
17230 | 0 | p->level--; |
17231 | 0 | return NULL; |
17232 | 0 | } |
17233 | 46.1k | int _end_lineno = _token->end_lineno; |
17234 | 46.1k | UNUSED(_end_lineno); // Only used by EXTRA macro |
17235 | 46.1k | int _end_col_offset = _token->end_col_offset; |
17236 | 46.1k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17237 | 46.1k | _res = _PyPegen_concatenate_strings ( p , a , EXTRA ); |
17238 | 46.1k | if (_res == NULL && PyErr_Occurred()) { |
17239 | 1 | p->error_indicator = 1; |
17240 | 1 | p->level--; |
17241 | 1 | return NULL; |
17242 | 1 | } |
17243 | 46.1k | goto done; |
17244 | 46.1k | } |
17245 | 48.8k | p->mark = _mark; |
17246 | 48.8k | D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ', |
17247 | 48.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((fstring | string))+")); |
17248 | 48.8k | } |
17249 | 0 | { // tstring+ |
17250 | 48.8k | if (p->error_indicator) { |
17251 | 905 | p->level--; |
17252 | 905 | return NULL; |
17253 | 905 | } |
17254 | 47.9k | D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tstring+")); |
17255 | 47.9k | asdl_expr_seq* a; |
17256 | 47.9k | if ( |
17257 | 47.9k | (a = (asdl_expr_seq*)_loop1_81_rule(p)) // tstring+ |
17258 | 47.9k | ) |
17259 | 3.18k | { |
17260 | 3.18k | D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tstring+")); |
17261 | 3.18k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17262 | 3.18k | if (_token == NULL) { |
17263 | 0 | p->level--; |
17264 | 0 | return NULL; |
17265 | 0 | } |
17266 | 3.18k | int _end_lineno = _token->end_lineno; |
17267 | 3.18k | UNUSED(_end_lineno); // Only used by EXTRA macro |
17268 | 3.18k | int _end_col_offset = _token->end_col_offset; |
17269 | 3.18k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17270 | 3.18k | _res = _PyPegen_concatenate_tstrings ( p , a , EXTRA ); |
17271 | 3.18k | if (_res == NULL && PyErr_Occurred()) { |
17272 | 0 | p->error_indicator = 1; |
17273 | 0 | p->level--; |
17274 | 0 | return NULL; |
17275 | 0 | } |
17276 | 3.18k | goto done; |
17277 | 3.18k | } |
17278 | 44.8k | p->mark = _mark; |
17279 | 44.8k | D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ', |
17280 | 44.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tstring+")); |
17281 | 44.8k | } |
17282 | 44.8k | _res = NULL; |
17283 | 94.1k | done: |
17284 | 94.1k | _PyPegen_insert_memo(p, _mark, strings_type, _res); |
17285 | 94.1k | p->level--; |
17286 | 94.1k | return _res; |
17287 | 44.8k | } |
17288 | | |
17289 | | // list: '[' star_named_expressions? ']' |
17290 | | static expr_ty |
17291 | | list_rule(Parser *p) |
17292 | 168k | { |
17293 | 168k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17294 | 1 | _Pypegen_stack_overflow(p); |
17295 | 1 | } |
17296 | 168k | if (p->error_indicator) { |
17297 | 1 | p->level--; |
17298 | 1 | return NULL; |
17299 | 1 | } |
17300 | 168k | expr_ty _res = NULL; |
17301 | 168k | int _mark = p->mark; |
17302 | 168k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
17303 | 0 | p->error_indicator = 1; |
17304 | 0 | p->level--; |
17305 | 0 | return NULL; |
17306 | 0 | } |
17307 | 168k | int _start_lineno = p->tokens[_mark]->lineno; |
17308 | 168k | UNUSED(_start_lineno); // Only used by EXTRA macro |
17309 | 168k | int _start_col_offset = p->tokens[_mark]->col_offset; |
17310 | 168k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
17311 | 168k | { // '[' star_named_expressions? ']' |
17312 | 168k | if (p->error_indicator) { |
17313 | 0 | p->level--; |
17314 | 0 | return NULL; |
17315 | 0 | } |
17316 | 168k | D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'")); |
17317 | 168k | Token * _literal; |
17318 | 168k | Token * _literal_1; |
17319 | 168k | void *a; |
17320 | 168k | if ( |
17321 | 168k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
17322 | 50.8k | && |
17323 | 50.8k | (a = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions? |
17324 | 38.9k | && |
17325 | 38.9k | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
17326 | 168k | ) |
17327 | 16.7k | { |
17328 | 16.7k | D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'")); |
17329 | 16.7k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17330 | 16.7k | if (_token == NULL) { |
17331 | 0 | p->level--; |
17332 | 0 | return NULL; |
17333 | 0 | } |
17334 | 16.7k | int _end_lineno = _token->end_lineno; |
17335 | 16.7k | UNUSED(_end_lineno); // Only used by EXTRA macro |
17336 | 16.7k | int _end_col_offset = _token->end_col_offset; |
17337 | 16.7k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17338 | 16.7k | _res = _PyAST_List ( a , Load , EXTRA ); |
17339 | 16.7k | if (_res == NULL && PyErr_Occurred()) { |
17340 | 0 | p->error_indicator = 1; |
17341 | 0 | p->level--; |
17342 | 0 | return NULL; |
17343 | 0 | } |
17344 | 16.7k | goto done; |
17345 | 16.7k | } |
17346 | 151k | p->mark = _mark; |
17347 | 151k | D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ', |
17348 | 151k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'")); |
17349 | 151k | } |
17350 | 151k | _res = NULL; |
17351 | 168k | done: |
17352 | 168k | p->level--; |
17353 | 168k | return _res; |
17354 | 151k | } |
17355 | | |
17356 | | // tuple: '(' [star_named_expression ',' star_named_expressions?] ')' |
17357 | | static expr_ty |
17358 | | tuple_rule(Parser *p) |
17359 | 195k | { |
17360 | 195k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17361 | 1 | _Pypegen_stack_overflow(p); |
17362 | 1 | } |
17363 | 195k | if (p->error_indicator) { |
17364 | 1 | p->level--; |
17365 | 1 | return NULL; |
17366 | 1 | } |
17367 | 195k | expr_ty _res = NULL; |
17368 | 195k | int _mark = p->mark; |
17369 | 195k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
17370 | 0 | p->error_indicator = 1; |
17371 | 0 | p->level--; |
17372 | 0 | return NULL; |
17373 | 0 | } |
17374 | 195k | int _start_lineno = p->tokens[_mark]->lineno; |
17375 | 195k | UNUSED(_start_lineno); // Only used by EXTRA macro |
17376 | 195k | int _start_col_offset = p->tokens[_mark]->col_offset; |
17377 | 195k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
17378 | 195k | { // '(' [star_named_expression ',' star_named_expressions?] ')' |
17379 | 195k | if (p->error_indicator) { |
17380 | 0 | p->level--; |
17381 | 0 | return NULL; |
17382 | 0 | } |
17383 | 195k | D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); |
17384 | 195k | Token * _literal; |
17385 | 195k | Token * _literal_1; |
17386 | 195k | void *a; |
17387 | 195k | if ( |
17388 | 195k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
17389 | 84.7k | && |
17390 | 84.7k | (a = _tmp_82_rule(p), !p->error_indicator) // [star_named_expression ',' star_named_expressions?] |
17391 | 79.2k | && |
17392 | 79.2k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
17393 | 195k | ) |
17394 | 43.1k | { |
17395 | 43.1k | D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); |
17396 | 43.1k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17397 | 43.1k | if (_token == NULL) { |
17398 | 0 | p->level--; |
17399 | 0 | return NULL; |
17400 | 0 | } |
17401 | 43.1k | int _end_lineno = _token->end_lineno; |
17402 | 43.1k | UNUSED(_end_lineno); // Only used by EXTRA macro |
17403 | 43.1k | int _end_col_offset = _token->end_col_offset; |
17404 | 43.1k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17405 | 43.1k | _res = _PyAST_Tuple ( a , Load , EXTRA ); |
17406 | 43.1k | if (_res == NULL && PyErr_Occurred()) { |
17407 | 0 | p->error_indicator = 1; |
17408 | 0 | p->level--; |
17409 | 0 | return NULL; |
17410 | 0 | } |
17411 | 43.1k | goto done; |
17412 | 43.1k | } |
17413 | 152k | p->mark = _mark; |
17414 | 152k | D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ', |
17415 | 152k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'")); |
17416 | 152k | } |
17417 | 152k | _res = NULL; |
17418 | 195k | done: |
17419 | 195k | p->level--; |
17420 | 195k | return _res; |
17421 | 152k | } |
17422 | | |
17423 | | // set: '{' star_named_expressions '}' |
17424 | | static expr_ty |
17425 | | set_rule(Parser *p) |
17426 | 11.2k | { |
17427 | 11.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17428 | 0 | _Pypegen_stack_overflow(p); |
17429 | 0 | } |
17430 | 11.2k | if (p->error_indicator) { |
17431 | 0 | p->level--; |
17432 | 0 | return NULL; |
17433 | 0 | } |
17434 | 11.2k | expr_ty _res = NULL; |
17435 | 11.2k | int _mark = p->mark; |
17436 | 11.2k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
17437 | 0 | p->error_indicator = 1; |
17438 | 0 | p->level--; |
17439 | 0 | return NULL; |
17440 | 0 | } |
17441 | 11.2k | int _start_lineno = p->tokens[_mark]->lineno; |
17442 | 11.2k | UNUSED(_start_lineno); // Only used by EXTRA macro |
17443 | 11.2k | int _start_col_offset = p->tokens[_mark]->col_offset; |
17444 | 11.2k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
17445 | 11.2k | { // '{' star_named_expressions '}' |
17446 | 11.2k | if (p->error_indicator) { |
17447 | 0 | p->level--; |
17448 | 0 | return NULL; |
17449 | 0 | } |
17450 | 11.2k | D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'")); |
17451 | 11.2k | Token * _literal; |
17452 | 11.2k | Token * _literal_1; |
17453 | 11.2k | asdl_expr_seq* a; |
17454 | 11.2k | if ( |
17455 | 11.2k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
17456 | 11.2k | && |
17457 | 11.2k | (a = star_named_expressions_rule(p)) // star_named_expressions |
17458 | 7.49k | && |
17459 | 7.49k | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
17460 | 11.2k | ) |
17461 | 1.48k | { |
17462 | 1.48k | D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'")); |
17463 | 1.48k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17464 | 1.48k | if (_token == NULL) { |
17465 | 0 | p->level--; |
17466 | 0 | return NULL; |
17467 | 0 | } |
17468 | 1.48k | int _end_lineno = _token->end_lineno; |
17469 | 1.48k | UNUSED(_end_lineno); // Only used by EXTRA macro |
17470 | 1.48k | int _end_col_offset = _token->end_col_offset; |
17471 | 1.48k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17472 | 1.48k | _res = _PyAST_Set ( a , EXTRA ); |
17473 | 1.48k | if (_res == NULL && PyErr_Occurred()) { |
17474 | 0 | p->error_indicator = 1; |
17475 | 0 | p->level--; |
17476 | 0 | return NULL; |
17477 | 0 | } |
17478 | 1.48k | goto done; |
17479 | 1.48k | } |
17480 | 9.78k | p->mark = _mark; |
17481 | 9.78k | D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ', |
17482 | 9.78k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' star_named_expressions '}'")); |
17483 | 9.78k | } |
17484 | 9.78k | _res = NULL; |
17485 | 11.2k | done: |
17486 | 11.2k | p->level--; |
17487 | 11.2k | return _res; |
17488 | 9.78k | } |
17489 | | |
17490 | | // dict: '{' double_starred_kvpairs? '}' | '{' invalid_double_starred_kvpairs '}' |
17491 | | static expr_ty |
17492 | | dict_rule(Parser *p) |
17493 | 21.8k | { |
17494 | 21.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17495 | 1 | _Pypegen_stack_overflow(p); |
17496 | 1 | } |
17497 | 21.8k | if (p->error_indicator) { |
17498 | 1 | p->level--; |
17499 | 1 | return NULL; |
17500 | 1 | } |
17501 | 21.8k | expr_ty _res = NULL; |
17502 | 21.8k | int _mark = p->mark; |
17503 | 21.8k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
17504 | 0 | p->error_indicator = 1; |
17505 | 0 | p->level--; |
17506 | 0 | return NULL; |
17507 | 0 | } |
17508 | 21.8k | int _start_lineno = p->tokens[_mark]->lineno; |
17509 | 21.8k | UNUSED(_start_lineno); // Only used by EXTRA macro |
17510 | 21.8k | int _start_col_offset = p->tokens[_mark]->col_offset; |
17511 | 21.8k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
17512 | 21.8k | { // '{' double_starred_kvpairs? '}' |
17513 | 21.8k | if (p->error_indicator) { |
17514 | 0 | p->level--; |
17515 | 0 | return NULL; |
17516 | 0 | } |
17517 | 21.8k | D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
17518 | 21.8k | Token * _literal; |
17519 | 21.8k | Token * _literal_1; |
17520 | 21.8k | void *a; |
17521 | 21.8k | if ( |
17522 | 21.8k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
17523 | 21.8k | && |
17524 | 21.8k | (a = double_starred_kvpairs_rule(p), !p->error_indicator) // double_starred_kvpairs? |
17525 | 15.8k | && |
17526 | 15.8k | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
17527 | 21.8k | ) |
17528 | 4.33k | { |
17529 | 4.33k | D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
17530 | 4.33k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17531 | 4.33k | if (_token == NULL) { |
17532 | 0 | p->level--; |
17533 | 0 | return NULL; |
17534 | 0 | } |
17535 | 4.33k | int _end_lineno = _token->end_lineno; |
17536 | 4.33k | UNUSED(_end_lineno); // Only used by EXTRA macro |
17537 | 4.33k | int _end_col_offset = _token->end_col_offset; |
17538 | 4.33k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17539 | 4.33k | _res = _PyAST_Dict ( CHECK ( asdl_expr_seq* , _PyPegen_get_keys ( p , a ) ) , CHECK ( asdl_expr_seq* , _PyPegen_get_values ( p , a ) ) , EXTRA ); |
17540 | 4.33k | if (_res == NULL && PyErr_Occurred()) { |
17541 | 0 | p->error_indicator = 1; |
17542 | 0 | p->level--; |
17543 | 0 | return NULL; |
17544 | 0 | } |
17545 | 4.33k | goto done; |
17546 | 4.33k | } |
17547 | 17.5k | p->mark = _mark; |
17548 | 17.5k | D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ', |
17549 | 17.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
17550 | 17.5k | } |
17551 | 0 | { // '{' invalid_double_starred_kvpairs '}' |
17552 | 17.5k | if (p->error_indicator) { |
17553 | 6.00k | p->level--; |
17554 | 6.00k | return NULL; |
17555 | 6.00k | } |
17556 | 11.5k | D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'")); |
17557 | 11.5k | Token * _literal; |
17558 | 11.5k | Token * _literal_1; |
17559 | 11.5k | void *invalid_double_starred_kvpairs_var; |
17560 | 11.5k | if ( |
17561 | 11.5k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
17562 | 11.5k | && |
17563 | 11.5k | (invalid_double_starred_kvpairs_var = invalid_double_starred_kvpairs_rule(p)) // invalid_double_starred_kvpairs |
17564 | 0 | && |
17565 | 0 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
17566 | 11.5k | ) |
17567 | 0 | { |
17568 | 0 | D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'")); |
17569 | 0 | _res = _PyPegen_dummy_name(p, _literal, invalid_double_starred_kvpairs_var, _literal_1); |
17570 | 0 | goto done; |
17571 | 0 | } |
17572 | 11.5k | p->mark = _mark; |
17573 | 11.5k | D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ', |
17574 | 11.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'")); |
17575 | 11.5k | } |
17576 | 11.5k | _res = NULL; |
17577 | 15.8k | done: |
17578 | 15.8k | p->level--; |
17579 | 15.8k | return _res; |
17580 | 11.5k | } |
17581 | | |
17582 | | // double_starred_kvpairs: ','.double_starred_kvpair+ ','? |
17583 | | static asdl_seq* |
17584 | | double_starred_kvpairs_rule(Parser *p) |
17585 | 21.8k | { |
17586 | 21.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17587 | 1 | _Pypegen_stack_overflow(p); |
17588 | 1 | } |
17589 | 21.8k | if (p->error_indicator) { |
17590 | 1 | p->level--; |
17591 | 1 | return NULL; |
17592 | 1 | } |
17593 | 21.8k | asdl_seq* _res = NULL; |
17594 | 21.8k | int _mark = p->mark; |
17595 | 21.8k | { // ','.double_starred_kvpair+ ','? |
17596 | 21.8k | if (p->error_indicator) { |
17597 | 0 | p->level--; |
17598 | 0 | return NULL; |
17599 | 0 | } |
17600 | 21.8k | D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
17601 | 21.8k | void *_opt_var; |
17602 | 21.8k | UNUSED(_opt_var); // Silence compiler warnings |
17603 | 21.8k | asdl_seq * a; |
17604 | 21.8k | if ( |
17605 | 21.8k | (a = _gather_84_rule(p)) // ','.double_starred_kvpair+ |
17606 | 5.12k | && |
17607 | 5.12k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
17608 | 21.8k | ) |
17609 | 5.05k | { |
17610 | 5.05k | D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
17611 | 5.05k | _res = a; |
17612 | 5.05k | if (_res == NULL && PyErr_Occurred()) { |
17613 | 0 | p->error_indicator = 1; |
17614 | 0 | p->level--; |
17615 | 0 | return NULL; |
17616 | 0 | } |
17617 | 5.05k | goto done; |
17618 | 5.05k | } |
17619 | 16.8k | p->mark = _mark; |
17620 | 16.8k | D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ', |
17621 | 16.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
17622 | 16.8k | } |
17623 | 16.8k | _res = NULL; |
17624 | 21.8k | done: |
17625 | 21.8k | p->level--; |
17626 | 21.8k | return _res; |
17627 | 16.8k | } |
17628 | | |
17629 | | // double_starred_kvpair: '**' bitwise_or | kvpair |
17630 | | static KeyValuePair* |
17631 | | double_starred_kvpair_rule(Parser *p) |
17632 | 68.8k | { |
17633 | 68.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17634 | 1 | _Pypegen_stack_overflow(p); |
17635 | 1 | } |
17636 | 68.8k | if (p->error_indicator) { |
17637 | 1 | p->level--; |
17638 | 1 | return NULL; |
17639 | 1 | } |
17640 | 68.8k | KeyValuePair* _res = NULL; |
17641 | 68.8k | int _mark = p->mark; |
17642 | 68.8k | { // '**' bitwise_or |
17643 | 68.8k | if (p->error_indicator) { |
17644 | 0 | p->level--; |
17645 | 0 | return NULL; |
17646 | 0 | } |
17647 | 68.8k | D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or")); |
17648 | 68.8k | Token * _literal; |
17649 | 68.8k | expr_ty a; |
17650 | 68.8k | if ( |
17651 | 68.8k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
17652 | 2.43k | && |
17653 | 2.43k | (a = bitwise_or_rule(p)) // bitwise_or |
17654 | 68.8k | ) |
17655 | 1.26k | { |
17656 | 1.26k | D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or")); |
17657 | 1.26k | _res = _PyPegen_key_value_pair ( p , NULL , a ); |
17658 | 1.26k | if (_res == NULL && PyErr_Occurred()) { |
17659 | 0 | p->error_indicator = 1; |
17660 | 0 | p->level--; |
17661 | 0 | return NULL; |
17662 | 0 | } |
17663 | 1.26k | goto done; |
17664 | 1.26k | } |
17665 | 67.6k | p->mark = _mark; |
17666 | 67.6k | D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
17667 | 67.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or")); |
17668 | 67.6k | } |
17669 | 0 | { // kvpair |
17670 | 67.6k | if (p->error_indicator) { |
17671 | 378 | p->level--; |
17672 | 378 | return NULL; |
17673 | 378 | } |
17674 | 67.2k | D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair")); |
17675 | 67.2k | KeyValuePair* kvpair_var; |
17676 | 67.2k | if ( |
17677 | 67.2k | (kvpair_var = kvpair_rule(p)) // kvpair |
17678 | 67.2k | ) |
17679 | 40.2k | { |
17680 | 40.2k | D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair")); |
17681 | 40.2k | _res = kvpair_var; |
17682 | 40.2k | goto done; |
17683 | 40.2k | } |
17684 | 26.9k | p->mark = _mark; |
17685 | 26.9k | D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
17686 | 26.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair")); |
17687 | 26.9k | } |
17688 | 26.9k | _res = NULL; |
17689 | 68.4k | done: |
17690 | 68.4k | p->level--; |
17691 | 68.4k | return _res; |
17692 | 26.9k | } |
17693 | | |
17694 | | // kvpair: expression ':' expression |
17695 | | static KeyValuePair* |
17696 | | kvpair_rule(Parser *p) |
17697 | 76.7k | { |
17698 | 76.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17699 | 1 | _Pypegen_stack_overflow(p); |
17700 | 1 | } |
17701 | 76.7k | if (p->error_indicator) { |
17702 | 1 | p->level--; |
17703 | 1 | return NULL; |
17704 | 1 | } |
17705 | 76.7k | KeyValuePair* _res = NULL; |
17706 | 76.7k | int _mark = p->mark; |
17707 | 76.7k | { // expression ':' expression |
17708 | 76.7k | if (p->error_indicator) { |
17709 | 0 | p->level--; |
17710 | 0 | return NULL; |
17711 | 0 | } |
17712 | 76.7k | D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); |
17713 | 76.7k | Token * _literal; |
17714 | 76.7k | expr_ty a; |
17715 | 76.7k | expr_ty b; |
17716 | 76.7k | if ( |
17717 | 76.7k | (a = expression_rule(p)) // expression |
17718 | 57.2k | && |
17719 | 57.2k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
17720 | 45.7k | && |
17721 | 45.7k | (b = expression_rule(p)) // expression |
17722 | 76.7k | ) |
17723 | 42.6k | { |
17724 | 42.6k | D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); |
17725 | 42.6k | _res = _PyPegen_key_value_pair ( p , a , b ); |
17726 | 42.6k | if (_res == NULL && PyErr_Occurred()) { |
17727 | 0 | p->error_indicator = 1; |
17728 | 0 | p->level--; |
17729 | 0 | return NULL; |
17730 | 0 | } |
17731 | 42.6k | goto done; |
17732 | 42.6k | } |
17733 | 34.0k | p->mark = _mark; |
17734 | 34.0k | D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
17735 | 34.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression")); |
17736 | 34.0k | } |
17737 | 34.0k | _res = NULL; |
17738 | 76.7k | done: |
17739 | 76.7k | p->level--; |
17740 | 76.7k | return _res; |
17741 | 34.0k | } |
17742 | | |
17743 | | // for_if_clauses: for_if_clause+ |
17744 | | static asdl_comprehension_seq* |
17745 | | for_if_clauses_rule(Parser *p) |
17746 | 100k | { |
17747 | 100k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17748 | 0 | _Pypegen_stack_overflow(p); |
17749 | 0 | } |
17750 | 100k | if (p->error_indicator) { |
17751 | 0 | p->level--; |
17752 | 0 | return NULL; |
17753 | 0 | } |
17754 | 100k | asdl_comprehension_seq* _res = NULL; |
17755 | 100k | int _mark = p->mark; |
17756 | 100k | { // for_if_clause+ |
17757 | 100k | if (p->error_indicator) { |
17758 | 0 | p->level--; |
17759 | 0 | return NULL; |
17760 | 0 | } |
17761 | 100k | D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); |
17762 | 100k | asdl_comprehension_seq* a; |
17763 | 100k | if ( |
17764 | 100k | (a = (asdl_comprehension_seq*)_loop1_85_rule(p)) // for_if_clause+ |
17765 | 100k | ) |
17766 | 10.4k | { |
17767 | 10.4k | D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+")); |
17768 | 10.4k | _res = a; |
17769 | 10.4k | if (_res == NULL && PyErr_Occurred()) { |
17770 | 0 | p->error_indicator = 1; |
17771 | 0 | p->level--; |
17772 | 0 | return NULL; |
17773 | 0 | } |
17774 | 10.4k | goto done; |
17775 | 10.4k | } |
17776 | 89.8k | p->mark = _mark; |
17777 | 89.8k | D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ', |
17778 | 89.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+")); |
17779 | 89.8k | } |
17780 | 89.8k | _res = NULL; |
17781 | 100k | done: |
17782 | 100k | p->level--; |
17783 | 100k | return _res; |
17784 | 89.8k | } |
17785 | | |
17786 | | // for_if_clause: |
17787 | | // | 'async' 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
17788 | | // | 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
17789 | | // | invalid_for_if_clause |
17790 | | // | invalid_for_target |
17791 | | static comprehension_ty |
17792 | | for_if_clause_rule(Parser *p) |
17793 | 111k | { |
17794 | 111k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17795 | 0 | _Pypegen_stack_overflow(p); |
17796 | 0 | } |
17797 | 111k | if (p->error_indicator) { |
17798 | 198 | p->level--; |
17799 | 198 | return NULL; |
17800 | 198 | } |
17801 | 111k | comprehension_ty _res = NULL; |
17802 | 111k | int _mark = p->mark; |
17803 | 111k | { // 'async' 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
17804 | 111k | if (p->error_indicator) { |
17805 | 0 | p->level--; |
17806 | 0 | return NULL; |
17807 | 0 | } |
17808 | 111k | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async' 'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
17809 | 111k | int _cut_var = 0; |
17810 | 111k | Token * _keyword; |
17811 | 111k | Token * _keyword_1; |
17812 | 111k | Token * _keyword_2; |
17813 | 111k | expr_ty a; |
17814 | 111k | expr_ty b; |
17815 | 111k | asdl_expr_seq* c; |
17816 | 111k | if ( |
17817 | 111k | (_keyword = _PyPegen_expect_token(p, 707)) // token='async' |
17818 | 1.49k | && |
17819 | 1.49k | (_keyword_1 = _PyPegen_expect_token(p, 703)) // token='for' |
17820 | 1.46k | && |
17821 | 1.46k | (a = star_targets_rule(p)) // star_targets |
17822 | 544 | && |
17823 | 544 | (_keyword_2 = _PyPegen_expect_token(p, 704)) // token='in' |
17824 | 466 | && |
17825 | 466 | (_cut_var = 1) |
17826 | 466 | && |
17827 | 466 | (b = disjunction_rule(p)) // disjunction |
17828 | 399 | && |
17829 | 399 | (c = (asdl_expr_seq*)_loop0_86_rule(p)) // (('if' disjunction))* |
17830 | 111k | ) |
17831 | 399 | { |
17832 | 399 | 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))*")); |
17833 | 399 | _res = CHECK_VERSION ( comprehension_ty , 6 , "Async comprehensions are" , _PyAST_comprehension ( a , b , c , 1 , p -> arena ) ); |
17834 | 399 | if (_res == NULL && PyErr_Occurred()) { |
17835 | 0 | p->error_indicator = 1; |
17836 | 0 | p->level--; |
17837 | 0 | return NULL; |
17838 | 0 | } |
17839 | 399 | goto done; |
17840 | 399 | } |
17841 | 111k | p->mark = _mark; |
17842 | 111k | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
17843 | 111k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async' 'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
17844 | 111k | if (_cut_var) { |
17845 | 67 | p->level--; |
17846 | 67 | return NULL; |
17847 | 67 | } |
17848 | 111k | } |
17849 | 111k | { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))* |
17850 | 111k | if (p->error_indicator) { |
17851 | 195 | p->level--; |
17852 | 195 | return NULL; |
17853 | 195 | } |
17854 | 110k | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
17855 | 110k | int _cut_var = 0; |
17856 | 110k | Token * _keyword; |
17857 | 110k | Token * _keyword_1; |
17858 | 110k | expr_ty a; |
17859 | 110k | expr_ty b; |
17860 | 110k | asdl_expr_seq* c; |
17861 | 110k | if ( |
17862 | 110k | (_keyword = _PyPegen_expect_token(p, 703)) // token='for' |
17863 | 16.1k | && |
17864 | 16.1k | (a = star_targets_rule(p)) // star_targets |
17865 | 13.6k | && |
17866 | 13.6k | (_keyword_1 = _PyPegen_expect_token(p, 704)) // token='in' |
17867 | 11.2k | && |
17868 | 11.2k | (_cut_var = 1) |
17869 | 11.2k | && |
17870 | 11.2k | (b = disjunction_rule(p)) // disjunction |
17871 | 11.0k | && |
17872 | 11.0k | (c = (asdl_expr_seq*)_loop0_86_rule(p)) // (('if' disjunction))* |
17873 | 110k | ) |
17874 | 11.0k | { |
17875 | 11.0k | D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
17876 | 11.0k | _res = _PyAST_comprehension ( a , b , c , 0 , p -> arena ); |
17877 | 11.0k | if (_res == NULL && PyErr_Occurred()) { |
17878 | 0 | p->error_indicator = 1; |
17879 | 0 | p->level--; |
17880 | 0 | return NULL; |
17881 | 0 | } |
17882 | 11.0k | goto done; |
17883 | 11.0k | } |
17884 | 99.8k | p->mark = _mark; |
17885 | 99.8k | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
17886 | 99.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*")); |
17887 | 99.8k | if (_cut_var) { |
17888 | 224 | p->level--; |
17889 | 224 | return NULL; |
17890 | 224 | } |
17891 | 99.8k | } |
17892 | 99.6k | if (p->call_invalid_rules) { // invalid_for_if_clause |
17893 | 44.8k | if (p->error_indicator) { |
17894 | 855 | p->level--; |
17895 | 855 | return NULL; |
17896 | 855 | } |
17897 | 44.0k | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_if_clause")); |
17898 | 44.0k | void *invalid_for_if_clause_var; |
17899 | 44.0k | if ( |
17900 | 44.0k | (invalid_for_if_clause_var = invalid_for_if_clause_rule(p)) // invalid_for_if_clause |
17901 | 44.0k | ) |
17902 | 0 | { |
17903 | 0 | D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_if_clause")); |
17904 | 0 | _res = invalid_for_if_clause_var; |
17905 | 0 | goto done; |
17906 | 0 | } |
17907 | 44.0k | p->mark = _mark; |
17908 | 44.0k | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
17909 | 44.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_if_clause")); |
17910 | 44.0k | } |
17911 | 98.7k | if (p->call_invalid_rules) { // invalid_for_target |
17912 | 44.0k | if (p->error_indicator) { |
17913 | 647 | p->level--; |
17914 | 647 | return NULL; |
17915 | 647 | } |
17916 | 43.3k | D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target")); |
17917 | 43.3k | void *invalid_for_target_var; |
17918 | 43.3k | if ( |
17919 | 43.3k | (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target |
17920 | 43.3k | ) |
17921 | 0 | { |
17922 | 0 | D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target")); |
17923 | 0 | _res = invalid_for_target_var; |
17924 | 0 | goto done; |
17925 | 0 | } |
17926 | 43.3k | p->mark = _mark; |
17927 | 43.3k | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
17928 | 43.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target")); |
17929 | 43.3k | } |
17930 | 98.1k | _res = NULL; |
17931 | 109k | done: |
17932 | 109k | p->level--; |
17933 | 109k | return _res; |
17934 | 98.1k | } |
17935 | | |
17936 | | // listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension |
17937 | | static expr_ty |
17938 | | listcomp_rule(Parser *p) |
17939 | 20.3k | { |
17940 | 20.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
17941 | 0 | _Pypegen_stack_overflow(p); |
17942 | 0 | } |
17943 | 20.3k | if (p->error_indicator) { |
17944 | 0 | p->level--; |
17945 | 0 | return NULL; |
17946 | 0 | } |
17947 | 20.3k | expr_ty _res = NULL; |
17948 | 20.3k | int _mark = p->mark; |
17949 | 20.3k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
17950 | 0 | p->error_indicator = 1; |
17951 | 0 | p->level--; |
17952 | 0 | return NULL; |
17953 | 0 | } |
17954 | 20.3k | int _start_lineno = p->tokens[_mark]->lineno; |
17955 | 20.3k | UNUSED(_start_lineno); // Only used by EXTRA macro |
17956 | 20.3k | int _start_col_offset = p->tokens[_mark]->col_offset; |
17957 | 20.3k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
17958 | 20.3k | { // '[' named_expression for_if_clauses ']' |
17959 | 20.3k | if (p->error_indicator) { |
17960 | 0 | p->level--; |
17961 | 0 | return NULL; |
17962 | 0 | } |
17963 | 20.3k | D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'")); |
17964 | 20.3k | Token * _literal; |
17965 | 20.3k | Token * _literal_1; |
17966 | 20.3k | expr_ty a; |
17967 | 20.3k | asdl_comprehension_seq* b; |
17968 | 20.3k | if ( |
17969 | 20.3k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
17970 | 20.3k | && |
17971 | 20.3k | (a = named_expression_rule(p)) // named_expression |
17972 | 7.73k | && |
17973 | 7.73k | (b = for_if_clauses_rule(p)) // for_if_clauses |
17974 | 1.73k | && |
17975 | 1.73k | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
17976 | 20.3k | ) |
17977 | 1.53k | { |
17978 | 1.53k | D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'")); |
17979 | 1.53k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
17980 | 1.53k | if (_token == NULL) { |
17981 | 0 | p->level--; |
17982 | 0 | return NULL; |
17983 | 0 | } |
17984 | 1.53k | int _end_lineno = _token->end_lineno; |
17985 | 1.53k | UNUSED(_end_lineno); // Only used by EXTRA macro |
17986 | 1.53k | int _end_col_offset = _token->end_col_offset; |
17987 | 1.53k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
17988 | 1.53k | _res = _PyAST_ListComp ( a , b , EXTRA ); |
17989 | 1.53k | if (_res == NULL && PyErr_Occurred()) { |
17990 | 0 | p->error_indicator = 1; |
17991 | 0 | p->level--; |
17992 | 0 | return NULL; |
17993 | 0 | } |
17994 | 1.53k | goto done; |
17995 | 1.53k | } |
17996 | 18.8k | p->mark = _mark; |
17997 | 18.8k | D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', |
17998 | 18.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression for_if_clauses ']'")); |
17999 | 18.8k | } |
18000 | 18.8k | if (p->call_invalid_rules) { // invalid_comprehension |
18001 | 4.52k | if (p->error_indicator) { |
18002 | 355 | p->level--; |
18003 | 355 | return NULL; |
18004 | 355 | } |
18005 | 4.16k | D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
18006 | 4.16k | void *invalid_comprehension_var; |
18007 | 4.16k | if ( |
18008 | 4.16k | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
18009 | 4.16k | ) |
18010 | 0 | { |
18011 | 0 | D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
18012 | 0 | _res = invalid_comprehension_var; |
18013 | 0 | goto done; |
18014 | 0 | } |
18015 | 4.16k | p->mark = _mark; |
18016 | 4.16k | D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', |
18017 | 4.16k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
18018 | 4.16k | } |
18019 | 18.4k | _res = NULL; |
18020 | 20.0k | done: |
18021 | 20.0k | p->level--; |
18022 | 20.0k | return _res; |
18023 | 18.4k | } |
18024 | | |
18025 | | // setcomp: '{' named_expression for_if_clauses '}' | invalid_comprehension |
18026 | | static expr_ty |
18027 | | setcomp_rule(Parser *p) |
18028 | 7.86k | { |
18029 | 7.86k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
18030 | 0 | _Pypegen_stack_overflow(p); |
18031 | 0 | } |
18032 | 7.86k | if (p->error_indicator) { |
18033 | 0 | p->level--; |
18034 | 0 | return NULL; |
18035 | 0 | } |
18036 | 7.86k | expr_ty _res = NULL; |
18037 | 7.86k | int _mark = p->mark; |
18038 | 7.86k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
18039 | 0 | p->error_indicator = 1; |
18040 | 0 | p->level--; |
18041 | 0 | return NULL; |
18042 | 0 | } |
18043 | 7.86k | int _start_lineno = p->tokens[_mark]->lineno; |
18044 | 7.86k | UNUSED(_start_lineno); // Only used by EXTRA macro |
18045 | 7.86k | int _start_col_offset = p->tokens[_mark]->col_offset; |
18046 | 7.86k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
18047 | 7.86k | { // '{' named_expression for_if_clauses '}' |
18048 | 7.86k | if (p->error_indicator) { |
18049 | 0 | p->level--; |
18050 | 0 | return NULL; |
18051 | 0 | } |
18052 | 7.86k | D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'")); |
18053 | 7.86k | Token * _literal; |
18054 | 7.86k | Token * _literal_1; |
18055 | 7.86k | expr_ty a; |
18056 | 7.86k | asdl_comprehension_seq* b; |
18057 | 7.86k | if ( |
18058 | 7.86k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
18059 | 7.86k | && |
18060 | 7.86k | (a = named_expression_rule(p)) // named_expression |
18061 | 4.33k | && |
18062 | 4.33k | (b = for_if_clauses_rule(p)) // for_if_clauses |
18063 | 659 | && |
18064 | 659 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
18065 | 7.86k | ) |
18066 | 560 | { |
18067 | 560 | D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'")); |
18068 | 560 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18069 | 560 | if (_token == NULL) { |
18070 | 0 | p->level--; |
18071 | 0 | return NULL; |
18072 | 0 | } |
18073 | 560 | int _end_lineno = _token->end_lineno; |
18074 | 560 | UNUSED(_end_lineno); // Only used by EXTRA macro |
18075 | 560 | int _end_col_offset = _token->end_col_offset; |
18076 | 560 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18077 | 560 | _res = _PyAST_SetComp ( a , b , EXTRA ); |
18078 | 560 | if (_res == NULL && PyErr_Occurred()) { |
18079 | 0 | p->error_indicator = 1; |
18080 | 0 | p->level--; |
18081 | 0 | return NULL; |
18082 | 0 | } |
18083 | 560 | goto done; |
18084 | 560 | } |
18085 | 7.30k | p->mark = _mark; |
18086 | 7.30k | D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', |
18087 | 7.30k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' named_expression for_if_clauses '}'")); |
18088 | 7.30k | } |
18089 | 7.30k | if (p->call_invalid_rules) { // invalid_comprehension |
18090 | 3.05k | if (p->error_indicator) { |
18091 | 213 | p->level--; |
18092 | 213 | return NULL; |
18093 | 213 | } |
18094 | 2.84k | D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
18095 | 2.84k | void *invalid_comprehension_var; |
18096 | 2.84k | if ( |
18097 | 2.84k | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
18098 | 2.84k | ) |
18099 | 0 | { |
18100 | 0 | D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
18101 | 0 | _res = invalid_comprehension_var; |
18102 | 0 | goto done; |
18103 | 0 | } |
18104 | 2.84k | p->mark = _mark; |
18105 | 2.84k | D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', |
18106 | 2.84k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
18107 | 2.84k | } |
18108 | 7.09k | _res = NULL; |
18109 | 7.65k | done: |
18110 | 7.65k | p->level--; |
18111 | 7.65k | return _res; |
18112 | 7.09k | } |
18113 | | |
18114 | | // genexp: |
18115 | | // | '(' (assignment_expression | expression !':=') for_if_clauses ')' |
18116 | | // | invalid_comprehension |
18117 | | static expr_ty |
18118 | | genexp_rule(Parser *p) |
18119 | 661k | { |
18120 | 661k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
18121 | 0 | _Pypegen_stack_overflow(p); |
18122 | 0 | } |
18123 | 661k | if (p->error_indicator) { |
18124 | 0 | p->level--; |
18125 | 0 | return NULL; |
18126 | 0 | } |
18127 | 661k | expr_ty _res = NULL; |
18128 | 661k | int _mark = p->mark; |
18129 | 661k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
18130 | 0 | p->error_indicator = 1; |
18131 | 0 | p->level--; |
18132 | 0 | return NULL; |
18133 | 0 | } |
18134 | 661k | int _start_lineno = p->tokens[_mark]->lineno; |
18135 | 661k | UNUSED(_start_lineno); // Only used by EXTRA macro |
18136 | 661k | int _start_col_offset = p->tokens[_mark]->col_offset; |
18137 | 661k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
18138 | 661k | { // '(' (assignment_expression | expression !':=') for_if_clauses ')' |
18139 | 661k | if (p->error_indicator) { |
18140 | 0 | p->level--; |
18141 | 0 | return NULL; |
18142 | 0 | } |
18143 | 661k | D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'")); |
18144 | 661k | Token * _literal; |
18145 | 661k | Token * _literal_1; |
18146 | 661k | void *a; |
18147 | 661k | asdl_comprehension_seq* b; |
18148 | 661k | if ( |
18149 | 661k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
18150 | 92.5k | && |
18151 | 92.5k | (a = _tmp_87_rule(p)) // assignment_expression | expression !':=' |
18152 | 57.5k | && |
18153 | 57.5k | (b = for_if_clauses_rule(p)) // for_if_clauses |
18154 | 5.65k | && |
18155 | 5.65k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
18156 | 661k | ) |
18157 | 4.77k | { |
18158 | 4.77k | D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'")); |
18159 | 4.77k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18160 | 4.77k | if (_token == NULL) { |
18161 | 0 | p->level--; |
18162 | 0 | return NULL; |
18163 | 0 | } |
18164 | 4.77k | int _end_lineno = _token->end_lineno; |
18165 | 4.77k | UNUSED(_end_lineno); // Only used by EXTRA macro |
18166 | 4.77k | int _end_col_offset = _token->end_col_offset; |
18167 | 4.77k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18168 | 4.77k | _res = _PyAST_GeneratorExp ( a , b , EXTRA ); |
18169 | 4.77k | if (_res == NULL && PyErr_Occurred()) { |
18170 | 0 | p->error_indicator = 1; |
18171 | 0 | p->level--; |
18172 | 0 | return NULL; |
18173 | 0 | } |
18174 | 4.77k | goto done; |
18175 | 4.77k | } |
18176 | 656k | p->mark = _mark; |
18177 | 656k | D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', |
18178 | 656k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'")); |
18179 | 656k | } |
18180 | 656k | if (p->call_invalid_rules) { // invalid_comprehension |
18181 | 204k | if (p->error_indicator) { |
18182 | 2.16k | p->level--; |
18183 | 2.16k | return NULL; |
18184 | 2.16k | } |
18185 | 202k | D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
18186 | 202k | void *invalid_comprehension_var; |
18187 | 202k | if ( |
18188 | 202k | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
18189 | 202k | ) |
18190 | 0 | { |
18191 | 0 | D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension")); |
18192 | 0 | _res = invalid_comprehension_var; |
18193 | 0 | goto done; |
18194 | 0 | } |
18195 | 202k | p->mark = _mark; |
18196 | 202k | D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', |
18197 | 202k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
18198 | 202k | } |
18199 | 654k | _res = NULL; |
18200 | 659k | done: |
18201 | 659k | p->level--; |
18202 | 659k | return _res; |
18203 | 654k | } |
18204 | | |
18205 | | // dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension |
18206 | | static expr_ty |
18207 | | dictcomp_rule(Parser *p) |
18208 | 9.50k | { |
18209 | 9.50k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
18210 | 0 | _Pypegen_stack_overflow(p); |
18211 | 0 | } |
18212 | 9.50k | if (p->error_indicator) { |
18213 | 0 | p->level--; |
18214 | 0 | return NULL; |
18215 | 0 | } |
18216 | 9.50k | expr_ty _res = NULL; |
18217 | 9.50k | int _mark = p->mark; |
18218 | 9.50k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
18219 | 0 | p->error_indicator = 1; |
18220 | 0 | p->level--; |
18221 | 0 | return NULL; |
18222 | 0 | } |
18223 | 9.50k | int _start_lineno = p->tokens[_mark]->lineno; |
18224 | 9.50k | UNUSED(_start_lineno); // Only used by EXTRA macro |
18225 | 9.50k | int _start_col_offset = p->tokens[_mark]->col_offset; |
18226 | 9.50k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
18227 | 9.50k | { // '{' kvpair for_if_clauses '}' |
18228 | 9.50k | if (p->error_indicator) { |
18229 | 0 | p->level--; |
18230 | 0 | return NULL; |
18231 | 0 | } |
18232 | 9.50k | D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
18233 | 9.50k | Token * _literal; |
18234 | 9.50k | Token * _literal_1; |
18235 | 9.50k | KeyValuePair* a; |
18236 | 9.50k | asdl_comprehension_seq* b; |
18237 | 9.50k | if ( |
18238 | 9.50k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
18239 | 9.50k | && |
18240 | 9.50k | (a = kvpair_rule(p)) // kvpair |
18241 | 2.38k | && |
18242 | 2.38k | (b = for_if_clauses_rule(p)) // for_if_clauses |
18243 | 1.63k | && |
18244 | 1.63k | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
18245 | 9.50k | ) |
18246 | 1.44k | { |
18247 | 1.44k | D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
18248 | 1.44k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18249 | 1.44k | if (_token == NULL) { |
18250 | 0 | p->level--; |
18251 | 0 | return NULL; |
18252 | 0 | } |
18253 | 1.44k | int _end_lineno = _token->end_lineno; |
18254 | 1.44k | UNUSED(_end_lineno); // Only used by EXTRA macro |
18255 | 1.44k | int _end_col_offset = _token->end_col_offset; |
18256 | 1.44k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18257 | 1.44k | _res = _PyAST_DictComp ( a -> key , a -> value , b , EXTRA ); |
18258 | 1.44k | if (_res == NULL && PyErr_Occurred()) { |
18259 | 0 | p->error_indicator = 1; |
18260 | 0 | p->level--; |
18261 | 0 | return NULL; |
18262 | 0 | } |
18263 | 1.44k | goto done; |
18264 | 1.44k | } |
18265 | 8.06k | p->mark = _mark; |
18266 | 8.06k | D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', |
18267 | 8.06k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
18268 | 8.06k | } |
18269 | 8.06k | if (p->call_invalid_rules) { // invalid_dict_comprehension |
18270 | 3.35k | if (p->error_indicator) { |
18271 | 194 | p->level--; |
18272 | 194 | return NULL; |
18273 | 194 | } |
18274 | 3.15k | D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension")); |
18275 | 3.15k | void *invalid_dict_comprehension_var; |
18276 | 3.15k | if ( |
18277 | 3.15k | (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension |
18278 | 3.15k | ) |
18279 | 0 | { |
18280 | 0 | D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension")); |
18281 | 0 | _res = invalid_dict_comprehension_var; |
18282 | 0 | goto done; |
18283 | 0 | } |
18284 | 3.15k | p->mark = _mark; |
18285 | 3.15k | D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', |
18286 | 3.15k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension")); |
18287 | 3.15k | } |
18288 | 7.87k | _res = NULL; |
18289 | 9.31k | done: |
18290 | 9.31k | p->level--; |
18291 | 9.31k | return _res; |
18292 | 7.87k | } |
18293 | | |
18294 | | // arguments: args ','? &')' | invalid_arguments |
18295 | | static expr_ty |
18296 | | arguments_rule(Parser *p) |
18297 | 67.3k | { |
18298 | 67.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
18299 | 0 | _Pypegen_stack_overflow(p); |
18300 | 0 | } |
18301 | 67.3k | if (p->error_indicator) { |
18302 | 0 | p->level--; |
18303 | 0 | return NULL; |
18304 | 0 | } |
18305 | 67.3k | expr_ty _res = NULL; |
18306 | 67.3k | if (_PyPegen_is_memoized(p, arguments_type, &_res)) { |
18307 | 18.5k | p->level--; |
18308 | 18.5k | return _res; |
18309 | 18.5k | } |
18310 | 48.8k | int _mark = p->mark; |
18311 | 48.8k | { // args ','? &')' |
18312 | 48.8k | if (p->error_indicator) { |
18313 | 0 | p->level--; |
18314 | 0 | return NULL; |
18315 | 0 | } |
18316 | 48.8k | D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'")); |
18317 | 48.8k | void *_opt_var; |
18318 | 48.8k | UNUSED(_opt_var); // Silence compiler warnings |
18319 | 48.8k | expr_ty a; |
18320 | 48.8k | if ( |
18321 | 48.8k | (a = args_rule(p)) // args |
18322 | 33.0k | && |
18323 | 33.0k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
18324 | 32.8k | && |
18325 | 32.8k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
18326 | 48.8k | ) |
18327 | 25.0k | { |
18328 | 25.0k | D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'")); |
18329 | 25.0k | _res = a; |
18330 | 25.0k | if (_res == NULL && PyErr_Occurred()) { |
18331 | 0 | p->error_indicator = 1; |
18332 | 0 | p->level--; |
18333 | 0 | return NULL; |
18334 | 0 | } |
18335 | 25.0k | goto done; |
18336 | 25.0k | } |
18337 | 23.8k | p->mark = _mark; |
18338 | 23.8k | D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', |
18339 | 23.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'")); |
18340 | 23.8k | } |
18341 | 23.8k | if (p->call_invalid_rules) { // invalid_arguments |
18342 | 8.03k | if (p->error_indicator) { |
18343 | 1.15k | p->level--; |
18344 | 1.15k | return NULL; |
18345 | 1.15k | } |
18346 | 6.88k | D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_arguments")); |
18347 | 6.88k | void *invalid_arguments_var; |
18348 | 6.88k | if ( |
18349 | 6.88k | (invalid_arguments_var = invalid_arguments_rule(p)) // invalid_arguments |
18350 | 6.88k | ) |
18351 | 0 | { |
18352 | 0 | D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_arguments")); |
18353 | 0 | _res = invalid_arguments_var; |
18354 | 0 | goto done; |
18355 | 0 | } |
18356 | 6.88k | p->mark = _mark; |
18357 | 6.88k | D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', |
18358 | 6.88k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_arguments")); |
18359 | 6.88k | } |
18360 | 22.6k | _res = NULL; |
18361 | 47.7k | done: |
18362 | 47.7k | _PyPegen_insert_memo(p, _mark, arguments_type, _res); |
18363 | 47.7k | p->level--; |
18364 | 47.7k | return _res; |
18365 | 22.6k | } |
18366 | | |
18367 | | // args: |
18368 | | // | ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs] |
18369 | | // | kwargs |
18370 | | static expr_ty |
18371 | | args_rule(Parser *p) |
18372 | 72.7k | { |
18373 | 72.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
18374 | 0 | _Pypegen_stack_overflow(p); |
18375 | 0 | } |
18376 | 72.7k | if (p->error_indicator) { |
18377 | 0 | p->level--; |
18378 | 0 | return NULL; |
18379 | 0 | } |
18380 | 72.7k | expr_ty _res = NULL; |
18381 | 72.7k | int _mark = p->mark; |
18382 | 72.7k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
18383 | 1 | p->error_indicator = 1; |
18384 | 1 | p->level--; |
18385 | 1 | return NULL; |
18386 | 1 | } |
18387 | 72.7k | int _start_lineno = p->tokens[_mark]->lineno; |
18388 | 72.7k | UNUSED(_start_lineno); // Only used by EXTRA macro |
18389 | 72.7k | int _start_col_offset = p->tokens[_mark]->col_offset; |
18390 | 72.7k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
18391 | 72.7k | { // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs] |
18392 | 72.7k | if (p->error_indicator) { |
18393 | 0 | p->level--; |
18394 | 0 | return NULL; |
18395 | 0 | } |
18396 | 72.7k | D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]")); |
18397 | 72.7k | asdl_expr_seq* a; |
18398 | 72.7k | void *b; |
18399 | 72.7k | if ( |
18400 | 72.7k | (a = (asdl_expr_seq*)_gather_89_rule(p)) // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ |
18401 | 39.0k | && |
18402 | 39.0k | (b = _tmp_90_rule(p), !p->error_indicator) // [',' kwargs] |
18403 | 72.7k | ) |
18404 | 38.5k | { |
18405 | 38.5k | D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]")); |
18406 | 38.5k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18407 | 38.5k | if (_token == NULL) { |
18408 | 0 | p->level--; |
18409 | 0 | return NULL; |
18410 | 0 | } |
18411 | 38.5k | int _end_lineno = _token->end_lineno; |
18412 | 38.5k | UNUSED(_end_lineno); // Only used by EXTRA macro |
18413 | 38.5k | int _end_col_offset = _token->end_col_offset; |
18414 | 38.5k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18415 | 38.5k | _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA ); |
18416 | 38.5k | if (_res == NULL && PyErr_Occurred()) { |
18417 | 0 | p->error_indicator = 1; |
18418 | 0 | p->level--; |
18419 | 0 | return NULL; |
18420 | 0 | } |
18421 | 38.5k | goto done; |
18422 | 38.5k | } |
18423 | 34.1k | p->mark = _mark; |
18424 | 34.1k | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', |
18425 | 34.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]")); |
18426 | 34.1k | } |
18427 | 0 | { // kwargs |
18428 | 34.1k | if (p->error_indicator) { |
18429 | 826 | p->level--; |
18430 | 826 | return NULL; |
18431 | 826 | } |
18432 | 33.3k | D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs")); |
18433 | 33.3k | asdl_seq* a; |
18434 | 33.3k | if ( |
18435 | 33.3k | (a = kwargs_rule(p)) // kwargs |
18436 | 33.3k | ) |
18437 | 7.26k | { |
18438 | 7.26k | D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs")); |
18439 | 7.26k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18440 | 7.26k | if (_token == NULL) { |
18441 | 0 | p->level--; |
18442 | 0 | return NULL; |
18443 | 0 | } |
18444 | 7.26k | int _end_lineno = _token->end_lineno; |
18445 | 7.26k | UNUSED(_end_lineno); // Only used by EXTRA macro |
18446 | 7.26k | int _end_col_offset = _token->end_col_offset; |
18447 | 7.26k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18448 | 7.26k | _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 ); |
18449 | 7.26k | if (_res == NULL && PyErr_Occurred()) { |
18450 | 0 | p->error_indicator = 1; |
18451 | 0 | p->level--; |
18452 | 0 | return NULL; |
18453 | 0 | } |
18454 | 7.26k | goto done; |
18455 | 7.26k | } |
18456 | 26.0k | p->mark = _mark; |
18457 | 26.0k | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', |
18458 | 26.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs")); |
18459 | 26.0k | } |
18460 | 26.0k | _res = NULL; |
18461 | 71.8k | done: |
18462 | 71.8k | p->level--; |
18463 | 71.8k | return _res; |
18464 | 26.0k | } |
18465 | | |
18466 | | // kwargs: |
18467 | | // | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ |
18468 | | // | ','.kwarg_or_starred+ |
18469 | | // | ','.kwarg_or_double_starred+ |
18470 | | static asdl_seq* |
18471 | | kwargs_rule(Parser *p) |
18472 | 44.0k | { |
18473 | 44.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
18474 | 0 | _Pypegen_stack_overflow(p); |
18475 | 0 | } |
18476 | 44.0k | if (p->error_indicator) { |
18477 | 0 | p->level--; |
18478 | 0 | return NULL; |
18479 | 0 | } |
18480 | 44.0k | asdl_seq* _res = NULL; |
18481 | 44.0k | int _mark = p->mark; |
18482 | 44.0k | { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ |
18483 | 44.0k | if (p->error_indicator) { |
18484 | 0 | p->level--; |
18485 | 0 | return NULL; |
18486 | 0 | } |
18487 | 44.0k | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); |
18488 | 44.0k | Token * _literal; |
18489 | 44.0k | asdl_seq * a; |
18490 | 44.0k | asdl_seq * b; |
18491 | 44.0k | if ( |
18492 | 44.0k | (a = _gather_92_rule(p)) // ','.kwarg_or_starred+ |
18493 | 8.91k | && |
18494 | 8.91k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
18495 | 3.22k | && |
18496 | 3.22k | (b = _gather_94_rule(p)) // ','.kwarg_or_double_starred+ |
18497 | 44.0k | ) |
18498 | 546 | { |
18499 | 546 | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); |
18500 | 546 | _res = _PyPegen_join_sequences ( p , a , b ); |
18501 | 546 | if (_res == NULL && PyErr_Occurred()) { |
18502 | 0 | p->error_indicator = 1; |
18503 | 0 | p->level--; |
18504 | 0 | return NULL; |
18505 | 0 | } |
18506 | 546 | goto done; |
18507 | 546 | } |
18508 | 43.5k | p->mark = _mark; |
18509 | 43.5k | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
18510 | 43.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+")); |
18511 | 43.5k | } |
18512 | 0 | { // ','.kwarg_or_starred+ |
18513 | 43.5k | if (p->error_indicator) { |
18514 | 988 | p->level--; |
18515 | 988 | return NULL; |
18516 | 988 | } |
18517 | 42.5k | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); |
18518 | 42.5k | asdl_seq * _gather_92_var; |
18519 | 42.5k | if ( |
18520 | 42.5k | (_gather_92_var = _gather_92_rule(p)) // ','.kwarg_or_starred+ |
18521 | 42.5k | ) |
18522 | 8.10k | { |
18523 | 8.10k | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+")); |
18524 | 8.10k | _res = _gather_92_var; |
18525 | 8.10k | goto done; |
18526 | 8.10k | } |
18527 | 34.4k | p->mark = _mark; |
18528 | 34.4k | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
18529 | 34.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+")); |
18530 | 34.4k | } |
18531 | 0 | { // ','.kwarg_or_double_starred+ |
18532 | 34.4k | if (p->error_indicator) { |
18533 | 0 | p->level--; |
18534 | 0 | return NULL; |
18535 | 0 | } |
18536 | 34.4k | D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); |
18537 | 34.4k | asdl_seq * _gather_94_var; |
18538 | 34.4k | if ( |
18539 | 34.4k | (_gather_94_var = _gather_94_rule(p)) // ','.kwarg_or_double_starred+ |
18540 | 34.4k | ) |
18541 | 3.92k | { |
18542 | 3.92k | D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+")); |
18543 | 3.92k | _res = _gather_94_var; |
18544 | 3.92k | goto done; |
18545 | 3.92k | } |
18546 | 30.4k | p->mark = _mark; |
18547 | 30.4k | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
18548 | 30.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+")); |
18549 | 30.4k | } |
18550 | 30.4k | _res = NULL; |
18551 | 43.0k | done: |
18552 | 43.0k | p->level--; |
18553 | 43.0k | return _res; |
18554 | 30.4k | } |
18555 | | |
18556 | | // starred_expression: |
18557 | | // | invalid_starred_expression_unpacking |
18558 | | // | '*' expression |
18559 | | // | invalid_starred_expression |
18560 | | static expr_ty |
18561 | | starred_expression_rule(Parser *p) |
18562 | 226k | { |
18563 | 226k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
18564 | 0 | _Pypegen_stack_overflow(p); |
18565 | 0 | } |
18566 | 226k | if (p->error_indicator) { |
18567 | 0 | p->level--; |
18568 | 0 | return NULL; |
18569 | 0 | } |
18570 | 226k | expr_ty _res = NULL; |
18571 | 226k | int _mark = p->mark; |
18572 | 226k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
18573 | 210 | p->error_indicator = 1; |
18574 | 210 | p->level--; |
18575 | 210 | return NULL; |
18576 | 210 | } |
18577 | 226k | int _start_lineno = p->tokens[_mark]->lineno; |
18578 | 226k | UNUSED(_start_lineno); // Only used by EXTRA macro |
18579 | 226k | int _start_col_offset = p->tokens[_mark]->col_offset; |
18580 | 226k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
18581 | 226k | if (p->call_invalid_rules) { // invalid_starred_expression_unpacking |
18582 | 143k | if (p->error_indicator) { |
18583 | 0 | p->level--; |
18584 | 0 | return NULL; |
18585 | 0 | } |
18586 | 143k | D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_starred_expression_unpacking")); |
18587 | 143k | void *invalid_starred_expression_unpacking_var; |
18588 | 143k | if ( |
18589 | 143k | (invalid_starred_expression_unpacking_var = invalid_starred_expression_unpacking_rule(p)) // invalid_starred_expression_unpacking |
18590 | 143k | ) |
18591 | 0 | { |
18592 | 0 | D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_starred_expression_unpacking")); |
18593 | 0 | _res = invalid_starred_expression_unpacking_var; |
18594 | 0 | goto done; |
18595 | 0 | } |
18596 | 143k | p->mark = _mark; |
18597 | 143k | D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ', |
18598 | 143k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_starred_expression_unpacking")); |
18599 | 143k | } |
18600 | 226k | { // '*' expression |
18601 | 226k | if (p->error_indicator) { |
18602 | 1.40k | p->level--; |
18603 | 1.40k | return NULL; |
18604 | 1.40k | } |
18605 | 225k | D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
18606 | 225k | Token * _literal; |
18607 | 225k | expr_ty a; |
18608 | 225k | if ( |
18609 | 225k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
18610 | 13.4k | && |
18611 | 13.4k | (a = expression_rule(p)) // expression |
18612 | 225k | ) |
18613 | 12.8k | { |
18614 | 12.8k | D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
18615 | 12.8k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18616 | 12.8k | if (_token == NULL) { |
18617 | 0 | p->level--; |
18618 | 0 | return NULL; |
18619 | 0 | } |
18620 | 12.8k | int _end_lineno = _token->end_lineno; |
18621 | 12.8k | UNUSED(_end_lineno); // Only used by EXTRA macro |
18622 | 12.8k | int _end_col_offset = _token->end_col_offset; |
18623 | 12.8k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18624 | 12.8k | _res = _PyAST_Starred ( a , Load , EXTRA ); |
18625 | 12.8k | if (_res == NULL && PyErr_Occurred()) { |
18626 | 0 | p->error_indicator = 1; |
18627 | 0 | p->level--; |
18628 | 0 | return NULL; |
18629 | 0 | } |
18630 | 12.8k | goto done; |
18631 | 12.8k | } |
18632 | 212k | p->mark = _mark; |
18633 | 212k | D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ', |
18634 | 212k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression")); |
18635 | 212k | } |
18636 | 212k | if (p->call_invalid_rules) { // invalid_starred_expression |
18637 | 130k | if (p->error_indicator) { |
18638 | 0 | p->level--; |
18639 | 0 | return NULL; |
18640 | 0 | } |
18641 | 130k | D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_starred_expression")); |
18642 | 130k | void *invalid_starred_expression_var; |
18643 | 130k | if ( |
18644 | 130k | (invalid_starred_expression_var = invalid_starred_expression_rule(p)) // invalid_starred_expression |
18645 | 130k | ) |
18646 | 0 | { |
18647 | 0 | D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_starred_expression")); |
18648 | 0 | _res = invalid_starred_expression_var; |
18649 | 0 | goto done; |
18650 | 0 | } |
18651 | 130k | p->mark = _mark; |
18652 | 130k | D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ', |
18653 | 130k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_starred_expression")); |
18654 | 130k | } |
18655 | 212k | _res = NULL; |
18656 | 225k | done: |
18657 | 225k | p->level--; |
18658 | 225k | return _res; |
18659 | 212k | } |
18660 | | |
18661 | | // kwarg_or_starred: invalid_kwarg | NAME '=' expression | starred_expression |
18662 | | static KeywordOrStarred* |
18663 | | kwarg_or_starred_rule(Parser *p) |
18664 | 102k | { |
18665 | 102k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
18666 | 0 | _Pypegen_stack_overflow(p); |
18667 | 0 | } |
18668 | 102k | if (p->error_indicator) { |
18669 | 0 | p->level--; |
18670 | 0 | return NULL; |
18671 | 0 | } |
18672 | 102k | KeywordOrStarred* _res = NULL; |
18673 | 102k | int _mark = p->mark; |
18674 | 102k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
18675 | 13 | p->error_indicator = 1; |
18676 | 13 | p->level--; |
18677 | 13 | return NULL; |
18678 | 13 | } |
18679 | 102k | int _start_lineno = p->tokens[_mark]->lineno; |
18680 | 102k | UNUSED(_start_lineno); // Only used by EXTRA macro |
18681 | 102k | int _start_col_offset = p->tokens[_mark]->col_offset; |
18682 | 102k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
18683 | 102k | if (p->call_invalid_rules) { // invalid_kwarg |
18684 | 68.5k | if (p->error_indicator) { |
18685 | 0 | p->level--; |
18686 | 0 | return NULL; |
18687 | 0 | } |
18688 | 68.5k | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
18689 | 68.5k | void *invalid_kwarg_var; |
18690 | 68.5k | if ( |
18691 | 68.5k | (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg |
18692 | 68.5k | ) |
18693 | 0 | { |
18694 | 0 | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
18695 | 0 | _res = invalid_kwarg_var; |
18696 | 0 | goto done; |
18697 | 0 | } |
18698 | 68.5k | p->mark = _mark; |
18699 | 68.5k | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
18700 | 68.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); |
18701 | 68.5k | } |
18702 | 102k | { // NAME '=' expression |
18703 | 102k | if (p->error_indicator) { |
18704 | 745 | p->level--; |
18705 | 745 | return NULL; |
18706 | 745 | } |
18707 | 101k | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
18708 | 101k | Token * _literal; |
18709 | 101k | expr_ty a; |
18710 | 101k | expr_ty b; |
18711 | 101k | if ( |
18712 | 101k | (a = _PyPegen_name_token(p)) // NAME |
18713 | 30.7k | && |
18714 | 30.7k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
18715 | 23.9k | && |
18716 | 23.9k | (b = expression_rule(p)) // expression |
18717 | 101k | ) |
18718 | 21.9k | { |
18719 | 21.9k | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
18720 | 21.9k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18721 | 21.9k | if (_token == NULL) { |
18722 | 0 | p->level--; |
18723 | 0 | return NULL; |
18724 | 0 | } |
18725 | 21.9k | int _end_lineno = _token->end_lineno; |
18726 | 21.9k | UNUSED(_end_lineno); // Only used by EXTRA macro |
18727 | 21.9k | int _end_col_offset = _token->end_col_offset; |
18728 | 21.9k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18729 | 21.9k | _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); |
18730 | 21.9k | if (_res == NULL && PyErr_Occurred()) { |
18731 | 0 | p->error_indicator = 1; |
18732 | 0 | p->level--; |
18733 | 0 | return NULL; |
18734 | 0 | } |
18735 | 21.9k | goto done; |
18736 | 21.9k | } |
18737 | 79.6k | p->mark = _mark; |
18738 | 79.6k | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
18739 | 79.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); |
18740 | 79.6k | } |
18741 | 0 | { // starred_expression |
18742 | 79.6k | if (p->error_indicator) { |
18743 | 225 | p->level--; |
18744 | 225 | return NULL; |
18745 | 225 | } |
18746 | 79.4k | D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
18747 | 79.4k | expr_ty a; |
18748 | 79.4k | if ( |
18749 | 79.4k | (a = starred_expression_rule(p)) // starred_expression |
18750 | 79.4k | ) |
18751 | 5.20k | { |
18752 | 5.20k | D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
18753 | 5.20k | _res = _PyPegen_keyword_or_starred ( p , a , 0 ); |
18754 | 5.20k | if (_res == NULL && PyErr_Occurred()) { |
18755 | 0 | p->error_indicator = 1; |
18756 | 0 | p->level--; |
18757 | 0 | return NULL; |
18758 | 0 | } |
18759 | 5.20k | goto done; |
18760 | 5.20k | } |
18761 | 74.2k | p->mark = _mark; |
18762 | 74.2k | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
18763 | 74.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); |
18764 | 74.2k | } |
18765 | 74.2k | _res = NULL; |
18766 | 101k | done: |
18767 | 101k | p->level--; |
18768 | 101k | return _res; |
18769 | 74.2k | } |
18770 | | |
18771 | | // kwarg_or_double_starred: invalid_kwarg | NAME '=' expression | '**' expression |
18772 | | static KeywordOrStarred* |
18773 | | kwarg_or_double_starred_rule(Parser *p) |
18774 | 47.0k | { |
18775 | 47.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
18776 | 0 | _Pypegen_stack_overflow(p); |
18777 | 0 | } |
18778 | 47.0k | if (p->error_indicator) { |
18779 | 0 | p->level--; |
18780 | 0 | return NULL; |
18781 | 0 | } |
18782 | 47.0k | KeywordOrStarred* _res = NULL; |
18783 | 47.0k | int _mark = p->mark; |
18784 | 47.0k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
18785 | 11 | p->error_indicator = 1; |
18786 | 11 | p->level--; |
18787 | 11 | return NULL; |
18788 | 11 | } |
18789 | 47.0k | int _start_lineno = p->tokens[_mark]->lineno; |
18790 | 47.0k | UNUSED(_start_lineno); // Only used by EXTRA macro |
18791 | 47.0k | int _start_col_offset = p->tokens[_mark]->col_offset; |
18792 | 47.0k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
18793 | 47.0k | if (p->call_invalid_rules) { // invalid_kwarg |
18794 | 30.6k | if (p->error_indicator) { |
18795 | 0 | p->level--; |
18796 | 0 | return NULL; |
18797 | 0 | } |
18798 | 30.6k | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
18799 | 30.6k | void *invalid_kwarg_var; |
18800 | 30.6k | if ( |
18801 | 30.6k | (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg |
18802 | 30.6k | ) |
18803 | 0 | { |
18804 | 0 | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg")); |
18805 | 0 | _res = invalid_kwarg_var; |
18806 | 0 | goto done; |
18807 | 0 | } |
18808 | 30.6k | p->mark = _mark; |
18809 | 30.6k | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
18810 | 30.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); |
18811 | 30.6k | } |
18812 | 47.0k | { // NAME '=' expression |
18813 | 47.0k | if (p->error_indicator) { |
18814 | 315 | p->level--; |
18815 | 315 | return NULL; |
18816 | 315 | } |
18817 | 46.7k | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
18818 | 46.7k | Token * _literal; |
18819 | 46.7k | expr_ty a; |
18820 | 46.7k | expr_ty b; |
18821 | 46.7k | if ( |
18822 | 46.7k | (a = _PyPegen_name_token(p)) // NAME |
18823 | 7.30k | && |
18824 | 7.30k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
18825 | 3.79k | && |
18826 | 3.79k | (b = expression_rule(p)) // expression |
18827 | 46.7k | ) |
18828 | 2.83k | { |
18829 | 2.83k | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression")); |
18830 | 2.83k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18831 | 2.83k | if (_token == NULL) { |
18832 | 0 | p->level--; |
18833 | 0 | return NULL; |
18834 | 0 | } |
18835 | 2.83k | int _end_lineno = _token->end_lineno; |
18836 | 2.83k | UNUSED(_end_lineno); // Only used by EXTRA macro |
18837 | 2.83k | int _end_col_offset = _token->end_col_offset; |
18838 | 2.83k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18839 | 2.83k | _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); |
18840 | 2.83k | if (_res == NULL && PyErr_Occurred()) { |
18841 | 0 | p->error_indicator = 1; |
18842 | 0 | p->level--; |
18843 | 0 | return NULL; |
18844 | 0 | } |
18845 | 2.83k | goto done; |
18846 | 2.83k | } |
18847 | 43.8k | p->mark = _mark; |
18848 | 43.8k | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
18849 | 43.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); |
18850 | 43.8k | } |
18851 | 0 | { // '**' expression |
18852 | 43.8k | if (p->error_indicator) { |
18853 | 34 | p->level--; |
18854 | 34 | return NULL; |
18855 | 34 | } |
18856 | 43.8k | D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
18857 | 43.8k | Token * _literal; |
18858 | 43.8k | expr_ty a; |
18859 | 43.8k | if ( |
18860 | 43.8k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
18861 | 9.54k | && |
18862 | 9.54k | (a = expression_rule(p)) // expression |
18863 | 43.8k | ) |
18864 | 9.11k | { |
18865 | 9.11k | D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
18866 | 9.11k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18867 | 9.11k | if (_token == NULL) { |
18868 | 0 | p->level--; |
18869 | 0 | return NULL; |
18870 | 0 | } |
18871 | 9.11k | int _end_lineno = _token->end_lineno; |
18872 | 9.11k | UNUSED(_end_lineno); // Only used by EXTRA macro |
18873 | 9.11k | int _end_col_offset = _token->end_col_offset; |
18874 | 9.11k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18875 | 9.11k | _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( NULL , a , EXTRA ) ) , 1 ); |
18876 | 9.11k | if (_res == NULL && PyErr_Occurred()) { |
18877 | 0 | p->error_indicator = 1; |
18878 | 0 | p->level--; |
18879 | 0 | return NULL; |
18880 | 0 | } |
18881 | 9.11k | goto done; |
18882 | 9.11k | } |
18883 | 34.7k | p->mark = _mark; |
18884 | 34.7k | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
18885 | 34.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression")); |
18886 | 34.7k | } |
18887 | 34.7k | _res = NULL; |
18888 | 46.6k | done: |
18889 | 46.6k | p->level--; |
18890 | 46.6k | return _res; |
18891 | 34.7k | } |
18892 | | |
18893 | | // star_targets: star_target !',' | star_target ((',' star_target))* ','? |
18894 | | static expr_ty |
18895 | | star_targets_rule(Parser *p) |
18896 | 303k | { |
18897 | 303k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
18898 | 0 | _Pypegen_stack_overflow(p); |
18899 | 0 | } |
18900 | 303k | if (p->error_indicator) { |
18901 | 0 | p->level--; |
18902 | 0 | return NULL; |
18903 | 0 | } |
18904 | 303k | expr_ty _res = NULL; |
18905 | 303k | int _mark = p->mark; |
18906 | 303k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
18907 | 29 | p->error_indicator = 1; |
18908 | 29 | p->level--; |
18909 | 29 | return NULL; |
18910 | 29 | } |
18911 | 303k | int _start_lineno = p->tokens[_mark]->lineno; |
18912 | 303k | UNUSED(_start_lineno); // Only used by EXTRA macro |
18913 | 303k | int _start_col_offset = p->tokens[_mark]->col_offset; |
18914 | 303k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
18915 | 303k | { // star_target !',' |
18916 | 303k | if (p->error_indicator) { |
18917 | 0 | p->level--; |
18918 | 0 | return NULL; |
18919 | 0 | } |
18920 | 303k | D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','")); |
18921 | 303k | expr_ty a; |
18922 | 303k | if ( |
18923 | 303k | (a = star_target_rule(p)) // star_target |
18924 | 160k | && |
18925 | 160k | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
18926 | 303k | ) |
18927 | 150k | { |
18928 | 150k | D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','")); |
18929 | 150k | _res = a; |
18930 | 150k | if (_res == NULL && PyErr_Occurred()) { |
18931 | 0 | p->error_indicator = 1; |
18932 | 0 | p->level--; |
18933 | 0 | return NULL; |
18934 | 0 | } |
18935 | 150k | goto done; |
18936 | 150k | } |
18937 | 153k | p->mark = _mark; |
18938 | 153k | D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', |
18939 | 153k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','")); |
18940 | 153k | } |
18941 | 0 | { // star_target ((',' star_target))* ','? |
18942 | 153k | if (p->error_indicator) { |
18943 | 1.35k | p->level--; |
18944 | 1.35k | return NULL; |
18945 | 1.35k | } |
18946 | 152k | D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?")); |
18947 | 152k | void *_opt_var; |
18948 | 152k | UNUSED(_opt_var); // Silence compiler warnings |
18949 | 152k | expr_ty a; |
18950 | 152k | asdl_seq * b; |
18951 | 152k | if ( |
18952 | 152k | (a = star_target_rule(p)) // star_target |
18953 | 10.4k | && |
18954 | 10.4k | (b = _loop0_95_rule(p)) // ((',' star_target))* |
18955 | 10.4k | && |
18956 | 10.4k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
18957 | 152k | ) |
18958 | 10.3k | { |
18959 | 10.3k | D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?")); |
18960 | 10.3k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
18961 | 10.3k | if (_token == NULL) { |
18962 | 0 | p->level--; |
18963 | 0 | return NULL; |
18964 | 0 | } |
18965 | 10.3k | int _end_lineno = _token->end_lineno; |
18966 | 10.3k | UNUSED(_end_lineno); // Only used by EXTRA macro |
18967 | 10.3k | int _end_col_offset = _token->end_col_offset; |
18968 | 10.3k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
18969 | 10.3k | _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA ); |
18970 | 10.3k | if (_res == NULL && PyErr_Occurred()) { |
18971 | 0 | p->error_indicator = 1; |
18972 | 0 | p->level--; |
18973 | 0 | return NULL; |
18974 | 0 | } |
18975 | 10.3k | goto done; |
18976 | 10.3k | } |
18977 | 141k | p->mark = _mark; |
18978 | 141k | D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', |
18979 | 141k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?")); |
18980 | 141k | } |
18981 | 141k | _res = NULL; |
18982 | 302k | done: |
18983 | 302k | p->level--; |
18984 | 302k | return _res; |
18985 | 141k | } |
18986 | | |
18987 | | // star_targets_list_seq: ','.star_target+ ','? |
18988 | | static asdl_expr_seq* |
18989 | | star_targets_list_seq_rule(Parser *p) |
18990 | 6.05k | { |
18991 | 6.05k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
18992 | 0 | _Pypegen_stack_overflow(p); |
18993 | 0 | } |
18994 | 6.05k | if (p->error_indicator) { |
18995 | 0 | p->level--; |
18996 | 0 | return NULL; |
18997 | 0 | } |
18998 | 6.05k | asdl_expr_seq* _res = NULL; |
18999 | 6.05k | int _mark = p->mark; |
19000 | 6.05k | { // ','.star_target+ ','? |
19001 | 6.05k | if (p->error_indicator) { |
19002 | 0 | p->level--; |
19003 | 0 | return NULL; |
19004 | 0 | } |
19005 | 6.05k | D(fprintf(stderr, "%*c> star_targets_list_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?")); |
19006 | 6.05k | void *_opt_var; |
19007 | 6.05k | UNUSED(_opt_var); // Silence compiler warnings |
19008 | 6.05k | asdl_expr_seq* a; |
19009 | 6.05k | if ( |
19010 | 6.05k | (a = (asdl_expr_seq*)_gather_97_rule(p)) // ','.star_target+ |
19011 | 2.25k | && |
19012 | 2.25k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
19013 | 6.05k | ) |
19014 | 2.25k | { |
19015 | 2.25k | D(fprintf(stderr, "%*c+ star_targets_list_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?")); |
19016 | 2.25k | _res = a; |
19017 | 2.25k | if (_res == NULL && PyErr_Occurred()) { |
19018 | 0 | p->error_indicator = 1; |
19019 | 0 | p->level--; |
19020 | 0 | return NULL; |
19021 | 0 | } |
19022 | 2.25k | goto done; |
19023 | 2.25k | } |
19024 | 3.79k | p->mark = _mark; |
19025 | 3.79k | D(fprintf(stderr, "%*c%s star_targets_list_seq[%d-%d]: %s failed!\n", p->level, ' ', |
19026 | 3.79k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?")); |
19027 | 3.79k | } |
19028 | 3.79k | _res = NULL; |
19029 | 6.05k | done: |
19030 | 6.05k | p->level--; |
19031 | 6.05k | return _res; |
19032 | 3.79k | } |
19033 | | |
19034 | | // star_targets_tuple_seq: star_target ((',' star_target))+ ','? | star_target ',' |
19035 | | static asdl_expr_seq* |
19036 | | star_targets_tuple_seq_rule(Parser *p) |
19037 | 9.13k | { |
19038 | 9.13k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
19039 | 0 | _Pypegen_stack_overflow(p); |
19040 | 0 | } |
19041 | 9.13k | if (p->error_indicator) { |
19042 | 0 | p->level--; |
19043 | 0 | return NULL; |
19044 | 0 | } |
19045 | 9.13k | asdl_expr_seq* _res = NULL; |
19046 | 9.13k | int _mark = p->mark; |
19047 | 9.13k | { // star_target ((',' star_target))+ ','? |
19048 | 9.13k | if (p->error_indicator) { |
19049 | 0 | p->level--; |
19050 | 0 | return NULL; |
19051 | 0 | } |
19052 | 9.13k | D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?")); |
19053 | 9.13k | void *_opt_var; |
19054 | 9.13k | UNUSED(_opt_var); // Silence compiler warnings |
19055 | 9.13k | expr_ty a; |
19056 | 9.13k | asdl_seq * b; |
19057 | 9.13k | if ( |
19058 | 9.13k | (a = star_target_rule(p)) // star_target |
19059 | 3.45k | && |
19060 | 3.45k | (b = _loop1_98_rule(p)) // ((',' star_target))+ |
19061 | 539 | && |
19062 | 539 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
19063 | 9.13k | ) |
19064 | 539 | { |
19065 | 539 | D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?")); |
19066 | 539 | _res = ( asdl_expr_seq* ) _PyPegen_seq_insert_in_front ( p , a , b ); |
19067 | 539 | if (_res == NULL && PyErr_Occurred()) { |
19068 | 0 | p->error_indicator = 1; |
19069 | 0 | p->level--; |
19070 | 0 | return NULL; |
19071 | 0 | } |
19072 | 539 | goto done; |
19073 | 539 | } |
19074 | 8.59k | p->mark = _mark; |
19075 | 8.59k | D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n", p->level, ' ', |
19076 | 8.59k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))+ ','?")); |
19077 | 8.59k | } |
19078 | 0 | { // star_target ',' |
19079 | 8.59k | if (p->error_indicator) { |
19080 | 0 | p->level--; |
19081 | 0 | return NULL; |
19082 | 0 | } |
19083 | 8.59k | D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ','")); |
19084 | 8.59k | Token * _literal; |
19085 | 8.59k | expr_ty a; |
19086 | 8.59k | if ( |
19087 | 8.59k | (a = star_target_rule(p)) // star_target |
19088 | 2.91k | && |
19089 | 2.91k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
19090 | 8.59k | ) |
19091 | 986 | { |
19092 | 986 | D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ','")); |
19093 | 986 | _res = ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , a ); |
19094 | 986 | if (_res == NULL && PyErr_Occurred()) { |
19095 | 0 | p->error_indicator = 1; |
19096 | 0 | p->level--; |
19097 | 0 | return NULL; |
19098 | 0 | } |
19099 | 986 | goto done; |
19100 | 986 | } |
19101 | 7.60k | p->mark = _mark; |
19102 | 7.60k | D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n", p->level, ' ', |
19103 | 7.60k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ','")); |
19104 | 7.60k | } |
19105 | 7.60k | _res = NULL; |
19106 | 9.13k | done: |
19107 | 9.13k | p->level--; |
19108 | 9.13k | return _res; |
19109 | 7.60k | } |
19110 | | |
19111 | | // star_target: '*' (!'*' star_target) | target_with_star_atom |
19112 | | static expr_ty |
19113 | | star_target_rule(Parser *p) |
19114 | 503k | { |
19115 | 503k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
19116 | 0 | _Pypegen_stack_overflow(p); |
19117 | 0 | } |
19118 | 503k | if (p->error_indicator) { |
19119 | 8 | p->level--; |
19120 | 8 | return NULL; |
19121 | 8 | } |
19122 | 503k | expr_ty _res = NULL; |
19123 | 503k | if (_PyPegen_is_memoized(p, star_target_type, &_res)) { |
19124 | 250k | p->level--; |
19125 | 250k | return _res; |
19126 | 250k | } |
19127 | 253k | int _mark = p->mark; |
19128 | 253k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
19129 | 0 | p->error_indicator = 1; |
19130 | 0 | p->level--; |
19131 | 0 | return NULL; |
19132 | 0 | } |
19133 | 253k | int _start_lineno = p->tokens[_mark]->lineno; |
19134 | 253k | UNUSED(_start_lineno); // Only used by EXTRA macro |
19135 | 253k | int _start_col_offset = p->tokens[_mark]->col_offset; |
19136 | 253k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
19137 | 253k | { // '*' (!'*' star_target) |
19138 | 253k | if (p->error_indicator) { |
19139 | 0 | p->level--; |
19140 | 0 | return NULL; |
19141 | 0 | } |
19142 | 253k | D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); |
19143 | 253k | Token * _literal; |
19144 | 253k | void *a; |
19145 | 253k | if ( |
19146 | 253k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
19147 | 2.93k | && |
19148 | 2.93k | (a = _tmp_99_rule(p)) // !'*' star_target |
19149 | 253k | ) |
19150 | 1.74k | { |
19151 | 1.74k | D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); |
19152 | 1.74k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
19153 | 1.74k | if (_token == NULL) { |
19154 | 0 | p->level--; |
19155 | 0 | return NULL; |
19156 | 0 | } |
19157 | 1.74k | int _end_lineno = _token->end_lineno; |
19158 | 1.74k | UNUSED(_end_lineno); // Only used by EXTRA macro |
19159 | 1.74k | int _end_col_offset = _token->end_col_offset; |
19160 | 1.74k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
19161 | 1.74k | _res = _PyAST_Starred ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA ); |
19162 | 1.74k | if (_res == NULL && PyErr_Occurred()) { |
19163 | 0 | p->error_indicator = 1; |
19164 | 0 | p->level--; |
19165 | 0 | return NULL; |
19166 | 0 | } |
19167 | 1.74k | goto done; |
19168 | 1.74k | } |
19169 | 251k | p->mark = _mark; |
19170 | 251k | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
19171 | 251k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)")); |
19172 | 251k | } |
19173 | 0 | { // target_with_star_atom |
19174 | 251k | if (p->error_indicator) { |
19175 | 403 | p->level--; |
19176 | 403 | return NULL; |
19177 | 403 | } |
19178 | 250k | D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target_with_star_atom")); |
19179 | 250k | expr_ty target_with_star_atom_var; |
19180 | 250k | if ( |
19181 | 250k | (target_with_star_atom_var = target_with_star_atom_rule(p)) // target_with_star_atom |
19182 | 250k | ) |
19183 | 126k | { |
19184 | 126k | D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target_with_star_atom")); |
19185 | 126k | _res = target_with_star_atom_var; |
19186 | 126k | goto done; |
19187 | 126k | } |
19188 | 124k | p->mark = _mark; |
19189 | 124k | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
19190 | 124k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target_with_star_atom")); |
19191 | 124k | } |
19192 | 124k | _res = NULL; |
19193 | 252k | done: |
19194 | 252k | _PyPegen_insert_memo(p, _mark, star_target_type, _res); |
19195 | 252k | p->level--; |
19196 | 252k | return _res; |
19197 | 124k | } |
19198 | | |
19199 | | // target_with_star_atom: |
19200 | | // | t_primary '.' NAME !t_lookahead |
19201 | | // | t_primary '[' slices ']' !t_lookahead |
19202 | | // | star_atom |
19203 | | static expr_ty |
19204 | | target_with_star_atom_rule(Parser *p) |
19205 | 261k | { |
19206 | 261k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
19207 | 0 | _Pypegen_stack_overflow(p); |
19208 | 0 | } |
19209 | 261k | if (p->error_indicator) { |
19210 | 0 | p->level--; |
19211 | 0 | return NULL; |
19212 | 0 | } |
19213 | 261k | expr_ty _res = NULL; |
19214 | 261k | if (_PyPegen_is_memoized(p, target_with_star_atom_type, &_res)) { |
19215 | 9.01k | p->level--; |
19216 | 9.01k | return _res; |
19217 | 9.01k | } |
19218 | 252k | int _mark = p->mark; |
19219 | 252k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
19220 | 0 | p->error_indicator = 1; |
19221 | 0 | p->level--; |
19222 | 0 | return NULL; |
19223 | 0 | } |
19224 | 252k | int _start_lineno = p->tokens[_mark]->lineno; |
19225 | 252k | UNUSED(_start_lineno); // Only used by EXTRA macro |
19226 | 252k | int _start_col_offset = p->tokens[_mark]->col_offset; |
19227 | 252k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
19228 | 252k | { // t_primary '.' NAME !t_lookahead |
19229 | 252k | if (p->error_indicator) { |
19230 | 0 | p->level--; |
19231 | 0 | return NULL; |
19232 | 0 | } |
19233 | 252k | D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
19234 | 252k | Token * _literal; |
19235 | 252k | expr_ty a; |
19236 | 252k | expr_ty b; |
19237 | 252k | if ( |
19238 | 252k | (a = t_primary_rule(p)) // t_primary |
19239 | 26.1k | && |
19240 | 26.1k | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
19241 | 6.50k | && |
19242 | 6.50k | (b = _PyPegen_name_token(p)) // NAME |
19243 | 5.94k | && |
19244 | 5.94k | _PyPegen_lookahead(0, t_lookahead_rule, p) |
19245 | 252k | ) |
19246 | 5.94k | { |
19247 | 5.94k | D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
19248 | 5.94k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
19249 | 5.94k | if (_token == NULL) { |
19250 | 0 | p->level--; |
19251 | 0 | return NULL; |
19252 | 0 | } |
19253 | 5.94k | int _end_lineno = _token->end_lineno; |
19254 | 5.94k | UNUSED(_end_lineno); // Only used by EXTRA macro |
19255 | 5.94k | int _end_col_offset = _token->end_col_offset; |
19256 | 5.94k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
19257 | 5.94k | _res = _PyAST_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
19258 | 5.94k | if (_res == NULL && PyErr_Occurred()) { |
19259 | 0 | p->error_indicator = 1; |
19260 | 0 | p->level--; |
19261 | 0 | return NULL; |
19262 | 0 | } |
19263 | 5.94k | goto done; |
19264 | 5.94k | } |
19265 | 246k | p->mark = _mark; |
19266 | 246k | D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
19267 | 246k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
19268 | 246k | } |
19269 | 0 | { // t_primary '[' slices ']' !t_lookahead |
19270 | 246k | if (p->error_indicator) { |
19271 | 1.42k | p->level--; |
19272 | 1.42k | return NULL; |
19273 | 1.42k | } |
19274 | 245k | D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
19275 | 245k | Token * _literal; |
19276 | 245k | Token * _literal_1; |
19277 | 245k | expr_ty a; |
19278 | 245k | expr_ty b; |
19279 | 245k | if ( |
19280 | 245k | (a = t_primary_rule(p)) // t_primary |
19281 | 20.2k | && |
19282 | 20.2k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
19283 | 3.11k | && |
19284 | 3.11k | (b = slices_rule(p)) // slices |
19285 | 2.83k | && |
19286 | 2.83k | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
19287 | 2.44k | && |
19288 | 2.44k | _PyPegen_lookahead(0, t_lookahead_rule, p) |
19289 | 245k | ) |
19290 | 2.44k | { |
19291 | 2.44k | D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
19292 | 2.44k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
19293 | 2.44k | if (_token == NULL) { |
19294 | 0 | p->level--; |
19295 | 0 | return NULL; |
19296 | 0 | } |
19297 | 2.44k | int _end_lineno = _token->end_lineno; |
19298 | 2.44k | UNUSED(_end_lineno); // Only used by EXTRA macro |
19299 | 2.44k | int _end_col_offset = _token->end_col_offset; |
19300 | 2.44k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
19301 | 2.44k | _res = _PyAST_Subscript ( a , b , Store , EXTRA ); |
19302 | 2.44k | if (_res == NULL && PyErr_Occurred()) { |
19303 | 0 | p->error_indicator = 1; |
19304 | 0 | p->level--; |
19305 | 0 | return NULL; |
19306 | 0 | } |
19307 | 2.44k | goto done; |
19308 | 2.44k | } |
19309 | 242k | p->mark = _mark; |
19310 | 242k | D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
19311 | 242k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
19312 | 242k | } |
19313 | 0 | { // star_atom |
19314 | 242k | if (p->error_indicator) { |
19315 | 0 | p->level--; |
19316 | 0 | return NULL; |
19317 | 0 | } |
19318 | 242k | D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom")); |
19319 | 242k | expr_ty star_atom_var; |
19320 | 242k | if ( |
19321 | 242k | (star_atom_var = star_atom_rule(p)) // star_atom |
19322 | 242k | ) |
19323 | 120k | { |
19324 | 120k | D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom")); |
19325 | 120k | _res = star_atom_var; |
19326 | 120k | goto done; |
19327 | 120k | } |
19328 | 122k | p->mark = _mark; |
19329 | 122k | D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
19330 | 122k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom")); |
19331 | 122k | } |
19332 | 122k | _res = NULL; |
19333 | 251k | done: |
19334 | 251k | _PyPegen_insert_memo(p, _mark, target_with_star_atom_type, _res); |
19335 | 251k | p->level--; |
19336 | 251k | return _res; |
19337 | 122k | } |
19338 | | |
19339 | | // star_atom: |
19340 | | // | NAME |
19341 | | // | '(' target_with_star_atom ')' |
19342 | | // | '(' star_targets_tuple_seq? ')' |
19343 | | // | '[' star_targets_list_seq? ']' |
19344 | | static expr_ty |
19345 | | star_atom_rule(Parser *p) |
19346 | 242k | { |
19347 | 242k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
19348 | 0 | _Pypegen_stack_overflow(p); |
19349 | 0 | } |
19350 | 242k | if (p->error_indicator) { |
19351 | 0 | p->level--; |
19352 | 0 | return NULL; |
19353 | 0 | } |
19354 | 242k | expr_ty _res = NULL; |
19355 | 242k | int _mark = p->mark; |
19356 | 242k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
19357 | 0 | p->error_indicator = 1; |
19358 | 0 | p->level--; |
19359 | 0 | return NULL; |
19360 | 0 | } |
19361 | 242k | int _start_lineno = p->tokens[_mark]->lineno; |
19362 | 242k | UNUSED(_start_lineno); // Only used by EXTRA macro |
19363 | 242k | int _start_col_offset = p->tokens[_mark]->col_offset; |
19364 | 242k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
19365 | 242k | { // NAME |
19366 | 242k | if (p->error_indicator) { |
19367 | 0 | p->level--; |
19368 | 0 | return NULL; |
19369 | 0 | } |
19370 | 242k | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
19371 | 242k | expr_ty a; |
19372 | 242k | if ( |
19373 | 242k | (a = _PyPegen_name_token(p)) // NAME |
19374 | 242k | ) |
19375 | 111k | { |
19376 | 111k | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
19377 | 111k | _res = _PyPegen_set_expr_context ( p , a , Store ); |
19378 | 111k | if (_res == NULL && PyErr_Occurred()) { |
19379 | 0 | p->error_indicator = 1; |
19380 | 0 | p->level--; |
19381 | 0 | return NULL; |
19382 | 0 | } |
19383 | 111k | goto done; |
19384 | 111k | } |
19385 | 131k | p->mark = _mark; |
19386 | 131k | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
19387 | 131k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
19388 | 131k | } |
19389 | 0 | { // '(' target_with_star_atom ')' |
19390 | 131k | if (p->error_indicator) { |
19391 | 0 | p->level--; |
19392 | 0 | return NULL; |
19393 | 0 | } |
19394 | 131k | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'")); |
19395 | 131k | Token * _literal; |
19396 | 131k | Token * _literal_1; |
19397 | 131k | expr_ty a; |
19398 | 131k | if ( |
19399 | 131k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
19400 | 10.9k | && |
19401 | 10.9k | (a = target_with_star_atom_rule(p)) // target_with_star_atom |
19402 | 5.19k | && |
19403 | 5.19k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
19404 | 131k | ) |
19405 | 1.84k | { |
19406 | 1.84k | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'")); |
19407 | 1.84k | _res = _PyPegen_set_expr_context ( p , a , Store ); |
19408 | 1.84k | if (_res == NULL && PyErr_Occurred()) { |
19409 | 0 | p->error_indicator = 1; |
19410 | 0 | p->level--; |
19411 | 0 | return NULL; |
19412 | 0 | } |
19413 | 1.84k | goto done; |
19414 | 1.84k | } |
19415 | 130k | p->mark = _mark; |
19416 | 130k | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
19417 | 130k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target_with_star_atom ')'")); |
19418 | 130k | } |
19419 | 0 | { // '(' star_targets_tuple_seq? ')' |
19420 | 130k | if (p->error_indicator) { |
19421 | 0 | p->level--; |
19422 | 0 | return NULL; |
19423 | 0 | } |
19424 | 130k | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_tuple_seq? ')'")); |
19425 | 130k | Token * _literal; |
19426 | 130k | Token * _literal_1; |
19427 | 130k | void *a; |
19428 | 130k | if ( |
19429 | 130k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
19430 | 9.13k | && |
19431 | 9.13k | (a = star_targets_tuple_seq_rule(p), !p->error_indicator) // star_targets_tuple_seq? |
19432 | 9.13k | && |
19433 | 9.13k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
19434 | 130k | ) |
19435 | 4.49k | { |
19436 | 4.49k | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_tuple_seq? ')'")); |
19437 | 4.49k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
19438 | 4.49k | if (_token == NULL) { |
19439 | 0 | p->level--; |
19440 | 0 | return NULL; |
19441 | 0 | } |
19442 | 4.49k | int _end_lineno = _token->end_lineno; |
19443 | 4.49k | UNUSED(_end_lineno); // Only used by EXTRA macro |
19444 | 4.49k | int _end_col_offset = _token->end_col_offset; |
19445 | 4.49k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
19446 | 4.49k | _res = _PyAST_Tuple ( a , Store , EXTRA ); |
19447 | 4.49k | if (_res == NULL && PyErr_Occurred()) { |
19448 | 0 | p->error_indicator = 1; |
19449 | 0 | p->level--; |
19450 | 0 | return NULL; |
19451 | 0 | } |
19452 | 4.49k | goto done; |
19453 | 4.49k | } |
19454 | 125k | p->mark = _mark; |
19455 | 125k | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
19456 | 125k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_tuple_seq? ')'")); |
19457 | 125k | } |
19458 | 0 | { // '[' star_targets_list_seq? ']' |
19459 | 125k | if (p->error_indicator) { |
19460 | 0 | p->level--; |
19461 | 0 | return NULL; |
19462 | 0 | } |
19463 | 125k | D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_list_seq? ']'")); |
19464 | 125k | Token * _literal; |
19465 | 125k | Token * _literal_1; |
19466 | 125k | void *a; |
19467 | 125k | if ( |
19468 | 125k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
19469 | 6.05k | && |
19470 | 6.05k | (a = star_targets_list_seq_rule(p), !p->error_indicator) // star_targets_list_seq? |
19471 | 6.05k | && |
19472 | 6.05k | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
19473 | 125k | ) |
19474 | 2.73k | { |
19475 | 2.73k | D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_list_seq? ']'")); |
19476 | 2.73k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
19477 | 2.73k | if (_token == NULL) { |
19478 | 0 | p->level--; |
19479 | 0 | return NULL; |
19480 | 0 | } |
19481 | 2.73k | int _end_lineno = _token->end_lineno; |
19482 | 2.73k | UNUSED(_end_lineno); // Only used by EXTRA macro |
19483 | 2.73k | int _end_col_offset = _token->end_col_offset; |
19484 | 2.73k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
19485 | 2.73k | _res = _PyAST_List ( a , Store , EXTRA ); |
19486 | 2.73k | if (_res == NULL && PyErr_Occurred()) { |
19487 | 0 | p->error_indicator = 1; |
19488 | 0 | p->level--; |
19489 | 0 | return NULL; |
19490 | 0 | } |
19491 | 2.73k | goto done; |
19492 | 2.73k | } |
19493 | 122k | p->mark = _mark; |
19494 | 122k | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
19495 | 122k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_list_seq? ']'")); |
19496 | 122k | } |
19497 | 122k | _res = NULL; |
19498 | 242k | done: |
19499 | 242k | p->level--; |
19500 | 242k | return _res; |
19501 | 122k | } |
19502 | | |
19503 | | // single_target: single_subscript_attribute_target | NAME | '(' single_target ')' |
19504 | | static expr_ty |
19505 | | single_target_rule(Parser *p) |
19506 | 178k | { |
19507 | 178k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
19508 | 0 | _Pypegen_stack_overflow(p); |
19509 | 0 | } |
19510 | 178k | if (p->error_indicator) { |
19511 | 0 | p->level--; |
19512 | 0 | return NULL; |
19513 | 0 | } |
19514 | 178k | expr_ty _res = NULL; |
19515 | 178k | int _mark = p->mark; |
19516 | 178k | { // single_subscript_attribute_target |
19517 | 178k | if (p->error_indicator) { |
19518 | 0 | p->level--; |
19519 | 0 | return NULL; |
19520 | 0 | } |
19521 | 178k | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
19522 | 178k | expr_ty single_subscript_attribute_target_var; |
19523 | 178k | if ( |
19524 | 178k | (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target |
19525 | 178k | ) |
19526 | 1.77k | { |
19527 | 1.77k | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
19528 | 1.77k | _res = single_subscript_attribute_target_var; |
19529 | 1.77k | goto done; |
19530 | 1.77k | } |
19531 | 177k | p->mark = _mark; |
19532 | 177k | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
19533 | 177k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); |
19534 | 177k | } |
19535 | 0 | { // NAME |
19536 | 177k | if (p->error_indicator) { |
19537 | 152 | p->level--; |
19538 | 152 | return NULL; |
19539 | 152 | } |
19540 | 176k | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
19541 | 176k | expr_ty a; |
19542 | 176k | if ( |
19543 | 176k | (a = _PyPegen_name_token(p)) // NAME |
19544 | 176k | ) |
19545 | 68.7k | { |
19546 | 68.7k | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
19547 | 68.7k | _res = _PyPegen_set_expr_context ( p , a , Store ); |
19548 | 68.7k | if (_res == NULL && PyErr_Occurred()) { |
19549 | 0 | p->error_indicator = 1; |
19550 | 0 | p->level--; |
19551 | 0 | return NULL; |
19552 | 0 | } |
19553 | 68.7k | goto done; |
19554 | 68.7k | } |
19555 | 108k | p->mark = _mark; |
19556 | 108k | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
19557 | 108k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
19558 | 108k | } |
19559 | 0 | { // '(' single_target ')' |
19560 | 108k | if (p->error_indicator) { |
19561 | 0 | p->level--; |
19562 | 0 | return NULL; |
19563 | 0 | } |
19564 | 108k | D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
19565 | 108k | Token * _literal; |
19566 | 108k | Token * _literal_1; |
19567 | 108k | expr_ty a; |
19568 | 108k | if ( |
19569 | 108k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
19570 | 7.27k | && |
19571 | 7.27k | (a = single_target_rule(p)) // single_target |
19572 | 2.28k | && |
19573 | 2.28k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
19574 | 108k | ) |
19575 | 628 | { |
19576 | 628 | D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
19577 | 628 | _res = a; |
19578 | 628 | if (_res == NULL && PyErr_Occurred()) { |
19579 | 0 | p->error_indicator = 1; |
19580 | 0 | p->level--; |
19581 | 0 | return NULL; |
19582 | 0 | } |
19583 | 628 | goto done; |
19584 | 628 | } |
19585 | 107k | p->mark = _mark; |
19586 | 107k | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
19587 | 107k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); |
19588 | 107k | } |
19589 | 107k | _res = NULL; |
19590 | 178k | done: |
19591 | 178k | p->level--; |
19592 | 178k | return _res; |
19593 | 107k | } |
19594 | | |
19595 | | // single_subscript_attribute_target: |
19596 | | // | t_primary '.' NAME !t_lookahead |
19597 | | // | t_primary '[' slices ']' !t_lookahead |
19598 | | static expr_ty |
19599 | | single_subscript_attribute_target_rule(Parser *p) |
19600 | 368k | { |
19601 | 368k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
19602 | 0 | _Pypegen_stack_overflow(p); |
19603 | 0 | } |
19604 | 368k | if (p->error_indicator) { |
19605 | 0 | p->level--; |
19606 | 0 | return NULL; |
19607 | 0 | } |
19608 | 368k | expr_ty _res = NULL; |
19609 | 368k | int _mark = p->mark; |
19610 | 368k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
19611 | 26 | p->error_indicator = 1; |
19612 | 26 | p->level--; |
19613 | 26 | return NULL; |
19614 | 26 | } |
19615 | 368k | int _start_lineno = p->tokens[_mark]->lineno; |
19616 | 368k | UNUSED(_start_lineno); // Only used by EXTRA macro |
19617 | 368k | int _start_col_offset = p->tokens[_mark]->col_offset; |
19618 | 368k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
19619 | 368k | { // t_primary '.' NAME !t_lookahead |
19620 | 368k | if (p->error_indicator) { |
19621 | 0 | p->level--; |
19622 | 0 | return NULL; |
19623 | 0 | } |
19624 | 368k | D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
19625 | 368k | Token * _literal; |
19626 | 368k | expr_ty a; |
19627 | 368k | expr_ty b; |
19628 | 368k | if ( |
19629 | 368k | (a = t_primary_rule(p)) // t_primary |
19630 | 28.0k | && |
19631 | 28.0k | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
19632 | 7.58k | && |
19633 | 7.58k | (b = _PyPegen_name_token(p)) // NAME |
19634 | 6.52k | && |
19635 | 6.52k | _PyPegen_lookahead(0, t_lookahead_rule, p) |
19636 | 368k | ) |
19637 | 6.52k | { |
19638 | 6.52k | D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
19639 | 6.52k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
19640 | 6.52k | if (_token == NULL) { |
19641 | 0 | p->level--; |
19642 | 0 | return NULL; |
19643 | 0 | } |
19644 | 6.52k | int _end_lineno = _token->end_lineno; |
19645 | 6.52k | UNUSED(_end_lineno); // Only used by EXTRA macro |
19646 | 6.52k | int _end_col_offset = _token->end_col_offset; |
19647 | 6.52k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
19648 | 6.52k | _res = _PyAST_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
19649 | 6.52k | if (_res == NULL && PyErr_Occurred()) { |
19650 | 0 | p->error_indicator = 1; |
19651 | 0 | p->level--; |
19652 | 0 | return NULL; |
19653 | 0 | } |
19654 | 6.52k | goto done; |
19655 | 6.52k | } |
19656 | 361k | p->mark = _mark; |
19657 | 361k | D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', |
19658 | 361k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
19659 | 361k | } |
19660 | 0 | { // t_primary '[' slices ']' !t_lookahead |
19661 | 361k | if (p->error_indicator) { |
19662 | 2.43k | p->level--; |
19663 | 2.43k | return NULL; |
19664 | 2.43k | } |
19665 | 359k | D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
19666 | 359k | Token * _literal; |
19667 | 359k | Token * _literal_1; |
19668 | 359k | expr_ty a; |
19669 | 359k | expr_ty b; |
19670 | 359k | if ( |
19671 | 359k | (a = t_primary_rule(p)) // t_primary |
19672 | 21.4k | && |
19673 | 21.4k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
19674 | 1.90k | && |
19675 | 1.90k | (b = slices_rule(p)) // slices |
19676 | 1.62k | && |
19677 | 1.62k | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
19678 | 1.29k | && |
19679 | 1.29k | _PyPegen_lookahead(0, t_lookahead_rule, p) |
19680 | 359k | ) |
19681 | 1.29k | { |
19682 | 1.29k | D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
19683 | 1.29k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
19684 | 1.29k | if (_token == NULL) { |
19685 | 0 | p->level--; |
19686 | 0 | return NULL; |
19687 | 0 | } |
19688 | 1.29k | int _end_lineno = _token->end_lineno; |
19689 | 1.29k | UNUSED(_end_lineno); // Only used by EXTRA macro |
19690 | 1.29k | int _end_col_offset = _token->end_col_offset; |
19691 | 1.29k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
19692 | 1.29k | _res = _PyAST_Subscript ( a , b , Store , EXTRA ); |
19693 | 1.29k | if (_res == NULL && PyErr_Occurred()) { |
19694 | 0 | p->error_indicator = 1; |
19695 | 0 | p->level--; |
19696 | 0 | return NULL; |
19697 | 0 | } |
19698 | 1.29k | goto done; |
19699 | 1.29k | } |
19700 | 358k | p->mark = _mark; |
19701 | 358k | D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', |
19702 | 358k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
19703 | 358k | } |
19704 | 358k | _res = NULL; |
19705 | 365k | done: |
19706 | 365k | p->level--; |
19707 | 365k | return _res; |
19708 | 358k | } |
19709 | | |
19710 | | // Left-recursive |
19711 | | // t_primary: |
19712 | | // | t_primary '.' NAME &t_lookahead |
19713 | | // | t_primary '[' slices ']' &t_lookahead |
19714 | | // | t_primary genexp &t_lookahead |
19715 | | // | t_primary '(' arguments? ')' &t_lookahead |
19716 | | // | atom &t_lookahead |
19717 | | static expr_ty t_primary_raw(Parser *); |
19718 | | static expr_ty |
19719 | | t_primary_rule(Parser *p) |
19720 | 2.44M | { |
19721 | 2.44M | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
19722 | 0 | _Pypegen_stack_overflow(p); |
19723 | 0 | } |
19724 | 2.44M | expr_ty _res = NULL; |
19725 | 2.44M | if (_PyPegen_is_memoized(p, t_primary_type, &_res)) { |
19726 | 2.17M | p->level--; |
19727 | 2.17M | return _res; |
19728 | 2.17M | } |
19729 | 265k | int _mark = p->mark; |
19730 | 265k | int _resmark = p->mark; |
19731 | 307k | while (1) { |
19732 | 307k | int tmpvar_9 = _PyPegen_update_memo(p, _mark, t_primary_type, _res); |
19733 | 307k | if (tmpvar_9) { |
19734 | 0 | p->level--; |
19735 | 0 | return _res; |
19736 | 0 | } |
19737 | 307k | p->mark = _mark; |
19738 | 307k | void *_raw = t_primary_raw(p); |
19739 | 307k | if (p->error_indicator) { |
19740 | 3.94k | p->level--; |
19741 | 3.94k | return NULL; |
19742 | 3.94k | } |
19743 | 303k | if (_raw == NULL || p->mark <= _resmark) |
19744 | 261k | break; |
19745 | 41.7k | _resmark = p->mark; |
19746 | 41.7k | _res = _raw; |
19747 | 41.7k | } |
19748 | 261k | p->mark = _resmark; |
19749 | 261k | p->level--; |
19750 | 261k | return _res; |
19751 | 265k | } |
19752 | | static expr_ty |
19753 | | t_primary_raw(Parser *p) |
19754 | 307k | { |
19755 | 307k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
19756 | 0 | _Pypegen_stack_overflow(p); |
19757 | 0 | } |
19758 | 307k | if (p->error_indicator) { |
19759 | 0 | p->level--; |
19760 | 0 | return NULL; |
19761 | 0 | } |
19762 | 307k | expr_ty _res = NULL; |
19763 | 307k | int _mark = p->mark; |
19764 | 307k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
19765 | 0 | p->error_indicator = 1; |
19766 | 0 | p->level--; |
19767 | 0 | return NULL; |
19768 | 0 | } |
19769 | 307k | int _start_lineno = p->tokens[_mark]->lineno; |
19770 | 307k | UNUSED(_start_lineno); // Only used by EXTRA macro |
19771 | 307k | int _start_col_offset = p->tokens[_mark]->col_offset; |
19772 | 307k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
19773 | 307k | { // t_primary '.' NAME &t_lookahead |
19774 | 307k | if (p->error_indicator) { |
19775 | 0 | p->level--; |
19776 | 0 | return NULL; |
19777 | 0 | } |
19778 | 307k | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
19779 | 307k | Token * _literal; |
19780 | 307k | expr_ty a; |
19781 | 307k | expr_ty b; |
19782 | 307k | if ( |
19783 | 307k | (a = t_primary_rule(p)) // t_primary |
19784 | 41.7k | && |
19785 | 41.7k | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
19786 | 16.9k | && |
19787 | 16.9k | (b = _PyPegen_name_token(p)) // NAME |
19788 | 16.3k | && |
19789 | 16.3k | _PyPegen_lookahead(1, t_lookahead_rule, p) |
19790 | 307k | ) |
19791 | 9.27k | { |
19792 | 9.27k | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
19793 | 9.27k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
19794 | 9.27k | if (_token == NULL) { |
19795 | 0 | p->level--; |
19796 | 0 | return NULL; |
19797 | 0 | } |
19798 | 9.27k | int _end_lineno = _token->end_lineno; |
19799 | 9.27k | UNUSED(_end_lineno); // Only used by EXTRA macro |
19800 | 9.27k | int _end_col_offset = _token->end_col_offset; |
19801 | 9.27k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
19802 | 9.27k | _res = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA ); |
19803 | 9.27k | if (_res == NULL && PyErr_Occurred()) { |
19804 | 0 | p->error_indicator = 1; |
19805 | 0 | p->level--; |
19806 | 0 | return NULL; |
19807 | 0 | } |
19808 | 9.27k | goto done; |
19809 | 9.27k | } |
19810 | 298k | p->mark = _mark; |
19811 | 298k | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
19812 | 298k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
19813 | 298k | } |
19814 | 0 | { // t_primary '[' slices ']' &t_lookahead |
19815 | 298k | if (p->error_indicator) { |
19816 | 13 | p->level--; |
19817 | 13 | return NULL; |
19818 | 13 | } |
19819 | 298k | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
19820 | 298k | Token * _literal; |
19821 | 298k | Token * _literal_1; |
19822 | 298k | expr_ty a; |
19823 | 298k | expr_ty b; |
19824 | 298k | if ( |
19825 | 298k | (a = t_primary_rule(p)) // t_primary |
19826 | 32.4k | && |
19827 | 32.4k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
19828 | 4.37k | && |
19829 | 4.37k | (b = slices_rule(p)) // slices |
19830 | 3.82k | && |
19831 | 3.82k | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
19832 | 3.42k | && |
19833 | 3.42k | _PyPegen_lookahead(1, t_lookahead_rule, p) |
19834 | 298k | ) |
19835 | 806 | { |
19836 | 806 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
19837 | 806 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
19838 | 806 | if (_token == NULL) { |
19839 | 0 | p->level--; |
19840 | 0 | return NULL; |
19841 | 0 | } |
19842 | 806 | int _end_lineno = _token->end_lineno; |
19843 | 806 | UNUSED(_end_lineno); // Only used by EXTRA macro |
19844 | 806 | int _end_col_offset = _token->end_col_offset; |
19845 | 806 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
19846 | 806 | _res = _PyAST_Subscript ( a , b , Load , EXTRA ); |
19847 | 806 | if (_res == NULL && PyErr_Occurred()) { |
19848 | 0 | p->error_indicator = 1; |
19849 | 0 | p->level--; |
19850 | 0 | return NULL; |
19851 | 0 | } |
19852 | 806 | goto done; |
19853 | 806 | } |
19854 | 297k | p->mark = _mark; |
19855 | 297k | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
19856 | 297k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
19857 | 297k | } |
19858 | 0 | { // t_primary genexp &t_lookahead |
19859 | 297k | if (p->error_indicator) { |
19860 | 251 | p->level--; |
19861 | 251 | return NULL; |
19862 | 251 | } |
19863 | 297k | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead")); |
19864 | 297k | expr_ty a; |
19865 | 297k | expr_ty b; |
19866 | 297k | if ( |
19867 | 297k | (a = t_primary_rule(p)) // t_primary |
19868 | 31.3k | && |
19869 | 31.3k | (b = genexp_rule(p)) // genexp |
19870 | 550 | && |
19871 | 550 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
19872 | 297k | ) |
19873 | 404 | { |
19874 | 404 | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead")); |
19875 | 404 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
19876 | 404 | if (_token == NULL) { |
19877 | 0 | p->level--; |
19878 | 0 | return NULL; |
19879 | 0 | } |
19880 | 404 | int _end_lineno = _token->end_lineno; |
19881 | 404 | UNUSED(_end_lineno); // Only used by EXTRA macro |
19882 | 404 | int _end_col_offset = _token->end_col_offset; |
19883 | 404 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
19884 | 404 | _res = _PyAST_Call ( a , CHECK ( asdl_expr_seq* , ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); |
19885 | 404 | if (_res == NULL && PyErr_Occurred()) { |
19886 | 0 | p->error_indicator = 1; |
19887 | 0 | p->level--; |
19888 | 0 | return NULL; |
19889 | 0 | } |
19890 | 404 | goto done; |
19891 | 404 | } |
19892 | 296k | p->mark = _mark; |
19893 | 296k | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
19894 | 296k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead")); |
19895 | 296k | } |
19896 | 0 | { // t_primary '(' arguments? ')' &t_lookahead |
19897 | 296k | if (p->error_indicator) { |
19898 | 349 | p->level--; |
19899 | 349 | return NULL; |
19900 | 349 | } |
19901 | 296k | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
19902 | 296k | Token * _literal; |
19903 | 296k | Token * _literal_1; |
19904 | 296k | expr_ty a; |
19905 | 296k | void *b; |
19906 | 296k | if ( |
19907 | 296k | (a = t_primary_rule(p)) // t_primary |
19908 | 30.6k | && |
19909 | 30.6k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
19910 | 19.6k | && |
19911 | 19.6k | (b = arguments_rule(p), !p->error_indicator) // arguments? |
19912 | 19.2k | && |
19913 | 19.2k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
19914 | 17.2k | && |
19915 | 17.2k | _PyPegen_lookahead(1, t_lookahead_rule, p) |
19916 | 296k | ) |
19917 | 2.61k | { |
19918 | 2.61k | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
19919 | 2.61k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
19920 | 2.61k | if (_token == NULL) { |
19921 | 0 | p->level--; |
19922 | 0 | return NULL; |
19923 | 0 | } |
19924 | 2.61k | int _end_lineno = _token->end_lineno; |
19925 | 2.61k | UNUSED(_end_lineno); // Only used by EXTRA macro |
19926 | 2.61k | int _end_col_offset = _token->end_col_offset; |
19927 | 2.61k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
19928 | 2.61k | _res = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
19929 | 2.61k | if (_res == NULL && PyErr_Occurred()) { |
19930 | 0 | p->error_indicator = 1; |
19931 | 0 | p->level--; |
19932 | 0 | return NULL; |
19933 | 0 | } |
19934 | 2.61k | goto done; |
19935 | 2.61k | } |
19936 | 293k | p->mark = _mark; |
19937 | 293k | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
19938 | 293k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
19939 | 293k | } |
19940 | 0 | { // atom &t_lookahead |
19941 | 293k | if (p->error_indicator) { |
19942 | 401 | p->level--; |
19943 | 401 | return NULL; |
19944 | 401 | } |
19945 | 293k | D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead")); |
19946 | 293k | expr_ty a; |
19947 | 293k | if ( |
19948 | 293k | (a = atom_rule(p)) // atom |
19949 | 198k | && |
19950 | 198k | _PyPegen_lookahead(1, t_lookahead_rule, p) |
19951 | 293k | ) |
19952 | 56.2k | { |
19953 | 56.2k | D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead")); |
19954 | 56.2k | _res = a; |
19955 | 56.2k | if (_res == NULL && PyErr_Occurred()) { |
19956 | 0 | p->error_indicator = 1; |
19957 | 0 | p->level--; |
19958 | 0 | return NULL; |
19959 | 0 | } |
19960 | 56.2k | goto done; |
19961 | 56.2k | } |
19962 | 237k | p->mark = _mark; |
19963 | 237k | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
19964 | 237k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead")); |
19965 | 237k | } |
19966 | 237k | _res = NULL; |
19967 | 306k | done: |
19968 | 306k | p->level--; |
19969 | 306k | return _res; |
19970 | 237k | } |
19971 | | |
19972 | | // t_lookahead: '(' | '[' | '.' |
19973 | | static void * |
19974 | | t_lookahead_rule(Parser *p) |
19975 | 252k | { |
19976 | 252k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
19977 | 0 | _Pypegen_stack_overflow(p); |
19978 | 0 | } |
19979 | 252k | if (p->error_indicator) { |
19980 | 0 | p->level--; |
19981 | 0 | return NULL; |
19982 | 0 | } |
19983 | 252k | void * _res = NULL; |
19984 | 252k | int _mark = p->mark; |
19985 | 252k | { // '(' |
19986 | 252k | if (p->error_indicator) { |
19987 | 0 | p->level--; |
19988 | 0 | return NULL; |
19989 | 0 | } |
19990 | 252k | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
19991 | 252k | Token * _literal; |
19992 | 252k | if ( |
19993 | 252k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
19994 | 252k | ) |
19995 | 30.7k | { |
19996 | 30.7k | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
19997 | 30.7k | _res = _literal; |
19998 | 30.7k | goto done; |
19999 | 30.7k | } |
20000 | 222k | p->mark = _mark; |
20001 | 222k | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
20002 | 222k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
20003 | 222k | } |
20004 | 0 | { // '[' |
20005 | 222k | if (p->error_indicator) { |
20006 | 134 | p->level--; |
20007 | 134 | return NULL; |
20008 | 134 | } |
20009 | 222k | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); |
20010 | 222k | Token * _literal; |
20011 | 222k | if ( |
20012 | 222k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
20013 | 222k | ) |
20014 | 7.47k | { |
20015 | 7.47k | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); |
20016 | 7.47k | _res = _literal; |
20017 | 7.47k | goto done; |
20018 | 7.47k | } |
20019 | 214k | p->mark = _mark; |
20020 | 214k | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
20021 | 214k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
20022 | 214k | } |
20023 | 0 | { // '.' |
20024 | 214k | if (p->error_indicator) { |
20025 | 0 | p->level--; |
20026 | 0 | return NULL; |
20027 | 0 | } |
20028 | 214k | D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
20029 | 214k | Token * _literal; |
20030 | 214k | if ( |
20031 | 214k | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
20032 | 214k | ) |
20033 | 31.1k | { |
20034 | 31.1k | D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
20035 | 31.1k | _res = _literal; |
20036 | 31.1k | goto done; |
20037 | 31.1k | } |
20038 | 183k | p->mark = _mark; |
20039 | 183k | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
20040 | 183k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
20041 | 183k | } |
20042 | 183k | _res = NULL; |
20043 | 252k | done: |
20044 | 252k | p->level--; |
20045 | 252k | return _res; |
20046 | 183k | } |
20047 | | |
20048 | | // del_targets: ','.del_target+ ','? |
20049 | | static asdl_expr_seq* |
20050 | | del_targets_rule(Parser *p) |
20051 | 4.97k | { |
20052 | 4.97k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
20053 | 0 | _Pypegen_stack_overflow(p); |
20054 | 0 | } |
20055 | 4.97k | if (p->error_indicator) { |
20056 | 0 | p->level--; |
20057 | 0 | return NULL; |
20058 | 0 | } |
20059 | 4.97k | asdl_expr_seq* _res = NULL; |
20060 | 4.97k | int _mark = p->mark; |
20061 | 4.97k | { // ','.del_target+ ','? |
20062 | 4.97k | if (p->error_indicator) { |
20063 | 0 | p->level--; |
20064 | 0 | return NULL; |
20065 | 0 | } |
20066 | 4.97k | D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?")); |
20067 | 4.97k | void *_opt_var; |
20068 | 4.97k | UNUSED(_opt_var); // Silence compiler warnings |
20069 | 4.97k | asdl_expr_seq* a; |
20070 | 4.97k | if ( |
20071 | 4.97k | (a = (asdl_expr_seq*)_gather_101_rule(p)) // ','.del_target+ |
20072 | 2.55k | && |
20073 | 2.55k | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
20074 | 4.97k | ) |
20075 | 2.50k | { |
20076 | 2.50k | D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?")); |
20077 | 2.50k | _res = a; |
20078 | 2.50k | if (_res == NULL && PyErr_Occurred()) { |
20079 | 0 | p->error_indicator = 1; |
20080 | 0 | p->level--; |
20081 | 0 | return NULL; |
20082 | 0 | } |
20083 | 2.50k | goto done; |
20084 | 2.50k | } |
20085 | 2.46k | p->mark = _mark; |
20086 | 2.46k | D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ', |
20087 | 2.46k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?")); |
20088 | 2.46k | } |
20089 | 2.46k | _res = NULL; |
20090 | 4.97k | done: |
20091 | 4.97k | p->level--; |
20092 | 4.97k | return _res; |
20093 | 2.46k | } |
20094 | | |
20095 | | // del_target: |
20096 | | // | t_primary '.' NAME !t_lookahead |
20097 | | // | t_primary '[' slices ']' !t_lookahead |
20098 | | // | del_t_atom |
20099 | | static expr_ty |
20100 | | del_target_rule(Parser *p) |
20101 | 11.5k | { |
20102 | 11.5k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
20103 | 0 | _Pypegen_stack_overflow(p); |
20104 | 0 | } |
20105 | 11.5k | if (p->error_indicator) { |
20106 | 0 | p->level--; |
20107 | 0 | return NULL; |
20108 | 0 | } |
20109 | 11.5k | expr_ty _res = NULL; |
20110 | 11.5k | if (_PyPegen_is_memoized(p, del_target_type, &_res)) { |
20111 | 2.56k | p->level--; |
20112 | 2.56k | return _res; |
20113 | 2.56k | } |
20114 | 8.99k | int _mark = p->mark; |
20115 | 8.99k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
20116 | 0 | p->error_indicator = 1; |
20117 | 0 | p->level--; |
20118 | 0 | return NULL; |
20119 | 0 | } |
20120 | 8.99k | int _start_lineno = p->tokens[_mark]->lineno; |
20121 | 8.99k | UNUSED(_start_lineno); // Only used by EXTRA macro |
20122 | 8.99k | int _start_col_offset = p->tokens[_mark]->col_offset; |
20123 | 8.99k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
20124 | 8.99k | { // t_primary '.' NAME !t_lookahead |
20125 | 8.99k | if (p->error_indicator) { |
20126 | 0 | p->level--; |
20127 | 0 | return NULL; |
20128 | 0 | } |
20129 | 8.99k | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
20130 | 8.99k | Token * _literal; |
20131 | 8.99k | expr_ty a; |
20132 | 8.99k | expr_ty b; |
20133 | 8.99k | if ( |
20134 | 8.99k | (a = t_primary_rule(p)) // t_primary |
20135 | 545 | && |
20136 | 545 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
20137 | 247 | && |
20138 | 247 | (b = _PyPegen_name_token(p)) // NAME |
20139 | 224 | && |
20140 | 224 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
20141 | 8.99k | ) |
20142 | 224 | { |
20143 | 224 | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
20144 | 224 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
20145 | 224 | if (_token == NULL) { |
20146 | 0 | p->level--; |
20147 | 0 | return NULL; |
20148 | 0 | } |
20149 | 224 | int _end_lineno = _token->end_lineno; |
20150 | 224 | UNUSED(_end_lineno); // Only used by EXTRA macro |
20151 | 224 | int _end_col_offset = _token->end_col_offset; |
20152 | 224 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
20153 | 224 | _res = _PyAST_Attribute ( a , b -> v . Name . id , Del , EXTRA ); |
20154 | 224 | if (_res == NULL && PyErr_Occurred()) { |
20155 | 0 | p->error_indicator = 1; |
20156 | 0 | p->level--; |
20157 | 0 | return NULL; |
20158 | 0 | } |
20159 | 224 | goto done; |
20160 | 224 | } |
20161 | 8.76k | p->mark = _mark; |
20162 | 8.76k | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
20163 | 8.76k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
20164 | 8.76k | } |
20165 | 0 | { // t_primary '[' slices ']' !t_lookahead |
20166 | 8.76k | if (p->error_indicator) { |
20167 | 83 | p->level--; |
20168 | 83 | return NULL; |
20169 | 83 | } |
20170 | 8.68k | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
20171 | 8.68k | Token * _literal; |
20172 | 8.68k | Token * _literal_1; |
20173 | 8.68k | expr_ty a; |
20174 | 8.68k | expr_ty b; |
20175 | 8.68k | if ( |
20176 | 8.68k | (a = t_primary_rule(p)) // t_primary |
20177 | 321 | && |
20178 | 321 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
20179 | 195 | && |
20180 | 195 | (b = slices_rule(p)) // slices |
20181 | 183 | && |
20182 | 183 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
20183 | 171 | && |
20184 | 171 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
20185 | 8.68k | ) |
20186 | 171 | { |
20187 | 171 | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
20188 | 171 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
20189 | 171 | if (_token == NULL) { |
20190 | 0 | p->level--; |
20191 | 0 | return NULL; |
20192 | 0 | } |
20193 | 171 | int _end_lineno = _token->end_lineno; |
20194 | 171 | UNUSED(_end_lineno); // Only used by EXTRA macro |
20195 | 171 | int _end_col_offset = _token->end_col_offset; |
20196 | 171 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
20197 | 171 | _res = _PyAST_Subscript ( a , b , Del , EXTRA ); |
20198 | 171 | if (_res == NULL && PyErr_Occurred()) { |
20199 | 0 | p->error_indicator = 1; |
20200 | 0 | p->level--; |
20201 | 0 | return NULL; |
20202 | 0 | } |
20203 | 171 | goto done; |
20204 | 171 | } |
20205 | 8.51k | p->mark = _mark; |
20206 | 8.51k | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
20207 | 8.51k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
20208 | 8.51k | } |
20209 | 0 | { // del_t_atom |
20210 | 8.51k | if (p->error_indicator) { |
20211 | 0 | p->level--; |
20212 | 0 | return NULL; |
20213 | 0 | } |
20214 | 8.51k | D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom")); |
20215 | 8.51k | expr_ty del_t_atom_var; |
20216 | 8.51k | if ( |
20217 | 8.51k | (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom |
20218 | 8.51k | ) |
20219 | 5.50k | { |
20220 | 5.50k | D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom")); |
20221 | 5.50k | _res = del_t_atom_var; |
20222 | 5.50k | goto done; |
20223 | 5.50k | } |
20224 | 3.01k | p->mark = _mark; |
20225 | 3.01k | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
20226 | 3.01k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom")); |
20227 | 3.01k | } |
20228 | 3.01k | _res = NULL; |
20229 | 8.91k | done: |
20230 | 8.91k | _PyPegen_insert_memo(p, _mark, del_target_type, _res); |
20231 | 8.91k | p->level--; |
20232 | 8.91k | return _res; |
20233 | 3.01k | } |
20234 | | |
20235 | | // del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']' |
20236 | | static expr_ty |
20237 | | del_t_atom_rule(Parser *p) |
20238 | 8.51k | { |
20239 | 8.51k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
20240 | 0 | _Pypegen_stack_overflow(p); |
20241 | 0 | } |
20242 | 8.51k | if (p->error_indicator) { |
20243 | 0 | p->level--; |
20244 | 0 | return NULL; |
20245 | 0 | } |
20246 | 8.51k | expr_ty _res = NULL; |
20247 | 8.51k | int _mark = p->mark; |
20248 | 8.51k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
20249 | 0 | p->error_indicator = 1; |
20250 | 0 | p->level--; |
20251 | 0 | return NULL; |
20252 | 0 | } |
20253 | 8.51k | int _start_lineno = p->tokens[_mark]->lineno; |
20254 | 8.51k | UNUSED(_start_lineno); // Only used by EXTRA macro |
20255 | 8.51k | int _start_col_offset = p->tokens[_mark]->col_offset; |
20256 | 8.51k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
20257 | 8.51k | { // NAME |
20258 | 8.51k | if (p->error_indicator) { |
20259 | 0 | p->level--; |
20260 | 0 | return NULL; |
20261 | 0 | } |
20262 | 8.51k | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME")); |
20263 | 8.51k | expr_ty a; |
20264 | 8.51k | if ( |
20265 | 8.51k | (a = _PyPegen_name_token(p)) // NAME |
20266 | 8.51k | ) |
20267 | 2.96k | { |
20268 | 2.96k | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME")); |
20269 | 2.96k | _res = _PyPegen_set_expr_context ( p , a , Del ); |
20270 | 2.96k | if (_res == NULL && PyErr_Occurred()) { |
20271 | 0 | p->error_indicator = 1; |
20272 | 0 | p->level--; |
20273 | 0 | return NULL; |
20274 | 0 | } |
20275 | 2.96k | goto done; |
20276 | 2.96k | } |
20277 | 5.54k | p->mark = _mark; |
20278 | 5.54k | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
20279 | 5.54k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
20280 | 5.54k | } |
20281 | 0 | { // '(' del_target ')' |
20282 | 5.54k | if (p->error_indicator) { |
20283 | 0 | p->level--; |
20284 | 0 | return NULL; |
20285 | 0 | } |
20286 | 5.54k | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'")); |
20287 | 5.54k | Token * _literal; |
20288 | 5.54k | Token * _literal_1; |
20289 | 5.54k | expr_ty a; |
20290 | 5.54k | if ( |
20291 | 5.54k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
20292 | 2.73k | && |
20293 | 2.73k | (a = del_target_rule(p)) // del_target |
20294 | 1.13k | && |
20295 | 1.13k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
20296 | 5.54k | ) |
20297 | 169 | { |
20298 | 169 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'")); |
20299 | 169 | _res = _PyPegen_set_expr_context ( p , a , Del ); |
20300 | 169 | if (_res == NULL && PyErr_Occurred()) { |
20301 | 0 | p->error_indicator = 1; |
20302 | 0 | p->level--; |
20303 | 0 | return NULL; |
20304 | 0 | } |
20305 | 169 | goto done; |
20306 | 169 | } |
20307 | 5.38k | p->mark = _mark; |
20308 | 5.38k | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
20309 | 5.38k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'")); |
20310 | 5.38k | } |
20311 | 0 | { // '(' del_targets? ')' |
20312 | 5.38k | if (p->error_indicator) { |
20313 | 0 | p->level--; |
20314 | 0 | return NULL; |
20315 | 0 | } |
20316 | 5.38k | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'")); |
20317 | 5.38k | Token * _literal; |
20318 | 5.38k | Token * _literal_1; |
20319 | 5.38k | void *a; |
20320 | 5.38k | if ( |
20321 | 5.38k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
20322 | 2.56k | && |
20323 | 2.56k | (a = del_targets_rule(p), !p->error_indicator) // del_targets? |
20324 | 2.56k | && |
20325 | 2.56k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
20326 | 5.38k | ) |
20327 | 1.87k | { |
20328 | 1.87k | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'")); |
20329 | 1.87k | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
20330 | 1.87k | if (_token == NULL) { |
20331 | 0 | p->level--; |
20332 | 0 | return NULL; |
20333 | 0 | } |
20334 | 1.87k | int _end_lineno = _token->end_lineno; |
20335 | 1.87k | UNUSED(_end_lineno); // Only used by EXTRA macro |
20336 | 1.87k | int _end_col_offset = _token->end_col_offset; |
20337 | 1.87k | UNUSED(_end_col_offset); // Only used by EXTRA macro |
20338 | 1.87k | _res = _PyAST_Tuple ( a , Del , EXTRA ); |
20339 | 1.87k | if (_res == NULL && PyErr_Occurred()) { |
20340 | 0 | p->error_indicator = 1; |
20341 | 0 | p->level--; |
20342 | 0 | return NULL; |
20343 | 0 | } |
20344 | 1.87k | goto done; |
20345 | 1.87k | } |
20346 | 3.50k | p->mark = _mark; |
20347 | 3.50k | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
20348 | 3.50k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'")); |
20349 | 3.50k | } |
20350 | 0 | { // '[' del_targets? ']' |
20351 | 3.50k | if (p->error_indicator) { |
20352 | 0 | p->level--; |
20353 | 0 | return NULL; |
20354 | 0 | } |
20355 | 3.50k | D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'")); |
20356 | 3.50k | Token * _literal; |
20357 | 3.50k | Token * _literal_1; |
20358 | 3.50k | void *a; |
20359 | 3.50k | if ( |
20360 | 3.50k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
20361 | 862 | && |
20362 | 862 | (a = del_targets_rule(p), !p->error_indicator) // del_targets? |
20363 | 862 | && |
20364 | 862 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
20365 | 3.50k | ) |
20366 | 491 | { |
20367 | 491 | D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'")); |
20368 | 491 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
20369 | 491 | if (_token == NULL) { |
20370 | 0 | p->level--; |
20371 | 0 | return NULL; |
20372 | 0 | } |
20373 | 491 | int _end_lineno = _token->end_lineno; |
20374 | 491 | UNUSED(_end_lineno); // Only used by EXTRA macro |
20375 | 491 | int _end_col_offset = _token->end_col_offset; |
20376 | 491 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
20377 | 491 | _res = _PyAST_List ( a , Del , EXTRA ); |
20378 | 491 | if (_res == NULL && PyErr_Occurred()) { |
20379 | 0 | p->error_indicator = 1; |
20380 | 0 | p->level--; |
20381 | 0 | return NULL; |
20382 | 0 | } |
20383 | 491 | goto done; |
20384 | 491 | } |
20385 | 3.01k | p->mark = _mark; |
20386 | 3.01k | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
20387 | 3.01k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'")); |
20388 | 3.01k | } |
20389 | 3.01k | _res = NULL; |
20390 | 8.51k | done: |
20391 | 8.51k | p->level--; |
20392 | 8.51k | return _res; |
20393 | 3.01k | } |
20394 | | |
20395 | | // type_expressions: |
20396 | | // | ','.expression+ ',' '*' expression ',' '**' expression |
20397 | | // | ','.expression+ ',' '*' expression |
20398 | | // | ','.expression+ ',' '**' expression |
20399 | | // | '*' expression ',' '**' expression |
20400 | | // | '*' expression |
20401 | | // | '**' expression |
20402 | | // | ','.expression+ |
20403 | | static asdl_expr_seq* |
20404 | | type_expressions_rule(Parser *p) |
20405 | 0 | { |
20406 | 0 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
20407 | 0 | _Pypegen_stack_overflow(p); |
20408 | 0 | } |
20409 | 0 | if (p->error_indicator) { |
20410 | 0 | p->level--; |
20411 | 0 | return NULL; |
20412 | 0 | } |
20413 | 0 | asdl_expr_seq* _res = NULL; |
20414 | 0 | int _mark = p->mark; |
20415 | 0 | { // ','.expression+ ',' '*' expression ',' '**' expression |
20416 | 0 | if (p->error_indicator) { |
20417 | 0 | p->level--; |
20418 | 0 | return NULL; |
20419 | 0 | } |
20420 | 0 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression")); |
20421 | 0 | Token * _literal; |
20422 | 0 | Token * _literal_1; |
20423 | 0 | Token * _literal_2; |
20424 | 0 | Token * _literal_3; |
20425 | 0 | asdl_seq * a; |
20426 | 0 | expr_ty b; |
20427 | 0 | expr_ty c; |
20428 | 0 | if ( |
20429 | 0 | (a = _gather_103_rule(p)) // ','.expression+ |
20430 | 0 | && |
20431 | 0 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
20432 | 0 | && |
20433 | 0 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
20434 | 0 | && |
20435 | 0 | (b = expression_rule(p)) // expression |
20436 | 0 | && |
20437 | 0 | (_literal_2 = _PyPegen_expect_token(p, 12)) // token=',' |
20438 | 0 | && |
20439 | 0 | (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**' |
20440 | 0 | && |
20441 | 0 | (c = expression_rule(p)) // expression |
20442 | 0 | ) |
20443 | 0 | { |
20444 | 0 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression")); |
20445 | 0 | _res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq* , _PyPegen_seq_append_to_end ( p , a , b ) ) , c ); |
20446 | 0 | if (_res == NULL && PyErr_Occurred()) { |
20447 | 0 | p->error_indicator = 1; |
20448 | 0 | p->level--; |
20449 | 0 | return NULL; |
20450 | 0 | } |
20451 | 0 | goto done; |
20452 | 0 | } |
20453 | 0 | p->mark = _mark; |
20454 | 0 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
20455 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression")); |
20456 | 0 | } |
20457 | 0 | { // ','.expression+ ',' '*' expression |
20458 | 0 | if (p->error_indicator) { |
20459 | 0 | p->level--; |
20460 | 0 | return NULL; |
20461 | 0 | } |
20462 | 0 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression")); |
20463 | 0 | Token * _literal; |
20464 | 0 | Token * _literal_1; |
20465 | 0 | asdl_seq * a; |
20466 | 0 | expr_ty b; |
20467 | 0 | if ( |
20468 | 0 | (a = _gather_103_rule(p)) // ','.expression+ |
20469 | 0 | && |
20470 | 0 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
20471 | 0 | && |
20472 | 0 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
20473 | 0 | && |
20474 | 0 | (b = expression_rule(p)) // expression |
20475 | 0 | ) |
20476 | 0 | { |
20477 | 0 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression")); |
20478 | 0 | _res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , a , b ); |
20479 | 0 | if (_res == NULL && PyErr_Occurred()) { |
20480 | 0 | p->error_indicator = 1; |
20481 | 0 | p->level--; |
20482 | 0 | return NULL; |
20483 | 0 | } |
20484 | 0 | goto done; |
20485 | 0 | } |
20486 | 0 | p->mark = _mark; |
20487 | 0 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
20488 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression")); |
20489 | 0 | } |
20490 | 0 | { // ','.expression+ ',' '**' expression |
20491 | 0 | if (p->error_indicator) { |
20492 | 0 | p->level--; |
20493 | 0 | return NULL; |
20494 | 0 | } |
20495 | 0 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression")); |
20496 | 0 | Token * _literal; |
20497 | 0 | Token * _literal_1; |
20498 | 0 | asdl_seq * a; |
20499 | 0 | expr_ty b; |
20500 | 0 | if ( |
20501 | 0 | (a = _gather_103_rule(p)) // ','.expression+ |
20502 | 0 | && |
20503 | 0 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
20504 | 0 | && |
20505 | 0 | (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**' |
20506 | 0 | && |
20507 | 0 | (b = expression_rule(p)) // expression |
20508 | 0 | ) |
20509 | 0 | { |
20510 | 0 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression")); |
20511 | 0 | _res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , a , b ); |
20512 | 0 | if (_res == NULL && PyErr_Occurred()) { |
20513 | 0 | p->error_indicator = 1; |
20514 | 0 | p->level--; |
20515 | 0 | return NULL; |
20516 | 0 | } |
20517 | 0 | goto done; |
20518 | 0 | } |
20519 | 0 | p->mark = _mark; |
20520 | 0 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
20521 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression")); |
20522 | 0 | } |
20523 | 0 | { // '*' expression ',' '**' expression |
20524 | 0 | if (p->error_indicator) { |
20525 | 0 | p->level--; |
20526 | 0 | return NULL; |
20527 | 0 | } |
20528 | 0 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression")); |
20529 | 0 | Token * _literal; |
20530 | 0 | Token * _literal_1; |
20531 | 0 | Token * _literal_2; |
20532 | 0 | expr_ty a; |
20533 | 0 | expr_ty b; |
20534 | 0 | if ( |
20535 | 0 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
20536 | 0 | && |
20537 | 0 | (a = expression_rule(p)) // expression |
20538 | 0 | && |
20539 | 0 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
20540 | 0 | && |
20541 | 0 | (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**' |
20542 | 0 | && |
20543 | 0 | (b = expression_rule(p)) // expression |
20544 | 0 | ) |
20545 | 0 | { |
20546 | 0 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression")); |
20547 | 0 | _res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq* , _PyPegen_singleton_seq ( p , a ) ) , b ); |
20548 | 0 | if (_res == NULL && PyErr_Occurred()) { |
20549 | 0 | p->error_indicator = 1; |
20550 | 0 | p->level--; |
20551 | 0 | return NULL; |
20552 | 0 | } |
20553 | 0 | goto done; |
20554 | 0 | } |
20555 | 0 | p->mark = _mark; |
20556 | 0 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
20557 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression")); |
20558 | 0 | } |
20559 | 0 | { // '*' expression |
20560 | 0 | if (p->error_indicator) { |
20561 | 0 | p->level--; |
20562 | 0 | return NULL; |
20563 | 0 | } |
20564 | 0 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
20565 | 0 | Token * _literal; |
20566 | 0 | expr_ty a; |
20567 | 0 | if ( |
20568 | 0 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
20569 | 0 | && |
20570 | 0 | (a = expression_rule(p)) // expression |
20571 | 0 | ) |
20572 | 0 | { |
20573 | 0 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression")); |
20574 | 0 | _res = ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , a ); |
20575 | 0 | if (_res == NULL && PyErr_Occurred()) { |
20576 | 0 | p->error_indicator = 1; |
20577 | 0 | p->level--; |
20578 | 0 | return NULL; |
20579 | 0 | } |
20580 | 0 | goto done; |
20581 | 0 | } |
20582 | 0 | p->mark = _mark; |
20583 | 0 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
20584 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression")); |
20585 | 0 | } |
20586 | 0 | { // '**' expression |
20587 | 0 | if (p->error_indicator) { |
20588 | 0 | p->level--; |
20589 | 0 | return NULL; |
20590 | 0 | } |
20591 | 0 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
20592 | 0 | Token * _literal; |
20593 | 0 | expr_ty a; |
20594 | 0 | if ( |
20595 | 0 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
20596 | 0 | && |
20597 | 0 | (a = expression_rule(p)) // expression |
20598 | 0 | ) |
20599 | 0 | { |
20600 | 0 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression")); |
20601 | 0 | _res = ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , a ); |
20602 | 0 | if (_res == NULL && PyErr_Occurred()) { |
20603 | 0 | p->error_indicator = 1; |
20604 | 0 | p->level--; |
20605 | 0 | return NULL; |
20606 | 0 | } |
20607 | 0 | goto done; |
20608 | 0 | } |
20609 | 0 | p->mark = _mark; |
20610 | 0 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
20611 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression")); |
20612 | 0 | } |
20613 | 0 | { // ','.expression+ |
20614 | 0 | if (p->error_indicator) { |
20615 | 0 | p->level--; |
20616 | 0 | return NULL; |
20617 | 0 | } |
20618 | 0 | D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+")); |
20619 | 0 | asdl_expr_seq* a; |
20620 | 0 | if ( |
20621 | 0 | (a = (asdl_expr_seq*)_gather_103_rule(p)) // ','.expression+ |
20622 | 0 | ) |
20623 | 0 | { |
20624 | 0 | D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+")); |
20625 | 0 | _res = a; |
20626 | 0 | if (_res == NULL && PyErr_Occurred()) { |
20627 | 0 | p->error_indicator = 1; |
20628 | 0 | p->level--; |
20629 | 0 | return NULL; |
20630 | 0 | } |
20631 | 0 | goto done; |
20632 | 0 | } |
20633 | 0 | p->mark = _mark; |
20634 | 0 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
20635 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+")); |
20636 | 0 | } |
20637 | 0 | _res = NULL; |
20638 | 0 | done: |
20639 | 0 | p->level--; |
20640 | 0 | return _res; |
20641 | 0 | } |
20642 | | |
20643 | | // func_type_comment: |
20644 | | // | NEWLINE TYPE_COMMENT &(NEWLINE INDENT) |
20645 | | // | invalid_double_type_comments |
20646 | | // | TYPE_COMMENT |
20647 | | static Token* |
20648 | | func_type_comment_rule(Parser *p) |
20649 | 12.2k | { |
20650 | 12.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
20651 | 0 | _Pypegen_stack_overflow(p); |
20652 | 0 | } |
20653 | 12.2k | if (p->error_indicator) { |
20654 | 0 | p->level--; |
20655 | 0 | return NULL; |
20656 | 0 | } |
20657 | 12.2k | Token* _res = NULL; |
20658 | 12.2k | int _mark = p->mark; |
20659 | 12.2k | { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT) |
20660 | 12.2k | if (p->error_indicator) { |
20661 | 0 | p->level--; |
20662 | 0 | return NULL; |
20663 | 0 | } |
20664 | 12.2k | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); |
20665 | 12.2k | Token * newline_var; |
20666 | 12.2k | Token * t; |
20667 | 12.2k | if ( |
20668 | 12.2k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
20669 | 6.21k | && |
20670 | 6.21k | (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
20671 | 0 | && |
20672 | 0 | _PyPegen_lookahead(1, _tmp_104_rule, p) |
20673 | 12.2k | ) |
20674 | 0 | { |
20675 | 0 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); |
20676 | 0 | _res = t; |
20677 | 0 | if (_res == NULL && PyErr_Occurred()) { |
20678 | 0 | p->error_indicator = 1; |
20679 | 0 | p->level--; |
20680 | 0 | return NULL; |
20681 | 0 | } |
20682 | 0 | goto done; |
20683 | 0 | } |
20684 | 12.2k | p->mark = _mark; |
20685 | 12.2k | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
20686 | 12.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); |
20687 | 12.2k | } |
20688 | 12.2k | if (p->call_invalid_rules) { // invalid_double_type_comments |
20689 | 2.35k | if (p->error_indicator) { |
20690 | 0 | p->level--; |
20691 | 0 | return NULL; |
20692 | 0 | } |
20693 | 2.35k | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments")); |
20694 | 2.35k | void *invalid_double_type_comments_var; |
20695 | 2.35k | if ( |
20696 | 2.35k | (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments |
20697 | 2.35k | ) |
20698 | 0 | { |
20699 | 0 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments")); |
20700 | 0 | _res = invalid_double_type_comments_var; |
20701 | 0 | goto done; |
20702 | 0 | } |
20703 | 2.35k | p->mark = _mark; |
20704 | 2.35k | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
20705 | 2.35k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments")); |
20706 | 2.35k | } |
20707 | 12.2k | { // TYPE_COMMENT |
20708 | 12.2k | if (p->error_indicator) { |
20709 | 2 | p->level--; |
20710 | 2 | return NULL; |
20711 | 2 | } |
20712 | 12.2k | D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT")); |
20713 | 12.2k | Token * type_comment_var; |
20714 | 12.2k | if ( |
20715 | 12.2k | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
20716 | 12.2k | ) |
20717 | 0 | { |
20718 | 0 | D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT")); |
20719 | 0 | _res = type_comment_var; |
20720 | 0 | goto done; |
20721 | 0 | } |
20722 | 12.2k | p->mark = _mark; |
20723 | 12.2k | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
20724 | 12.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT")); |
20725 | 12.2k | } |
20726 | 12.2k | _res = NULL; |
20727 | 12.2k | done: |
20728 | 12.2k | p->level--; |
20729 | 12.2k | return _res; |
20730 | 12.2k | } |
20731 | | |
20732 | | // invalid_arguments: |
20733 | | // | ((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+ |
20734 | | // | expression for_if_clauses ',' [args | expression for_if_clauses] |
20735 | | // | NAME '=' expression for_if_clauses |
20736 | | // | [(args ',')] NAME '=' &(',' | ')') |
20737 | | // | args for_if_clauses |
20738 | | // | args ',' expression for_if_clauses |
20739 | | // | args ',' args |
20740 | | static void * |
20741 | | invalid_arguments_rule(Parser *p) |
20742 | 6.88k | { |
20743 | 6.88k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
20744 | 0 | _Pypegen_stack_overflow(p); |
20745 | 0 | } |
20746 | 6.88k | if (p->error_indicator) { |
20747 | 0 | p->level--; |
20748 | 0 | return NULL; |
20749 | 0 | } |
20750 | 6.88k | void * _res = NULL; |
20751 | 6.88k | int _mark = p->mark; |
20752 | 6.88k | { // ((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+ |
20753 | 6.88k | if (p->error_indicator) { |
20754 | 0 | p->level--; |
20755 | 0 | return NULL; |
20756 | 0 | } |
20757 | 6.88k | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+")); |
20758 | 6.88k | asdl_seq * _gather_107_var; |
20759 | 6.88k | void *_tmp_105_var; |
20760 | 6.88k | Token * a; |
20761 | 6.88k | if ( |
20762 | 6.88k | (_tmp_105_var = _tmp_105_rule(p)) // (','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs |
20763 | 2.53k | && |
20764 | 2.53k | (a = _PyPegen_expect_token(p, 12)) // token=',' |
20765 | 1.29k | && |
20766 | 1.29k | (_gather_107_var = _gather_107_rule(p)) // ','.(starred_expression !'=')+ |
20767 | 6.88k | ) |
20768 | 497 | { |
20769 | 497 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+")); |
20770 | 497 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "iterable argument unpacking follows keyword argument unpacking" ); |
20771 | 497 | if (_res == NULL && PyErr_Occurred()) { |
20772 | 497 | p->error_indicator = 1; |
20773 | 497 | p->level--; |
20774 | 497 | return NULL; |
20775 | 497 | } |
20776 | 0 | goto done; |
20777 | 497 | } |
20778 | 6.38k | p->mark = _mark; |
20779 | 6.38k | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
20780 | 6.38k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+")); |
20781 | 6.38k | } |
20782 | 0 | { // expression for_if_clauses ',' [args | expression for_if_clauses] |
20783 | 6.38k | if (p->error_indicator) { |
20784 | 207 | p->level--; |
20785 | 207 | return NULL; |
20786 | 207 | } |
20787 | 6.17k | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); |
20788 | 6.17k | Token * _literal; |
20789 | 6.17k | void *_opt_var; |
20790 | 6.17k | UNUSED(_opt_var); // Silence compiler warnings |
20791 | 6.17k | expr_ty a; |
20792 | 6.17k | asdl_comprehension_seq* b; |
20793 | 6.17k | if ( |
20794 | 6.17k | (a = expression_rule(p)) // expression |
20795 | 2.94k | && |
20796 | 2.94k | (b = for_if_clauses_rule(p)) // for_if_clauses |
20797 | 381 | && |
20798 | 381 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
20799 | 149 | && |
20800 | 149 | (_opt_var = _tmp_108_rule(p), !p->error_indicator) // [args | expression for_if_clauses] |
20801 | 6.17k | ) |
20802 | 4 | { |
20803 | 4 | 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]")); |
20804 | 4 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , _PyPegen_get_last_comprehension_item ( PyPegen_last_item ( b , comprehension_ty ) ) , "Generator expression must be parenthesized" ); |
20805 | 4 | if (_res == NULL && PyErr_Occurred()) { |
20806 | 4 | p->error_indicator = 1; |
20807 | 4 | p->level--; |
20808 | 4 | return NULL; |
20809 | 4 | } |
20810 | 0 | goto done; |
20811 | 4 | } |
20812 | 6.17k | p->mark = _mark; |
20813 | 6.17k | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
20814 | 6.17k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); |
20815 | 6.17k | } |
20816 | 0 | { // NAME '=' expression for_if_clauses |
20817 | 6.17k | if (p->error_indicator) { |
20818 | 145 | p->level--; |
20819 | 145 | return NULL; |
20820 | 145 | } |
20821 | 6.02k | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses")); |
20822 | 6.02k | expr_ty a; |
20823 | 6.02k | Token * b; |
20824 | 6.02k | expr_ty expression_var; |
20825 | 6.02k | asdl_comprehension_seq* for_if_clauses_var; |
20826 | 6.02k | if ( |
20827 | 6.02k | (a = _PyPegen_name_token(p)) // NAME |
20828 | 2.23k | && |
20829 | 2.23k | (b = _PyPegen_expect_token(p, 22)) // token='=' |
20830 | 874 | && |
20831 | 874 | (expression_var = expression_rule(p)) // expression |
20832 | 747 | && |
20833 | 747 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
20834 | 6.02k | ) |
20835 | 0 | { |
20836 | 0 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses")); |
20837 | 0 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" ); |
20838 | 0 | if (_res == NULL && PyErr_Occurred()) { |
20839 | 0 | p->error_indicator = 1; |
20840 | 0 | p->level--; |
20841 | 0 | return NULL; |
20842 | 0 | } |
20843 | 0 | goto done; |
20844 | 0 | } |
20845 | 6.02k | p->mark = _mark; |
20846 | 6.02k | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
20847 | 6.02k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression for_if_clauses")); |
20848 | 6.02k | } |
20849 | 0 | { // [(args ',')] NAME '=' &(',' | ')') |
20850 | 6.02k | if (p->error_indicator) { |
20851 | 0 | p->level--; |
20852 | 0 | return NULL; |
20853 | 0 | } |
20854 | 6.02k | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[(args ',')] NAME '=' &(',' | ')')")); |
20855 | 6.02k | void *_opt_var; |
20856 | 6.02k | UNUSED(_opt_var); // Silence compiler warnings |
20857 | 6.02k | expr_ty a; |
20858 | 6.02k | Token * b; |
20859 | 6.02k | if ( |
20860 | 6.02k | (_opt_var = _tmp_109_rule(p), !p->error_indicator) // [(args ',')] |
20861 | 6.02k | && |
20862 | 6.02k | (a = _PyPegen_name_token(p)) // NAME |
20863 | 2.03k | && |
20864 | 2.03k | (b = _PyPegen_expect_token(p, 22)) // token='=' |
20865 | 545 | && |
20866 | 545 | _PyPegen_lookahead(1, _tmp_110_rule, p) |
20867 | 6.02k | ) |
20868 | 13 | { |
20869 | 13 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[(args ',')] NAME '=' &(',' | ')')")); |
20870 | 13 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expected argument value expression" ); |
20871 | 13 | if (_res == NULL && PyErr_Occurred()) { |
20872 | 13 | p->error_indicator = 1; |
20873 | 13 | p->level--; |
20874 | 13 | return NULL; |
20875 | 13 | } |
20876 | 0 | goto done; |
20877 | 13 | } |
20878 | 6.01k | p->mark = _mark; |
20879 | 6.01k | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
20880 | 6.01k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[(args ',')] NAME '=' &(',' | ')')")); |
20881 | 6.01k | } |
20882 | 0 | { // args for_if_clauses |
20883 | 6.01k | if (p->error_indicator) { |
20884 | 0 | p->level--; |
20885 | 0 | return NULL; |
20886 | 0 | } |
20887 | 6.01k | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses")); |
20888 | 6.01k | expr_ty a; |
20889 | 6.01k | asdl_comprehension_seq* b; |
20890 | 6.01k | if ( |
20891 | 6.01k | (a = args_rule(p)) // args |
20892 | 3.34k | && |
20893 | 3.34k | (b = for_if_clauses_rule(p)) // for_if_clauses |
20894 | 6.01k | ) |
20895 | 301 | { |
20896 | 301 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses")); |
20897 | 301 | _res = _PyPegen_nonparen_genexp_in_call ( p , a , b ); |
20898 | 301 | if (_res == NULL && PyErr_Occurred()) { |
20899 | 3 | p->error_indicator = 1; |
20900 | 3 | p->level--; |
20901 | 3 | return NULL; |
20902 | 3 | } |
20903 | 298 | goto done; |
20904 | 301 | } |
20905 | 5.71k | p->mark = _mark; |
20906 | 5.71k | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
20907 | 5.71k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses")); |
20908 | 5.71k | } |
20909 | 0 | { // args ',' expression for_if_clauses |
20910 | 5.71k | if (p->error_indicator) { |
20911 | 69 | p->level--; |
20912 | 69 | return NULL; |
20913 | 69 | } |
20914 | 5.64k | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses")); |
20915 | 5.64k | Token * _literal; |
20916 | 5.64k | expr_ty a; |
20917 | 5.64k | expr_ty args_var; |
20918 | 5.64k | asdl_comprehension_seq* b; |
20919 | 5.64k | if ( |
20920 | 5.64k | (args_var = args_rule(p)) // args |
20921 | 2.97k | && |
20922 | 2.97k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
20923 | 531 | && |
20924 | 531 | (a = expression_rule(p)) // expression |
20925 | 379 | && |
20926 | 379 | (b = for_if_clauses_rule(p)) // for_if_clauses |
20927 | 5.64k | ) |
20928 | 1 | { |
20929 | 1 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses")); |
20930 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , _PyPegen_get_last_comprehension_item ( PyPegen_last_item ( b , comprehension_ty ) ) , "Generator expression must be parenthesized" ); |
20931 | 1 | if (_res == NULL && PyErr_Occurred()) { |
20932 | 1 | p->error_indicator = 1; |
20933 | 1 | p->level--; |
20934 | 1 | return NULL; |
20935 | 1 | } |
20936 | 0 | goto done; |
20937 | 1 | } |
20938 | 5.64k | p->mark = _mark; |
20939 | 5.64k | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
20940 | 5.64k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses")); |
20941 | 5.64k | } |
20942 | 0 | { // args ',' args |
20943 | 5.64k | if (p->error_indicator) { |
20944 | 83 | p->level--; |
20945 | 83 | return NULL; |
20946 | 83 | } |
20947 | 5.56k | D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args")); |
20948 | 5.56k | Token * _literal; |
20949 | 5.56k | expr_ty a; |
20950 | 5.56k | expr_ty args_var; |
20951 | 5.56k | if ( |
20952 | 5.56k | (a = args_rule(p)) // args |
20953 | 2.89k | && |
20954 | 2.89k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
20955 | 447 | && |
20956 | 447 | (args_var = args_rule(p)) // args |
20957 | 5.56k | ) |
20958 | 29 | { |
20959 | 29 | D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args")); |
20960 | 29 | _res = _PyPegen_arguments_parsing_error ( p , a ); |
20961 | 29 | if (_res == NULL && PyErr_Occurred()) { |
20962 | 29 | p->error_indicator = 1; |
20963 | 29 | p->level--; |
20964 | 29 | return NULL; |
20965 | 29 | } |
20966 | 0 | goto done; |
20967 | 29 | } |
20968 | 5.53k | p->mark = _mark; |
20969 | 5.53k | D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
20970 | 5.53k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args")); |
20971 | 5.53k | } |
20972 | 5.53k | _res = NULL; |
20973 | 5.83k | done: |
20974 | 5.83k | p->level--; |
20975 | 5.83k | return _res; |
20976 | 5.53k | } |
20977 | | |
20978 | | // invalid_kwarg: |
20979 | | // | ('True' | 'False' | 'None') '=' |
20980 | | // | NAME '=' expression for_if_clauses |
20981 | | // | !(NAME '=') expression '=' |
20982 | | // | '**' expression '=' expression |
20983 | | static void * |
20984 | | invalid_kwarg_rule(Parser *p) |
20985 | 99.2k | { |
20986 | 99.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
20987 | 0 | _Pypegen_stack_overflow(p); |
20988 | 0 | } |
20989 | 99.2k | if (p->error_indicator) { |
20990 | 0 | p->level--; |
20991 | 0 | return NULL; |
20992 | 0 | } |
20993 | 99.2k | void * _res = NULL; |
20994 | 99.2k | int _mark = p->mark; |
20995 | 99.2k | { // ('True' | 'False' | 'None') '=' |
20996 | 99.2k | if (p->error_indicator) { |
20997 | 0 | p->level--; |
20998 | 0 | return NULL; |
20999 | 0 | } |
21000 | 99.2k | D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('True' | 'False' | 'None') '='")); |
21001 | 99.2k | Token* a; |
21002 | 99.2k | Token * b; |
21003 | 99.2k | if ( |
21004 | 99.2k | (a = (Token*)_tmp_111_rule(p)) // 'True' | 'False' | 'None' |
21005 | 503 | && |
21006 | 503 | (b = _PyPegen_expect_token(p, 22)) // token='=' |
21007 | 99.2k | ) |
21008 | 4 | { |
21009 | 4 | D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('True' | 'False' | 'None') '='")); |
21010 | 4 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to %s" , PyBytes_AS_STRING ( a -> bytes ) ); |
21011 | 4 | if (_res == NULL && PyErr_Occurred()) { |
21012 | 4 | p->error_indicator = 1; |
21013 | 4 | p->level--; |
21014 | 4 | return NULL; |
21015 | 4 | } |
21016 | 0 | goto done; |
21017 | 4 | } |
21018 | 99.2k | p->mark = _mark; |
21019 | 99.2k | D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ', |
21020 | 99.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('True' | 'False' | 'None') '='")); |
21021 | 99.2k | } |
21022 | 0 | { // NAME '=' expression for_if_clauses |
21023 | 99.2k | if (p->error_indicator) { |
21024 | 3 | p->level--; |
21025 | 3 | return NULL; |
21026 | 3 | } |
21027 | 99.2k | D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses")); |
21028 | 99.2k | expr_ty a; |
21029 | 99.2k | Token * b; |
21030 | 99.2k | expr_ty expression_var; |
21031 | 99.2k | asdl_comprehension_seq* for_if_clauses_var; |
21032 | 99.2k | if ( |
21033 | 99.2k | (a = _PyPegen_name_token(p)) // NAME |
21034 | 29.6k | && |
21035 | 29.6k | (b = _PyPegen_expect_token(p, 22)) // token='=' |
21036 | 19.3k | && |
21037 | 19.3k | (expression_var = expression_rule(p)) // expression |
21038 | 16.5k | && |
21039 | 16.5k | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
21040 | 99.2k | ) |
21041 | 1 | { |
21042 | 1 | D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses")); |
21043 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" ); |
21044 | 1 | if (_res == NULL && PyErr_Occurred()) { |
21045 | 1 | p->error_indicator = 1; |
21046 | 1 | p->level--; |
21047 | 1 | return NULL; |
21048 | 1 | } |
21049 | 0 | goto done; |
21050 | 1 | } |
21051 | 99.2k | p->mark = _mark; |
21052 | 99.2k | D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ', |
21053 | 99.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression for_if_clauses")); |
21054 | 99.2k | } |
21055 | 0 | { // !(NAME '=') expression '=' |
21056 | 99.2k | if (p->error_indicator) { |
21057 | 341 | p->level--; |
21058 | 341 | return NULL; |
21059 | 341 | } |
21060 | 98.8k | D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!(NAME '=') expression '='")); |
21061 | 98.8k | expr_ty a; |
21062 | 98.8k | Token * b; |
21063 | 98.8k | if ( |
21064 | 98.8k | _PyPegen_lookahead(0, _tmp_112_rule, p) |
21065 | 79.9k | && |
21066 | 79.9k | (a = expression_rule(p)) // expression |
21067 | 13.3k | && |
21068 | 13.3k | (b = _PyPegen_expect_token(p, 22)) // token='=' |
21069 | 98.8k | ) |
21070 | 7 | { |
21071 | 7 | D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(NAME '=') expression '='")); |
21072 | 7 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expression cannot contain assignment, perhaps you meant \"==\"?" ); |
21073 | 7 | if (_res == NULL && PyErr_Occurred()) { |
21074 | 7 | p->error_indicator = 1; |
21075 | 7 | p->level--; |
21076 | 7 | return NULL; |
21077 | 7 | } |
21078 | 0 | goto done; |
21079 | 7 | } |
21080 | 98.8k | p->mark = _mark; |
21081 | 98.8k | D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ', |
21082 | 98.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(NAME '=') expression '='")); |
21083 | 98.8k | } |
21084 | 0 | { // '**' expression '=' expression |
21085 | 98.8k | if (p->error_indicator) { |
21086 | 452 | p->level--; |
21087 | 452 | return NULL; |
21088 | 452 | } |
21089 | 98.4k | D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression '=' expression")); |
21090 | 98.4k | Token * _literal; |
21091 | 98.4k | Token * a; |
21092 | 98.4k | expr_ty b; |
21093 | 98.4k | expr_ty expression_var; |
21094 | 98.4k | if ( |
21095 | 98.4k | (a = _PyPegen_expect_token(p, 35)) // token='**' |
21096 | 13.6k | && |
21097 | 13.6k | (expression_var = expression_rule(p)) // expression |
21098 | 12.6k | && |
21099 | 12.6k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
21100 | 86 | && |
21101 | 86 | (b = expression_rule(p)) // expression |
21102 | 98.4k | ) |
21103 | 1 | { |
21104 | 1 | D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression '=' expression")); |
21105 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to keyword argument unpacking" ); |
21106 | 1 | if (_res == NULL && PyErr_Occurred()) { |
21107 | 1 | p->error_indicator = 1; |
21108 | 1 | p->level--; |
21109 | 1 | return NULL; |
21110 | 1 | } |
21111 | 0 | goto done; |
21112 | 1 | } |
21113 | 98.4k | p->mark = _mark; |
21114 | 98.4k | D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ', |
21115 | 98.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression '=' expression")); |
21116 | 98.4k | } |
21117 | 98.4k | _res = NULL; |
21118 | 98.4k | done: |
21119 | 98.4k | p->level--; |
21120 | 98.4k | return _res; |
21121 | 98.4k | } |
21122 | | |
21123 | | // expression_without_invalid: |
21124 | | // | disjunction 'if' disjunction 'else' expression |
21125 | | // | disjunction |
21126 | | // | lambdef |
21127 | | static expr_ty |
21128 | | expression_without_invalid_rule(Parser *p) |
21129 | 92.8k | { |
21130 | 92.8k | int _prev_call_invalid = p->call_invalid_rules; |
21131 | 92.8k | p->call_invalid_rules = 0; |
21132 | 92.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
21133 | 1 | _Pypegen_stack_overflow(p); |
21134 | 1 | } |
21135 | 92.8k | if (p->error_indicator) { |
21136 | 20 | p->call_invalid_rules = _prev_call_invalid; |
21137 | 20 | p->level--; |
21138 | 20 | return NULL; |
21139 | 20 | } |
21140 | 92.8k | expr_ty _res = NULL; |
21141 | 92.8k | int _mark = p->mark; |
21142 | 92.8k | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
21143 | 0 | p->error_indicator = 1; |
21144 | 0 | p->call_invalid_rules = _prev_call_invalid; |
21145 | 0 | p->level--; |
21146 | 0 | return NULL; |
21147 | 0 | } |
21148 | 92.8k | int _start_lineno = p->tokens[_mark]->lineno; |
21149 | 92.8k | UNUSED(_start_lineno); // Only used by EXTRA macro |
21150 | 92.8k | int _start_col_offset = p->tokens[_mark]->col_offset; |
21151 | 92.8k | UNUSED(_start_col_offset); // Only used by EXTRA macro |
21152 | 92.8k | { // disjunction 'if' disjunction 'else' expression |
21153 | 92.8k | if (p->error_indicator) { |
21154 | 0 | p->call_invalid_rules = _prev_call_invalid; |
21155 | 0 | p->level--; |
21156 | 0 | return NULL; |
21157 | 0 | } |
21158 | 92.8k | D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
21159 | 92.8k | Token * _keyword; |
21160 | 92.8k | Token * _keyword_1; |
21161 | 92.8k | expr_ty a; |
21162 | 92.8k | expr_ty b; |
21163 | 92.8k | expr_ty c; |
21164 | 92.8k | if ( |
21165 | 92.8k | (a = disjunction_rule(p)) // disjunction |
21166 | 7.44k | && |
21167 | 7.44k | (_keyword = _PyPegen_expect_token(p, 691)) // token='if' |
21168 | 89 | && |
21169 | 89 | (b = disjunction_rule(p)) // disjunction |
21170 | 83 | && |
21171 | 83 | (_keyword_1 = _PyPegen_expect_token(p, 695)) // token='else' |
21172 | 73 | && |
21173 | 73 | (c = expression_rule(p)) // expression |
21174 | 92.8k | ) |
21175 | 66 | { |
21176 | 66 | D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
21177 | 66 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
21178 | 66 | if (_token == NULL) { |
21179 | 0 | p->call_invalid_rules = _prev_call_invalid; |
21180 | 0 | p->level--; |
21181 | 0 | return NULL; |
21182 | 0 | } |
21183 | 66 | int _end_lineno = _token->end_lineno; |
21184 | 66 | UNUSED(_end_lineno); // Only used by EXTRA macro |
21185 | 66 | int _end_col_offset = _token->end_col_offset; |
21186 | 66 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
21187 | 66 | _res = _PyAST_IfExp ( b , a , c , EXTRA ); |
21188 | 66 | if (_res == NULL && PyErr_Occurred()) { |
21189 | 0 | p->error_indicator = 1; |
21190 | 0 | p->call_invalid_rules = _prev_call_invalid; |
21191 | 0 | p->level--; |
21192 | 0 | return NULL; |
21193 | 0 | } |
21194 | 66 | goto done; |
21195 | 66 | } |
21196 | 92.7k | p->mark = _mark; |
21197 | 92.7k | D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n", p->level, ' ', |
21198 | 92.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
21199 | 92.7k | } |
21200 | 0 | { // disjunction |
21201 | 92.7k | if (p->error_indicator) { |
21202 | 310 | p->call_invalid_rules = _prev_call_invalid; |
21203 | 310 | p->level--; |
21204 | 310 | return NULL; |
21205 | 310 | } |
21206 | 92.4k | D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction")); |
21207 | 92.4k | expr_ty disjunction_var; |
21208 | 92.4k | if ( |
21209 | 92.4k | (disjunction_var = disjunction_rule(p)) // disjunction |
21210 | 92.4k | ) |
21211 | 7.38k | { |
21212 | 7.38k | D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction")); |
21213 | 7.38k | _res = disjunction_var; |
21214 | 7.38k | goto done; |
21215 | 7.38k | } |
21216 | 85.0k | p->mark = _mark; |
21217 | 85.0k | D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n", p->level, ' ', |
21218 | 85.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction")); |
21219 | 85.0k | } |
21220 | 0 | { // lambdef |
21221 | 85.0k | if (p->error_indicator) { |
21222 | 0 | p->call_invalid_rules = _prev_call_invalid; |
21223 | 0 | p->level--; |
21224 | 0 | return NULL; |
21225 | 0 | } |
21226 | 85.0k | D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef")); |
21227 | 85.0k | expr_ty lambdef_var; |
21228 | 85.0k | if ( |
21229 | 85.0k | (lambdef_var = lambdef_rule(p)) // lambdef |
21230 | 85.0k | ) |
21231 | 80 | { |
21232 | 80 | D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef")); |
21233 | 80 | _res = lambdef_var; |
21234 | 80 | goto done; |
21235 | 80 | } |
21236 | 84.9k | p->mark = _mark; |
21237 | 84.9k | D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n", p->level, ' ', |
21238 | 84.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef")); |
21239 | 84.9k | } |
21240 | 84.9k | _res = NULL; |
21241 | 92.5k | done: |
21242 | 92.5k | p->call_invalid_rules = _prev_call_invalid; |
21243 | 92.5k | p->level--; |
21244 | 92.5k | return _res; |
21245 | 84.9k | } |
21246 | | |
21247 | | // invalid_legacy_expression: NAME !'(' star_expressions |
21248 | | static void * |
21249 | | invalid_legacy_expression_rule(Parser *p) |
21250 | 184k | { |
21251 | 184k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
21252 | 0 | _Pypegen_stack_overflow(p); |
21253 | 0 | } |
21254 | 184k | if (p->error_indicator) { |
21255 | 0 | p->level--; |
21256 | 0 | return NULL; |
21257 | 0 | } |
21258 | 184k | void * _res = NULL; |
21259 | 184k | int _mark = p->mark; |
21260 | 184k | { // NAME !'(' star_expressions |
21261 | 184k | if (p->error_indicator) { |
21262 | 0 | p->level--; |
21263 | 0 | return NULL; |
21264 | 0 | } |
21265 | 184k | D(fprintf(stderr, "%*c> invalid_legacy_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME !'(' star_expressions")); |
21266 | 184k | expr_ty a; |
21267 | 184k | expr_ty b; |
21268 | 184k | if ( |
21269 | 184k | (a = _PyPegen_name_token(p)) // NAME |
21270 | 61.3k | && |
21271 | 61.3k | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 7) // token='(' |
21272 | 57.8k | && |
21273 | 57.8k | (b = star_expressions_rule(p)) // star_expressions |
21274 | 184k | ) |
21275 | 4.00k | { |
21276 | 4.00k | D(fprintf(stderr, "%*c+ invalid_legacy_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME !'(' star_expressions")); |
21277 | 4.00k | _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; |
21278 | 4.00k | if (_res == NULL && PyErr_Occurred()) { |
21279 | 12 | p->error_indicator = 1; |
21280 | 12 | p->level--; |
21281 | 12 | return NULL; |
21282 | 12 | } |
21283 | 3.99k | goto done; |
21284 | 4.00k | } |
21285 | 180k | p->mark = _mark; |
21286 | 180k | D(fprintf(stderr, "%*c%s invalid_legacy_expression[%d-%d]: %s failed!\n", p->level, ' ', |
21287 | 180k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME !'(' star_expressions")); |
21288 | 180k | } |
21289 | 180k | _res = NULL; |
21290 | 184k | done: |
21291 | 184k | p->level--; |
21292 | 184k | return _res; |
21293 | 180k | } |
21294 | | |
21295 | | // invalid_type_param: '*' NAME ':' expression | '**' NAME ':' expression |
21296 | | static void * |
21297 | | invalid_type_param_rule(Parser *p) |
21298 | 904 | { |
21299 | 904 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
21300 | 0 | _Pypegen_stack_overflow(p); |
21301 | 0 | } |
21302 | 904 | if (p->error_indicator) { |
21303 | 0 | p->level--; |
21304 | 0 | return NULL; |
21305 | 0 | } |
21306 | 904 | void * _res = NULL; |
21307 | 904 | int _mark = p->mark; |
21308 | 904 | { // '*' NAME ':' expression |
21309 | 904 | if (p->error_indicator) { |
21310 | 0 | p->level--; |
21311 | 0 | return NULL; |
21312 | 0 | } |
21313 | 904 | D(fprintf(stderr, "%*c> invalid_type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' NAME ':' expression")); |
21314 | 904 | Token * _literal; |
21315 | 904 | expr_ty a; |
21316 | 904 | Token * colon; |
21317 | 904 | expr_ty e; |
21318 | 904 | if ( |
21319 | 904 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
21320 | 411 | && |
21321 | 411 | (a = _PyPegen_name_token(p)) // NAME |
21322 | 409 | && |
21323 | 409 | (colon = _PyPegen_expect_token(p, 11)) // token=':' |
21324 | 3 | && |
21325 | 3 | (e = expression_rule(p)) // expression |
21326 | 904 | ) |
21327 | 1 | { |
21328 | 1 | D(fprintf(stderr, "%*c+ invalid_type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' NAME ':' expression")); |
21329 | 1 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( colon , e -> kind == Tuple_kind ? "cannot use constraints with TypeVarTuple" : "cannot use bound with TypeVarTuple" ); |
21330 | 1 | if (_res == NULL && PyErr_Occurred()) { |
21331 | 1 | p->error_indicator = 1; |
21332 | 1 | p->level--; |
21333 | 1 | return NULL; |
21334 | 1 | } |
21335 | 0 | goto done; |
21336 | 1 | } |
21337 | 903 | p->mark = _mark; |
21338 | 903 | D(fprintf(stderr, "%*c%s invalid_type_param[%d-%d]: %s failed!\n", p->level, ' ', |
21339 | 903 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' NAME ':' expression")); |
21340 | 903 | } |
21341 | 0 | { // '**' NAME ':' expression |
21342 | 903 | if (p->error_indicator) { |
21343 | 2 | p->level--; |
21344 | 2 | return NULL; |
21345 | 2 | } |
21346 | 901 | D(fprintf(stderr, "%*c> invalid_type_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' NAME ':' expression")); |
21347 | 901 | Token * _literal; |
21348 | 901 | expr_ty a; |
21349 | 901 | Token * colon; |
21350 | 901 | expr_ty e; |
21351 | 901 | if ( |
21352 | 901 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
21353 | 271 | && |
21354 | 271 | (a = _PyPegen_name_token(p)) // NAME |
21355 | 270 | && |
21356 | 270 | (colon = _PyPegen_expect_token(p, 11)) // token=':' |
21357 | 3 | && |
21358 | 3 | (e = expression_rule(p)) // expression |
21359 | 901 | ) |
21360 | 1 | { |
21361 | 1 | D(fprintf(stderr, "%*c+ invalid_type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' NAME ':' expression")); |
21362 | 1 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( colon , e -> kind == Tuple_kind ? "cannot use constraints with ParamSpec" : "cannot use bound with ParamSpec" ); |
21363 | 1 | if (_res == NULL && PyErr_Occurred()) { |
21364 | 1 | p->error_indicator = 1; |
21365 | 1 | p->level--; |
21366 | 1 | return NULL; |
21367 | 1 | } |
21368 | 0 | goto done; |
21369 | 1 | } |
21370 | 900 | p->mark = _mark; |
21371 | 900 | D(fprintf(stderr, "%*c%s invalid_type_param[%d-%d]: %s failed!\n", p->level, ' ', |
21372 | 900 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' NAME ':' expression")); |
21373 | 900 | } |
21374 | 900 | _res = NULL; |
21375 | 900 | done: |
21376 | 900 | p->level--; |
21377 | 900 | return _res; |
21378 | 900 | } |
21379 | | |
21380 | | // invalid_expression: |
21381 | | // | STRING ((!STRING expression_without_invalid))+ STRING |
21382 | | // | !(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid |
21383 | | // | disjunction 'if' disjunction !('else' | ':') |
21384 | | // | disjunction 'if' disjunction 'else' !expression |
21385 | | // | (pass_stmt | break_stmt | continue_stmt) 'if' disjunction 'else' simple_stmt |
21386 | | // | 'lambda' lambda_params? ':' &FSTRING_MIDDLE |
21387 | | // | 'lambda' lambda_params? ':' &TSTRING_MIDDLE |
21388 | | static void * |
21389 | | invalid_expression_rule(Parser *p) |
21390 | 211k | { |
21391 | 211k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
21392 | 1 | _Pypegen_stack_overflow(p); |
21393 | 1 | } |
21394 | 211k | if (p->error_indicator) { |
21395 | 1 | p->level--; |
21396 | 1 | return NULL; |
21397 | 1 | } |
21398 | 211k | void * _res = NULL; |
21399 | 211k | int _mark = p->mark; |
21400 | 211k | { // STRING ((!STRING expression_without_invalid))+ STRING |
21401 | 211k | if (p->error_indicator) { |
21402 | 0 | p->level--; |
21403 | 0 | return NULL; |
21404 | 0 | } |
21405 | 211k | D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING ((!STRING expression_without_invalid))+ STRING")); |
21406 | 211k | asdl_seq * a; |
21407 | 211k | expr_ty string_var; |
21408 | 211k | expr_ty string_var_1; |
21409 | 211k | if ( |
21410 | 211k | (string_var = _PyPegen_string_token(p)) // STRING |
21411 | 3.38k | && |
21412 | 3.38k | (a = _loop1_113_rule(p)) // ((!STRING expression_without_invalid))+ |
21413 | 1.01k | && |
21414 | 1.01k | (string_var_1 = _PyPegen_string_token(p)) // STRING |
21415 | 211k | ) |
21416 | 8 | { |
21417 | 8 | D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING ((!STRING expression_without_invalid))+ STRING")); |
21418 | 8 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( PyPegen_first_item ( a , expr_ty ) , PyPegen_last_item ( a , expr_ty ) , "invalid syntax. Is this intended to be part of the string?" ); |
21419 | 8 | if (_res == NULL && PyErr_Occurred()) { |
21420 | 8 | p->error_indicator = 1; |
21421 | 8 | p->level--; |
21422 | 8 | return NULL; |
21423 | 8 | } |
21424 | 0 | goto done; |
21425 | 8 | } |
21426 | 211k | p->mark = _mark; |
21427 | 211k | D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ', |
21428 | 211k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING ((!STRING expression_without_invalid))+ STRING")); |
21429 | 211k | } |
21430 | 0 | { // !(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid |
21431 | 211k | if (p->error_indicator) { |
21432 | 83 | p->level--; |
21433 | 83 | return NULL; |
21434 | 83 | } |
21435 | 211k | D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid")); |
21436 | 211k | expr_ty a; |
21437 | 211k | expr_ty b; |
21438 | 211k | if ( |
21439 | 211k | _PyPegen_lookahead(0, _tmp_114_rule, p) |
21440 | 206k | && |
21441 | 206k | (a = disjunction_rule(p)) // disjunction |
21442 | 87.5k | && |
21443 | 87.5k | (b = expression_without_invalid_rule(p)) // expression_without_invalid |
21444 | 211k | ) |
21445 | 4.99k | { |
21446 | 4.99k | D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid")); |
21447 | 4.99k | _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?" ); |
21448 | 4.99k | if (_res == NULL && PyErr_Occurred()) { |
21449 | 124 | p->error_indicator = 1; |
21450 | 124 | p->level--; |
21451 | 124 | return NULL; |
21452 | 124 | } |
21453 | 4.87k | goto done; |
21454 | 4.99k | } |
21455 | 206k | p->mark = _mark; |
21456 | 206k | D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ', |
21457 | 206k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid")); |
21458 | 206k | } |
21459 | 0 | { // disjunction 'if' disjunction !('else' | ':') |
21460 | 206k | if (p->error_indicator) { |
21461 | 23.9k | p->level--; |
21462 | 23.9k | return NULL; |
21463 | 23.9k | } |
21464 | 182k | D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')")); |
21465 | 182k | Token * _keyword; |
21466 | 182k | expr_ty a; |
21467 | 182k | expr_ty b; |
21468 | 182k | if ( |
21469 | 182k | (a = disjunction_rule(p)) // disjunction |
21470 | 86.9k | && |
21471 | 86.9k | (_keyword = _PyPegen_expect_token(p, 691)) // token='if' |
21472 | 1.10k | && |
21473 | 1.10k | (b = disjunction_rule(p)) // disjunction |
21474 | 671 | && |
21475 | 671 | _PyPegen_lookahead(0, _tmp_115_rule, p) |
21476 | 182k | ) |
21477 | 19 | { |
21478 | 19 | D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')")); |
21479 | 19 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expected 'else' after 'if' expression" ); |
21480 | 19 | if (_res == NULL && PyErr_Occurred()) { |
21481 | 19 | p->error_indicator = 1; |
21482 | 19 | p->level--; |
21483 | 19 | return NULL; |
21484 | 19 | } |
21485 | 0 | goto done; |
21486 | 19 | } |
21487 | 182k | p->mark = _mark; |
21488 | 182k | D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ', |
21489 | 182k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')")); |
21490 | 182k | } |
21491 | 0 | { // disjunction 'if' disjunction 'else' !expression |
21492 | 182k | if (p->error_indicator) { |
21493 | 527 | p->level--; |
21494 | 527 | return NULL; |
21495 | 527 | } |
21496 | 182k | D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' !expression")); |
21497 | 182k | Token * _keyword; |
21498 | 182k | Token * _keyword_1; |
21499 | 182k | expr_ty a; |
21500 | 182k | expr_ty b; |
21501 | 182k | if ( |
21502 | 182k | (a = disjunction_rule(p)) // disjunction |
21503 | 86.7k | && |
21504 | 86.7k | (_keyword = _PyPegen_expect_token(p, 691)) // token='if' |
21505 | 939 | && |
21506 | 939 | (b = disjunction_rule(p)) // disjunction |
21507 | 652 | && |
21508 | 652 | (_keyword_1 = _PyPegen_expect_token(p, 695)) // token='else' |
21509 | 645 | && |
21510 | 645 | _PyPegen_lookahead_for_expr(0, expression_rule, p) |
21511 | 182k | ) |
21512 | 251 | { |
21513 | 251 | D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' !expression")); |
21514 | 251 | _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "expected expression after 'else', but statement is given" ); |
21515 | 251 | if (_res == NULL && PyErr_Occurred()) { |
21516 | 251 | p->error_indicator = 1; |
21517 | 251 | p->level--; |
21518 | 251 | return NULL; |
21519 | 251 | } |
21520 | 0 | goto done; |
21521 | 251 | } |
21522 | 181k | p->mark = _mark; |
21523 | 181k | D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ', |
21524 | 181k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' !expression")); |
21525 | 181k | } |
21526 | 0 | { // (pass_stmt | break_stmt | continue_stmt) 'if' disjunction 'else' simple_stmt |
21527 | 181k | if (p->error_indicator) { |
21528 | 0 | p->level--; |
21529 | 0 | return NULL; |
21530 | 0 | } |
21531 | 181k | D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(pass_stmt | break_stmt | continue_stmt) 'if' disjunction 'else' simple_stmt")); |
21532 | 181k | Token * _keyword; |
21533 | 181k | Token * _keyword_1; |
21534 | 181k | stmt_ty a; |
21535 | 181k | expr_ty b; |
21536 | 181k | stmt_ty c; |
21537 | 181k | if ( |
21538 | 181k | (a = (stmt_ty)_tmp_116_rule(p)) // pass_stmt | break_stmt | continue_stmt |
21539 | 2.37k | && |
21540 | 2.37k | (_keyword = _PyPegen_expect_token(p, 691)) // token='if' |
21541 | 1.45k | && |
21542 | 1.45k | (b = disjunction_rule(p)) // disjunction |
21543 | 1.24k | && |
21544 | 1.24k | (_keyword_1 = _PyPegen_expect_token(p, 695)) // token='else' |
21545 | 1.21k | && |
21546 | 1.21k | (c = simple_stmt_rule(p)) // simple_stmt |
21547 | 181k | ) |
21548 | 10 | { |
21549 | 10 | D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(pass_stmt | break_stmt | continue_stmt) 'if' disjunction 'else' simple_stmt")); |
21550 | 10 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected expression before 'if', but statement is given" ); |
21551 | 10 | if (_res == NULL && PyErr_Occurred()) { |
21552 | 10 | p->error_indicator = 1; |
21553 | 10 | p->level--; |
21554 | 10 | return NULL; |
21555 | 10 | } |
21556 | 0 | goto done; |
21557 | 10 | } |
21558 | 181k | p->mark = _mark; |
21559 | 181k | D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ', |
21560 | 181k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(pass_stmt | break_stmt | continue_stmt) 'if' disjunction 'else' simple_stmt")); |
21561 | 181k | } |
21562 | 0 | { // 'lambda' lambda_params? ':' &FSTRING_MIDDLE |
21563 | 181k | if (p->error_indicator) { |
21564 | 1.26k | p->level--; |
21565 | 1.26k | return NULL; |
21566 | 1.26k | } |
21567 | 180k | D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' &FSTRING_MIDDLE")); |
21568 | 180k | void *_opt_var; |
21569 | 180k | UNUSED(_opt_var); // Silence compiler warnings |
21570 | 180k | Token * a; |
21571 | 180k | Token * b; |
21572 | 180k | if ( |
21573 | 180k | (a = _PyPegen_expect_token(p, 622)) // token='lambda' |
21574 | 2.93k | && |
21575 | 2.93k | (_opt_var = lambda_params_rule(p), !p->error_indicator) // lambda_params? |
21576 | 2.15k | && |
21577 | 2.15k | (b = _PyPegen_expect_token(p, 11)) // token=':' |
21578 | 1.33k | && |
21579 | 1.33k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, FSTRING_MIDDLE) // token=FSTRING_MIDDLE |
21580 | 180k | ) |
21581 | 1 | { |
21582 | 1 | D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' &FSTRING_MIDDLE")); |
21583 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "f-string: lambda expressions are not allowed without parentheses" ); |
21584 | 1 | if (_res == NULL && PyErr_Occurred()) { |
21585 | 1 | p->error_indicator = 1; |
21586 | 1 | p->level--; |
21587 | 1 | return NULL; |
21588 | 1 | } |
21589 | 0 | goto done; |
21590 | 1 | } |
21591 | 180k | p->mark = _mark; |
21592 | 180k | D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ', |
21593 | 180k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' &FSTRING_MIDDLE")); |
21594 | 180k | } |
21595 | 0 | { // 'lambda' lambda_params? ':' &TSTRING_MIDDLE |
21596 | 180k | if (p->error_indicator) { |
21597 | 787 | p->level--; |
21598 | 787 | return NULL; |
21599 | 787 | } |
21600 | 179k | D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' &TSTRING_MIDDLE")); |
21601 | 179k | void *_opt_var; |
21602 | 179k | UNUSED(_opt_var); // Silence compiler warnings |
21603 | 179k | Token * a; |
21604 | 179k | Token * b; |
21605 | 179k | if ( |
21606 | 179k | (a = _PyPegen_expect_token(p, 622)) // token='lambda' |
21607 | 2.14k | && |
21608 | 2.14k | (_opt_var = lambda_params_rule(p), !p->error_indicator) // lambda_params? |
21609 | 2.14k | && |
21610 | 2.14k | (b = _PyPegen_expect_token(p, 11)) // token=':' |
21611 | 1.32k | && |
21612 | 1.32k | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, TSTRING_MIDDLE) // token=TSTRING_MIDDLE |
21613 | 179k | ) |
21614 | 8 | { |
21615 | 8 | D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' &TSTRING_MIDDLE")); |
21616 | 8 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "t-string: lambda expressions are not allowed without parentheses" ); |
21617 | 8 | if (_res == NULL && PyErr_Occurred()) { |
21618 | 8 | p->error_indicator = 1; |
21619 | 8 | p->level--; |
21620 | 8 | return NULL; |
21621 | 8 | } |
21622 | 0 | goto done; |
21623 | 8 | } |
21624 | 179k | p->mark = _mark; |
21625 | 179k | D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ', |
21626 | 179k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' &TSTRING_MIDDLE")); |
21627 | 179k | } |
21628 | 179k | _res = NULL; |
21629 | 184k | done: |
21630 | 184k | p->level--; |
21631 | 184k | return _res; |
21632 | 179k | } |
21633 | | |
21634 | | // invalid_named_expression: |
21635 | | // | expression ':=' expression |
21636 | | // | NAME '=' bitwise_or !('=' | ':=') |
21637 | | // | !(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=') |
21638 | | static void * |
21639 | | invalid_named_expression_rule(Parser *p) |
21640 | 214k | { |
21641 | 214k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
21642 | 0 | _Pypegen_stack_overflow(p); |
21643 | 0 | } |
21644 | 214k | if (p->error_indicator) { |
21645 | 0 | p->level--; |
21646 | 0 | return NULL; |
21647 | 0 | } |
21648 | 214k | void * _res = NULL; |
21649 | 214k | if (_PyPegen_is_memoized(p, invalid_named_expression_type, &_res)) { |
21650 | 119k | p->level--; |
21651 | 119k | return _res; |
21652 | 119k | } |
21653 | 94.7k | int _mark = p->mark; |
21654 | 94.7k | { // expression ':=' expression |
21655 | 94.7k | if (p->error_indicator) { |
21656 | 0 | p->level--; |
21657 | 0 | return NULL; |
21658 | 0 | } |
21659 | 94.7k | D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression")); |
21660 | 94.7k | Token * _literal; |
21661 | 94.7k | expr_ty a; |
21662 | 94.7k | expr_ty expression_var; |
21663 | 94.7k | if ( |
21664 | 94.7k | (a = expression_rule(p)) // expression |
21665 | 54.9k | && |
21666 | 54.9k | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
21667 | 247 | && |
21668 | 247 | (expression_var = expression_rule(p)) // expression |
21669 | 94.7k | ) |
21670 | 3 | { |
21671 | 3 | D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression")); |
21672 | 3 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) ); |
21673 | 3 | if (_res == NULL && PyErr_Occurred()) { |
21674 | 3 | p->error_indicator = 1; |
21675 | 3 | p->level--; |
21676 | 3 | return NULL; |
21677 | 3 | } |
21678 | 0 | goto done; |
21679 | 3 | } |
21680 | 94.7k | p->mark = _mark; |
21681 | 94.7k | D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
21682 | 94.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression")); |
21683 | 94.7k | } |
21684 | 0 | { // NAME '=' bitwise_or !('=' | ':=') |
21685 | 94.7k | if (p->error_indicator) { |
21686 | 13.4k | p->level--; |
21687 | 13.4k | return NULL; |
21688 | 13.4k | } |
21689 | 81.3k | D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')")); |
21690 | 81.3k | Token * _literal; |
21691 | 81.3k | expr_ty a; |
21692 | 81.3k | expr_ty b; |
21693 | 81.3k | if ( |
21694 | 81.3k | (a = _PyPegen_name_token(p)) // NAME |
21695 | 33.5k | && |
21696 | 33.5k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
21697 | 542 | && |
21698 | 542 | (b = bitwise_or_rule(p)) // bitwise_or |
21699 | 36 | && |
21700 | 36 | _PyPegen_lookahead(0, _tmp_117_rule, p) |
21701 | 81.3k | ) |
21702 | 7 | { |
21703 | 7 | D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')")); |
21704 | 7 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" ); |
21705 | 7 | if (_res == NULL && PyErr_Occurred()) { |
21706 | 7 | p->error_indicator = 1; |
21707 | 7 | p->level--; |
21708 | 7 | return NULL; |
21709 | 7 | } |
21710 | 0 | goto done; |
21711 | 7 | } |
21712 | 81.3k | p->mark = _mark; |
21713 | 81.3k | D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
21714 | 81.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')")); |
21715 | 81.3k | } |
21716 | 0 | { // !(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=') |
21717 | 81.3k | if (p->error_indicator) { |
21718 | 277 | p->level--; |
21719 | 277 | return NULL; |
21720 | 277 | } |
21721 | 81.0k | 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 !('=' | ':=')")); |
21722 | 81.0k | expr_ty a; |
21723 | 81.0k | Token * b; |
21724 | 81.0k | expr_ty bitwise_or_var; |
21725 | 81.0k | if ( |
21726 | 81.0k | _PyPegen_lookahead(0, _tmp_118_rule, p) |
21727 | 75.2k | && |
21728 | 75.2k | (a = bitwise_or_rule(p)) // bitwise_or |
21729 | 48.5k | && |
21730 | 48.5k | (b = _PyPegen_expect_token(p, 22)) // token='=' |
21731 | 397 | && |
21732 | 397 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
21733 | 49 | && |
21734 | 49 | _PyPegen_lookahead(0, _tmp_117_rule, p) |
21735 | 81.0k | ) |
21736 | 14 | { |
21737 | 14 | 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 !('=' | ':=')")); |
21738 | 14 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot assign to %s here. Maybe you meant '==' instead of '='?" , _PyPegen_get_expr_name ( a ) ); |
21739 | 14 | if (_res == NULL && PyErr_Occurred()) { |
21740 | 14 | p->error_indicator = 1; |
21741 | 14 | p->level--; |
21742 | 14 | return NULL; |
21743 | 14 | } |
21744 | 0 | goto done; |
21745 | 14 | } |
21746 | 81.0k | p->mark = _mark; |
21747 | 81.0k | D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
21748 | 81.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')")); |
21749 | 81.0k | } |
21750 | 81.0k | _res = NULL; |
21751 | 81.0k | done: |
21752 | 81.0k | _PyPegen_insert_memo(p, _mark, invalid_named_expression_type, _res); |
21753 | 81.0k | p->level--; |
21754 | 81.0k | return _res; |
21755 | 81.0k | } |
21756 | | |
21757 | | // invalid_assignment: |
21758 | | // | invalid_ann_assign_target ':' expression |
21759 | | // | star_named_expression ',' star_named_expressions* ':' expression |
21760 | | // | expression ':' expression |
21761 | | // | ((star_targets '='))* star_expressions '=' |
21762 | | // | ((star_targets '='))* yield_expr '=' |
21763 | | // | star_expressions augassign annotated_rhs |
21764 | | static void * |
21765 | | invalid_assignment_rule(Parser *p) |
21766 | 38.4k | { |
21767 | 38.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
21768 | 0 | _Pypegen_stack_overflow(p); |
21769 | 0 | } |
21770 | 38.4k | if (p->error_indicator) { |
21771 | 0 | p->level--; |
21772 | 0 | return NULL; |
21773 | 0 | } |
21774 | 38.4k | void * _res = NULL; |
21775 | 38.4k | int _mark = p->mark; |
21776 | 38.4k | { // invalid_ann_assign_target ':' expression |
21777 | 38.4k | if (p->error_indicator) { |
21778 | 0 | p->level--; |
21779 | 0 | return NULL; |
21780 | 0 | } |
21781 | 38.4k | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression")); |
21782 | 38.4k | Token * _literal; |
21783 | 38.4k | expr_ty a; |
21784 | 38.4k | expr_ty expression_var; |
21785 | 38.4k | if ( |
21786 | 38.4k | (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target |
21787 | 747 | && |
21788 | 747 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
21789 | 73 | && |
21790 | 73 | (expression_var = expression_rule(p)) // expression |
21791 | 38.4k | ) |
21792 | 3 | { |
21793 | 3 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression")); |
21794 | 3 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not %s) can be annotated" , _PyPegen_get_expr_name ( a ) ); |
21795 | 3 | if (_res == NULL && PyErr_Occurred()) { |
21796 | 3 | p->error_indicator = 1; |
21797 | 3 | p->level--; |
21798 | 3 | return NULL; |
21799 | 3 | } |
21800 | 0 | goto done; |
21801 | 3 | } |
21802 | 38.4k | p->mark = _mark; |
21803 | 38.4k | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
21804 | 38.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression")); |
21805 | 38.4k | } |
21806 | 0 | { // star_named_expression ',' star_named_expressions* ':' expression |
21807 | 38.4k | if (p->error_indicator) { |
21808 | 67 | p->level--; |
21809 | 67 | return NULL; |
21810 | 67 | } |
21811 | 38.3k | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression")); |
21812 | 38.3k | Token * _literal; |
21813 | 38.3k | Token * _literal_1; |
21814 | 38.3k | asdl_seq * _loop0_119_var; |
21815 | 38.3k | expr_ty a; |
21816 | 38.3k | expr_ty expression_var; |
21817 | 38.3k | if ( |
21818 | 38.3k | (a = star_named_expression_rule(p)) // star_named_expression |
21819 | 26.3k | && |
21820 | 26.3k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
21821 | 1.49k | && |
21822 | 1.49k | (_loop0_119_var = _loop0_119_rule(p)) // star_named_expressions* |
21823 | 1.49k | && |
21824 | 1.49k | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
21825 | 54 | && |
21826 | 54 | (expression_var = expression_rule(p)) // expression |
21827 | 38.3k | ) |
21828 | 9 | { |
21829 | 9 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression")); |
21830 | 9 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" ); |
21831 | 9 | if (_res == NULL && PyErr_Occurred()) { |
21832 | 9 | p->error_indicator = 1; |
21833 | 9 | p->level--; |
21834 | 9 | return NULL; |
21835 | 9 | } |
21836 | 0 | goto done; |
21837 | 9 | } |
21838 | 38.3k | p->mark = _mark; |
21839 | 38.3k | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
21840 | 38.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression")); |
21841 | 38.3k | } |
21842 | 0 | { // expression ':' expression |
21843 | 38.3k | if (p->error_indicator) { |
21844 | 731 | p->level--; |
21845 | 731 | return NULL; |
21846 | 731 | } |
21847 | 37.6k | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); |
21848 | 37.6k | Token * _literal; |
21849 | 37.6k | expr_ty a; |
21850 | 37.6k | expr_ty expression_var; |
21851 | 37.6k | if ( |
21852 | 37.6k | (a = expression_rule(p)) // expression |
21853 | 26.1k | && |
21854 | 26.1k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
21855 | 573 | && |
21856 | 573 | (expression_var = expression_rule(p)) // expression |
21857 | 37.6k | ) |
21858 | 48 | { |
21859 | 48 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression")); |
21860 | 48 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" ); |
21861 | 48 | if (_res == NULL && PyErr_Occurred()) { |
21862 | 48 | p->error_indicator = 1; |
21863 | 48 | p->level--; |
21864 | 48 | return NULL; |
21865 | 48 | } |
21866 | 0 | goto done; |
21867 | 48 | } |
21868 | 37.6k | p->mark = _mark; |
21869 | 37.6k | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
21870 | 37.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression")); |
21871 | 37.6k | } |
21872 | 0 | { // ((star_targets '='))* star_expressions '=' |
21873 | 37.6k | if (p->error_indicator) { |
21874 | 117 | p->level--; |
21875 | 117 | return NULL; |
21876 | 117 | } |
21877 | 37.4k | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='")); |
21878 | 37.4k | Token * _literal; |
21879 | 37.4k | asdl_seq * _loop0_120_var; |
21880 | 37.4k | expr_ty a; |
21881 | 37.4k | if ( |
21882 | 37.4k | (_loop0_120_var = _loop0_120_rule(p)) // ((star_targets '='))* |
21883 | 37.4k | && |
21884 | 37.4k | (a = star_expressions_rule(p)) // star_expressions |
21885 | 26.0k | && |
21886 | 26.0k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
21887 | 37.4k | ) |
21888 | 113 | { |
21889 | 113 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='")); |
21890 | 113 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a ); |
21891 | 113 | if (_res == NULL && PyErr_Occurred()) { |
21892 | 113 | p->error_indicator = 1; |
21893 | 113 | p->level--; |
21894 | 113 | return NULL; |
21895 | 113 | } |
21896 | 0 | goto done; |
21897 | 113 | } |
21898 | 37.3k | p->mark = _mark; |
21899 | 37.3k | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
21900 | 37.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='")); |
21901 | 37.3k | } |
21902 | 0 | { // ((star_targets '='))* yield_expr '=' |
21903 | 37.3k | if (p->error_indicator) { |
21904 | 0 | p->level--; |
21905 | 0 | return NULL; |
21906 | 0 | } |
21907 | 37.3k | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); |
21908 | 37.3k | Token * _literal; |
21909 | 37.3k | asdl_seq * _loop0_120_var; |
21910 | 37.3k | expr_ty a; |
21911 | 37.3k | if ( |
21912 | 37.3k | (_loop0_120_var = _loop0_120_rule(p)) // ((star_targets '='))* |
21913 | 37.3k | && |
21914 | 37.3k | (a = yield_expr_rule(p)) // yield_expr |
21915 | 403 | && |
21916 | 403 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
21917 | 37.3k | ) |
21918 | 4 | { |
21919 | 4 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); |
21920 | 4 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" ); |
21921 | 4 | if (_res == NULL && PyErr_Occurred()) { |
21922 | 4 | p->error_indicator = 1; |
21923 | 4 | p->level--; |
21924 | 4 | return NULL; |
21925 | 4 | } |
21926 | 0 | goto done; |
21927 | 4 | } |
21928 | 37.3k | p->mark = _mark; |
21929 | 37.3k | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
21930 | 37.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='")); |
21931 | 37.3k | } |
21932 | 0 | { // star_expressions augassign annotated_rhs |
21933 | 37.3k | if (p->error_indicator) { |
21934 | 66 | p->level--; |
21935 | 66 | return NULL; |
21936 | 66 | } |
21937 | 37.3k | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign annotated_rhs")); |
21938 | 37.3k | expr_ty a; |
21939 | 37.3k | expr_ty annotated_rhs_var; |
21940 | 37.3k | AugOperator* augassign_var; |
21941 | 37.3k | if ( |
21942 | 37.3k | (a = star_expressions_rule(p)) // star_expressions |
21943 | 25.9k | && |
21944 | 25.9k | (augassign_var = augassign_rule(p)) // augassign |
21945 | 156 | && |
21946 | 156 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
21947 | 37.3k | ) |
21948 | 16 | { |
21949 | 16 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign annotated_rhs")); |
21950 | 16 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) ); |
21951 | 16 | if (_res == NULL && PyErr_Occurred()) { |
21952 | 16 | p->error_indicator = 1; |
21953 | 16 | p->level--; |
21954 | 16 | return NULL; |
21955 | 16 | } |
21956 | 0 | goto done; |
21957 | 16 | } |
21958 | 37.2k | p->mark = _mark; |
21959 | 37.2k | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
21960 | 37.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign annotated_rhs")); |
21961 | 37.2k | } |
21962 | 37.2k | _res = NULL; |
21963 | 37.2k | done: |
21964 | 37.2k | p->level--; |
21965 | 37.2k | return _res; |
21966 | 37.2k | } |
21967 | | |
21968 | | // invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')' |
21969 | | static expr_ty |
21970 | | invalid_ann_assign_target_rule(Parser *p) |
21971 | 40.1k | { |
21972 | 40.1k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
21973 | 0 | _Pypegen_stack_overflow(p); |
21974 | 0 | } |
21975 | 40.1k | if (p->error_indicator) { |
21976 | 0 | p->level--; |
21977 | 0 | return NULL; |
21978 | 0 | } |
21979 | 40.1k | expr_ty _res = NULL; |
21980 | 40.1k | int _mark = p->mark; |
21981 | 40.1k | { // list |
21982 | 40.1k | if (p->error_indicator) { |
21983 | 0 | p->level--; |
21984 | 0 | return NULL; |
21985 | 0 | } |
21986 | 40.1k | D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); |
21987 | 40.1k | expr_ty list_var; |
21988 | 40.1k | if ( |
21989 | 40.1k | (list_var = list_rule(p)) // list |
21990 | 40.1k | ) |
21991 | 229 | { |
21992 | 229 | D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); |
21993 | 229 | _res = list_var; |
21994 | 229 | goto done; |
21995 | 229 | } |
21996 | 39.8k | p->mark = _mark; |
21997 | 39.8k | D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ', |
21998 | 39.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); |
21999 | 39.8k | } |
22000 | 0 | { // tuple |
22001 | 39.8k | if (p->error_indicator) { |
22002 | 0 | p->level--; |
22003 | 0 | return NULL; |
22004 | 0 | } |
22005 | 39.8k | D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); |
22006 | 39.8k | expr_ty tuple_var; |
22007 | 39.8k | if ( |
22008 | 39.8k | (tuple_var = tuple_rule(p)) // tuple |
22009 | 39.8k | ) |
22010 | 563 | { |
22011 | 563 | D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); |
22012 | 563 | _res = tuple_var; |
22013 | 563 | goto done; |
22014 | 563 | } |
22015 | 39.3k | p->mark = _mark; |
22016 | 39.3k | D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ', |
22017 | 39.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); |
22018 | 39.3k | } |
22019 | 0 | { // '(' invalid_ann_assign_target ')' |
22020 | 39.3k | if (p->error_indicator) { |
22021 | 0 | p->level--; |
22022 | 0 | return NULL; |
22023 | 0 | } |
22024 | 39.3k | D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'")); |
22025 | 39.3k | Token * _literal; |
22026 | 39.3k | Token * _literal_1; |
22027 | 39.3k | expr_ty a; |
22028 | 39.3k | if ( |
22029 | 39.3k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
22030 | 1.64k | && |
22031 | 1.64k | (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target |
22032 | 431 | && |
22033 | 431 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
22034 | 39.3k | ) |
22035 | 386 | { |
22036 | 386 | D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'")); |
22037 | 386 | _res = a; |
22038 | 386 | if (_res == NULL && PyErr_Occurred()) { |
22039 | 0 | p->error_indicator = 1; |
22040 | 0 | p->level--; |
22041 | 0 | return NULL; |
22042 | 0 | } |
22043 | 386 | goto done; |
22044 | 386 | } |
22045 | 38.9k | p->mark = _mark; |
22046 | 38.9k | D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ', |
22047 | 38.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'")); |
22048 | 38.9k | } |
22049 | 38.9k | _res = NULL; |
22050 | 40.1k | done: |
22051 | 40.1k | p->level--; |
22052 | 40.1k | return _res; |
22053 | 38.9k | } |
22054 | | |
22055 | | // invalid_raise_stmt: 'raise' 'from' | 'raise' expression 'from' |
22056 | | static void * |
22057 | | invalid_raise_stmt_rule(Parser *p) |
22058 | 537 | { |
22059 | 537 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
22060 | 0 | _Pypegen_stack_overflow(p); |
22061 | 0 | } |
22062 | 537 | if (p->error_indicator) { |
22063 | 0 | p->level--; |
22064 | 0 | return NULL; |
22065 | 0 | } |
22066 | 537 | void * _res = NULL; |
22067 | 537 | int _mark = p->mark; |
22068 | 537 | { // 'raise' 'from' |
22069 | 537 | if (p->error_indicator) { |
22070 | 0 | p->level--; |
22071 | 0 | return NULL; |
22072 | 0 | } |
22073 | 537 | D(fprintf(stderr, "%*c> invalid_raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' 'from'")); |
22074 | 537 | Token * a; |
22075 | 537 | Token * b; |
22076 | 537 | if ( |
22077 | 537 | (a = _PyPegen_expect_token(p, 628)) // token='raise' |
22078 | 537 | && |
22079 | 537 | (b = _PyPegen_expect_token(p, 642)) // token='from' |
22080 | 537 | ) |
22081 | 1 | { |
22082 | 1 | D(fprintf(stderr, "%*c+ invalid_raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' 'from'")); |
22083 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "did you forget an expression between 'raise' and 'from'?" ); |
22084 | 1 | if (_res == NULL && PyErr_Occurred()) { |
22085 | 1 | p->error_indicator = 1; |
22086 | 1 | p->level--; |
22087 | 1 | return NULL; |
22088 | 1 | } |
22089 | 0 | goto done; |
22090 | 1 | } |
22091 | 536 | p->mark = _mark; |
22092 | 536 | D(fprintf(stderr, "%*c%s invalid_raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
22093 | 536 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' 'from'")); |
22094 | 536 | } |
22095 | 0 | { // 'raise' expression 'from' |
22096 | 536 | if (p->error_indicator) { |
22097 | 0 | p->level--; |
22098 | 0 | return NULL; |
22099 | 0 | } |
22100 | 536 | D(fprintf(stderr, "%*c> invalid_raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression 'from'")); |
22101 | 536 | Token * _keyword; |
22102 | 536 | Token * a; |
22103 | 536 | expr_ty expression_var; |
22104 | 536 | if ( |
22105 | 536 | (_keyword = _PyPegen_expect_token(p, 628)) // token='raise' |
22106 | 536 | && |
22107 | 536 | (expression_var = expression_rule(p)) // expression |
22108 | 277 | && |
22109 | 277 | (a = _PyPegen_expect_token(p, 642)) // token='from' |
22110 | 536 | ) |
22111 | 2 | { |
22112 | 2 | D(fprintf(stderr, "%*c+ invalid_raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression 'from'")); |
22113 | 2 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "did you forget an expression after 'from'?" ); |
22114 | 2 | if (_res == NULL && PyErr_Occurred()) { |
22115 | 2 | p->error_indicator = 1; |
22116 | 2 | p->level--; |
22117 | 2 | return NULL; |
22118 | 2 | } |
22119 | 0 | goto done; |
22120 | 2 | } |
22121 | 534 | p->mark = _mark; |
22122 | 534 | D(fprintf(stderr, "%*c%s invalid_raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
22123 | 534 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression 'from'")); |
22124 | 534 | } |
22125 | 534 | _res = NULL; |
22126 | 534 | done: |
22127 | 534 | p->level--; |
22128 | 534 | return _res; |
22129 | 534 | } |
22130 | | |
22131 | | // invalid_del_stmt: 'del' star_expressions |
22132 | | static void * |
22133 | | invalid_del_stmt_rule(Parser *p) |
22134 | 311 | { |
22135 | 311 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
22136 | 0 | _Pypegen_stack_overflow(p); |
22137 | 0 | } |
22138 | 311 | if (p->error_indicator) { |
22139 | 0 | p->level--; |
22140 | 0 | return NULL; |
22141 | 0 | } |
22142 | 311 | void * _res = NULL; |
22143 | 311 | int _mark = p->mark; |
22144 | 311 | { // 'del' star_expressions |
22145 | 311 | if (p->error_indicator) { |
22146 | 0 | p->level--; |
22147 | 0 | return NULL; |
22148 | 0 | } |
22149 | 311 | D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions")); |
22150 | 311 | Token * _keyword; |
22151 | 311 | expr_ty a; |
22152 | 311 | if ( |
22153 | 311 | (_keyword = _PyPegen_expect_token(p, 630)) // token='del' |
22154 | 311 | && |
22155 | 311 | (a = star_expressions_rule(p)) // star_expressions |
22156 | 311 | ) |
22157 | 170 | { |
22158 | 170 | D(fprintf(stderr, "%*c+ invalid_del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' star_expressions")); |
22159 | 170 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a ); |
22160 | 170 | if (_res == NULL && PyErr_Occurred()) { |
22161 | 13 | p->error_indicator = 1; |
22162 | 13 | p->level--; |
22163 | 13 | return NULL; |
22164 | 13 | } |
22165 | 157 | goto done; |
22166 | 170 | } |
22167 | 141 | p->mark = _mark; |
22168 | 141 | D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
22169 | 141 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions")); |
22170 | 141 | } |
22171 | 141 | _res = NULL; |
22172 | 298 | done: |
22173 | 298 | p->level--; |
22174 | 298 | return _res; |
22175 | 141 | } |
22176 | | |
22177 | | // invalid_assert_stmt: |
22178 | | // | 'assert' expression '=' expression |
22179 | | // | 'assert' expression ',' expression '=' expression |
22180 | | // | 'assert' expression ':=' expression |
22181 | | // | 'assert' expression ',' expression ':=' expression |
22182 | | static void * |
22183 | | invalid_assert_stmt_rule(Parser *p) |
22184 | 353 | { |
22185 | 353 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
22186 | 0 | _Pypegen_stack_overflow(p); |
22187 | 0 | } |
22188 | 353 | if (p->error_indicator) { |
22189 | 0 | p->level--; |
22190 | 0 | return NULL; |
22191 | 0 | } |
22192 | 353 | void * _res = NULL; |
22193 | 353 | int _mark = p->mark; |
22194 | 353 | { // 'assert' expression '=' expression |
22195 | 353 | if (p->error_indicator) { |
22196 | 0 | p->level--; |
22197 | 0 | return NULL; |
22198 | 0 | } |
22199 | 353 | D(fprintf(stderr, "%*c> invalid_assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression '=' expression")); |
22200 | 353 | Token * _keyword; |
22201 | 353 | Token * _literal; |
22202 | 353 | expr_ty a; |
22203 | 353 | expr_ty b; |
22204 | 353 | if ( |
22205 | 353 | (_keyword = _PyPegen_expect_token(p, 634)) // token='assert' |
22206 | 353 | && |
22207 | 353 | (a = expression_rule(p)) // expression |
22208 | 277 | && |
22209 | 277 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
22210 | 2 | && |
22211 | 2 | (b = expression_rule(p)) // expression |
22212 | 353 | ) |
22213 | 1 | { |
22214 | 1 | D(fprintf(stderr, "%*c+ invalid_assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression '=' expression")); |
22215 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to %s here. Maybe you meant '==' instead of '='?" , _PyPegen_get_expr_name ( a ) ); |
22216 | 1 | if (_res == NULL && PyErr_Occurred()) { |
22217 | 1 | p->error_indicator = 1; |
22218 | 1 | p->level--; |
22219 | 1 | return NULL; |
22220 | 1 | } |
22221 | 0 | goto done; |
22222 | 1 | } |
22223 | 352 | p->mark = _mark; |
22224 | 352 | D(fprintf(stderr, "%*c%s invalid_assert_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
22225 | 352 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression '=' expression")); |
22226 | 352 | } |
22227 | 0 | { // 'assert' expression ',' expression '=' expression |
22228 | 352 | if (p->error_indicator) { |
22229 | 66 | p->level--; |
22230 | 66 | return NULL; |
22231 | 66 | } |
22232 | 286 | D(fprintf(stderr, "%*c> invalid_assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression ',' expression '=' expression")); |
22233 | 286 | Token * _keyword; |
22234 | 286 | Token * _literal; |
22235 | 286 | Token * _literal_1; |
22236 | 286 | expr_ty a; |
22237 | 286 | expr_ty b; |
22238 | 286 | expr_ty expression_var; |
22239 | 286 | if ( |
22240 | 286 | (_keyword = _PyPegen_expect_token(p, 634)) // token='assert' |
22241 | 286 | && |
22242 | 286 | (expression_var = expression_rule(p)) // expression |
22243 | 276 | && |
22244 | 276 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
22245 | 80 | && |
22246 | 80 | (a = expression_rule(p)) // expression |
22247 | 78 | && |
22248 | 78 | (_literal_1 = _PyPegen_expect_token(p, 22)) // token='=' |
22249 | 2 | && |
22250 | 2 | (b = expression_rule(p)) // expression |
22251 | 286 | ) |
22252 | 1 | { |
22253 | 1 | D(fprintf(stderr, "%*c+ invalid_assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression ',' expression '=' expression")); |
22254 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to %s here. Maybe you meant '==' instead of '='?" , _PyPegen_get_expr_name ( a ) ); |
22255 | 1 | if (_res == NULL && PyErr_Occurred()) { |
22256 | 1 | p->error_indicator = 1; |
22257 | 1 | p->level--; |
22258 | 1 | return NULL; |
22259 | 1 | } |
22260 | 0 | goto done; |
22261 | 1 | } |
22262 | 285 | p->mark = _mark; |
22263 | 285 | D(fprintf(stderr, "%*c%s invalid_assert_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
22264 | 285 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression ',' expression '=' expression")); |
22265 | 285 | } |
22266 | 0 | { // 'assert' expression ':=' expression |
22267 | 285 | if (p->error_indicator) { |
22268 | 1 | p->level--; |
22269 | 1 | return NULL; |
22270 | 1 | } |
22271 | 284 | D(fprintf(stderr, "%*c> invalid_assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression ':=' expression")); |
22272 | 284 | Token * _keyword; |
22273 | 284 | Token * _literal; |
22274 | 284 | expr_ty a; |
22275 | 284 | expr_ty b; |
22276 | 284 | if ( |
22277 | 284 | (_keyword = _PyPegen_expect_token(p, 634)) // token='assert' |
22278 | 284 | && |
22279 | 284 | (a = expression_rule(p)) // expression |
22280 | 274 | && |
22281 | 274 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
22282 | 3 | && |
22283 | 3 | (b = expression_rule(p)) // expression |
22284 | 284 | ) |
22285 | 1 | { |
22286 | 1 | D(fprintf(stderr, "%*c+ invalid_assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression ':=' expression")); |
22287 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot use named expression without parentheses here" ); |
22288 | 1 | if (_res == NULL && PyErr_Occurred()) { |
22289 | 1 | p->error_indicator = 1; |
22290 | 1 | p->level--; |
22291 | 1 | return NULL; |
22292 | 1 | } |
22293 | 0 | goto done; |
22294 | 1 | } |
22295 | 283 | p->mark = _mark; |
22296 | 283 | D(fprintf(stderr, "%*c%s invalid_assert_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
22297 | 283 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression ':=' expression")); |
22298 | 283 | } |
22299 | 0 | { // 'assert' expression ',' expression ':=' expression |
22300 | 283 | if (p->error_indicator) { |
22301 | 1 | p->level--; |
22302 | 1 | return NULL; |
22303 | 1 | } |
22304 | 282 | D(fprintf(stderr, "%*c> invalid_assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression ',' expression ':=' expression")); |
22305 | 282 | Token * _keyword; |
22306 | 282 | Token * _literal; |
22307 | 282 | Token * _literal_1; |
22308 | 282 | expr_ty a; |
22309 | 282 | expr_ty b; |
22310 | 282 | expr_ty expression_var; |
22311 | 282 | if ( |
22312 | 282 | (_keyword = _PyPegen_expect_token(p, 634)) // token='assert' |
22313 | 282 | && |
22314 | 282 | (expression_var = expression_rule(p)) // expression |
22315 | 272 | && |
22316 | 272 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
22317 | 78 | && |
22318 | 78 | (a = expression_rule(p)) // expression |
22319 | 77 | && |
22320 | 77 | (_literal_1 = _PyPegen_expect_token(p, 53)) // token=':=' |
22321 | 2 | && |
22322 | 2 | (b = expression_rule(p)) // expression |
22323 | 282 | ) |
22324 | 1 | { |
22325 | 1 | D(fprintf(stderr, "%*c+ invalid_assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression ',' expression ':=' expression")); |
22326 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot use named expression without parentheses here" ); |
22327 | 1 | if (_res == NULL && PyErr_Occurred()) { |
22328 | 1 | p->error_indicator = 1; |
22329 | 1 | p->level--; |
22330 | 1 | return NULL; |
22331 | 1 | } |
22332 | 0 | goto done; |
22333 | 1 | } |
22334 | 281 | p->mark = _mark; |
22335 | 281 | D(fprintf(stderr, "%*c%s invalid_assert_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
22336 | 281 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression ',' expression ':=' expression")); |
22337 | 281 | } |
22338 | 281 | _res = NULL; |
22339 | 281 | done: |
22340 | 281 | p->level--; |
22341 | 281 | return _res; |
22342 | 281 | } |
22343 | | |
22344 | | // invalid_block: NEWLINE !INDENT |
22345 | | static void * |
22346 | | invalid_block_rule(Parser *p) |
22347 | 2.24k | { |
22348 | 2.24k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
22349 | 0 | _Pypegen_stack_overflow(p); |
22350 | 0 | } |
22351 | 2.24k | if (p->error_indicator) { |
22352 | 0 | p->level--; |
22353 | 0 | return NULL; |
22354 | 0 | } |
22355 | 2.24k | void * _res = NULL; |
22356 | 2.24k | int _mark = p->mark; |
22357 | 2.24k | { // NEWLINE !INDENT |
22358 | 2.24k | if (p->error_indicator) { |
22359 | 0 | p->level--; |
22360 | 0 | return NULL; |
22361 | 0 | } |
22362 | 2.24k | D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT")); |
22363 | 2.24k | Token * newline_var; |
22364 | 2.24k | if ( |
22365 | 2.24k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
22366 | 182 | && |
22367 | 182 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
22368 | 2.24k | ) |
22369 | 4 | { |
22370 | 4 | D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT")); |
22371 | 4 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block" ); |
22372 | 4 | if (_res == NULL && PyErr_Occurred()) { |
22373 | 4 | p->error_indicator = 1; |
22374 | 4 | p->level--; |
22375 | 4 | return NULL; |
22376 | 4 | } |
22377 | 0 | goto done; |
22378 | 4 | } |
22379 | 2.24k | p->mark = _mark; |
22380 | 2.24k | D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ', |
22381 | 2.24k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT")); |
22382 | 2.24k | } |
22383 | 2.24k | _res = NULL; |
22384 | 2.24k | done: |
22385 | 2.24k | p->level--; |
22386 | 2.24k | return _res; |
22387 | 2.24k | } |
22388 | | |
22389 | | // invalid_comprehension: |
22390 | | // | ('[' | '(' | '{') starred_expression for_if_clauses |
22391 | | // | ('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses |
22392 | | // | ('[' | '{') star_named_expression ',' for_if_clauses |
22393 | | static void * |
22394 | | invalid_comprehension_rule(Parser *p) |
22395 | 209k | { |
22396 | 209k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
22397 | 1 | _Pypegen_stack_overflow(p); |
22398 | 1 | } |
22399 | 209k | if (p->error_indicator) { |
22400 | 1 | p->level--; |
22401 | 1 | return NULL; |
22402 | 1 | } |
22403 | 209k | void * _res = NULL; |
22404 | 209k | int _mark = p->mark; |
22405 | 209k | { // ('[' | '(' | '{') starred_expression for_if_clauses |
22406 | 209k | if (p->error_indicator) { |
22407 | 0 | p->level--; |
22408 | 0 | return NULL; |
22409 | 0 | } |
22410 | 209k | D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
22411 | 209k | void *_tmp_121_var; |
22412 | 209k | expr_ty a; |
22413 | 209k | asdl_comprehension_seq* for_if_clauses_var; |
22414 | 209k | if ( |
22415 | 209k | (_tmp_121_var = _tmp_121_rule(p)) // '[' | '(' | '{' |
22416 | 33.0k | && |
22417 | 33.0k | (a = starred_expression_rule(p)) // starred_expression |
22418 | 1.16k | && |
22419 | 1.16k | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
22420 | 209k | ) |
22421 | 1 | { |
22422 | 1 | D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
22423 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" ); |
22424 | 1 | if (_res == NULL && PyErr_Occurred()) { |
22425 | 1 | p->error_indicator = 1; |
22426 | 1 | p->level--; |
22427 | 1 | return NULL; |
22428 | 1 | } |
22429 | 0 | goto done; |
22430 | 1 | } |
22431 | 209k | p->mark = _mark; |
22432 | 209k | D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
22433 | 209k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
22434 | 209k | } |
22435 | 0 | { // ('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses |
22436 | 209k | if (p->error_indicator) { |
22437 | 659 | p->level--; |
22438 | 659 | return NULL; |
22439 | 659 | } |
22440 | 208k | D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses")); |
22441 | 208k | Token * _literal; |
22442 | 208k | void *_tmp_122_var; |
22443 | 208k | expr_ty a; |
22444 | 208k | asdl_expr_seq* b; |
22445 | 208k | asdl_comprehension_seq* for_if_clauses_var; |
22446 | 208k | if ( |
22447 | 208k | (_tmp_122_var = _tmp_122_rule(p)) // '[' | '{' |
22448 | 13.8k | && |
22449 | 13.8k | (a = star_named_expression_rule(p)) // star_named_expression |
22450 | 6.86k | && |
22451 | 6.86k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
22452 | 1.69k | && |
22453 | 1.69k | (b = star_named_expressions_rule(p)) // star_named_expressions |
22454 | 1.18k | && |
22455 | 1.18k | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
22456 | 208k | ) |
22457 | 1 | { |
22458 | 1 | 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")); |
22459 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , PyPegen_last_item ( b , expr_ty ) , "did you forget parentheses around the comprehension target?" ); |
22460 | 1 | if (_res == NULL && PyErr_Occurred()) { |
22461 | 1 | p->error_indicator = 1; |
22462 | 1 | p->level--; |
22463 | 1 | return NULL; |
22464 | 1 | } |
22465 | 0 | goto done; |
22466 | 1 | } |
22467 | 208k | p->mark = _mark; |
22468 | 208k | D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
22469 | 208k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses")); |
22470 | 208k | } |
22471 | 0 | { // ('[' | '{') star_named_expression ',' for_if_clauses |
22472 | 208k | if (p->error_indicator) { |
22473 | 1.46k | p->level--; |
22474 | 1.46k | return NULL; |
22475 | 1.46k | } |
22476 | 207k | D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses")); |
22477 | 207k | void *_tmp_122_var; |
22478 | 207k | expr_ty a; |
22479 | 207k | Token * b; |
22480 | 207k | asdl_comprehension_seq* for_if_clauses_var; |
22481 | 207k | if ( |
22482 | 207k | (_tmp_122_var = _tmp_122_rule(p)) // '[' | '{' |
22483 | 12.3k | && |
22484 | 12.3k | (a = star_named_expression_rule(p)) // star_named_expression |
22485 | 6.84k | && |
22486 | 6.84k | (b = _PyPegen_expect_token(p, 12)) // token=',' |
22487 | 1.68k | && |
22488 | 1.68k | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
22489 | 207k | ) |
22490 | 1 | { |
22491 | 1 | D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses")); |
22492 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "did you forget parentheses around the comprehension target?" ); |
22493 | 1 | if (_res == NULL && PyErr_Occurred()) { |
22494 | 1 | p->error_indicator = 1; |
22495 | 1 | p->level--; |
22496 | 1 | return NULL; |
22497 | 1 | } |
22498 | 0 | goto done; |
22499 | 1 | } |
22500 | 207k | p->mark = _mark; |
22501 | 207k | D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
22502 | 207k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses")); |
22503 | 207k | } |
22504 | 207k | _res = NULL; |
22505 | 207k | done: |
22506 | 207k | p->level--; |
22507 | 207k | return _res; |
22508 | 207k | } |
22509 | | |
22510 | | // invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}' |
22511 | | static void * |
22512 | | invalid_dict_comprehension_rule(Parser *p) |
22513 | 3.15k | { |
22514 | 3.15k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
22515 | 0 | _Pypegen_stack_overflow(p); |
22516 | 0 | } |
22517 | 3.15k | if (p->error_indicator) { |
22518 | 0 | p->level--; |
22519 | 0 | return NULL; |
22520 | 0 | } |
22521 | 3.15k | void * _res = NULL; |
22522 | 3.15k | int _mark = p->mark; |
22523 | 3.15k | { // '{' '**' bitwise_or for_if_clauses '}' |
22524 | 3.15k | if (p->error_indicator) { |
22525 | 0 | p->level--; |
22526 | 0 | return NULL; |
22527 | 0 | } |
22528 | 3.15k | D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); |
22529 | 3.15k | Token * _literal; |
22530 | 3.15k | Token * _literal_1; |
22531 | 3.15k | Token * a; |
22532 | 3.15k | expr_ty bitwise_or_var; |
22533 | 3.15k | asdl_comprehension_seq* for_if_clauses_var; |
22534 | 3.15k | if ( |
22535 | 3.15k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
22536 | 3.15k | && |
22537 | 3.15k | (a = _PyPegen_expect_token(p, 35)) // token='**' |
22538 | 417 | && |
22539 | 417 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
22540 | 211 | && |
22541 | 211 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
22542 | 67 | && |
22543 | 67 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
22544 | 3.15k | ) |
22545 | 1 | { |
22546 | 1 | D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); |
22547 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" ); |
22548 | 1 | if (_res == NULL && PyErr_Occurred()) { |
22549 | 1 | p->error_indicator = 1; |
22550 | 1 | p->level--; |
22551 | 1 | return NULL; |
22552 | 1 | } |
22553 | 0 | goto done; |
22554 | 1 | } |
22555 | 3.15k | p->mark = _mark; |
22556 | 3.15k | D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
22557 | 3.15k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'")); |
22558 | 3.15k | } |
22559 | 3.15k | _res = NULL; |
22560 | 3.15k | done: |
22561 | 3.15k | p->level--; |
22562 | 3.15k | return _res; |
22563 | 3.15k | } |
22564 | | |
22565 | | // invalid_parameters: |
22566 | | // | "/" ',' |
22567 | | // | (slash_no_default | slash_with_default) param_maybe_default* '/' |
22568 | | // | slash_no_default? param_no_default* invalid_parameters_helper param_no_default |
22569 | | // | param_no_default* '(' param_no_default+ ','? ')' |
22570 | | // | [(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/' |
22571 | | // | param_maybe_default+ '/' '*' |
22572 | | static void * |
22573 | | invalid_parameters_rule(Parser *p) |
22574 | 5.28k | { |
22575 | 5.28k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
22576 | 0 | _Pypegen_stack_overflow(p); |
22577 | 0 | } |
22578 | 5.28k | if (p->error_indicator) { |
22579 | 0 | p->level--; |
22580 | 0 | return NULL; |
22581 | 0 | } |
22582 | 5.28k | void * _res = NULL; |
22583 | 5.28k | int _mark = p->mark; |
22584 | 5.28k | { // "/" ',' |
22585 | 5.28k | if (p->error_indicator) { |
22586 | 0 | p->level--; |
22587 | 0 | return NULL; |
22588 | 0 | } |
22589 | 5.28k | D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"/\" ','")); |
22590 | 5.28k | Token * _literal; |
22591 | 5.28k | Token * a; |
22592 | 5.28k | if ( |
22593 | 5.28k | (a = _PyPegen_expect_token(p, 17)) // token='/' |
22594 | 8 | && |
22595 | 8 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
22596 | 5.28k | ) |
22597 | 1 | { |
22598 | 1 | D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"/\" ','")); |
22599 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "at least one parameter must precede /" ); |
22600 | 1 | if (_res == NULL && PyErr_Occurred()) { |
22601 | 1 | p->error_indicator = 1; |
22602 | 1 | p->level--; |
22603 | 1 | return NULL; |
22604 | 1 | } |
22605 | 0 | goto done; |
22606 | 1 | } |
22607 | 5.28k | p->mark = _mark; |
22608 | 5.28k | D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
22609 | 5.28k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"/\" ','")); |
22610 | 5.28k | } |
22611 | 0 | { // (slash_no_default | slash_with_default) param_maybe_default* '/' |
22612 | 5.28k | if (p->error_indicator) { |
22613 | 1 | p->level--; |
22614 | 1 | return NULL; |
22615 | 1 | } |
22616 | 5.28k | D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(slash_no_default | slash_with_default) param_maybe_default* '/'")); |
22617 | 5.28k | asdl_seq * _loop0_31_var; |
22618 | 5.28k | void *_tmp_123_var; |
22619 | 5.28k | Token * a; |
22620 | 5.28k | if ( |
22621 | 5.28k | (_tmp_123_var = _tmp_123_rule(p)) // slash_no_default | slash_with_default |
22622 | 886 | && |
22623 | 886 | (_loop0_31_var = _loop0_31_rule(p)) // param_maybe_default* |
22624 | 886 | && |
22625 | 886 | (a = _PyPegen_expect_token(p, 17)) // token='/' |
22626 | 5.28k | ) |
22627 | 2 | { |
22628 | 2 | D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(slash_no_default | slash_with_default) param_maybe_default* '/'")); |
22629 | 2 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ may appear only once" ); |
22630 | 2 | if (_res == NULL && PyErr_Occurred()) { |
22631 | 2 | p->error_indicator = 1; |
22632 | 2 | p->level--; |
22633 | 2 | return NULL; |
22634 | 2 | } |
22635 | 0 | goto done; |
22636 | 2 | } |
22637 | 5.27k | p->mark = _mark; |
22638 | 5.27k | D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
22639 | 5.27k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(slash_no_default | slash_with_default) param_maybe_default* '/'")); |
22640 | 5.27k | } |
22641 | 0 | { // slash_no_default? param_no_default* invalid_parameters_helper param_no_default |
22642 | 5.27k | if (p->error_indicator) { |
22643 | 7 | p->level--; |
22644 | 7 | return NULL; |
22645 | 7 | } |
22646 | 5.27k | D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default? param_no_default* invalid_parameters_helper param_no_default")); |
22647 | 5.27k | asdl_seq * _loop0_27_var; |
22648 | 5.27k | void *_opt_var; |
22649 | 5.27k | UNUSED(_opt_var); // Silence compiler warnings |
22650 | 5.27k | arg_ty a; |
22651 | 5.27k | void *invalid_parameters_helper_var; |
22652 | 5.27k | if ( |
22653 | 5.27k | (_opt_var = slash_no_default_rule(p), !p->error_indicator) // slash_no_default? |
22654 | 5.27k | && |
22655 | 5.27k | (_loop0_27_var = _loop0_27_rule(p)) // param_no_default* |
22656 | 5.27k | && |
22657 | 5.27k | (invalid_parameters_helper_var = invalid_parameters_helper_rule(p)) // invalid_parameters_helper |
22658 | 995 | && |
22659 | 995 | (a = param_no_default_rule(p)) // param_no_default |
22660 | 5.27k | ) |
22661 | 4 | { |
22662 | 4 | D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default? param_no_default* invalid_parameters_helper param_no_default")); |
22663 | 4 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "parameter without a default follows parameter with a default" ); |
22664 | 4 | if (_res == NULL && PyErr_Occurred()) { |
22665 | 4 | p->error_indicator = 1; |
22666 | 4 | p->level--; |
22667 | 4 | return NULL; |
22668 | 4 | } |
22669 | 0 | goto done; |
22670 | 4 | } |
22671 | 5.26k | p->mark = _mark; |
22672 | 5.26k | D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
22673 | 5.26k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default? param_no_default* invalid_parameters_helper param_no_default")); |
22674 | 5.26k | } |
22675 | 0 | { // param_no_default* '(' param_no_default+ ','? ')' |
22676 | 5.26k | if (p->error_indicator) { |
22677 | 1 | p->level--; |
22678 | 1 | return NULL; |
22679 | 1 | } |
22680 | 5.26k | D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* '(' param_no_default+ ','? ')'")); |
22681 | 5.26k | asdl_seq * _loop0_27_var; |
22682 | 5.26k | asdl_seq * _loop1_29_var; |
22683 | 5.26k | void *_opt_var; |
22684 | 5.26k | UNUSED(_opt_var); // Silence compiler warnings |
22685 | 5.26k | Token * a; |
22686 | 5.26k | Token * b; |
22687 | 5.26k | if ( |
22688 | 5.26k | (_loop0_27_var = _loop0_27_rule(p)) // param_no_default* |
22689 | 5.26k | && |
22690 | 5.26k | (a = _PyPegen_expect_token(p, 7)) // token='(' |
22691 | 15 | && |
22692 | 15 | (_loop1_29_var = _loop1_29_rule(p)) // param_no_default+ |
22693 | 6 | && |
22694 | 6 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
22695 | 6 | && |
22696 | 6 | (b = _PyPegen_expect_token(p, 8)) // token=')' |
22697 | 5.26k | ) |
22698 | 2 | { |
22699 | 2 | D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* '(' param_no_default+ ','? ')'")); |
22700 | 2 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Function parameters cannot be parenthesized" ); |
22701 | 2 | if (_res == NULL && PyErr_Occurred()) { |
22702 | 2 | p->error_indicator = 1; |
22703 | 2 | p->level--; |
22704 | 2 | return NULL; |
22705 | 2 | } |
22706 | 0 | goto done; |
22707 | 2 | } |
22708 | 5.26k | p->mark = _mark; |
22709 | 5.26k | D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
22710 | 5.26k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* '(' param_no_default+ ','? ')'")); |
22711 | 5.26k | } |
22712 | 0 | { // [(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/' |
22713 | 5.26k | if (p->error_indicator) { |
22714 | 4 | p->level--; |
22715 | 4 | return NULL; |
22716 | 4 | } |
22717 | 5.26k | D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'")); |
22718 | 5.26k | Token * _literal; |
22719 | 5.26k | asdl_seq * _loop0_31_var; |
22720 | 5.26k | asdl_seq * _loop0_31_var_1; |
22721 | 5.26k | void *_opt_var; |
22722 | 5.26k | UNUSED(_opt_var); // Silence compiler warnings |
22723 | 5.26k | void *_tmp_124_var; |
22724 | 5.26k | Token * a; |
22725 | 5.26k | if ( |
22726 | 5.26k | (_opt_var = _tmp_123_rule(p), !p->error_indicator) // [(slash_no_default | slash_with_default)] |
22727 | 5.26k | && |
22728 | 5.26k | (_loop0_31_var = _loop0_31_rule(p)) // param_maybe_default* |
22729 | 5.26k | && |
22730 | 5.26k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
22731 | 1.75k | && |
22732 | 1.75k | (_tmp_124_var = _tmp_124_rule(p)) // ',' | param_no_default |
22733 | 1.24k | && |
22734 | 1.24k | (_loop0_31_var_1 = _loop0_31_rule(p)) // param_maybe_default* |
22735 | 1.24k | && |
22736 | 1.24k | (a = _PyPegen_expect_token(p, 17)) // token='/' |
22737 | 5.26k | ) |
22738 | 2 | { |
22739 | 2 | D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'")); |
22740 | 2 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ must be ahead of *" ); |
22741 | 2 | if (_res == NULL && PyErr_Occurred()) { |
22742 | 2 | p->error_indicator = 1; |
22743 | 2 | p->level--; |
22744 | 2 | return NULL; |
22745 | 2 | } |
22746 | 0 | goto done; |
22747 | 2 | } |
22748 | 5.25k | p->mark = _mark; |
22749 | 5.25k | D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
22750 | 5.25k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'")); |
22751 | 5.25k | } |
22752 | 0 | { // param_maybe_default+ '/' '*' |
22753 | 5.25k | if (p->error_indicator) { |
22754 | 3 | p->level--; |
22755 | 3 | return NULL; |
22756 | 3 | } |
22757 | 5.25k | D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default+ '/' '*'")); |
22758 | 5.25k | Token * _literal; |
22759 | 5.25k | asdl_seq * _loop1_32_var; |
22760 | 5.25k | Token * a; |
22761 | 5.25k | if ( |
22762 | 5.25k | (_loop1_32_var = _loop1_32_rule(p)) // param_maybe_default+ |
22763 | 2.00k | && |
22764 | 2.00k | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
22765 | 893 | && |
22766 | 893 | (a = _PyPegen_expect_token(p, 16)) // token='*' |
22767 | 5.25k | ) |
22768 | 2 | { |
22769 | 2 | D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_maybe_default+ '/' '*'")); |
22770 | 2 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected comma between / and *" ); |
22771 | 2 | if (_res == NULL && PyErr_Occurred()) { |
22772 | 2 | p->error_indicator = 1; |
22773 | 2 | p->level--; |
22774 | 2 | return NULL; |
22775 | 2 | } |
22776 | 0 | goto done; |
22777 | 2 | } |
22778 | 5.25k | p->mark = _mark; |
22779 | 5.25k | D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
22780 | 5.25k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default+ '/' '*'")); |
22781 | 5.25k | } |
22782 | 5.25k | _res = NULL; |
22783 | 5.25k | done: |
22784 | 5.25k | p->level--; |
22785 | 5.25k | return _res; |
22786 | 5.25k | } |
22787 | | |
22788 | | // invalid_default: '=' &(')' | ',') |
22789 | | static void * |
22790 | | invalid_default_rule(Parser *p) |
22791 | 42.6k | { |
22792 | 42.6k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
22793 | 0 | _Pypegen_stack_overflow(p); |
22794 | 0 | } |
22795 | 42.6k | if (p->error_indicator) { |
22796 | 0 | p->level--; |
22797 | 0 | return NULL; |
22798 | 0 | } |
22799 | 42.6k | void * _res = NULL; |
22800 | 42.6k | int _mark = p->mark; |
22801 | 42.6k | { // '=' &(')' | ',') |
22802 | 42.6k | if (p->error_indicator) { |
22803 | 0 | p->level--; |
22804 | 0 | return NULL; |
22805 | 0 | } |
22806 | 42.6k | D(fprintf(stderr, "%*c> invalid_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' &(')' | ',')")); |
22807 | 42.6k | Token * a; |
22808 | 42.6k | if ( |
22809 | 42.6k | (a = _PyPegen_expect_token(p, 22)) // token='=' |
22810 | 14.3k | && |
22811 | 14.3k | _PyPegen_lookahead(1, _tmp_125_rule, p) |
22812 | 42.6k | ) |
22813 | 16 | { |
22814 | 16 | D(fprintf(stderr, "%*c+ invalid_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' &(')' | ',')")); |
22815 | 16 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected default value expression" ); |
22816 | 16 | if (_res == NULL && PyErr_Occurred()) { |
22817 | 16 | p->error_indicator = 1; |
22818 | 16 | p->level--; |
22819 | 16 | return NULL; |
22820 | 16 | } |
22821 | 0 | goto done; |
22822 | 16 | } |
22823 | 42.6k | p->mark = _mark; |
22824 | 42.6k | D(fprintf(stderr, "%*c%s invalid_default[%d-%d]: %s failed!\n", p->level, ' ', |
22825 | 42.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' &(')' | ',')")); |
22826 | 42.6k | } |
22827 | 42.6k | _res = NULL; |
22828 | 42.6k | done: |
22829 | 42.6k | p->level--; |
22830 | 42.6k | return _res; |
22831 | 42.6k | } |
22832 | | |
22833 | | // invalid_star_etc: |
22834 | | // | '*' (')' | ',' (')' | '**')) |
22835 | | // | '*' ',' TYPE_COMMENT |
22836 | | // | '*' param '=' |
22837 | | // | '*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',') |
22838 | | static void * |
22839 | | invalid_star_etc_rule(Parser *p) |
22840 | 5.25k | { |
22841 | 5.25k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
22842 | 0 | _Pypegen_stack_overflow(p); |
22843 | 0 | } |
22844 | 5.25k | if (p->error_indicator) { |
22845 | 0 | p->level--; |
22846 | 0 | return NULL; |
22847 | 0 | } |
22848 | 5.25k | void * _res = NULL; |
22849 | 5.25k | int _mark = p->mark; |
22850 | 5.25k | { // '*' (')' | ',' (')' | '**')) |
22851 | 5.25k | if (p->error_indicator) { |
22852 | 0 | p->level--; |
22853 | 0 | return NULL; |
22854 | 0 | } |
22855 | 5.25k | D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
22856 | 5.25k | void *_tmp_126_var; |
22857 | 5.25k | Token * a; |
22858 | 5.25k | if ( |
22859 | 5.25k | (a = _PyPegen_expect_token(p, 16)) // token='*' |
22860 | 1.74k | && |
22861 | 1.74k | (_tmp_126_var = _tmp_126_rule(p)) // ')' | ',' (')' | '**') |
22862 | 5.25k | ) |
22863 | 3 | { |
22864 | 3 | D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
22865 | 3 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "named parameters must follow bare *" ); |
22866 | 3 | if (_res == NULL && PyErr_Occurred()) { |
22867 | 3 | p->error_indicator = 1; |
22868 | 3 | p->level--; |
22869 | 3 | return NULL; |
22870 | 3 | } |
22871 | 0 | goto done; |
22872 | 3 | } |
22873 | 5.25k | p->mark = _mark; |
22874 | 5.25k | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
22875 | 5.25k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
22876 | 5.25k | } |
22877 | 0 | { // '*' ',' TYPE_COMMENT |
22878 | 5.25k | if (p->error_indicator) { |
22879 | 0 | p->level--; |
22880 | 0 | return NULL; |
22881 | 0 | } |
22882 | 5.25k | D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
22883 | 5.25k | Token * _literal; |
22884 | 5.25k | Token * _literal_1; |
22885 | 5.25k | Token * type_comment_var; |
22886 | 5.25k | if ( |
22887 | 5.25k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
22888 | 1.74k | && |
22889 | 1.74k | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
22890 | 703 | && |
22891 | 703 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
22892 | 5.25k | ) |
22893 | 0 | { |
22894 | 0 | D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
22895 | 0 | _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" ); |
22896 | 0 | if (_res == NULL && PyErr_Occurred()) { |
22897 | 0 | p->error_indicator = 1; |
22898 | 0 | p->level--; |
22899 | 0 | return NULL; |
22900 | 0 | } |
22901 | 0 | goto done; |
22902 | 0 | } |
22903 | 5.25k | p->mark = _mark; |
22904 | 5.25k | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
22905 | 5.25k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
22906 | 5.25k | } |
22907 | 0 | { // '*' param '=' |
22908 | 5.25k | if (p->error_indicator) { |
22909 | 0 | p->level--; |
22910 | 0 | return NULL; |
22911 | 0 | } |
22912 | 5.25k | D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param '='")); |
22913 | 5.25k | Token * _literal; |
22914 | 5.25k | Token * a; |
22915 | 5.25k | arg_ty param_var; |
22916 | 5.25k | if ( |
22917 | 5.25k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
22918 | 1.74k | && |
22919 | 1.74k | (param_var = param_rule(p)) // param |
22920 | 1.03k | && |
22921 | 1.03k | (a = _PyPegen_expect_token(p, 22)) // token='=' |
22922 | 5.25k | ) |
22923 | 2 | { |
22924 | 2 | D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param '='")); |
22925 | 2 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-positional parameter cannot have default value" ); |
22926 | 2 | if (_res == NULL && PyErr_Occurred()) { |
22927 | 2 | p->error_indicator = 1; |
22928 | 2 | p->level--; |
22929 | 2 | return NULL; |
22930 | 2 | } |
22931 | 0 | goto done; |
22932 | 2 | } |
22933 | 5.24k | p->mark = _mark; |
22934 | 5.24k | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
22935 | 5.24k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param '='")); |
22936 | 5.24k | } |
22937 | 0 | { // '*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',') |
22938 | 5.24k | if (p->error_indicator) { |
22939 | 0 | p->level--; |
22940 | 0 | return NULL; |
22941 | 0 | } |
22942 | 5.24k | D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')")); |
22943 | 5.24k | Token * _literal; |
22944 | 5.24k | asdl_seq * _loop0_31_var; |
22945 | 5.24k | void *_tmp_127_var; |
22946 | 5.24k | void *_tmp_127_var_1; |
22947 | 5.24k | Token * a; |
22948 | 5.24k | if ( |
22949 | 5.24k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
22950 | 1.74k | && |
22951 | 1.74k | (_tmp_127_var = _tmp_127_rule(p)) // param_no_default | ',' |
22952 | 1.23k | && |
22953 | 1.23k | (_loop0_31_var = _loop0_31_rule(p)) // param_maybe_default* |
22954 | 1.23k | && |
22955 | 1.23k | (a = _PyPegen_expect_token(p, 16)) // token='*' |
22956 | 11 | && |
22957 | 11 | (_tmp_127_var_1 = _tmp_127_rule(p)) // param_no_default | ',' |
22958 | 5.24k | ) |
22959 | 3 | { |
22960 | 3 | D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')")); |
22961 | 3 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "* may appear only once" ); |
22962 | 3 | if (_res == NULL && PyErr_Occurred()) { |
22963 | 3 | p->error_indicator = 1; |
22964 | 3 | p->level--; |
22965 | 3 | return NULL; |
22966 | 3 | } |
22967 | 0 | goto done; |
22968 | 3 | } |
22969 | 5.24k | p->mark = _mark; |
22970 | 5.24k | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
22971 | 5.24k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')")); |
22972 | 5.24k | } |
22973 | 5.24k | _res = NULL; |
22974 | 5.24k | done: |
22975 | 5.24k | p->level--; |
22976 | 5.24k | return _res; |
22977 | 5.24k | } |
22978 | | |
22979 | | // invalid_kwds: '**' param '=' | '**' param ',' param | '**' param ',' ('*' | '**' | '/') |
22980 | | static void * |
22981 | | invalid_kwds_rule(Parser *p) |
22982 | 5.24k | { |
22983 | 5.24k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
22984 | 0 | _Pypegen_stack_overflow(p); |
22985 | 0 | } |
22986 | 5.24k | if (p->error_indicator) { |
22987 | 0 | p->level--; |
22988 | 0 | return NULL; |
22989 | 0 | } |
22990 | 5.24k | void * _res = NULL; |
22991 | 5.24k | int _mark = p->mark; |
22992 | 5.24k | { // '**' param '=' |
22993 | 5.24k | if (p->error_indicator) { |
22994 | 0 | p->level--; |
22995 | 0 | return NULL; |
22996 | 0 | } |
22997 | 5.24k | D(fprintf(stderr, "%*c> invalid_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param '='")); |
22998 | 5.24k | Token * _literal; |
22999 | 5.24k | Token * a; |
23000 | 5.24k | arg_ty param_var; |
23001 | 5.24k | if ( |
23002 | 5.24k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
23003 | 324 | && |
23004 | 324 | (param_var = param_rule(p)) // param |
23005 | 320 | && |
23006 | 320 | (a = _PyPegen_expect_token(p, 22)) // token='=' |
23007 | 5.24k | ) |
23008 | 1 | { |
23009 | 1 | D(fprintf(stderr, "%*c+ invalid_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param '='")); |
23010 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-keyword parameter cannot have default value" ); |
23011 | 1 | if (_res == NULL && PyErr_Occurred()) { |
23012 | 1 | p->error_indicator = 1; |
23013 | 1 | p->level--; |
23014 | 1 | return NULL; |
23015 | 1 | } |
23016 | 0 | goto done; |
23017 | 1 | } |
23018 | 5.24k | p->mark = _mark; |
23019 | 5.24k | D(fprintf(stderr, "%*c%s invalid_kwds[%d-%d]: %s failed!\n", p->level, ' ', |
23020 | 5.24k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param '='")); |
23021 | 5.24k | } |
23022 | 0 | { // '**' param ',' param |
23023 | 5.24k | if (p->error_indicator) { |
23024 | 1 | p->level--; |
23025 | 1 | return NULL; |
23026 | 1 | } |
23027 | 5.23k | D(fprintf(stderr, "%*c> invalid_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param ',' param")); |
23028 | 5.23k | Token * _literal; |
23029 | 5.23k | Token * _literal_1; |
23030 | 5.23k | arg_ty a; |
23031 | 5.23k | arg_ty param_var; |
23032 | 5.23k | if ( |
23033 | 5.23k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
23034 | 322 | && |
23035 | 322 | (param_var = param_rule(p)) // param |
23036 | 319 | && |
23037 | 319 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
23038 | 25 | && |
23039 | 25 | (a = param_rule(p)) // param |
23040 | 5.23k | ) |
23041 | 1 | { |
23042 | 1 | D(fprintf(stderr, "%*c+ invalid_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param ',' param")); |
23043 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "parameters cannot follow var-keyword parameter" ); |
23044 | 1 | if (_res == NULL && PyErr_Occurred()) { |
23045 | 1 | p->error_indicator = 1; |
23046 | 1 | p->level--; |
23047 | 1 | return NULL; |
23048 | 1 | } |
23049 | 0 | goto done; |
23050 | 1 | } |
23051 | 5.23k | p->mark = _mark; |
23052 | 5.23k | D(fprintf(stderr, "%*c%s invalid_kwds[%d-%d]: %s failed!\n", p->level, ' ', |
23053 | 5.23k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param ',' param")); |
23054 | 5.23k | } |
23055 | 0 | { // '**' param ',' ('*' | '**' | '/') |
23056 | 5.23k | if (p->error_indicator) { |
23057 | 1 | p->level--; |
23058 | 1 | return NULL; |
23059 | 1 | } |
23060 | 5.23k | D(fprintf(stderr, "%*c> invalid_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param ',' ('*' | '**' | '/')")); |
23061 | 5.23k | Token * _literal; |
23062 | 5.23k | Token * _literal_1; |
23063 | 5.23k | Token* a; |
23064 | 5.23k | arg_ty param_var; |
23065 | 5.23k | if ( |
23066 | 5.23k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
23067 | 320 | && |
23068 | 320 | (param_var = param_rule(p)) // param |
23069 | 317 | && |
23070 | 317 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
23071 | 23 | && |
23072 | 23 | (a = (Token*)_tmp_128_rule(p)) // '*' | '**' | '/' |
23073 | 5.23k | ) |
23074 | 2 | { |
23075 | 2 | D(fprintf(stderr, "%*c+ invalid_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param ',' ('*' | '**' | '/')")); |
23076 | 2 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "parameters cannot follow var-keyword parameter" ); |
23077 | 2 | if (_res == NULL && PyErr_Occurred()) { |
23078 | 2 | p->error_indicator = 1; |
23079 | 2 | p->level--; |
23080 | 2 | return NULL; |
23081 | 2 | } |
23082 | 0 | goto done; |
23083 | 2 | } |
23084 | 5.23k | p->mark = _mark; |
23085 | 5.23k | D(fprintf(stderr, "%*c%s invalid_kwds[%d-%d]: %s failed!\n", p->level, ' ', |
23086 | 5.23k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param ',' ('*' | '**' | '/')")); |
23087 | 5.23k | } |
23088 | 5.23k | _res = NULL; |
23089 | 5.23k | done: |
23090 | 5.23k | p->level--; |
23091 | 5.23k | return _res; |
23092 | 5.23k | } |
23093 | | |
23094 | | // invalid_parameters_helper: slash_with_default | param_with_default+ |
23095 | | static void * |
23096 | | invalid_parameters_helper_rule(Parser *p) |
23097 | 5.27k | { |
23098 | 5.27k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
23099 | 0 | _Pypegen_stack_overflow(p); |
23100 | 0 | } |
23101 | 5.27k | if (p->error_indicator) { |
23102 | 0 | p->level--; |
23103 | 0 | return NULL; |
23104 | 0 | } |
23105 | 5.27k | void * _res = NULL; |
23106 | 5.27k | int _mark = p->mark; |
23107 | 5.27k | { // slash_with_default |
23108 | 5.27k | if (p->error_indicator) { |
23109 | 0 | p->level--; |
23110 | 0 | return NULL; |
23111 | 0 | } |
23112 | 5.27k | D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); |
23113 | 5.27k | SlashWithDefault* a; |
23114 | 5.27k | if ( |
23115 | 5.27k | (a = slash_with_default_rule(p)) // slash_with_default |
23116 | 5.27k | ) |
23117 | 483 | { |
23118 | 483 | D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); |
23119 | 483 | _res = _PyPegen_singleton_seq ( p , a ); |
23120 | 483 | if (_res == NULL && PyErr_Occurred()) { |
23121 | 0 | p->error_indicator = 1; |
23122 | 0 | p->level--; |
23123 | 0 | return NULL; |
23124 | 0 | } |
23125 | 483 | goto done; |
23126 | 483 | } |
23127 | 4.78k | p->mark = _mark; |
23128 | 4.78k | D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ', |
23129 | 4.78k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); |
23130 | 4.78k | } |
23131 | 0 | { // param_with_default+ |
23132 | 4.78k | if (p->error_indicator) { |
23133 | 0 | p->level--; |
23134 | 0 | return NULL; |
23135 | 0 | } |
23136 | 4.78k | D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); |
23137 | 4.78k | asdl_seq * _loop1_30_var; |
23138 | 4.78k | if ( |
23139 | 4.78k | (_loop1_30_var = _loop1_30_rule(p)) // param_with_default+ |
23140 | 4.78k | ) |
23141 | 512 | { |
23142 | 512 | D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); |
23143 | 512 | _res = _loop1_30_var; |
23144 | 512 | goto done; |
23145 | 512 | } |
23146 | 4.27k | p->mark = _mark; |
23147 | 4.27k | D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ', |
23148 | 4.27k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); |
23149 | 4.27k | } |
23150 | 4.27k | _res = NULL; |
23151 | 5.27k | done: |
23152 | 5.27k | p->level--; |
23153 | 5.27k | return _res; |
23154 | 4.27k | } |
23155 | | |
23156 | | // invalid_lambda_parameters: |
23157 | | // | "/" ',' |
23158 | | // | (lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/' |
23159 | | // | lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default |
23160 | | // | lambda_param_no_default* '(' ','.lambda_param+ ','? ')' |
23161 | | // | [(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/' |
23162 | | // | lambda_param_maybe_default+ '/' '*' |
23163 | | static void * |
23164 | | invalid_lambda_parameters_rule(Parser *p) |
23165 | 7.21k | { |
23166 | 7.21k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
23167 | 0 | _Pypegen_stack_overflow(p); |
23168 | 0 | } |
23169 | 7.21k | if (p->error_indicator) { |
23170 | 0 | p->level--; |
23171 | 0 | return NULL; |
23172 | 0 | } |
23173 | 7.21k | void * _res = NULL; |
23174 | 7.21k | int _mark = p->mark; |
23175 | 7.21k | { // "/" ',' |
23176 | 7.21k | if (p->error_indicator) { |
23177 | 0 | p->level--; |
23178 | 0 | return NULL; |
23179 | 0 | } |
23180 | 7.21k | D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"/\" ','")); |
23181 | 7.21k | Token * _literal; |
23182 | 7.21k | Token * a; |
23183 | 7.21k | if ( |
23184 | 7.21k | (a = _PyPegen_expect_token(p, 17)) // token='/' |
23185 | 5 | && |
23186 | 5 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
23187 | 7.21k | ) |
23188 | 1 | { |
23189 | 1 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"/\" ','")); |
23190 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "at least one parameter must precede /" ); |
23191 | 1 | if (_res == NULL && PyErr_Occurred()) { |
23192 | 1 | p->error_indicator = 1; |
23193 | 1 | p->level--; |
23194 | 1 | return NULL; |
23195 | 1 | } |
23196 | 0 | goto done; |
23197 | 1 | } |
23198 | 7.21k | p->mark = _mark; |
23199 | 7.21k | D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
23200 | 7.21k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"/\" ','")); |
23201 | 7.21k | } |
23202 | 0 | { // (lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/' |
23203 | 7.21k | if (p->error_indicator) { |
23204 | 1 | p->level--; |
23205 | 1 | return NULL; |
23206 | 1 | } |
23207 | 7.21k | D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'")); |
23208 | 7.21k | asdl_seq * _loop0_74_var; |
23209 | 7.21k | void *_tmp_129_var; |
23210 | 7.21k | Token * a; |
23211 | 7.21k | if ( |
23212 | 7.21k | (_tmp_129_var = _tmp_129_rule(p)) // lambda_slash_no_default | lambda_slash_with_default |
23213 | 1.27k | && |
23214 | 1.27k | (_loop0_74_var = _loop0_74_rule(p)) // lambda_param_maybe_default* |
23215 | 1.27k | && |
23216 | 1.27k | (a = _PyPegen_expect_token(p, 17)) // token='/' |
23217 | 7.21k | ) |
23218 | 6 | { |
23219 | 6 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'")); |
23220 | 6 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ may appear only once" ); |
23221 | 6 | if (_res == NULL && PyErr_Occurred()) { |
23222 | 6 | p->error_indicator = 1; |
23223 | 6 | p->level--; |
23224 | 6 | return NULL; |
23225 | 6 | } |
23226 | 0 | goto done; |
23227 | 6 | } |
23228 | 7.20k | p->mark = _mark; |
23229 | 7.20k | D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
23230 | 7.20k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'")); |
23231 | 7.20k | } |
23232 | 0 | { // lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default |
23233 | 7.20k | if (p->error_indicator) { |
23234 | 518 | p->level--; |
23235 | 518 | return NULL; |
23236 | 518 | } |
23237 | 6.68k | D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default")); |
23238 | 6.68k | asdl_seq * _loop0_70_var; |
23239 | 6.68k | void *_opt_var; |
23240 | 6.68k | UNUSED(_opt_var); // Silence compiler warnings |
23241 | 6.68k | arg_ty a; |
23242 | 6.68k | void *invalid_lambda_parameters_helper_var; |
23243 | 6.68k | if ( |
23244 | 6.68k | (_opt_var = lambda_slash_no_default_rule(p), !p->error_indicator) // lambda_slash_no_default? |
23245 | 6.68k | && |
23246 | 6.68k | (_loop0_70_var = _loop0_70_rule(p)) // lambda_param_no_default* |
23247 | 6.68k | && |
23248 | 6.68k | (invalid_lambda_parameters_helper_var = invalid_lambda_parameters_helper_rule(p)) // invalid_lambda_parameters_helper |
23249 | 1.43k | && |
23250 | 1.43k | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
23251 | 6.68k | ) |
23252 | 4 | { |
23253 | 4 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default")); |
23254 | 4 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "parameter without a default follows parameter with a default" ); |
23255 | 4 | if (_res == NULL && PyErr_Occurred()) { |
23256 | 4 | p->error_indicator = 1; |
23257 | 4 | p->level--; |
23258 | 4 | return NULL; |
23259 | 4 | } |
23260 | 0 | goto done; |
23261 | 4 | } |
23262 | 6.68k | p->mark = _mark; |
23263 | 6.68k | D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
23264 | 6.68k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default")); |
23265 | 6.68k | } |
23266 | 0 | { // lambda_param_no_default* '(' ','.lambda_param+ ','? ')' |
23267 | 6.68k | if (p->error_indicator) { |
23268 | 0 | p->level--; |
23269 | 0 | return NULL; |
23270 | 0 | } |
23271 | 6.68k | D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* '(' ','.lambda_param+ ','? ')'")); |
23272 | 6.68k | asdl_seq * _gather_131_var; |
23273 | 6.68k | asdl_seq * _loop0_70_var; |
23274 | 6.68k | void *_opt_var; |
23275 | 6.68k | UNUSED(_opt_var); // Silence compiler warnings |
23276 | 6.68k | Token * a; |
23277 | 6.68k | Token * b; |
23278 | 6.68k | if ( |
23279 | 6.68k | (_loop0_70_var = _loop0_70_rule(p)) // lambda_param_no_default* |
23280 | 6.68k | && |
23281 | 6.68k | (a = _PyPegen_expect_token(p, 7)) // token='(' |
23282 | 61 | && |
23283 | 61 | (_gather_131_var = _gather_131_rule(p)) // ','.lambda_param+ |
23284 | 55 | && |
23285 | 55 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
23286 | 49 | && |
23287 | 49 | (b = _PyPegen_expect_token(p, 8)) // token=')' |
23288 | 6.68k | ) |
23289 | 1 | { |
23290 | 1 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* '(' ','.lambda_param+ ','? ')'")); |
23291 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Lambda expression parameters cannot be parenthesized" ); |
23292 | 1 | if (_res == NULL && PyErr_Occurred()) { |
23293 | 1 | p->error_indicator = 1; |
23294 | 1 | p->level--; |
23295 | 1 | return NULL; |
23296 | 1 | } |
23297 | 0 | goto done; |
23298 | 1 | } |
23299 | 6.68k | p->mark = _mark; |
23300 | 6.68k | D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
23301 | 6.68k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* '(' ','.lambda_param+ ','? ')'")); |
23302 | 6.68k | } |
23303 | 0 | { // [(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/' |
23304 | 6.68k | if (p->error_indicator) { |
23305 | 9 | p->level--; |
23306 | 9 | return NULL; |
23307 | 9 | } |
23308 | 6.67k | D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'")); |
23309 | 6.67k | Token * _literal; |
23310 | 6.67k | asdl_seq * _loop0_74_var; |
23311 | 6.67k | asdl_seq * _loop0_74_var_1; |
23312 | 6.67k | void *_opt_var; |
23313 | 6.67k | UNUSED(_opt_var); // Silence compiler warnings |
23314 | 6.67k | void *_tmp_132_var; |
23315 | 6.67k | Token * a; |
23316 | 6.67k | if ( |
23317 | 6.67k | (_opt_var = _tmp_129_rule(p), !p->error_indicator) // [(lambda_slash_no_default | lambda_slash_with_default)] |
23318 | 6.67k | && |
23319 | 6.67k | (_loop0_74_var = _loop0_74_rule(p)) // lambda_param_maybe_default* |
23320 | 6.67k | && |
23321 | 6.67k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
23322 | 2.77k | && |
23323 | 2.77k | (_tmp_132_var = _tmp_132_rule(p)) // ',' | lambda_param_no_default |
23324 | 2.69k | && |
23325 | 2.69k | (_loop0_74_var_1 = _loop0_74_rule(p)) // lambda_param_maybe_default* |
23326 | 2.69k | && |
23327 | 2.69k | (a = _PyPegen_expect_token(p, 17)) // token='/' |
23328 | 6.67k | ) |
23329 | 3 | { |
23330 | 3 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'")); |
23331 | 3 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ must be ahead of *" ); |
23332 | 3 | if (_res == NULL && PyErr_Occurred()) { |
23333 | 3 | p->error_indicator = 1; |
23334 | 3 | p->level--; |
23335 | 3 | return NULL; |
23336 | 3 | } |
23337 | 0 | goto done; |
23338 | 3 | } |
23339 | 6.67k | p->mark = _mark; |
23340 | 6.67k | D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
23341 | 6.67k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'")); |
23342 | 6.67k | } |
23343 | 0 | { // lambda_param_maybe_default+ '/' '*' |
23344 | 6.67k | if (p->error_indicator) { |
23345 | 214 | p->level--; |
23346 | 214 | return NULL; |
23347 | 214 | } |
23348 | 6.45k | D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default+ '/' '*'")); |
23349 | 6.45k | Token * _literal; |
23350 | 6.45k | asdl_seq * _loop1_75_var; |
23351 | 6.45k | Token * a; |
23352 | 6.45k | if ( |
23353 | 6.45k | (_loop1_75_var = _loop1_75_rule(p)) // lambda_param_maybe_default+ |
23354 | 2.37k | && |
23355 | 2.37k | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
23356 | 1.12k | && |
23357 | 1.12k | (a = _PyPegen_expect_token(p, 16)) // token='*' |
23358 | 6.45k | ) |
23359 | 4 | { |
23360 | 4 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default+ '/' '*'")); |
23361 | 4 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected comma between / and *" ); |
23362 | 4 | if (_res == NULL && PyErr_Occurred()) { |
23363 | 4 | p->error_indicator = 1; |
23364 | 4 | p->level--; |
23365 | 4 | return NULL; |
23366 | 4 | } |
23367 | 0 | goto done; |
23368 | 4 | } |
23369 | 6.45k | p->mark = _mark; |
23370 | 6.45k | D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
23371 | 6.45k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default+ '/' '*'")); |
23372 | 6.45k | } |
23373 | 6.45k | _res = NULL; |
23374 | 6.45k | done: |
23375 | 6.45k | p->level--; |
23376 | 6.45k | return _res; |
23377 | 6.45k | } |
23378 | | |
23379 | | // invalid_lambda_parameters_helper: |
23380 | | // | lambda_slash_with_default |
23381 | | // | lambda_param_with_default+ |
23382 | | static void * |
23383 | | invalid_lambda_parameters_helper_rule(Parser *p) |
23384 | 6.68k | { |
23385 | 6.68k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
23386 | 0 | _Pypegen_stack_overflow(p); |
23387 | 0 | } |
23388 | 6.68k | if (p->error_indicator) { |
23389 | 0 | p->level--; |
23390 | 0 | return NULL; |
23391 | 0 | } |
23392 | 6.68k | void * _res = NULL; |
23393 | 6.68k | int _mark = p->mark; |
23394 | 6.68k | { // lambda_slash_with_default |
23395 | 6.68k | if (p->error_indicator) { |
23396 | 0 | p->level--; |
23397 | 0 | return NULL; |
23398 | 0 | } |
23399 | 6.68k | D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); |
23400 | 6.68k | SlashWithDefault* a; |
23401 | 6.68k | if ( |
23402 | 6.68k | (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default |
23403 | 6.68k | ) |
23404 | 741 | { |
23405 | 741 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); |
23406 | 741 | _res = _PyPegen_singleton_seq ( p , a ); |
23407 | 741 | if (_res == NULL && PyErr_Occurred()) { |
23408 | 0 | p->error_indicator = 1; |
23409 | 0 | p->level--; |
23410 | 0 | return NULL; |
23411 | 0 | } |
23412 | 741 | goto done; |
23413 | 741 | } |
23414 | 5.94k | p->mark = _mark; |
23415 | 5.94k | D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ', |
23416 | 5.94k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default")); |
23417 | 5.94k | } |
23418 | 0 | { // lambda_param_with_default+ |
23419 | 5.94k | if (p->error_indicator) { |
23420 | 0 | p->level--; |
23421 | 0 | return NULL; |
23422 | 0 | } |
23423 | 5.94k | D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); |
23424 | 5.94k | asdl_seq * _loop1_73_var; |
23425 | 5.94k | if ( |
23426 | 5.94k | (_loop1_73_var = _loop1_73_rule(p)) // lambda_param_with_default+ |
23427 | 5.94k | ) |
23428 | 698 | { |
23429 | 698 | D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); |
23430 | 698 | _res = _loop1_73_var; |
23431 | 698 | goto done; |
23432 | 698 | } |
23433 | 5.25k | p->mark = _mark; |
23434 | 5.25k | D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ', |
23435 | 5.25k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+")); |
23436 | 5.25k | } |
23437 | 5.25k | _res = NULL; |
23438 | 6.68k | done: |
23439 | 6.68k | p->level--; |
23440 | 6.68k | return _res; |
23441 | 5.25k | } |
23442 | | |
23443 | | // invalid_lambda_star_etc: |
23444 | | // | '*' (':' | ',' (':' | '**')) |
23445 | | // | '*' lambda_param '=' |
23446 | | // | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',') |
23447 | | static void * |
23448 | | invalid_lambda_star_etc_rule(Parser *p) |
23449 | 6.45k | { |
23450 | 6.45k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
23451 | 0 | _Pypegen_stack_overflow(p); |
23452 | 0 | } |
23453 | 6.45k | if (p->error_indicator) { |
23454 | 0 | p->level--; |
23455 | 0 | return NULL; |
23456 | 0 | } |
23457 | 6.45k | void * _res = NULL; |
23458 | 6.45k | int _mark = p->mark; |
23459 | 6.45k | { // '*' (':' | ',' (':' | '**')) |
23460 | 6.45k | if (p->error_indicator) { |
23461 | 0 | p->level--; |
23462 | 0 | return NULL; |
23463 | 0 | } |
23464 | 6.45k | D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
23465 | 6.45k | Token * _literal; |
23466 | 6.45k | void *_tmp_133_var; |
23467 | 6.45k | if ( |
23468 | 6.45k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
23469 | 2.55k | && |
23470 | 2.55k | (_tmp_133_var = _tmp_133_rule(p)) // ':' | ',' (':' | '**') |
23471 | 6.45k | ) |
23472 | 6 | { |
23473 | 6 | D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
23474 | 6 | _res = RAISE_SYNTAX_ERROR ( "named parameters must follow bare *" ); |
23475 | 6 | if (_res == NULL && PyErr_Occurred()) { |
23476 | 6 | p->error_indicator = 1; |
23477 | 6 | p->level--; |
23478 | 6 | return NULL; |
23479 | 6 | } |
23480 | 0 | goto done; |
23481 | 6 | } |
23482 | 6.44k | p->mark = _mark; |
23483 | 6.44k | D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
23484 | 6.44k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
23485 | 6.44k | } |
23486 | 0 | { // '*' lambda_param '=' |
23487 | 6.44k | if (p->error_indicator) { |
23488 | 0 | p->level--; |
23489 | 0 | return NULL; |
23490 | 0 | } |
23491 | 6.44k | D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' lambda_param '='")); |
23492 | 6.44k | Token * _literal; |
23493 | 6.44k | Token * a; |
23494 | 6.44k | arg_ty lambda_param_var; |
23495 | 6.44k | if ( |
23496 | 6.44k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
23497 | 2.54k | && |
23498 | 2.54k | (lambda_param_var = lambda_param_rule(p)) // lambda_param |
23499 | 1.27k | && |
23500 | 1.27k | (a = _PyPegen_expect_token(p, 22)) // token='=' |
23501 | 6.44k | ) |
23502 | 6 | { |
23503 | 6 | D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param '='")); |
23504 | 6 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-positional parameter cannot have default value" ); |
23505 | 6 | if (_res == NULL && PyErr_Occurred()) { |
23506 | 6 | p->error_indicator = 1; |
23507 | 6 | p->level--; |
23508 | 6 | return NULL; |
23509 | 6 | } |
23510 | 0 | goto done; |
23511 | 6 | } |
23512 | 6.44k | p->mark = _mark; |
23513 | 6.44k | D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
23514 | 6.44k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param '='")); |
23515 | 6.44k | } |
23516 | 0 | { // '*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',') |
23517 | 6.44k | if (p->error_indicator) { |
23518 | 0 | p->level--; |
23519 | 0 | return NULL; |
23520 | 0 | } |
23521 | 6.44k | D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')")); |
23522 | 6.44k | Token * _literal; |
23523 | 6.44k | asdl_seq * _loop0_74_var; |
23524 | 6.44k | void *_tmp_134_var; |
23525 | 6.44k | void *_tmp_134_var_1; |
23526 | 6.44k | Token * a; |
23527 | 6.44k | if ( |
23528 | 6.44k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
23529 | 2.54k | && |
23530 | 2.54k | (_tmp_134_var = _tmp_134_rule(p)) // lambda_param_no_default | ',' |
23531 | 2.47k | && |
23532 | 2.47k | (_loop0_74_var = _loop0_74_rule(p)) // lambda_param_maybe_default* |
23533 | 2.47k | && |
23534 | 2.47k | (a = _PyPegen_expect_token(p, 16)) // token='*' |
23535 | 75 | && |
23536 | 75 | (_tmp_134_var_1 = _tmp_134_rule(p)) // lambda_param_no_default | ',' |
23537 | 6.44k | ) |
23538 | 2 | { |
23539 | 2 | D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')")); |
23540 | 2 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "* may appear only once" ); |
23541 | 2 | if (_res == NULL && PyErr_Occurred()) { |
23542 | 2 | p->error_indicator = 1; |
23543 | 2 | p->level--; |
23544 | 2 | return NULL; |
23545 | 2 | } |
23546 | 0 | goto done; |
23547 | 2 | } |
23548 | 6.44k | p->mark = _mark; |
23549 | 6.44k | D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
23550 | 6.44k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')")); |
23551 | 6.44k | } |
23552 | 6.44k | _res = NULL; |
23553 | 6.44k | done: |
23554 | 6.44k | p->level--; |
23555 | 6.44k | return _res; |
23556 | 6.44k | } |
23557 | | |
23558 | | // invalid_lambda_kwds: |
23559 | | // | '**' lambda_param '=' |
23560 | | // | '**' lambda_param ',' lambda_param |
23561 | | // | '**' lambda_param ',' ('*' | '**' | '/') |
23562 | | static void * |
23563 | | invalid_lambda_kwds_rule(Parser *p) |
23564 | 6.43k | { |
23565 | 6.43k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
23566 | 0 | _Pypegen_stack_overflow(p); |
23567 | 0 | } |
23568 | 6.43k | if (p->error_indicator) { |
23569 | 0 | p->level--; |
23570 | 0 | return NULL; |
23571 | 0 | } |
23572 | 6.43k | void * _res = NULL; |
23573 | 6.43k | int _mark = p->mark; |
23574 | 6.43k | { // '**' lambda_param '=' |
23575 | 6.43k | if (p->error_indicator) { |
23576 | 0 | p->level--; |
23577 | 0 | return NULL; |
23578 | 0 | } |
23579 | 6.43k | D(fprintf(stderr, "%*c> invalid_lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param '='")); |
23580 | 6.43k | Token * _literal; |
23581 | 6.43k | Token * a; |
23582 | 6.43k | arg_ty lambda_param_var; |
23583 | 6.43k | if ( |
23584 | 6.43k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
23585 | 307 | && |
23586 | 307 | (lambda_param_var = lambda_param_rule(p)) // lambda_param |
23587 | 294 | && |
23588 | 294 | (a = _PyPegen_expect_token(p, 22)) // token='=' |
23589 | 6.43k | ) |
23590 | 1 | { |
23591 | 1 | D(fprintf(stderr, "%*c+ invalid_lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param '='")); |
23592 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-keyword parameter cannot have default value" ); |
23593 | 1 | if (_res == NULL && PyErr_Occurred()) { |
23594 | 1 | p->error_indicator = 1; |
23595 | 1 | p->level--; |
23596 | 1 | return NULL; |
23597 | 1 | } |
23598 | 0 | goto done; |
23599 | 1 | } |
23600 | 6.43k | p->mark = _mark; |
23601 | 6.43k | D(fprintf(stderr, "%*c%s invalid_lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ', |
23602 | 6.43k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param '='")); |
23603 | 6.43k | } |
23604 | 0 | { // '**' lambda_param ',' lambda_param |
23605 | 6.43k | if (p->error_indicator) { |
23606 | 1 | p->level--; |
23607 | 1 | return NULL; |
23608 | 1 | } |
23609 | 6.43k | D(fprintf(stderr, "%*c> invalid_lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' lambda_param")); |
23610 | 6.43k | Token * _literal; |
23611 | 6.43k | Token * _literal_1; |
23612 | 6.43k | arg_ty a; |
23613 | 6.43k | arg_ty lambda_param_var; |
23614 | 6.43k | if ( |
23615 | 6.43k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
23616 | 305 | && |
23617 | 305 | (lambda_param_var = lambda_param_rule(p)) // lambda_param |
23618 | 293 | && |
23619 | 293 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
23620 | 14 | && |
23621 | 14 | (a = lambda_param_rule(p)) // lambda_param |
23622 | 6.43k | ) |
23623 | 1 | { |
23624 | 1 | D(fprintf(stderr, "%*c+ invalid_lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' lambda_param")); |
23625 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "parameters cannot follow var-keyword parameter" ); |
23626 | 1 | if (_res == NULL && PyErr_Occurred()) { |
23627 | 1 | p->error_indicator = 1; |
23628 | 1 | p->level--; |
23629 | 1 | return NULL; |
23630 | 1 | } |
23631 | 0 | goto done; |
23632 | 1 | } |
23633 | 6.43k | p->mark = _mark; |
23634 | 6.43k | D(fprintf(stderr, "%*c%s invalid_lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ', |
23635 | 6.43k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param ',' lambda_param")); |
23636 | 6.43k | } |
23637 | 0 | { // '**' lambda_param ',' ('*' | '**' | '/') |
23638 | 6.43k | if (p->error_indicator) { |
23639 | 1 | p->level--; |
23640 | 1 | return NULL; |
23641 | 1 | } |
23642 | 6.43k | D(fprintf(stderr, "%*c> invalid_lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' ('*' | '**' | '/')")); |
23643 | 6.43k | Token * _literal; |
23644 | 6.43k | Token * _literal_1; |
23645 | 6.43k | Token* a; |
23646 | 6.43k | arg_ty lambda_param_var; |
23647 | 6.43k | if ( |
23648 | 6.43k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
23649 | 303 | && |
23650 | 303 | (lambda_param_var = lambda_param_rule(p)) // lambda_param |
23651 | 291 | && |
23652 | 291 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
23653 | 12 | && |
23654 | 12 | (a = (Token*)_tmp_128_rule(p)) // '*' | '**' | '/' |
23655 | 6.43k | ) |
23656 | 1 | { |
23657 | 1 | D(fprintf(stderr, "%*c+ invalid_lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' ('*' | '**' | '/')")); |
23658 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "parameters cannot follow var-keyword parameter" ); |
23659 | 1 | if (_res == NULL && PyErr_Occurred()) { |
23660 | 1 | p->error_indicator = 1; |
23661 | 1 | p->level--; |
23662 | 1 | return NULL; |
23663 | 1 | } |
23664 | 0 | goto done; |
23665 | 1 | } |
23666 | 6.43k | p->mark = _mark; |
23667 | 6.43k | D(fprintf(stderr, "%*c%s invalid_lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ', |
23668 | 6.43k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param ',' ('*' | '**' | '/')")); |
23669 | 6.43k | } |
23670 | 6.43k | _res = NULL; |
23671 | 6.43k | done: |
23672 | 6.43k | p->level--; |
23673 | 6.43k | return _res; |
23674 | 6.43k | } |
23675 | | |
23676 | | // invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT |
23677 | | static void * |
23678 | | invalid_double_type_comments_rule(Parser *p) |
23679 | 2.35k | { |
23680 | 2.35k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
23681 | 0 | _Pypegen_stack_overflow(p); |
23682 | 0 | } |
23683 | 2.35k | if (p->error_indicator) { |
23684 | 0 | p->level--; |
23685 | 0 | return NULL; |
23686 | 0 | } |
23687 | 2.35k | void * _res = NULL; |
23688 | 2.35k | int _mark = p->mark; |
23689 | 2.35k | { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT |
23690 | 2.35k | if (p->error_indicator) { |
23691 | 0 | p->level--; |
23692 | 0 | return NULL; |
23693 | 0 | } |
23694 | 2.35k | D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); |
23695 | 2.35k | Token * indent_var; |
23696 | 2.35k | Token * newline_var; |
23697 | 2.35k | Token * newline_var_1; |
23698 | 2.35k | Token * type_comment_var; |
23699 | 2.35k | Token * type_comment_var_1; |
23700 | 2.35k | if ( |
23701 | 2.35k | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
23702 | 0 | && |
23703 | 0 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
23704 | 0 | && |
23705 | 0 | (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
23706 | 0 | && |
23707 | 0 | (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
23708 | 0 | && |
23709 | 0 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
23710 | 2.35k | ) |
23711 | 0 | { |
23712 | 0 | 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")); |
23713 | 0 | _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" ); |
23714 | 0 | if (_res == NULL && PyErr_Occurred()) { |
23715 | 0 | p->error_indicator = 1; |
23716 | 0 | p->level--; |
23717 | 0 | return NULL; |
23718 | 0 | } |
23719 | 0 | goto done; |
23720 | 0 | } |
23721 | 2.35k | p->mark = _mark; |
23722 | 2.35k | D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ', |
23723 | 2.35k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT")); |
23724 | 2.35k | } |
23725 | 2.35k | _res = NULL; |
23726 | 2.35k | done: |
23727 | 2.35k | p->level--; |
23728 | 2.35k | return _res; |
23729 | 2.35k | } |
23730 | | |
23731 | | // invalid_with_item: expression 'as' expression &(',' | ')' | ':') |
23732 | | static void * |
23733 | | invalid_with_item_rule(Parser *p) |
23734 | 3.48k | { |
23735 | 3.48k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
23736 | 0 | _Pypegen_stack_overflow(p); |
23737 | 0 | } |
23738 | 3.48k | if (p->error_indicator) { |
23739 | 0 | p->level--; |
23740 | 0 | return NULL; |
23741 | 0 | } |
23742 | 3.48k | void * _res = NULL; |
23743 | 3.48k | int _mark = p->mark; |
23744 | 3.48k | { // expression 'as' expression &(',' | ')' | ':') |
23745 | 3.48k | if (p->error_indicator) { |
23746 | 0 | p->level--; |
23747 | 0 | return NULL; |
23748 | 0 | } |
23749 | 3.48k | D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')")); |
23750 | 3.48k | Token * _keyword; |
23751 | 3.48k | expr_ty a; |
23752 | 3.48k | expr_ty expression_var; |
23753 | 3.48k | if ( |
23754 | 3.48k | (expression_var = expression_rule(p)) // expression |
23755 | 2.84k | && |
23756 | 2.84k | (_keyword = _PyPegen_expect_token(p, 689)) // token='as' |
23757 | 11 | && |
23758 | 11 | (a = expression_rule(p)) // expression |
23759 | 6 | && |
23760 | 6 | _PyPegen_lookahead(1, _tmp_35_rule, p) |
23761 | 3.48k | ) |
23762 | 2 | { |
23763 | 2 | D(fprintf(stderr, "%*c+ invalid_with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')")); |
23764 | 2 | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a ); |
23765 | 2 | if (_res == NULL && PyErr_Occurred()) { |
23766 | 2 | p->error_indicator = 1; |
23767 | 2 | p->level--; |
23768 | 2 | return NULL; |
23769 | 2 | } |
23770 | 0 | goto done; |
23771 | 2 | } |
23772 | 3.48k | p->mark = _mark; |
23773 | 3.48k | D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ', |
23774 | 3.48k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')")); |
23775 | 3.48k | } |
23776 | 3.48k | _res = NULL; |
23777 | 3.48k | done: |
23778 | 3.48k | p->level--; |
23779 | 3.48k | return _res; |
23780 | 3.48k | } |
23781 | | |
23782 | | // invalid_for_if_clause: 'async'? 'for' (bitwise_or ((',' bitwise_or))* ','?) !'in' |
23783 | | static void * |
23784 | | invalid_for_if_clause_rule(Parser *p) |
23785 | 44.0k | { |
23786 | 44.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
23787 | 0 | _Pypegen_stack_overflow(p); |
23788 | 0 | } |
23789 | 44.0k | if (p->error_indicator) { |
23790 | 0 | p->level--; |
23791 | 0 | return NULL; |
23792 | 0 | } |
23793 | 44.0k | void * _res = NULL; |
23794 | 44.0k | int _mark = p->mark; |
23795 | 44.0k | { // 'async'? 'for' (bitwise_or ((',' bitwise_or))* ','?) !'in' |
23796 | 44.0k | if (p->error_indicator) { |
23797 | 0 | p->level--; |
23798 | 0 | return NULL; |
23799 | 0 | } |
23800 | 44.0k | D(fprintf(stderr, "%*c> invalid_for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'for' (bitwise_or ((',' bitwise_or))* ','?) !'in'")); |
23801 | 44.0k | Token * _keyword; |
23802 | 44.0k | void *_opt_var; |
23803 | 44.0k | UNUSED(_opt_var); // Silence compiler warnings |
23804 | 44.0k | void *_tmp_135_var; |
23805 | 44.0k | if ( |
23806 | 44.0k | (_opt_var = _PyPegen_expect_token(p, 707), !p->error_indicator) // 'async'? |
23807 | 44.0k | && |
23808 | 44.0k | (_keyword = _PyPegen_expect_token(p, 703)) // token='for' |
23809 | 2.96k | && |
23810 | 2.96k | (_tmp_135_var = _tmp_135_rule(p)) // bitwise_or ((',' bitwise_or))* ','? |
23811 | 109 | && |
23812 | 109 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 704) // token='in' |
23813 | 44.0k | ) |
23814 | 25 | { |
23815 | 25 | D(fprintf(stderr, "%*c+ invalid_for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'for' (bitwise_or ((',' bitwise_or))* ','?) !'in'")); |
23816 | 25 | _res = RAISE_SYNTAX_ERROR ( "'in' expected after for-loop variables" ); |
23817 | 25 | if (_res == NULL && PyErr_Occurred()) { |
23818 | 25 | p->error_indicator = 1; |
23819 | 25 | p->level--; |
23820 | 25 | return NULL; |
23821 | 25 | } |
23822 | 0 | goto done; |
23823 | 25 | } |
23824 | 44.0k | p->mark = _mark; |
23825 | 44.0k | D(fprintf(stderr, "%*c%s invalid_for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
23826 | 44.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'for' (bitwise_or ((',' bitwise_or))* ','?) !'in'")); |
23827 | 44.0k | } |
23828 | 44.0k | _res = NULL; |
23829 | 44.0k | done: |
23830 | 44.0k | p->level--; |
23831 | 44.0k | return _res; |
23832 | 44.0k | } |
23833 | | |
23834 | | // invalid_for_target: 'async'? 'for' star_expressions |
23835 | | static void * |
23836 | | invalid_for_target_rule(Parser *p) |
23837 | 43.4k | { |
23838 | 43.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
23839 | 0 | _Pypegen_stack_overflow(p); |
23840 | 0 | } |
23841 | 43.4k | if (p->error_indicator) { |
23842 | 0 | p->level--; |
23843 | 0 | return NULL; |
23844 | 0 | } |
23845 | 43.4k | void * _res = NULL; |
23846 | 43.4k | int _mark = p->mark; |
23847 | 43.4k | { // 'async'? 'for' star_expressions |
23848 | 43.4k | if (p->error_indicator) { |
23849 | 0 | p->level--; |
23850 | 0 | return NULL; |
23851 | 0 | } |
23852 | 43.4k | D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'for' star_expressions")); |
23853 | 43.4k | Token * _keyword; |
23854 | 43.4k | void *_opt_var; |
23855 | 43.4k | UNUSED(_opt_var); // Silence compiler warnings |
23856 | 43.4k | expr_ty a; |
23857 | 43.4k | if ( |
23858 | 43.4k | (_opt_var = _PyPegen_expect_token(p, 707), !p->error_indicator) // 'async'? |
23859 | 43.4k | && |
23860 | 43.4k | (_keyword = _PyPegen_expect_token(p, 703)) // token='for' |
23861 | 2.34k | && |
23862 | 2.34k | (a = star_expressions_rule(p)) // star_expressions |
23863 | 43.4k | ) |
23864 | 1.69k | { |
23865 | 1.69k | D(fprintf(stderr, "%*c+ invalid_for_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'for' star_expressions")); |
23866 | 1.69k | _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a ); |
23867 | 1.69k | if (_res == NULL && PyErr_Occurred()) { |
23868 | 7 | p->error_indicator = 1; |
23869 | 7 | p->level--; |
23870 | 7 | return NULL; |
23871 | 7 | } |
23872 | 1.69k | goto done; |
23873 | 1.69k | } |
23874 | 41.7k | p->mark = _mark; |
23875 | 41.7k | D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ', |
23876 | 41.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'for' star_expressions")); |
23877 | 41.7k | } |
23878 | 41.7k | _res = NULL; |
23879 | 43.4k | done: |
23880 | 43.4k | p->level--; |
23881 | 43.4k | return _res; |
23882 | 41.7k | } |
23883 | | |
23884 | | // invalid_group: '(' starred_expression ')' | '(' '**' expression ')' |
23885 | | static void * |
23886 | | invalid_group_rule(Parser *p) |
23887 | 7.79k | { |
23888 | 7.79k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
23889 | 0 | _Pypegen_stack_overflow(p); |
23890 | 0 | } |
23891 | 7.79k | if (p->error_indicator) { |
23892 | 0 | p->level--; |
23893 | 0 | return NULL; |
23894 | 0 | } |
23895 | 7.79k | void * _res = NULL; |
23896 | 7.79k | int _mark = p->mark; |
23897 | 7.79k | { // '(' starred_expression ')' |
23898 | 7.79k | if (p->error_indicator) { |
23899 | 0 | p->level--; |
23900 | 0 | return NULL; |
23901 | 0 | } |
23902 | 7.79k | D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'")); |
23903 | 7.79k | Token * _literal; |
23904 | 7.79k | Token * _literal_1; |
23905 | 7.79k | expr_ty a; |
23906 | 7.79k | if ( |
23907 | 7.79k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
23908 | 7.79k | && |
23909 | 7.79k | (a = starred_expression_rule(p)) // starred_expression |
23910 | 264 | && |
23911 | 264 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
23912 | 7.79k | ) |
23913 | 2 | { |
23914 | 2 | D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'")); |
23915 | 2 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use starred expression here" ); |
23916 | 2 | if (_res == NULL && PyErr_Occurred()) { |
23917 | 2 | p->error_indicator = 1; |
23918 | 2 | p->level--; |
23919 | 2 | return NULL; |
23920 | 2 | } |
23921 | 0 | goto done; |
23922 | 2 | } |
23923 | 7.78k | p->mark = _mark; |
23924 | 7.78k | D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ', |
23925 | 7.78k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'")); |
23926 | 7.78k | } |
23927 | 0 | { // '(' '**' expression ')' |
23928 | 7.78k | if (p->error_indicator) { |
23929 | 288 | p->level--; |
23930 | 288 | return NULL; |
23931 | 288 | } |
23932 | 7.50k | D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' '**' expression ')'")); |
23933 | 7.50k | Token * _literal; |
23934 | 7.50k | Token * _literal_1; |
23935 | 7.50k | Token * a; |
23936 | 7.50k | expr_ty expression_var; |
23937 | 7.50k | if ( |
23938 | 7.50k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
23939 | 7.50k | && |
23940 | 7.50k | (a = _PyPegen_expect_token(p, 35)) // token='**' |
23941 | 361 | && |
23942 | 361 | (expression_var = expression_rule(p)) // expression |
23943 | 74 | && |
23944 | 74 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
23945 | 7.50k | ) |
23946 | 1 | { |
23947 | 1 | D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' '**' expression ')'")); |
23948 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use double starred expression here" ); |
23949 | 1 | if (_res == NULL && PyErr_Occurred()) { |
23950 | 1 | p->error_indicator = 1; |
23951 | 1 | p->level--; |
23952 | 1 | return NULL; |
23953 | 1 | } |
23954 | 0 | goto done; |
23955 | 1 | } |
23956 | 7.50k | p->mark = _mark; |
23957 | 7.50k | D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ', |
23958 | 7.50k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' '**' expression ')'")); |
23959 | 7.50k | } |
23960 | 7.50k | _res = NULL; |
23961 | 7.50k | done: |
23962 | 7.50k | p->level--; |
23963 | 7.50k | return _res; |
23964 | 7.50k | } |
23965 | | |
23966 | | // invalid_import: 'import' ','.dotted_name+ 'from' dotted_name | 'import' NEWLINE |
23967 | | static void * |
23968 | | invalid_import_rule(Parser *p) |
23969 | 1.71k | { |
23970 | 1.71k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
23971 | 0 | _Pypegen_stack_overflow(p); |
23972 | 0 | } |
23973 | 1.71k | if (p->error_indicator) { |
23974 | 0 | p->level--; |
23975 | 0 | return NULL; |
23976 | 0 | } |
23977 | 1.71k | void * _res = NULL; |
23978 | 1.71k | int _mark = p->mark; |
23979 | 1.71k | { // 'import' ','.dotted_name+ 'from' dotted_name |
23980 | 1.71k | if (p->error_indicator) { |
23981 | 0 | p->level--; |
23982 | 0 | return NULL; |
23983 | 0 | } |
23984 | 1.71k | D(fprintf(stderr, "%*c> invalid_import[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' ','.dotted_name+ 'from' dotted_name")); |
23985 | 1.71k | asdl_seq * _gather_137_var; |
23986 | 1.71k | Token * _keyword; |
23987 | 1.71k | Token * a; |
23988 | 1.71k | expr_ty dotted_name_var; |
23989 | 1.71k | if ( |
23990 | 1.71k | (a = _PyPegen_expect_token(p, 643)) // token='import' |
23991 | 740 | && |
23992 | 740 | (_gather_137_var = _gather_137_rule(p)) // ','.dotted_name+ |
23993 | 733 | && |
23994 | 733 | (_keyword = _PyPegen_expect_token(p, 642)) // token='from' |
23995 | 2 | && |
23996 | 2 | (dotted_name_var = dotted_name_rule(p)) // dotted_name |
23997 | 1.71k | ) |
23998 | 1 | { |
23999 | 1 | D(fprintf(stderr, "%*c+ invalid_import[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' ','.dotted_name+ 'from' dotted_name")); |
24000 | 1 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "Did you mean to use 'from ... import ...' instead?" ); |
24001 | 1 | if (_res == NULL && PyErr_Occurred()) { |
24002 | 1 | p->error_indicator = 1; |
24003 | 1 | p->level--; |
24004 | 1 | return NULL; |
24005 | 1 | } |
24006 | 0 | goto done; |
24007 | 1 | } |
24008 | 1.71k | p->mark = _mark; |
24009 | 1.71k | D(fprintf(stderr, "%*c%s invalid_import[%d-%d]: %s failed!\n", p->level, ' ', |
24010 | 1.71k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' ','.dotted_name+ 'from' dotted_name")); |
24011 | 1.71k | } |
24012 | 0 | { // 'import' NEWLINE |
24013 | 1.71k | if (p->error_indicator) { |
24014 | 1 | p->level--; |
24015 | 1 | return NULL; |
24016 | 1 | } |
24017 | 1.70k | D(fprintf(stderr, "%*c> invalid_import[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' NEWLINE")); |
24018 | 1.70k | Token * _keyword; |
24019 | 1.70k | Token * token; |
24020 | 1.70k | if ( |
24021 | 1.70k | (_keyword = _PyPegen_expect_token(p, 643)) // token='import' |
24022 | 738 | && |
24023 | 738 | (token = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
24024 | 1.70k | ) |
24025 | 4 | { |
24026 | 4 | D(fprintf(stderr, "%*c+ invalid_import[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' NEWLINE")); |
24027 | 4 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( token , "Expected one or more names after 'import'" ); |
24028 | 4 | if (_res == NULL && PyErr_Occurred()) { |
24029 | 4 | p->error_indicator = 1; |
24030 | 4 | p->level--; |
24031 | 4 | return NULL; |
24032 | 4 | } |
24033 | 0 | goto done; |
24034 | 4 | } |
24035 | 1.70k | p->mark = _mark; |
24036 | 1.70k | D(fprintf(stderr, "%*c%s invalid_import[%d-%d]: %s failed!\n", p->level, ' ', |
24037 | 1.70k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' NEWLINE")); |
24038 | 1.70k | } |
24039 | 1.70k | _res = NULL; |
24040 | 1.70k | done: |
24041 | 1.70k | p->level--; |
24042 | 1.70k | return _res; |
24043 | 1.70k | } |
24044 | | |
24045 | | // invalid_dotted_as_name: dotted_name 'as' !(NAME (',' | ')' | ';' | NEWLINE)) expression |
24046 | | static void * |
24047 | | invalid_dotted_as_name_rule(Parser *p) |
24048 | 2.89k | { |
24049 | 2.89k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
24050 | 0 | _Pypegen_stack_overflow(p); |
24051 | 0 | } |
24052 | 2.89k | if (p->error_indicator) { |
24053 | 0 | p->level--; |
24054 | 0 | return NULL; |
24055 | 0 | } |
24056 | 2.89k | void * _res = NULL; |
24057 | 2.89k | int _mark = p->mark; |
24058 | 2.89k | { // dotted_name 'as' !(NAME (',' | ')' | ';' | NEWLINE)) expression |
24059 | 2.89k | if (p->error_indicator) { |
24060 | 0 | p->level--; |
24061 | 0 | return NULL; |
24062 | 0 | } |
24063 | 2.89k | D(fprintf(stderr, "%*c> invalid_dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name 'as' !(NAME (',' | ')' | ';' | NEWLINE)) expression")); |
24064 | 2.89k | Token * _keyword; |
24065 | 2.89k | expr_ty a; |
24066 | 2.89k | expr_ty dotted_name_var; |
24067 | 2.89k | if ( |
24068 | 2.89k | (dotted_name_var = dotted_name_rule(p)) // dotted_name |
24069 | 2.86k | && |
24070 | 2.86k | (_keyword = _PyPegen_expect_token(p, 689)) // token='as' |
24071 | 312 | && |
24072 | 312 | _PyPegen_lookahead(0, _tmp_138_rule, p) |
24073 | 34 | && |
24074 | 34 | (a = expression_rule(p)) // expression |
24075 | 2.89k | ) |
24076 | 4 | { |
24077 | 4 | D(fprintf(stderr, "%*c+ invalid_dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name 'as' !(NAME (',' | ')' | ';' | NEWLINE)) expression")); |
24078 | 4 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use %s as import target" , _PyPegen_get_expr_name ( a ) ); |
24079 | 4 | if (_res == NULL && PyErr_Occurred()) { |
24080 | 4 | p->error_indicator = 1; |
24081 | 4 | p->level--; |
24082 | 4 | return NULL; |
24083 | 4 | } |
24084 | 0 | goto done; |
24085 | 4 | } |
24086 | 2.89k | p->mark = _mark; |
24087 | 2.89k | D(fprintf(stderr, "%*c%s invalid_dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
24088 | 2.89k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name 'as' !(NAME (',' | ')' | ';' | NEWLINE)) expression")); |
24089 | 2.89k | } |
24090 | 2.89k | _res = NULL; |
24091 | 2.89k | done: |
24092 | 2.89k | p->level--; |
24093 | 2.89k | return _res; |
24094 | 2.89k | } |
24095 | | |
24096 | | // invalid_import_from_as_name: NAME 'as' !(NAME (',' | ')' | ';' | NEWLINE)) expression |
24097 | | static void * |
24098 | | invalid_import_from_as_name_rule(Parser *p) |
24099 | 2.34k | { |
24100 | 2.34k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
24101 | 0 | _Pypegen_stack_overflow(p); |
24102 | 0 | } |
24103 | 2.34k | if (p->error_indicator) { |
24104 | 0 | p->level--; |
24105 | 0 | return NULL; |
24106 | 0 | } |
24107 | 2.34k | void * _res = NULL; |
24108 | 2.34k | int _mark = p->mark; |
24109 | 2.34k | { // NAME 'as' !(NAME (',' | ')' | ';' | NEWLINE)) expression |
24110 | 2.34k | if (p->error_indicator) { |
24111 | 0 | p->level--; |
24112 | 0 | return NULL; |
24113 | 0 | } |
24114 | 2.34k | D(fprintf(stderr, "%*c> invalid_import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME 'as' !(NAME (',' | ')' | ';' | NEWLINE)) expression")); |
24115 | 2.34k | Token * _keyword; |
24116 | 2.34k | expr_ty a; |
24117 | 2.34k | expr_ty name_var; |
24118 | 2.34k | if ( |
24119 | 2.34k | (name_var = _PyPegen_name_token(p)) // NAME |
24120 | 1.99k | && |
24121 | 1.99k | (_keyword = _PyPegen_expect_token(p, 689)) // token='as' |
24122 | 286 | && |
24123 | 286 | _PyPegen_lookahead(0, _tmp_138_rule, p) |
24124 | 2 | && |
24125 | 2 | (a = expression_rule(p)) // expression |
24126 | 2.34k | ) |
24127 | 1 | { |
24128 | 1 | D(fprintf(stderr, "%*c+ invalid_import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME 'as' !(NAME (',' | ')' | ';' | NEWLINE)) expression")); |
24129 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use %s as import target" , _PyPegen_get_expr_name ( a ) ); |
24130 | 1 | if (_res == NULL && PyErr_Occurred()) { |
24131 | 1 | p->error_indicator = 1; |
24132 | 1 | p->level--; |
24133 | 1 | return NULL; |
24134 | 1 | } |
24135 | 0 | goto done; |
24136 | 1 | } |
24137 | 2.33k | p->mark = _mark; |
24138 | 2.33k | D(fprintf(stderr, "%*c%s invalid_import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
24139 | 2.33k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME 'as' !(NAME (',' | ')' | ';' | NEWLINE)) expression")); |
24140 | 2.33k | } |
24141 | 2.33k | _res = NULL; |
24142 | 2.33k | done: |
24143 | 2.33k | p->level--; |
24144 | 2.33k | return _res; |
24145 | 2.33k | } |
24146 | | |
24147 | | // invalid_import_from_targets: import_from_as_names ',' NEWLINE | NEWLINE |
24148 | | static void * |
24149 | | invalid_import_from_targets_rule(Parser *p) |
24150 | 33 | { |
24151 | 33 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
24152 | 0 | _Pypegen_stack_overflow(p); |
24153 | 0 | } |
24154 | 33 | if (p->error_indicator) { |
24155 | 0 | p->level--; |
24156 | 0 | return NULL; |
24157 | 0 | } |
24158 | 33 | void * _res = NULL; |
24159 | 33 | int _mark = p->mark; |
24160 | 33 | { // import_from_as_names ',' NEWLINE |
24161 | 33 | if (p->error_indicator) { |
24162 | 0 | p->level--; |
24163 | 0 | return NULL; |
24164 | 0 | } |
24165 | 33 | D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE")); |
24166 | 33 | Token * _literal; |
24167 | 33 | asdl_alias_seq* import_from_as_names_var; |
24168 | 33 | Token * newline_var; |
24169 | 33 | if ( |
24170 | 33 | (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names |
24171 | 20 | && |
24172 | 20 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
24173 | 20 | && |
24174 | 20 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
24175 | 33 | ) |
24176 | 16 | { |
24177 | 16 | D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE")); |
24178 | 16 | _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" ); |
24179 | 16 | if (_res == NULL && PyErr_Occurred()) { |
24180 | 16 | p->error_indicator = 1; |
24181 | 16 | p->level--; |
24182 | 16 | return NULL; |
24183 | 16 | } |
24184 | 0 | goto done; |
24185 | 16 | } |
24186 | 17 | p->mark = _mark; |
24187 | 17 | D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
24188 | 17 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ',' NEWLINE")); |
24189 | 17 | } |
24190 | 0 | { // NEWLINE |
24191 | 17 | if (p->error_indicator) { |
24192 | 0 | p->level--; |
24193 | 0 | return NULL; |
24194 | 0 | } |
24195 | 17 | D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
24196 | 17 | Token * token; |
24197 | 17 | if ( |
24198 | 17 | (token = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
24199 | 17 | ) |
24200 | 7 | { |
24201 | 7 | D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
24202 | 7 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( token , "Expected one or more names after 'import'" ); |
24203 | 7 | if (_res == NULL && PyErr_Occurred()) { |
24204 | 7 | p->error_indicator = 1; |
24205 | 7 | p->level--; |
24206 | 7 | return NULL; |
24207 | 7 | } |
24208 | 0 | goto done; |
24209 | 7 | } |
24210 | 10 | p->mark = _mark; |
24211 | 10 | D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
24212 | 10 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
24213 | 10 | } |
24214 | 10 | _res = NULL; |
24215 | 10 | done: |
24216 | 10 | p->level--; |
24217 | 10 | return _res; |
24218 | 10 | } |
24219 | | |
24220 | | // invalid_with_stmt: |
24221 | | // | 'async'? 'with' ','.(expression ['as' star_target])+ NEWLINE |
24222 | | // | 'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE |
24223 | | static void * |
24224 | | invalid_with_stmt_rule(Parser *p) |
24225 | 505 | { |
24226 | 505 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
24227 | 0 | _Pypegen_stack_overflow(p); |
24228 | 0 | } |
24229 | 505 | if (p->error_indicator) { |
24230 | 0 | p->level--; |
24231 | 0 | return NULL; |
24232 | 0 | } |
24233 | 505 | void * _res = NULL; |
24234 | 505 | int _mark = p->mark; |
24235 | 505 | { // 'async'? 'with' ','.(expression ['as' star_target])+ NEWLINE |
24236 | 505 | if (p->error_indicator) { |
24237 | 0 | p->level--; |
24238 | 0 | return NULL; |
24239 | 0 | } |
24240 | 505 | D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'with' ','.(expression ['as' star_target])+ NEWLINE")); |
24241 | 505 | asdl_seq * _gather_140_var; |
24242 | 505 | Token * _keyword; |
24243 | 505 | void *_opt_var; |
24244 | 505 | UNUSED(_opt_var); // Silence compiler warnings |
24245 | 505 | Token * newline_var; |
24246 | 505 | if ( |
24247 | 505 | (_opt_var = _PyPegen_expect_token(p, 707), !p->error_indicator) // 'async'? |
24248 | 505 | && |
24249 | 505 | (_keyword = _PyPegen_expect_token(p, 656)) // token='with' |
24250 | 179 | && |
24251 | 179 | (_gather_140_var = _gather_140_rule(p)) // ','.(expression ['as' star_target])+ |
24252 | 99 | && |
24253 | 99 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
24254 | 505 | ) |
24255 | 41 | { |
24256 | 41 | D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'with' ','.(expression ['as' star_target])+ NEWLINE")); |
24257 | 41 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
24258 | 41 | if (_res == NULL && PyErr_Occurred()) { |
24259 | 41 | p->error_indicator = 1; |
24260 | 41 | p->level--; |
24261 | 41 | return NULL; |
24262 | 41 | } |
24263 | 0 | goto done; |
24264 | 41 | } |
24265 | 464 | p->mark = _mark; |
24266 | 464 | D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24267 | 464 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'with' ','.(expression ['as' star_target])+ NEWLINE")); |
24268 | 464 | } |
24269 | 0 | { // 'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE |
24270 | 464 | if (p->error_indicator) { |
24271 | 0 | p->level--; |
24272 | 0 | return NULL; |
24273 | 0 | } |
24274 | 464 | D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE")); |
24275 | 464 | asdl_seq * _gather_142_var; |
24276 | 464 | Token * _keyword; |
24277 | 464 | Token * _literal; |
24278 | 464 | Token * _literal_1; |
24279 | 464 | void *_opt_var; |
24280 | 464 | UNUSED(_opt_var); // Silence compiler warnings |
24281 | 464 | void *_opt_var_1; |
24282 | 464 | UNUSED(_opt_var_1); // Silence compiler warnings |
24283 | 464 | Token * newline_var; |
24284 | 464 | if ( |
24285 | 464 | (_opt_var = _PyPegen_expect_token(p, 707), !p->error_indicator) // 'async'? |
24286 | 464 | && |
24287 | 464 | (_keyword = _PyPegen_expect_token(p, 656)) // token='with' |
24288 | 138 | && |
24289 | 138 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
24290 | 102 | && |
24291 | 102 | (_gather_142_var = _gather_142_rule(p)) // ','.(expressions ['as' star_target])+ |
24292 | 80 | && |
24293 | 80 | (_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
24294 | 80 | && |
24295 | 80 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
24296 | 33 | && |
24297 | 33 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
24298 | 464 | ) |
24299 | 6 | { |
24300 | 6 | D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE")); |
24301 | 6 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
24302 | 6 | if (_res == NULL && PyErr_Occurred()) { |
24303 | 6 | p->error_indicator = 1; |
24304 | 6 | p->level--; |
24305 | 6 | return NULL; |
24306 | 6 | } |
24307 | 0 | goto done; |
24308 | 6 | } |
24309 | 458 | p->mark = _mark; |
24310 | 458 | D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24311 | 458 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE")); |
24312 | 458 | } |
24313 | 458 | _res = NULL; |
24314 | 458 | done: |
24315 | 458 | p->level--; |
24316 | 458 | return _res; |
24317 | 458 | } |
24318 | | |
24319 | | // invalid_with_stmt_indent: |
24320 | | // | 'async'? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT |
24321 | | // | 'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT |
24322 | | static void * |
24323 | | invalid_with_stmt_indent_rule(Parser *p) |
24324 | 1.89k | { |
24325 | 1.89k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
24326 | 0 | _Pypegen_stack_overflow(p); |
24327 | 0 | } |
24328 | 1.89k | if (p->error_indicator) { |
24329 | 0 | p->level--; |
24330 | 0 | return NULL; |
24331 | 0 | } |
24332 | 1.89k | void * _res = NULL; |
24333 | 1.89k | int _mark = p->mark; |
24334 | 1.89k | { // 'async'? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT |
24335 | 1.89k | if (p->error_indicator) { |
24336 | 0 | p->level--; |
24337 | 0 | return NULL; |
24338 | 0 | } |
24339 | 1.89k | 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")); |
24340 | 1.89k | asdl_seq * _gather_140_var; |
24341 | 1.89k | Token * _literal; |
24342 | 1.89k | void *_opt_var; |
24343 | 1.89k | UNUSED(_opt_var); // Silence compiler warnings |
24344 | 1.89k | Token * a; |
24345 | 1.89k | Token * newline_var; |
24346 | 1.89k | if ( |
24347 | 1.89k | (_opt_var = _PyPegen_expect_token(p, 707), !p->error_indicator) // 'async'? |
24348 | 1.89k | && |
24349 | 1.89k | (a = _PyPegen_expect_token(p, 656)) // token='with' |
24350 | 1.56k | && |
24351 | 1.56k | (_gather_140_var = _gather_140_rule(p)) // ','.(expression ['as' star_target])+ |
24352 | 1.44k | && |
24353 | 1.44k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
24354 | 1.37k | && |
24355 | 1.37k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
24356 | 64 | && |
24357 | 64 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
24358 | 1.89k | ) |
24359 | 17 | { |
24360 | 17 | 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")); |
24361 | 17 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'with' statement on line %d" , a -> lineno ); |
24362 | 17 | if (_res == NULL && PyErr_Occurred()) { |
24363 | 17 | p->error_indicator = 1; |
24364 | 17 | p->level--; |
24365 | 17 | return NULL; |
24366 | 17 | } |
24367 | 0 | goto done; |
24368 | 17 | } |
24369 | 1.87k | p->mark = _mark; |
24370 | 1.87k | D(fprintf(stderr, "%*c%s invalid_with_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ', |
24371 | 1.87k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT")); |
24372 | 1.87k | } |
24373 | 0 | { // 'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT |
24374 | 1.87k | if (p->error_indicator) { |
24375 | 11 | p->level--; |
24376 | 11 | return NULL; |
24377 | 11 | } |
24378 | 1.86k | 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")); |
24379 | 1.86k | asdl_seq * _gather_142_var; |
24380 | 1.86k | Token * _literal; |
24381 | 1.86k | Token * _literal_1; |
24382 | 1.86k | Token * _literal_2; |
24383 | 1.86k | void *_opt_var; |
24384 | 1.86k | UNUSED(_opt_var); // Silence compiler warnings |
24385 | 1.86k | void *_opt_var_1; |
24386 | 1.86k | UNUSED(_opt_var_1); // Silence compiler warnings |
24387 | 1.86k | Token * a; |
24388 | 1.86k | Token * newline_var; |
24389 | 1.86k | if ( |
24390 | 1.86k | (_opt_var = _PyPegen_expect_token(p, 707), !p->error_indicator) // 'async'? |
24391 | 1.86k | && |
24392 | 1.86k | (a = _PyPegen_expect_token(p, 656)) // token='with' |
24393 | 1.53k | && |
24394 | 1.53k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
24395 | 1.06k | && |
24396 | 1.06k | (_gather_142_var = _gather_142_rule(p)) // ','.(expressions ['as' star_target])+ |
24397 | 829 | && |
24398 | 829 | (_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
24399 | 816 | && |
24400 | 816 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
24401 | 672 | && |
24402 | 672 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
24403 | 364 | && |
24404 | 364 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
24405 | 22 | && |
24406 | 22 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
24407 | 1.86k | ) |
24408 | 2 | { |
24409 | 2 | 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")); |
24410 | 2 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'with' statement on line %d" , a -> lineno ); |
24411 | 2 | if (_res == NULL && PyErr_Occurred()) { |
24412 | 2 | p->error_indicator = 1; |
24413 | 2 | p->level--; |
24414 | 2 | return NULL; |
24415 | 2 | } |
24416 | 0 | goto done; |
24417 | 2 | } |
24418 | 1.86k | p->mark = _mark; |
24419 | 1.86k | D(fprintf(stderr, "%*c%s invalid_with_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ', |
24420 | 1.86k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT")); |
24421 | 1.86k | } |
24422 | 1.86k | _res = NULL; |
24423 | 1.86k | done: |
24424 | 1.86k | p->level--; |
24425 | 1.86k | return _res; |
24426 | 1.86k | } |
24427 | | |
24428 | | // invalid_try_stmt: |
24429 | | // | 'try' ':' NEWLINE !INDENT |
24430 | | // | 'try' ':' block !('except' | 'finally') |
24431 | | // | 'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':' |
24432 | | // | 'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':' |
24433 | | static void * |
24434 | | invalid_try_stmt_rule(Parser *p) |
24435 | 2.01k | { |
24436 | 2.01k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
24437 | 0 | _Pypegen_stack_overflow(p); |
24438 | 0 | } |
24439 | 2.01k | if (p->error_indicator) { |
24440 | 0 | p->level--; |
24441 | 0 | return NULL; |
24442 | 0 | } |
24443 | 2.01k | void * _res = NULL; |
24444 | 2.01k | int _mark = p->mark; |
24445 | 2.01k | { // 'try' ':' NEWLINE !INDENT |
24446 | 2.01k | if (p->error_indicator) { |
24447 | 0 | p->level--; |
24448 | 0 | return NULL; |
24449 | 0 | } |
24450 | 2.01k | D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' NEWLINE !INDENT")); |
24451 | 2.01k | Token * _literal; |
24452 | 2.01k | Token * a; |
24453 | 2.01k | Token * newline_var; |
24454 | 2.01k | if ( |
24455 | 2.01k | (a = _PyPegen_expect_token(p, 665)) // token='try' |
24456 | 2.01k | && |
24457 | 2.01k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
24458 | 2.01k | && |
24459 | 2.01k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
24460 | 134 | && |
24461 | 134 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
24462 | 2.01k | ) |
24463 | 6 | { |
24464 | 6 | D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' NEWLINE !INDENT")); |
24465 | 6 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'try' statement on line %d" , a -> lineno ); |
24466 | 6 | if (_res == NULL && PyErr_Occurred()) { |
24467 | 6 | p->error_indicator = 1; |
24468 | 6 | p->level--; |
24469 | 6 | return NULL; |
24470 | 6 | } |
24471 | 0 | goto done; |
24472 | 6 | } |
24473 | 2.00k | p->mark = _mark; |
24474 | 2.00k | D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24475 | 2.00k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' NEWLINE !INDENT")); |
24476 | 2.00k | } |
24477 | 0 | { // 'try' ':' block !('except' | 'finally') |
24478 | 2.00k | if (p->error_indicator) { |
24479 | 1 | p->level--; |
24480 | 1 | return NULL; |
24481 | 1 | } |
24482 | 2.00k | D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block !('except' | 'finally')")); |
24483 | 2.00k | Token * _keyword; |
24484 | 2.00k | Token * _literal; |
24485 | 2.00k | asdl_stmt_seq* block_var; |
24486 | 2.00k | if ( |
24487 | 2.00k | (_keyword = _PyPegen_expect_token(p, 665)) // token='try' |
24488 | 2.00k | && |
24489 | 2.00k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
24490 | 2.00k | && |
24491 | 2.00k | (block_var = block_rule(p)) // block |
24492 | 1.90k | && |
24493 | 1.90k | _PyPegen_lookahead(0, _tmp_143_rule, p) |
24494 | 2.00k | ) |
24495 | 39 | { |
24496 | 39 | D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block !('except' | 'finally')")); |
24497 | 39 | _res = RAISE_SYNTAX_ERROR ( "expected 'except' or 'finally' block" ); |
24498 | 39 | if (_res == NULL && PyErr_Occurred()) { |
24499 | 39 | p->error_indicator = 1; |
24500 | 39 | p->level--; |
24501 | 39 | return NULL; |
24502 | 39 | } |
24503 | 0 | goto done; |
24504 | 39 | } |
24505 | 1.96k | p->mark = _mark; |
24506 | 1.96k | D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24507 | 1.96k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block !('except' | 'finally')")); |
24508 | 1.96k | } |
24509 | 0 | { // 'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':' |
24510 | 1.96k | if (p->error_indicator) { |
24511 | 16 | p->level--; |
24512 | 16 | return NULL; |
24513 | 16 | } |
24514 | 1.95k | D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'")); |
24515 | 1.95k | Token * _keyword; |
24516 | 1.95k | Token * _literal; |
24517 | 1.95k | Token * _literal_1; |
24518 | 1.95k | asdl_seq * _loop0_144_var; |
24519 | 1.95k | asdl_seq * _loop1_36_var; |
24520 | 1.95k | void *_opt_var; |
24521 | 1.95k | UNUSED(_opt_var); // Silence compiler warnings |
24522 | 1.95k | Token * a; |
24523 | 1.95k | Token * b; |
24524 | 1.95k | expr_ty expression_var; |
24525 | 1.95k | if ( |
24526 | 1.95k | (_keyword = _PyPegen_expect_token(p, 665)) // token='try' |
24527 | 1.95k | && |
24528 | 1.95k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
24529 | 1.95k | && |
24530 | 1.95k | (_loop0_144_var = _loop0_144_rule(p)) // block* |
24531 | 1.95k | && |
24532 | 1.95k | (_loop1_36_var = _loop1_36_rule(p)) // except_block+ |
24533 | 717 | && |
24534 | 717 | (a = _PyPegen_expect_token(p, 686)) // token='except' |
24535 | 30 | && |
24536 | 30 | (b = _PyPegen_expect_token(p, 16)) // token='*' |
24537 | 6 | && |
24538 | 6 | (expression_var = expression_rule(p)) // expression |
24539 | 3 | && |
24540 | 3 | (_opt_var = _tmp_21_rule(p), !p->error_indicator) // ['as' NAME] |
24541 | 2 | && |
24542 | 2 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
24543 | 1.95k | ) |
24544 | 1 | { |
24545 | 1 | D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'")); |
24546 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot have both 'except' and 'except*' on the same 'try'" ); |
24547 | 1 | if (_res == NULL && PyErr_Occurred()) { |
24548 | 1 | p->error_indicator = 1; |
24549 | 1 | p->level--; |
24550 | 1 | return NULL; |
24551 | 1 | } |
24552 | 0 | goto done; |
24553 | 1 | } |
24554 | 1.95k | p->mark = _mark; |
24555 | 1.95k | D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24556 | 1.95k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'")); |
24557 | 1.95k | } |
24558 | 0 | { // 'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':' |
24559 | 1.95k | if (p->error_indicator) { |
24560 | 43 | p->level--; |
24561 | 43 | return NULL; |
24562 | 43 | } |
24563 | 1.90k | D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'")); |
24564 | 1.90k | Token * _keyword; |
24565 | 1.90k | Token * _literal; |
24566 | 1.90k | Token * _literal_1; |
24567 | 1.90k | asdl_seq * _loop0_144_var; |
24568 | 1.90k | asdl_seq * _loop1_37_var; |
24569 | 1.90k | void *_opt_var; |
24570 | 1.90k | UNUSED(_opt_var); // Silence compiler warnings |
24571 | 1.90k | Token * a; |
24572 | 1.90k | if ( |
24573 | 1.90k | (_keyword = _PyPegen_expect_token(p, 665)) // token='try' |
24574 | 1.90k | && |
24575 | 1.90k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
24576 | 1.90k | && |
24577 | 1.90k | (_loop0_144_var = _loop0_144_rule(p)) // block* |
24578 | 1.90k | && |
24579 | 1.90k | (_loop1_37_var = _loop1_37_rule(p)) // except_star_block+ |
24580 | 608 | && |
24581 | 608 | (a = _PyPegen_expect_token(p, 686)) // token='except' |
24582 | 15 | && |
24583 | 15 | (_opt_var = _tmp_145_rule(p), !p->error_indicator) // [expression ['as' NAME]] |
24584 | 13 | && |
24585 | 13 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
24586 | 1.90k | ) |
24587 | 3 | { |
24588 | 3 | D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'")); |
24589 | 3 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot have both 'except' and 'except*' on the same 'try'" ); |
24590 | 3 | if (_res == NULL && PyErr_Occurred()) { |
24591 | 3 | p->error_indicator = 1; |
24592 | 3 | p->level--; |
24593 | 3 | return NULL; |
24594 | 3 | } |
24595 | 0 | goto done; |
24596 | 3 | } |
24597 | 1.90k | p->mark = _mark; |
24598 | 1.90k | D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24599 | 1.90k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'")); |
24600 | 1.90k | } |
24601 | 1.90k | _res = NULL; |
24602 | 1.90k | done: |
24603 | 1.90k | p->level--; |
24604 | 1.90k | return _res; |
24605 | 1.90k | } |
24606 | | |
24607 | | // invalid_except_stmt: |
24608 | | // | 'except' expression ',' expressions 'as' NAME ':' |
24609 | | // | 'except' expression ['as' NAME] NEWLINE |
24610 | | // | 'except' NEWLINE |
24611 | | // | 'except' expression 'as' expression ':' block |
24612 | | static void * |
24613 | | invalid_except_stmt_rule(Parser *p) |
24614 | 3.29k | { |
24615 | 3.29k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
24616 | 0 | _Pypegen_stack_overflow(p); |
24617 | 0 | } |
24618 | 3.29k | if (p->error_indicator) { |
24619 | 0 | p->level--; |
24620 | 0 | return NULL; |
24621 | 0 | } |
24622 | 3.29k | void * _res = NULL; |
24623 | 3.29k | int _mark = p->mark; |
24624 | 3.29k | { // 'except' expression ',' expressions 'as' NAME ':' |
24625 | 3.29k | if (p->error_indicator) { |
24626 | 0 | p->level--; |
24627 | 0 | return NULL; |
24628 | 0 | } |
24629 | 3.29k | D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions 'as' NAME ':'")); |
24630 | 3.29k | Token * _keyword; |
24631 | 3.29k | Token * _keyword_1; |
24632 | 3.29k | Token * _literal; |
24633 | 3.29k | Token * _literal_1; |
24634 | 3.29k | expr_ty a; |
24635 | 3.29k | expr_ty expressions_var; |
24636 | 3.29k | expr_ty name_var; |
24637 | 3.29k | if ( |
24638 | 3.29k | (_keyword = _PyPegen_expect_token(p, 686)) // token='except' |
24639 | 1.44k | && |
24640 | 1.44k | (a = expression_rule(p)) // expression |
24641 | 80 | && |
24642 | 80 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
24643 | 25 | && |
24644 | 25 | (expressions_var = expressions_rule(p)) // expressions |
24645 | 18 | && |
24646 | 18 | (_keyword_1 = _PyPegen_expect_token(p, 689)) // token='as' |
24647 | 7 | && |
24648 | 7 | (name_var = _PyPegen_name_token(p)) // NAME |
24649 | 4 | && |
24650 | 4 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
24651 | 3.29k | ) |
24652 | 1 | { |
24653 | 1 | D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions 'as' NAME ':'")); |
24654 | 1 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "multiple exception types must be parenthesized when using 'as'" ); |
24655 | 1 | if (_res == NULL && PyErr_Occurred()) { |
24656 | 1 | p->error_indicator = 1; |
24657 | 1 | p->level--; |
24658 | 1 | return NULL; |
24659 | 1 | } |
24660 | 0 | goto done; |
24661 | 1 | } |
24662 | 3.29k | p->mark = _mark; |
24663 | 3.29k | D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24664 | 3.29k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ',' expressions 'as' NAME ':'")); |
24665 | 3.29k | } |
24666 | 0 | { // 'except' expression ['as' NAME] NEWLINE |
24667 | 3.29k | if (p->error_indicator) { |
24668 | 1 | p->level--; |
24669 | 1 | return NULL; |
24670 | 1 | } |
24671 | 3.29k | D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] NEWLINE")); |
24672 | 3.29k | void *_opt_var; |
24673 | 3.29k | UNUSED(_opt_var); // Silence compiler warnings |
24674 | 3.29k | Token * a; |
24675 | 3.29k | expr_ty expression_var; |
24676 | 3.29k | Token * newline_var; |
24677 | 3.29k | if ( |
24678 | 3.29k | (a = _PyPegen_expect_token(p, 686)) // token='except' |
24679 | 1.44k | && |
24680 | 1.44k | (expression_var = expression_rule(p)) // expression |
24681 | 78 | && |
24682 | 78 | (_opt_var = _tmp_21_rule(p), !p->error_indicator) // ['as' NAME] |
24683 | 78 | && |
24684 | 78 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
24685 | 3.29k | ) |
24686 | 3 | { |
24687 | 3 | D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] NEWLINE")); |
24688 | 3 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
24689 | 3 | if (_res == NULL && PyErr_Occurred()) { |
24690 | 3 | p->error_indicator = 1; |
24691 | 3 | p->level--; |
24692 | 3 | return NULL; |
24693 | 3 | } |
24694 | 0 | goto done; |
24695 | 3 | } |
24696 | 3.29k | p->mark = _mark; |
24697 | 3.29k | D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24698 | 3.29k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] NEWLINE")); |
24699 | 3.29k | } |
24700 | 0 | { // 'except' NEWLINE |
24701 | 3.29k | if (p->error_indicator) { |
24702 | 0 | p->level--; |
24703 | 0 | return NULL; |
24704 | 0 | } |
24705 | 3.29k | D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' NEWLINE")); |
24706 | 3.29k | Token * a; |
24707 | 3.29k | Token * newline_var; |
24708 | 3.29k | if ( |
24709 | 3.29k | (a = _PyPegen_expect_token(p, 686)) // token='except' |
24710 | 1.44k | && |
24711 | 1.44k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
24712 | 3.29k | ) |
24713 | 10 | { |
24714 | 10 | D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' NEWLINE")); |
24715 | 10 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
24716 | 10 | if (_res == NULL && PyErr_Occurred()) { |
24717 | 10 | p->error_indicator = 1; |
24718 | 10 | p->level--; |
24719 | 10 | return NULL; |
24720 | 10 | } |
24721 | 0 | goto done; |
24722 | 10 | } |
24723 | 3.28k | p->mark = _mark; |
24724 | 3.28k | D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24725 | 3.28k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' NEWLINE")); |
24726 | 3.28k | } |
24727 | 0 | { // 'except' expression 'as' expression ':' block |
24728 | 3.28k | if (p->error_indicator) { |
24729 | 0 | p->level--; |
24730 | 0 | return NULL; |
24731 | 0 | } |
24732 | 3.28k | D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression 'as' expression ':' block")); |
24733 | 3.28k | Token * _keyword; |
24734 | 3.28k | Token * _keyword_1; |
24735 | 3.28k | Token * _literal; |
24736 | 3.28k | expr_ty a; |
24737 | 3.28k | asdl_stmt_seq* block_var; |
24738 | 3.28k | expr_ty expression_var; |
24739 | 3.28k | if ( |
24740 | 3.28k | (_keyword = _PyPegen_expect_token(p, 686)) // token='except' |
24741 | 1.43k | && |
24742 | 1.43k | (expression_var = expression_rule(p)) // expression |
24743 | 75 | && |
24744 | 75 | (_keyword_1 = _PyPegen_expect_token(p, 689)) // token='as' |
24745 | 23 | && |
24746 | 23 | (a = expression_rule(p)) // expression |
24747 | 15 | && |
24748 | 15 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
24749 | 10 | && |
24750 | 10 | (block_var = block_rule(p)) // block |
24751 | 3.28k | ) |
24752 | 1 | { |
24753 | 1 | D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression 'as' expression ':' block")); |
24754 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use except statement with %s" , _PyPegen_get_expr_name ( a ) ); |
24755 | 1 | if (_res == NULL && PyErr_Occurred()) { |
24756 | 1 | p->error_indicator = 1; |
24757 | 1 | p->level--; |
24758 | 1 | return NULL; |
24759 | 1 | } |
24760 | 0 | goto done; |
24761 | 1 | } |
24762 | 3.28k | p->mark = _mark; |
24763 | 3.28k | D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24764 | 3.28k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression 'as' expression ':' block")); |
24765 | 3.28k | } |
24766 | 3.28k | _res = NULL; |
24767 | 3.28k | done: |
24768 | 3.28k | p->level--; |
24769 | 3.28k | return _res; |
24770 | 3.28k | } |
24771 | | |
24772 | | // invalid_except_star_stmt: |
24773 | | // | 'except' '*' expression ',' expressions 'as' NAME ':' |
24774 | | // | 'except' '*' expression ['as' NAME] NEWLINE |
24775 | | // | 'except' '*' (NEWLINE | ':') |
24776 | | // | 'except' '*' expression 'as' expression ':' block |
24777 | | static void * |
24778 | | invalid_except_star_stmt_rule(Parser *p) |
24779 | 2.56k | { |
24780 | 2.56k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
24781 | 0 | _Pypegen_stack_overflow(p); |
24782 | 0 | } |
24783 | 2.56k | if (p->error_indicator) { |
24784 | 0 | p->level--; |
24785 | 0 | return NULL; |
24786 | 0 | } |
24787 | 2.56k | void * _res = NULL; |
24788 | 2.56k | int _mark = p->mark; |
24789 | 2.56k | { // 'except' '*' expression ',' expressions 'as' NAME ':' |
24790 | 2.56k | if (p->error_indicator) { |
24791 | 0 | p->level--; |
24792 | 0 | return NULL; |
24793 | 0 | } |
24794 | 2.56k | D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ',' expressions 'as' NAME ':'")); |
24795 | 2.56k | Token * _keyword; |
24796 | 2.56k | Token * _keyword_1; |
24797 | 2.56k | Token * _literal; |
24798 | 2.56k | Token * _literal_1; |
24799 | 2.56k | Token * _literal_2; |
24800 | 2.56k | expr_ty a; |
24801 | 2.56k | expr_ty expressions_var; |
24802 | 2.56k | expr_ty name_var; |
24803 | 2.56k | if ( |
24804 | 2.56k | (_keyword = _PyPegen_expect_token(p, 686)) // token='except' |
24805 | 891 | && |
24806 | 891 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
24807 | 86 | && |
24808 | 86 | (a = expression_rule(p)) // expression |
24809 | 66 | && |
24810 | 66 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
24811 | 36 | && |
24812 | 36 | (expressions_var = expressions_rule(p)) // expressions |
24813 | 29 | && |
24814 | 29 | (_keyword_1 = _PyPegen_expect_token(p, 689)) // token='as' |
24815 | 6 | && |
24816 | 6 | (name_var = _PyPegen_name_token(p)) // NAME |
24817 | 3 | && |
24818 | 3 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
24819 | 2.56k | ) |
24820 | 0 | { |
24821 | 0 | D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ',' expressions 'as' NAME ':'")); |
24822 | 0 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "multiple exception types must be parenthesized when using 'as'" ); |
24823 | 0 | if (_res == NULL && PyErr_Occurred()) { |
24824 | 0 | p->error_indicator = 1; |
24825 | 0 | p->level--; |
24826 | 0 | return NULL; |
24827 | 0 | } |
24828 | 0 | goto done; |
24829 | 0 | } |
24830 | 2.56k | p->mark = _mark; |
24831 | 2.56k | D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24832 | 2.56k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ',' expressions 'as' NAME ':'")); |
24833 | 2.56k | } |
24834 | 0 | { // 'except' '*' expression ['as' NAME] NEWLINE |
24835 | 2.56k | if (p->error_indicator) { |
24836 | 1 | p->level--; |
24837 | 1 | return NULL; |
24838 | 1 | } |
24839 | 2.55k | D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] NEWLINE")); |
24840 | 2.55k | Token * _literal; |
24841 | 2.55k | void *_opt_var; |
24842 | 2.55k | UNUSED(_opt_var); // Silence compiler warnings |
24843 | 2.55k | Token * a; |
24844 | 2.55k | expr_ty expression_var; |
24845 | 2.55k | Token * newline_var; |
24846 | 2.55k | if ( |
24847 | 2.55k | (a = _PyPegen_expect_token(p, 686)) // token='except' |
24848 | 890 | && |
24849 | 890 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
24850 | 85 | && |
24851 | 85 | (expression_var = expression_rule(p)) // expression |
24852 | 65 | && |
24853 | 65 | (_opt_var = _tmp_21_rule(p), !p->error_indicator) // ['as' NAME] |
24854 | 65 | && |
24855 | 65 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
24856 | 2.55k | ) |
24857 | 4 | { |
24858 | 4 | D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] NEWLINE")); |
24859 | 4 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
24860 | 4 | if (_res == NULL && PyErr_Occurred()) { |
24861 | 4 | p->error_indicator = 1; |
24862 | 4 | p->level--; |
24863 | 4 | return NULL; |
24864 | 4 | } |
24865 | 0 | goto done; |
24866 | 4 | } |
24867 | 2.55k | p->mark = _mark; |
24868 | 2.55k | D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24869 | 2.55k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ['as' NAME] NEWLINE")); |
24870 | 2.55k | } |
24871 | 0 | { // 'except' '*' (NEWLINE | ':') |
24872 | 2.55k | if (p->error_indicator) { |
24873 | 0 | p->level--; |
24874 | 0 | return NULL; |
24875 | 0 | } |
24876 | 2.55k | D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')")); |
24877 | 2.55k | Token * _literal; |
24878 | 2.55k | void *_tmp_146_var; |
24879 | 2.55k | Token * a; |
24880 | 2.55k | if ( |
24881 | 2.55k | (a = _PyPegen_expect_token(p, 686)) // token='except' |
24882 | 886 | && |
24883 | 886 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
24884 | 81 | && |
24885 | 81 | (_tmp_146_var = _tmp_146_rule(p)) // NEWLINE | ':' |
24886 | 2.55k | ) |
24887 | 5 | { |
24888 | 5 | D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')")); |
24889 | 5 | _res = RAISE_SYNTAX_ERROR ( "expected one or more exception types" ); |
24890 | 5 | if (_res == NULL && PyErr_Occurred()) { |
24891 | 5 | p->error_indicator = 1; |
24892 | 5 | p->level--; |
24893 | 5 | return NULL; |
24894 | 5 | } |
24895 | 0 | goto done; |
24896 | 5 | } |
24897 | 2.55k | p->mark = _mark; |
24898 | 2.55k | D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24899 | 2.55k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' (NEWLINE | ':')")); |
24900 | 2.55k | } |
24901 | 0 | { // 'except' '*' expression 'as' expression ':' block |
24902 | 2.55k | if (p->error_indicator) { |
24903 | 0 | p->level--; |
24904 | 0 | return NULL; |
24905 | 0 | } |
24906 | 2.55k | D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression 'as' expression ':' block")); |
24907 | 2.55k | Token * _keyword; |
24908 | 2.55k | Token * _keyword_1; |
24909 | 2.55k | Token * _literal; |
24910 | 2.55k | Token * _literal_1; |
24911 | 2.55k | expr_ty a; |
24912 | 2.55k | asdl_stmt_seq* block_var; |
24913 | 2.55k | expr_ty expression_var; |
24914 | 2.55k | if ( |
24915 | 2.55k | (_keyword = _PyPegen_expect_token(p, 686)) // token='except' |
24916 | 881 | && |
24917 | 881 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
24918 | 76 | && |
24919 | 76 | (expression_var = expression_rule(p)) // expression |
24920 | 61 | && |
24921 | 61 | (_keyword_1 = _PyPegen_expect_token(p, 689)) // token='as' |
24922 | 11 | && |
24923 | 11 | (a = expression_rule(p)) // expression |
24924 | 7 | && |
24925 | 7 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
24926 | 4 | && |
24927 | 4 | (block_var = block_rule(p)) // block |
24928 | 2.55k | ) |
24929 | 1 | { |
24930 | 1 | D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression 'as' expression ':' block")); |
24931 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use except* statement with %s" , _PyPegen_get_expr_name ( a ) ); |
24932 | 1 | if (_res == NULL && PyErr_Occurred()) { |
24933 | 1 | p->error_indicator = 1; |
24934 | 1 | p->level--; |
24935 | 1 | return NULL; |
24936 | 1 | } |
24937 | 0 | goto done; |
24938 | 1 | } |
24939 | 2.54k | p->mark = _mark; |
24940 | 2.54k | D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24941 | 2.54k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression 'as' expression ':' block")); |
24942 | 2.54k | } |
24943 | 2.54k | _res = NULL; |
24944 | 2.54k | done: |
24945 | 2.54k | p->level--; |
24946 | 2.54k | return _res; |
24947 | 2.54k | } |
24948 | | |
24949 | | // invalid_finally_stmt: 'finally' ':' NEWLINE !INDENT |
24950 | | static void * |
24951 | | invalid_finally_stmt_rule(Parser *p) |
24952 | 3.13k | { |
24953 | 3.13k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
24954 | 0 | _Pypegen_stack_overflow(p); |
24955 | 0 | } |
24956 | 3.13k | if (p->error_indicator) { |
24957 | 0 | p->level--; |
24958 | 0 | return NULL; |
24959 | 0 | } |
24960 | 3.13k | void * _res = NULL; |
24961 | 3.13k | int _mark = p->mark; |
24962 | 3.13k | { // 'finally' ':' NEWLINE !INDENT |
24963 | 3.13k | if (p->error_indicator) { |
24964 | 0 | p->level--; |
24965 | 0 | return NULL; |
24966 | 0 | } |
24967 | 3.13k | D(fprintf(stderr, "%*c> invalid_finally_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT")); |
24968 | 3.13k | Token * _literal; |
24969 | 3.13k | Token * a; |
24970 | 3.13k | Token * newline_var; |
24971 | 3.13k | if ( |
24972 | 3.13k | (a = _PyPegen_expect_token(p, 682)) // token='finally' |
24973 | 456 | && |
24974 | 456 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
24975 | 456 | && |
24976 | 456 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
24977 | 68 | && |
24978 | 68 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
24979 | 3.13k | ) |
24980 | 1 | { |
24981 | 1 | D(fprintf(stderr, "%*c+ invalid_finally_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT")); |
24982 | 1 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'finally' statement on line %d" , a -> lineno ); |
24983 | 1 | if (_res == NULL && PyErr_Occurred()) { |
24984 | 1 | p->error_indicator = 1; |
24985 | 1 | p->level--; |
24986 | 1 | return NULL; |
24987 | 1 | } |
24988 | 0 | goto done; |
24989 | 1 | } |
24990 | 3.13k | p->mark = _mark; |
24991 | 3.13k | D(fprintf(stderr, "%*c%s invalid_finally_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
24992 | 3.13k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' NEWLINE !INDENT")); |
24993 | 3.13k | } |
24994 | 3.13k | _res = NULL; |
24995 | 3.13k | done: |
24996 | 3.13k | p->level--; |
24997 | 3.13k | return _res; |
24998 | 3.13k | } |
24999 | | |
25000 | | // invalid_except_stmt_indent: |
25001 | | // | 'except' expression ['as' NAME] ':' NEWLINE !INDENT |
25002 | | // | 'except' ':' NEWLINE !INDENT |
25003 | | static void * |
25004 | | invalid_except_stmt_indent_rule(Parser *p) |
25005 | 6.51k | { |
25006 | 6.51k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25007 | 0 | _Pypegen_stack_overflow(p); |
25008 | 0 | } |
25009 | 6.51k | if (p->error_indicator) { |
25010 | 0 | p->level--; |
25011 | 0 | return NULL; |
25012 | 0 | } |
25013 | 6.51k | void * _res = NULL; |
25014 | 6.51k | int _mark = p->mark; |
25015 | 6.51k | { // 'except' expression ['as' NAME] ':' NEWLINE !INDENT |
25016 | 6.51k | if (p->error_indicator) { |
25017 | 0 | p->level--; |
25018 | 0 | return NULL; |
25019 | 0 | } |
25020 | 6.51k | D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT")); |
25021 | 6.51k | Token * _literal; |
25022 | 6.51k | void *_opt_var; |
25023 | 6.51k | UNUSED(_opt_var); // Silence compiler warnings |
25024 | 6.51k | Token * a; |
25025 | 6.51k | expr_ty expression_var; |
25026 | 6.51k | Token * newline_var; |
25027 | 6.51k | if ( |
25028 | 6.51k | (a = _PyPegen_expect_token(p, 686)) // token='except' |
25029 | 4.66k | && |
25030 | 4.66k | (expression_var = expression_rule(p)) // expression |
25031 | 946 | && |
25032 | 946 | (_opt_var = _tmp_21_rule(p), !p->error_indicator) // ['as' NAME] |
25033 | 945 | && |
25034 | 945 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
25035 | 539 | && |
25036 | 539 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25037 | 92 | && |
25038 | 92 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
25039 | 6.51k | ) |
25040 | 2 | { |
25041 | 2 | D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT")); |
25042 | 2 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno ); |
25043 | 2 | if (_res == NULL && PyErr_Occurred()) { |
25044 | 2 | p->error_indicator = 1; |
25045 | 2 | p->level--; |
25046 | 2 | return NULL; |
25047 | 2 | } |
25048 | 0 | goto done; |
25049 | 2 | } |
25050 | 6.51k | p->mark = _mark; |
25051 | 6.51k | D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ', |
25052 | 6.51k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT")); |
25053 | 6.51k | } |
25054 | 0 | { // 'except' ':' NEWLINE !INDENT |
25055 | 6.51k | if (p->error_indicator) { |
25056 | 2 | p->level--; |
25057 | 2 | return NULL; |
25058 | 2 | } |
25059 | 6.51k | D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT")); |
25060 | 6.51k | Token * _literal; |
25061 | 6.51k | Token * a; |
25062 | 6.51k | Token * newline_var; |
25063 | 6.51k | if ( |
25064 | 6.51k | (a = _PyPegen_expect_token(p, 686)) // token='except' |
25065 | 4.66k | && |
25066 | 4.66k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
25067 | 2.39k | && |
25068 | 2.39k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25069 | 332 | && |
25070 | 332 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
25071 | 6.51k | ) |
25072 | 1 | { |
25073 | 1 | D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT")); |
25074 | 1 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno ); |
25075 | 1 | if (_res == NULL && PyErr_Occurred()) { |
25076 | 1 | p->error_indicator = 1; |
25077 | 1 | p->level--; |
25078 | 1 | return NULL; |
25079 | 1 | } |
25080 | 0 | goto done; |
25081 | 1 | } |
25082 | 6.51k | p->mark = _mark; |
25083 | 6.51k | D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ', |
25084 | 6.51k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' NEWLINE !INDENT")); |
25085 | 6.51k | } |
25086 | 6.51k | _res = NULL; |
25087 | 6.51k | done: |
25088 | 6.51k | p->level--; |
25089 | 6.51k | return _res; |
25090 | 6.51k | } |
25091 | | |
25092 | | // invalid_except_star_stmt_indent: |
25093 | | // | 'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT |
25094 | | static void * |
25095 | | invalid_except_star_stmt_indent_rule(Parser *p) |
25096 | 4.74k | { |
25097 | 4.74k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25098 | 0 | _Pypegen_stack_overflow(p); |
25099 | 0 | } |
25100 | 4.74k | if (p->error_indicator) { |
25101 | 0 | p->level--; |
25102 | 0 | return NULL; |
25103 | 0 | } |
25104 | 4.74k | void * _res = NULL; |
25105 | 4.74k | int _mark = p->mark; |
25106 | 4.74k | { // 'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT |
25107 | 4.74k | if (p->error_indicator) { |
25108 | 0 | p->level--; |
25109 | 0 | return NULL; |
25110 | 0 | } |
25111 | 4.74k | D(fprintf(stderr, "%*c> invalid_except_star_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT")); |
25112 | 4.74k | Token * _literal; |
25113 | 4.74k | Token * _literal_1; |
25114 | 4.74k | void *_opt_var; |
25115 | 4.74k | UNUSED(_opt_var); // Silence compiler warnings |
25116 | 4.74k | Token * a; |
25117 | 4.74k | expr_ty expression_var; |
25118 | 4.74k | Token * newline_var; |
25119 | 4.74k | if ( |
25120 | 4.74k | (a = _PyPegen_expect_token(p, 686)) // token='except' |
25121 | 3.07k | && |
25122 | 3.07k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
25123 | 2.26k | && |
25124 | 2.26k | (expression_var = expression_rule(p)) // expression |
25125 | 2.24k | && |
25126 | 2.24k | (_opt_var = _tmp_21_rule(p), !p->error_indicator) // ['as' NAME] |
25127 | 2.24k | && |
25128 | 2.24k | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
25129 | 1.86k | && |
25130 | 1.86k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25131 | 197 | && |
25132 | 197 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
25133 | 4.74k | ) |
25134 | 4 | { |
25135 | 4 | D(fprintf(stderr, "%*c+ invalid_except_star_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT")); |
25136 | 4 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except*' statement on line %d" , a -> lineno ); |
25137 | 4 | if (_res == NULL && PyErr_Occurred()) { |
25138 | 4 | p->error_indicator = 1; |
25139 | 4 | p->level--; |
25140 | 4 | return NULL; |
25141 | 4 | } |
25142 | 0 | goto done; |
25143 | 4 | } |
25144 | 4.73k | p->mark = _mark; |
25145 | 4.73k | D(fprintf(stderr, "%*c%s invalid_except_star_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ', |
25146 | 4.73k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT")); |
25147 | 4.73k | } |
25148 | 4.73k | _res = NULL; |
25149 | 4.73k | done: |
25150 | 4.73k | p->level--; |
25151 | 4.73k | return _res; |
25152 | 4.73k | } |
25153 | | |
25154 | | // invalid_match_stmt: |
25155 | | // | "match" subject_expr NEWLINE |
25156 | | // | "match" subject_expr ':' NEWLINE !INDENT |
25157 | | // | "case" patterns guard? ':' block |
25158 | | static void * |
25159 | | invalid_match_stmt_rule(Parser *p) |
25160 | 21.1k | { |
25161 | 21.1k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25162 | 0 | _Pypegen_stack_overflow(p); |
25163 | 0 | } |
25164 | 21.1k | if (p->error_indicator) { |
25165 | 0 | p->level--; |
25166 | 0 | return NULL; |
25167 | 0 | } |
25168 | 21.1k | void * _res = NULL; |
25169 | 21.1k | int _mark = p->mark; |
25170 | 21.1k | { // "match" subject_expr NEWLINE |
25171 | 21.1k | if (p->error_indicator) { |
25172 | 0 | p->level--; |
25173 | 0 | return NULL; |
25174 | 0 | } |
25175 | 21.1k | D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr NEWLINE")); |
25176 | 21.1k | expr_ty _keyword; |
25177 | 21.1k | Token * newline_var; |
25178 | 21.1k | expr_ty subject_expr_var; |
25179 | 21.1k | if ( |
25180 | 21.1k | (_keyword = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' |
25181 | 1.27k | && |
25182 | 1.27k | (subject_expr_var = subject_expr_rule(p)) // subject_expr |
25183 | 944 | && |
25184 | 944 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25185 | 21.1k | ) |
25186 | 7 | { |
25187 | 7 | D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr NEWLINE")); |
25188 | 7 | _res = CHECK_VERSION ( void* , 10 , "Pattern matching is" , RAISE_SYNTAX_ERROR ( "expected ':'" ) ); |
25189 | 7 | if (_res == NULL && PyErr_Occurred()) { |
25190 | 7 | p->error_indicator = 1; |
25191 | 7 | p->level--; |
25192 | 7 | return NULL; |
25193 | 7 | } |
25194 | 0 | goto done; |
25195 | 7 | } |
25196 | 21.1k | p->mark = _mark; |
25197 | 21.1k | D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
25198 | 21.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr NEWLINE")); |
25199 | 21.1k | } |
25200 | 0 | { // "match" subject_expr ':' NEWLINE !INDENT |
25201 | 21.1k | if (p->error_indicator) { |
25202 | 0 | p->level--; |
25203 | 0 | return NULL; |
25204 | 0 | } |
25205 | 21.1k | D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT")); |
25206 | 21.1k | Token * _literal; |
25207 | 21.1k | expr_ty a; |
25208 | 21.1k | Token * newline_var; |
25209 | 21.1k | expr_ty subject; |
25210 | 21.1k | if ( |
25211 | 21.1k | (a = _PyPegen_expect_soft_keyword(p, "match")) // soft_keyword='"match"' |
25212 | 1.26k | && |
25213 | 1.26k | (subject = subject_expr_rule(p)) // subject_expr |
25214 | 937 | && |
25215 | 937 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
25216 | 664 | && |
25217 | 664 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25218 | 400 | && |
25219 | 400 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
25220 | 21.1k | ) |
25221 | 3 | { |
25222 | 3 | D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT")); |
25223 | 3 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'match' statement on line %d" , a -> lineno ); |
25224 | 3 | if (_res == NULL && PyErr_Occurred()) { |
25225 | 3 | p->error_indicator = 1; |
25226 | 3 | p->level--; |
25227 | 3 | return NULL; |
25228 | 3 | } |
25229 | 0 | goto done; |
25230 | 3 | } |
25231 | 21.1k | p->mark = _mark; |
25232 | 21.1k | D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
25233 | 21.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT")); |
25234 | 21.1k | } |
25235 | 0 | { // "case" patterns guard? ':' block |
25236 | 21.1k | if (p->error_indicator) { |
25237 | 0 | p->level--; |
25238 | 0 | return NULL; |
25239 | 0 | } |
25240 | 21.1k | D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block")); |
25241 | 21.1k | void *_opt_var; |
25242 | 21.1k | UNUSED(_opt_var); // Silence compiler warnings |
25243 | 21.1k | expr_ty a; |
25244 | 21.1k | Token * b; |
25245 | 21.1k | asdl_stmt_seq* block_var; |
25246 | 21.1k | pattern_ty patterns_var; |
25247 | 21.1k | if ( |
25248 | 21.1k | (a = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' |
25249 | 20 | && |
25250 | 20 | (patterns_var = patterns_rule(p)) // patterns |
25251 | 3 | && |
25252 | 3 | (_opt_var = guard_rule(p), !p->error_indicator) // guard? |
25253 | 3 | && |
25254 | 3 | (b = _PyPegen_expect_token(p, 11)) // token=':' |
25255 | 2 | && |
25256 | 2 | (block_var = block_rule(p)) // block |
25257 | 21.1k | ) |
25258 | 1 | { |
25259 | 1 | D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block")); |
25260 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "case statement must be inside match statement" ); |
25261 | 1 | if (_res == NULL && PyErr_Occurred()) { |
25262 | 1 | p->error_indicator = 1; |
25263 | 1 | p->level--; |
25264 | 1 | return NULL; |
25265 | 1 | } |
25266 | 0 | goto done; |
25267 | 1 | } |
25268 | 21.1k | p->mark = _mark; |
25269 | 21.1k | D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
25270 | 21.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? ':' block")); |
25271 | 21.1k | } |
25272 | 21.1k | _res = NULL; |
25273 | 21.1k | done: |
25274 | 21.1k | p->level--; |
25275 | 21.1k | return _res; |
25276 | 21.1k | } |
25277 | | |
25278 | | // invalid_case_block: |
25279 | | // | "case" patterns guard? NEWLINE |
25280 | | // | "case" patterns guard? ':' NEWLINE !INDENT |
25281 | | static void * |
25282 | | invalid_case_block_rule(Parser *p) |
25283 | 1.95k | { |
25284 | 1.95k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25285 | 0 | _Pypegen_stack_overflow(p); |
25286 | 0 | } |
25287 | 1.95k | if (p->error_indicator) { |
25288 | 0 | p->level--; |
25289 | 0 | return NULL; |
25290 | 0 | } |
25291 | 1.95k | void * _res = NULL; |
25292 | 1.95k | int _mark = p->mark; |
25293 | 1.95k | { // "case" patterns guard? NEWLINE |
25294 | 1.95k | if (p->error_indicator) { |
25295 | 0 | p->level--; |
25296 | 0 | return NULL; |
25297 | 0 | } |
25298 | 1.95k | D(fprintf(stderr, "%*c> invalid_case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? NEWLINE")); |
25299 | 1.95k | expr_ty _keyword; |
25300 | 1.95k | void *_opt_var; |
25301 | 1.95k | UNUSED(_opt_var); // Silence compiler warnings |
25302 | 1.95k | Token * newline_var; |
25303 | 1.95k | pattern_ty patterns_var; |
25304 | 1.95k | if ( |
25305 | 1.95k | (_keyword = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' |
25306 | 1.73k | && |
25307 | 1.73k | (patterns_var = patterns_rule(p)) // patterns |
25308 | 1.44k | && |
25309 | 1.44k | (_opt_var = guard_rule(p), !p->error_indicator) // guard? |
25310 | 1.44k | && |
25311 | 1.44k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25312 | 1.95k | ) |
25313 | 73 | { |
25314 | 73 | D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? NEWLINE")); |
25315 | 73 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
25316 | 73 | if (_res == NULL && PyErr_Occurred()) { |
25317 | 73 | p->error_indicator = 1; |
25318 | 73 | p->level--; |
25319 | 73 | return NULL; |
25320 | 73 | } |
25321 | 0 | goto done; |
25322 | 73 | } |
25323 | 1.88k | p->mark = _mark; |
25324 | 1.88k | D(fprintf(stderr, "%*c%s invalid_case_block[%d-%d]: %s failed!\n", p->level, ' ', |
25325 | 1.88k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? NEWLINE")); |
25326 | 1.88k | } |
25327 | 0 | { // "case" patterns guard? ':' NEWLINE !INDENT |
25328 | 1.88k | if (p->error_indicator) { |
25329 | 54 | p->level--; |
25330 | 54 | return NULL; |
25331 | 54 | } |
25332 | 1.82k | D(fprintf(stderr, "%*c> invalid_case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT")); |
25333 | 1.82k | Token * _literal; |
25334 | 1.82k | void *_opt_var; |
25335 | 1.82k | UNUSED(_opt_var); // Silence compiler warnings |
25336 | 1.82k | expr_ty a; |
25337 | 1.82k | Token * newline_var; |
25338 | 1.82k | pattern_ty patterns_var; |
25339 | 1.82k | if ( |
25340 | 1.82k | (a = _PyPegen_expect_soft_keyword(p, "case")) // soft_keyword='"case"' |
25341 | 1.60k | && |
25342 | 1.60k | (patterns_var = patterns_rule(p)) // patterns |
25343 | 1.37k | && |
25344 | 1.37k | (_opt_var = guard_rule(p), !p->error_indicator) // guard? |
25345 | 1.37k | && |
25346 | 1.37k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
25347 | 1.25k | && |
25348 | 1.25k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25349 | 92 | && |
25350 | 92 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
25351 | 1.82k | ) |
25352 | 9 | { |
25353 | 9 | D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT")); |
25354 | 9 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'case' statement on line %d" , a -> lineno ); |
25355 | 9 | if (_res == NULL && PyErr_Occurred()) { |
25356 | 9 | p->error_indicator = 1; |
25357 | 9 | p->level--; |
25358 | 9 | return NULL; |
25359 | 9 | } |
25360 | 0 | goto done; |
25361 | 9 | } |
25362 | 1.81k | p->mark = _mark; |
25363 | 1.81k | D(fprintf(stderr, "%*c%s invalid_case_block[%d-%d]: %s failed!\n", p->level, ' ', |
25364 | 1.81k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT")); |
25365 | 1.81k | } |
25366 | 1.81k | _res = NULL; |
25367 | 1.81k | done: |
25368 | 1.81k | p->level--; |
25369 | 1.81k | return _res; |
25370 | 1.81k | } |
25371 | | |
25372 | | // invalid_as_pattern: or_pattern 'as' "_" | or_pattern 'as' expression |
25373 | | static void * |
25374 | | invalid_as_pattern_rule(Parser *p) |
25375 | 36.0k | { |
25376 | 36.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25377 | 0 | _Pypegen_stack_overflow(p); |
25378 | 0 | } |
25379 | 36.0k | if (p->error_indicator) { |
25380 | 0 | p->level--; |
25381 | 0 | return NULL; |
25382 | 0 | } |
25383 | 36.0k | void * _res = NULL; |
25384 | 36.0k | int _mark = p->mark; |
25385 | 36.0k | { // or_pattern 'as' "_" |
25386 | 36.0k | if (p->error_indicator) { |
25387 | 0 | p->level--; |
25388 | 0 | return NULL; |
25389 | 0 | } |
25390 | 36.0k | D(fprintf(stderr, "%*c> invalid_as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' \"_\"")); |
25391 | 36.0k | Token * _keyword; |
25392 | 36.0k | expr_ty a; |
25393 | 36.0k | pattern_ty or_pattern_var; |
25394 | 36.0k | if ( |
25395 | 36.0k | (or_pattern_var = or_pattern_rule(p)) // or_pattern |
25396 | 22.2k | && |
25397 | 22.2k | (_keyword = _PyPegen_expect_token(p, 689)) // token='as' |
25398 | 21 | && |
25399 | 21 | (a = _PyPegen_expect_soft_keyword(p, "_")) // soft_keyword='"_"' |
25400 | 36.0k | ) |
25401 | 1 | { |
25402 | 1 | D(fprintf(stderr, "%*c+ invalid_as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' \"_\"")); |
25403 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use '_' as a target" ); |
25404 | 1 | if (_res == NULL && PyErr_Occurred()) { |
25405 | 1 | p->error_indicator = 1; |
25406 | 1 | p->level--; |
25407 | 1 | return NULL; |
25408 | 1 | } |
25409 | 0 | goto done; |
25410 | 1 | } |
25411 | 36.0k | p->mark = _mark; |
25412 | 36.0k | D(fprintf(stderr, "%*c%s invalid_as_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
25413 | 36.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' \"_\"")); |
25414 | 36.0k | } |
25415 | 0 | { // or_pattern 'as' expression |
25416 | 36.0k | if (p->error_indicator) { |
25417 | 0 | p->level--; |
25418 | 0 | return NULL; |
25419 | 0 | } |
25420 | 36.0k | D(fprintf(stderr, "%*c> invalid_as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' expression")); |
25421 | 36.0k | Token * _keyword; |
25422 | 36.0k | expr_ty a; |
25423 | 36.0k | pattern_ty or_pattern_var; |
25424 | 36.0k | if ( |
25425 | 36.0k | (or_pattern_var = or_pattern_rule(p)) // or_pattern |
25426 | 22.2k | && |
25427 | 22.2k | (_keyword = _PyPegen_expect_token(p, 689)) // token='as' |
25428 | 20 | && |
25429 | 20 | (a = expression_rule(p)) // expression |
25430 | 36.0k | ) |
25431 | 1 | { |
25432 | 1 | D(fprintf(stderr, "%*c+ invalid_as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' expression")); |
25433 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use %s as pattern target" , _PyPegen_get_expr_name ( a ) ); |
25434 | 1 | if (_res == NULL && PyErr_Occurred()) { |
25435 | 1 | p->error_indicator = 1; |
25436 | 1 | p->level--; |
25437 | 1 | return NULL; |
25438 | 1 | } |
25439 | 0 | goto done; |
25440 | 1 | } |
25441 | 36.0k | p->mark = _mark; |
25442 | 36.0k | D(fprintf(stderr, "%*c%s invalid_as_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
25443 | 36.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' expression")); |
25444 | 36.0k | } |
25445 | 36.0k | _res = NULL; |
25446 | 36.0k | done: |
25447 | 36.0k | p->level--; |
25448 | 36.0k | return _res; |
25449 | 36.0k | } |
25450 | | |
25451 | | // invalid_class_pattern: name_or_attr '(' invalid_class_argument_pattern |
25452 | | static void * |
25453 | | invalid_class_pattern_rule(Parser *p) |
25454 | 6.85k | { |
25455 | 6.85k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25456 | 0 | _Pypegen_stack_overflow(p); |
25457 | 0 | } |
25458 | 6.85k | if (p->error_indicator) { |
25459 | 0 | p->level--; |
25460 | 0 | return NULL; |
25461 | 0 | } |
25462 | 6.85k | void * _res = NULL; |
25463 | 6.85k | int _mark = p->mark; |
25464 | 6.85k | { // name_or_attr '(' invalid_class_argument_pattern |
25465 | 6.85k | if (p->error_indicator) { |
25466 | 0 | p->level--; |
25467 | 0 | return NULL; |
25468 | 0 | } |
25469 | 6.85k | D(fprintf(stderr, "%*c> invalid_class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern")); |
25470 | 6.85k | Token * _literal; |
25471 | 6.85k | asdl_pattern_seq* a; |
25472 | 6.85k | expr_ty name_or_attr_var; |
25473 | 6.85k | if ( |
25474 | 6.85k | (name_or_attr_var = name_or_attr_rule(p)) // name_or_attr |
25475 | 4.21k | && |
25476 | 4.21k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
25477 | 2.64k | && |
25478 | 2.64k | (a = invalid_class_argument_pattern_rule(p)) // invalid_class_argument_pattern |
25479 | 6.85k | ) |
25480 | 412 | { |
25481 | 412 | D(fprintf(stderr, "%*c+ invalid_class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern")); |
25482 | 412 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( PyPegen_first_item ( a , pattern_ty ) , PyPegen_last_item ( a , pattern_ty ) , "positional patterns follow keyword patterns" ); |
25483 | 412 | if (_res == NULL && PyErr_Occurred()) { |
25484 | 412 | p->error_indicator = 1; |
25485 | 412 | p->level--; |
25486 | 412 | return NULL; |
25487 | 412 | } |
25488 | 0 | goto done; |
25489 | 412 | } |
25490 | 6.44k | p->mark = _mark; |
25491 | 6.44k | D(fprintf(stderr, "%*c%s invalid_class_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
25492 | 6.44k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern")); |
25493 | 6.44k | } |
25494 | 6.44k | _res = NULL; |
25495 | 6.44k | done: |
25496 | 6.44k | p->level--; |
25497 | 6.44k | return _res; |
25498 | 6.44k | } |
25499 | | |
25500 | | // invalid_mapping_pattern: |
25501 | | // | '{' [(items_pattern ',')] double_star_pattern ',' items_pattern ','? '}' |
25502 | | static void * |
25503 | | invalid_mapping_pattern_rule(Parser *p) |
25504 | 8.09k | { |
25505 | 8.09k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25506 | 0 | _Pypegen_stack_overflow(p); |
25507 | 0 | } |
25508 | 8.09k | if (p->error_indicator) { |
25509 | 0 | p->level--; |
25510 | 0 | return NULL; |
25511 | 0 | } |
25512 | 8.09k | void * _res = NULL; |
25513 | 8.09k | int _mark = p->mark; |
25514 | 8.09k | { // '{' [(items_pattern ',')] double_star_pattern ',' items_pattern ','? '}' |
25515 | 8.09k | if (p->error_indicator) { |
25516 | 0 | p->level--; |
25517 | 0 | return NULL; |
25518 | 0 | } |
25519 | 8.09k | D(fprintf(stderr, "%*c> invalid_mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' [(items_pattern ',')] double_star_pattern ',' items_pattern ','? '}'")); |
25520 | 8.09k | Token * _literal; |
25521 | 8.09k | Token * _literal_1; |
25522 | 8.09k | Token * _literal_2; |
25523 | 8.09k | void *_opt_var; |
25524 | 8.09k | UNUSED(_opt_var); // Silence compiler warnings |
25525 | 8.09k | void *_opt_var_1; |
25526 | 8.09k | UNUSED(_opt_var_1); // Silence compiler warnings |
25527 | 8.09k | asdl_seq* items_pattern_var; |
25528 | 8.09k | expr_ty rest; |
25529 | 8.09k | if ( |
25530 | 8.09k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
25531 | 242 | && |
25532 | 242 | (_opt_var = _tmp_147_rule(p), !p->error_indicator) // [(items_pattern ',')] |
25533 | 242 | && |
25534 | 242 | (rest = double_star_pattern_rule(p)) // double_star_pattern |
25535 | 4 | && |
25536 | 4 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
25537 | 1 | && |
25538 | 1 | (items_pattern_var = items_pattern_rule(p)) // items_pattern |
25539 | 0 | && |
25540 | 0 | (_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
25541 | 0 | && |
25542 | 0 | (_literal_2 = _PyPegen_expect_token(p, 26)) // token='}' |
25543 | 8.09k | ) |
25544 | 0 | { |
25545 | 0 | D(fprintf(stderr, "%*c+ invalid_mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' [(items_pattern ',')] double_star_pattern ',' items_pattern ','? '}'")); |
25546 | 0 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( rest , "double star pattern must be the last (right-most) subpattern in the mapping pattern" ); |
25547 | 0 | if (_res == NULL && PyErr_Occurred()) { |
25548 | 0 | p->error_indicator = 1; |
25549 | 0 | p->level--; |
25550 | 0 | return NULL; |
25551 | 0 | } |
25552 | 0 | goto done; |
25553 | 0 | } |
25554 | 8.09k | p->mark = _mark; |
25555 | 8.09k | D(fprintf(stderr, "%*c%s invalid_mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
25556 | 8.09k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' [(items_pattern ',')] double_star_pattern ',' items_pattern ','? '}'")); |
25557 | 8.09k | } |
25558 | 8.09k | _res = NULL; |
25559 | 8.09k | done: |
25560 | 8.09k | p->level--; |
25561 | 8.09k | return _res; |
25562 | 8.09k | } |
25563 | | |
25564 | | // invalid_class_argument_pattern: |
25565 | | // | [positional_patterns ','] keyword_patterns ',' positional_patterns |
25566 | | static asdl_pattern_seq* |
25567 | | invalid_class_argument_pattern_rule(Parser *p) |
25568 | 2.64k | { |
25569 | 2.64k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25570 | 0 | _Pypegen_stack_overflow(p); |
25571 | 0 | } |
25572 | 2.64k | if (p->error_indicator) { |
25573 | 0 | p->level--; |
25574 | 0 | return NULL; |
25575 | 0 | } |
25576 | 2.64k | asdl_pattern_seq* _res = NULL; |
25577 | 2.64k | int _mark = p->mark; |
25578 | 2.64k | { // [positional_patterns ','] keyword_patterns ',' positional_patterns |
25579 | 2.64k | if (p->error_indicator) { |
25580 | 0 | p->level--; |
25581 | 0 | return NULL; |
25582 | 0 | } |
25583 | 2.64k | D(fprintf(stderr, "%*c> invalid_class_argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns")); |
25584 | 2.64k | Token * _literal; |
25585 | 2.64k | void *_opt_var; |
25586 | 2.64k | UNUSED(_opt_var); // Silence compiler warnings |
25587 | 2.64k | asdl_pattern_seq* a; |
25588 | 2.64k | asdl_seq* keyword_patterns_var; |
25589 | 2.64k | if ( |
25590 | 2.64k | (_opt_var = _tmp_148_rule(p), !p->error_indicator) // [positional_patterns ','] |
25591 | 2.64k | && |
25592 | 2.64k | (keyword_patterns_var = keyword_patterns_rule(p)) // keyword_patterns |
25593 | 1.17k | && |
25594 | 1.17k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
25595 | 805 | && |
25596 | 805 | (a = positional_patterns_rule(p)) // positional_patterns |
25597 | 2.64k | ) |
25598 | 412 | { |
25599 | 412 | D(fprintf(stderr, "%*c+ invalid_class_argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns")); |
25600 | 412 | _res = a; |
25601 | 412 | if (_res == NULL && PyErr_Occurred()) { |
25602 | 0 | p->error_indicator = 1; |
25603 | 0 | p->level--; |
25604 | 0 | return NULL; |
25605 | 0 | } |
25606 | 412 | goto done; |
25607 | 412 | } |
25608 | 2.23k | p->mark = _mark; |
25609 | 2.23k | D(fprintf(stderr, "%*c%s invalid_class_argument_pattern[%d-%d]: %s failed!\n", p->level, ' ', |
25610 | 2.23k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns")); |
25611 | 2.23k | } |
25612 | 2.23k | _res = NULL; |
25613 | 2.64k | done: |
25614 | 2.64k | p->level--; |
25615 | 2.64k | return _res; |
25616 | 2.23k | } |
25617 | | |
25618 | | // invalid_if_stmt: |
25619 | | // | 'if' named_expression NEWLINE |
25620 | | // | 'if' named_expression ':' NEWLINE !INDENT |
25621 | | static void * |
25622 | | invalid_if_stmt_rule(Parser *p) |
25623 | 588 | { |
25624 | 588 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25625 | 0 | _Pypegen_stack_overflow(p); |
25626 | 0 | } |
25627 | 588 | if (p->error_indicator) { |
25628 | 0 | p->level--; |
25629 | 0 | return NULL; |
25630 | 0 | } |
25631 | 588 | void * _res = NULL; |
25632 | 588 | int _mark = p->mark; |
25633 | 588 | { // 'if' named_expression NEWLINE |
25634 | 588 | if (p->error_indicator) { |
25635 | 0 | p->level--; |
25636 | 0 | return NULL; |
25637 | 0 | } |
25638 | 588 | D(fprintf(stderr, "%*c> invalid_if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression NEWLINE")); |
25639 | 588 | Token * _keyword; |
25640 | 588 | expr_ty named_expression_var; |
25641 | 588 | Token * newline_var; |
25642 | 588 | if ( |
25643 | 588 | (_keyword = _PyPegen_expect_token(p, 691)) // token='if' |
25644 | 588 | && |
25645 | 588 | (named_expression_var = named_expression_rule(p)) // named_expression |
25646 | 579 | && |
25647 | 579 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25648 | 588 | ) |
25649 | 3 | { |
25650 | 3 | D(fprintf(stderr, "%*c+ invalid_if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression NEWLINE")); |
25651 | 3 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
25652 | 3 | if (_res == NULL && PyErr_Occurred()) { |
25653 | 3 | p->error_indicator = 1; |
25654 | 3 | p->level--; |
25655 | 3 | return NULL; |
25656 | 3 | } |
25657 | 0 | goto done; |
25658 | 3 | } |
25659 | 585 | p->mark = _mark; |
25660 | 585 | D(fprintf(stderr, "%*c%s invalid_if_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
25661 | 585 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression NEWLINE")); |
25662 | 585 | } |
25663 | 0 | { // 'if' named_expression ':' NEWLINE !INDENT |
25664 | 585 | if (p->error_indicator) { |
25665 | 1 | p->level--; |
25666 | 1 | return NULL; |
25667 | 1 | } |
25668 | 584 | D(fprintf(stderr, "%*c> invalid_if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT")); |
25669 | 584 | Token * _literal; |
25670 | 584 | Token * a; |
25671 | 584 | expr_ty a_1; |
25672 | 584 | Token * newline_var; |
25673 | 584 | if ( |
25674 | 584 | (a = _PyPegen_expect_token(p, 691)) // token='if' |
25675 | 584 | && |
25676 | 584 | (a_1 = named_expression_rule(p)) // named_expression |
25677 | 576 | && |
25678 | 576 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
25679 | 575 | && |
25680 | 575 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25681 | 97 | && |
25682 | 97 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
25683 | 584 | ) |
25684 | 5 | { |
25685 | 5 | D(fprintf(stderr, "%*c+ invalid_if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT")); |
25686 | 5 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'if' statement on line %d" , a -> lineno ); |
25687 | 5 | if (_res == NULL && PyErr_Occurred()) { |
25688 | 5 | p->error_indicator = 1; |
25689 | 5 | p->level--; |
25690 | 5 | return NULL; |
25691 | 5 | } |
25692 | 0 | goto done; |
25693 | 5 | } |
25694 | 579 | p->mark = _mark; |
25695 | 579 | D(fprintf(stderr, "%*c%s invalid_if_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
25696 | 579 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT")); |
25697 | 579 | } |
25698 | 579 | _res = NULL; |
25699 | 579 | done: |
25700 | 579 | p->level--; |
25701 | 579 | return _res; |
25702 | 579 | } |
25703 | | |
25704 | | // invalid_elif_stmt: |
25705 | | // | 'elif' named_expression NEWLINE |
25706 | | // | 'elif' named_expression ':' NEWLINE !INDENT |
25707 | | static void * |
25708 | | invalid_elif_stmt_rule(Parser *p) |
25709 | 919 | { |
25710 | 919 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25711 | 0 | _Pypegen_stack_overflow(p); |
25712 | 0 | } |
25713 | 919 | if (p->error_indicator) { |
25714 | 0 | p->level--; |
25715 | 0 | return NULL; |
25716 | 0 | } |
25717 | 919 | void * _res = NULL; |
25718 | 919 | int _mark = p->mark; |
25719 | 919 | { // 'elif' named_expression NEWLINE |
25720 | 919 | if (p->error_indicator) { |
25721 | 0 | p->level--; |
25722 | 0 | return NULL; |
25723 | 0 | } |
25724 | 919 | D(fprintf(stderr, "%*c> invalid_elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression NEWLINE")); |
25725 | 919 | Token * _keyword; |
25726 | 919 | expr_ty named_expression_var; |
25727 | 919 | Token * newline_var; |
25728 | 919 | if ( |
25729 | 919 | (_keyword = _PyPegen_expect_token(p, 696)) // token='elif' |
25730 | 421 | && |
25731 | 421 | (named_expression_var = named_expression_rule(p)) // named_expression |
25732 | 417 | && |
25733 | 417 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25734 | 919 | ) |
25735 | 2 | { |
25736 | 2 | D(fprintf(stderr, "%*c+ invalid_elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression NEWLINE")); |
25737 | 2 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
25738 | 2 | if (_res == NULL && PyErr_Occurred()) { |
25739 | 2 | p->error_indicator = 1; |
25740 | 2 | p->level--; |
25741 | 2 | return NULL; |
25742 | 2 | } |
25743 | 0 | goto done; |
25744 | 2 | } |
25745 | 917 | p->mark = _mark; |
25746 | 917 | D(fprintf(stderr, "%*c%s invalid_elif_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
25747 | 917 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression NEWLINE")); |
25748 | 917 | } |
25749 | 0 | { // 'elif' named_expression ':' NEWLINE !INDENT |
25750 | 917 | if (p->error_indicator) { |
25751 | 1 | p->level--; |
25752 | 1 | return NULL; |
25753 | 1 | } |
25754 | 916 | D(fprintf(stderr, "%*c> invalid_elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT")); |
25755 | 916 | Token * _literal; |
25756 | 916 | Token * a; |
25757 | 916 | expr_ty named_expression_var; |
25758 | 916 | Token * newline_var; |
25759 | 916 | if ( |
25760 | 916 | (a = _PyPegen_expect_token(p, 696)) // token='elif' |
25761 | 418 | && |
25762 | 418 | (named_expression_var = named_expression_rule(p)) // named_expression |
25763 | 415 | && |
25764 | 415 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
25765 | 413 | && |
25766 | 413 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25767 | 50 | && |
25768 | 50 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
25769 | 916 | ) |
25770 | 6 | { |
25771 | 6 | D(fprintf(stderr, "%*c+ invalid_elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT")); |
25772 | 6 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'elif' statement on line %d" , a -> lineno ); |
25773 | 6 | if (_res == NULL && PyErr_Occurred()) { |
25774 | 6 | p->error_indicator = 1; |
25775 | 6 | p->level--; |
25776 | 6 | return NULL; |
25777 | 6 | } |
25778 | 0 | goto done; |
25779 | 6 | } |
25780 | 910 | p->mark = _mark; |
25781 | 910 | D(fprintf(stderr, "%*c%s invalid_elif_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
25782 | 910 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT")); |
25783 | 910 | } |
25784 | 910 | _res = NULL; |
25785 | 910 | done: |
25786 | 910 | p->level--; |
25787 | 910 | return _res; |
25788 | 910 | } |
25789 | | |
25790 | | // invalid_else_stmt: 'else' ':' NEWLINE !INDENT | 'else' ':' block 'elif' |
25791 | | static void * |
25792 | | invalid_else_stmt_rule(Parser *p) |
25793 | 2.76k | { |
25794 | 2.76k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25795 | 0 | _Pypegen_stack_overflow(p); |
25796 | 0 | } |
25797 | 2.76k | if (p->error_indicator) { |
25798 | 0 | p->level--; |
25799 | 0 | return NULL; |
25800 | 0 | } |
25801 | 2.76k | void * _res = NULL; |
25802 | 2.76k | int _mark = p->mark; |
25803 | 2.76k | { // 'else' ':' NEWLINE !INDENT |
25804 | 2.76k | if (p->error_indicator) { |
25805 | 0 | p->level--; |
25806 | 0 | return NULL; |
25807 | 0 | } |
25808 | 2.76k | D(fprintf(stderr, "%*c> invalid_else_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' NEWLINE !INDENT")); |
25809 | 2.76k | Token * _literal; |
25810 | 2.76k | Token * a; |
25811 | 2.76k | Token * newline_var; |
25812 | 2.76k | if ( |
25813 | 2.76k | (a = _PyPegen_expect_token(p, 695)) // token='else' |
25814 | 93 | && |
25815 | 93 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
25816 | 93 | && |
25817 | 93 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25818 | 78 | && |
25819 | 78 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
25820 | 2.76k | ) |
25821 | 3 | { |
25822 | 3 | D(fprintf(stderr, "%*c+ invalid_else_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' NEWLINE !INDENT")); |
25823 | 3 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'else' statement on line %d" , a -> lineno ); |
25824 | 3 | if (_res == NULL && PyErr_Occurred()) { |
25825 | 3 | p->error_indicator = 1; |
25826 | 3 | p->level--; |
25827 | 3 | return NULL; |
25828 | 3 | } |
25829 | 0 | goto done; |
25830 | 3 | } |
25831 | 2.76k | p->mark = _mark; |
25832 | 2.76k | D(fprintf(stderr, "%*c%s invalid_else_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
25833 | 2.76k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' NEWLINE !INDENT")); |
25834 | 2.76k | } |
25835 | 0 | { // 'else' ':' block 'elif' |
25836 | 2.76k | if (p->error_indicator) { |
25837 | 1 | p->level--; |
25838 | 1 | return NULL; |
25839 | 1 | } |
25840 | 2.76k | D(fprintf(stderr, "%*c> invalid_else_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' block 'elif'")); |
25841 | 2.76k | Token * _keyword; |
25842 | 2.76k | Token * _keyword_1; |
25843 | 2.76k | Token * _literal; |
25844 | 2.76k | asdl_stmt_seq* block_var; |
25845 | 2.76k | if ( |
25846 | 2.76k | (_keyword = _PyPegen_expect_token(p, 695)) // token='else' |
25847 | 90 | && |
25848 | 90 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
25849 | 90 | && |
25850 | 90 | (block_var = block_rule(p)) // block |
25851 | 78 | && |
25852 | 78 | (_keyword_1 = _PyPegen_expect_token(p, 696)) // token='elif' |
25853 | 2.76k | ) |
25854 | 1 | { |
25855 | 1 | D(fprintf(stderr, "%*c+ invalid_else_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' block 'elif'")); |
25856 | 1 | _res = RAISE_SYNTAX_ERROR ( "'elif' block follows an 'else' block" ); |
25857 | 1 | if (_res == NULL && PyErr_Occurred()) { |
25858 | 1 | p->error_indicator = 1; |
25859 | 1 | p->level--; |
25860 | 1 | return NULL; |
25861 | 1 | } |
25862 | 0 | goto done; |
25863 | 1 | } |
25864 | 2.76k | p->mark = _mark; |
25865 | 2.76k | D(fprintf(stderr, "%*c%s invalid_else_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
25866 | 2.76k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' block 'elif'")); |
25867 | 2.76k | } |
25868 | 2.76k | _res = NULL; |
25869 | 2.76k | done: |
25870 | 2.76k | p->level--; |
25871 | 2.76k | return _res; |
25872 | 2.76k | } |
25873 | | |
25874 | | // invalid_while_stmt: |
25875 | | // | 'while' named_expression NEWLINE |
25876 | | // | 'while' named_expression ':' NEWLINE !INDENT |
25877 | | static void * |
25878 | | invalid_while_stmt_rule(Parser *p) |
25879 | 432 | { |
25880 | 432 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25881 | 0 | _Pypegen_stack_overflow(p); |
25882 | 0 | } |
25883 | 432 | if (p->error_indicator) { |
25884 | 0 | p->level--; |
25885 | 0 | return NULL; |
25886 | 0 | } |
25887 | 432 | void * _res = NULL; |
25888 | 432 | int _mark = p->mark; |
25889 | 432 | { // 'while' named_expression NEWLINE |
25890 | 432 | if (p->error_indicator) { |
25891 | 0 | p->level--; |
25892 | 0 | return NULL; |
25893 | 0 | } |
25894 | 432 | D(fprintf(stderr, "%*c> invalid_while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression NEWLINE")); |
25895 | 432 | Token * _keyword; |
25896 | 432 | expr_ty named_expression_var; |
25897 | 432 | Token * newline_var; |
25898 | 432 | if ( |
25899 | 432 | (_keyword = _PyPegen_expect_token(p, 698)) // token='while' |
25900 | 432 | && |
25901 | 432 | (named_expression_var = named_expression_rule(p)) // named_expression |
25902 | 429 | && |
25903 | 429 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25904 | 432 | ) |
25905 | 4 | { |
25906 | 4 | D(fprintf(stderr, "%*c+ invalid_while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression NEWLINE")); |
25907 | 4 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
25908 | 4 | if (_res == NULL && PyErr_Occurred()) { |
25909 | 4 | p->error_indicator = 1; |
25910 | 4 | p->level--; |
25911 | 4 | return NULL; |
25912 | 4 | } |
25913 | 0 | goto done; |
25914 | 4 | } |
25915 | 428 | p->mark = _mark; |
25916 | 428 | D(fprintf(stderr, "%*c%s invalid_while_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
25917 | 428 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression NEWLINE")); |
25918 | 428 | } |
25919 | 0 | { // 'while' named_expression ':' NEWLINE !INDENT |
25920 | 428 | if (p->error_indicator) { |
25921 | 1 | p->level--; |
25922 | 1 | return NULL; |
25923 | 1 | } |
25924 | 427 | D(fprintf(stderr, "%*c> invalid_while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT")); |
25925 | 427 | Token * _literal; |
25926 | 427 | Token * a; |
25927 | 427 | expr_ty named_expression_var; |
25928 | 427 | Token * newline_var; |
25929 | 427 | if ( |
25930 | 427 | (a = _PyPegen_expect_token(p, 698)) // token='while' |
25931 | 427 | && |
25932 | 427 | (named_expression_var = named_expression_rule(p)) // named_expression |
25933 | 425 | && |
25934 | 425 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
25935 | 421 | && |
25936 | 421 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
25937 | 132 | && |
25938 | 132 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
25939 | 427 | ) |
25940 | 2 | { |
25941 | 2 | D(fprintf(stderr, "%*c+ invalid_while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT")); |
25942 | 2 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'while' statement on line %d" , a -> lineno ); |
25943 | 2 | if (_res == NULL && PyErr_Occurred()) { |
25944 | 2 | p->error_indicator = 1; |
25945 | 2 | p->level--; |
25946 | 2 | return NULL; |
25947 | 2 | } |
25948 | 0 | goto done; |
25949 | 2 | } |
25950 | 425 | p->mark = _mark; |
25951 | 425 | D(fprintf(stderr, "%*c%s invalid_while_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
25952 | 425 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT")); |
25953 | 425 | } |
25954 | 425 | _res = NULL; |
25955 | 425 | done: |
25956 | 425 | p->level--; |
25957 | 425 | return _res; |
25958 | 425 | } |
25959 | | |
25960 | | // invalid_for_stmt: |
25961 | | // | 'async'? 'for' star_targets 'in' star_expressions NEWLINE |
25962 | | // | 'async'? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT |
25963 | | static void * |
25964 | | invalid_for_stmt_rule(Parser *p) |
25965 | 668 | { |
25966 | 668 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
25967 | 0 | _Pypegen_stack_overflow(p); |
25968 | 0 | } |
25969 | 668 | if (p->error_indicator) { |
25970 | 0 | p->level--; |
25971 | 0 | return NULL; |
25972 | 0 | } |
25973 | 668 | void * _res = NULL; |
25974 | 668 | int _mark = p->mark; |
25975 | 668 | { // 'async'? 'for' star_targets 'in' star_expressions NEWLINE |
25976 | 668 | if (p->error_indicator) { |
25977 | 0 | p->level--; |
25978 | 0 | return NULL; |
25979 | 0 | } |
25980 | 668 | D(fprintf(stderr, "%*c> invalid_for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'for' star_targets 'in' star_expressions NEWLINE")); |
25981 | 668 | Token * _keyword; |
25982 | 668 | Token * _keyword_1; |
25983 | 668 | void *_opt_var; |
25984 | 668 | UNUSED(_opt_var); // Silence compiler warnings |
25985 | 668 | Token * newline_var; |
25986 | 668 | expr_ty star_expressions_var; |
25987 | 668 | expr_ty star_targets_var; |
25988 | 668 | if ( |
25989 | 668 | (_opt_var = _PyPegen_expect_token(p, 707), !p->error_indicator) // 'async'? |
25990 | 668 | && |
25991 | 668 | (_keyword = _PyPegen_expect_token(p, 703)) // token='for' |
25992 | 620 | && |
25993 | 620 | (star_targets_var = star_targets_rule(p)) // star_targets |
25994 | 599 | && |
25995 | 599 | (_keyword_1 = _PyPegen_expect_token(p, 704)) // token='in' |
25996 | 585 | && |
25997 | 585 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
25998 | 581 | && |
25999 | 581 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
26000 | 668 | ) |
26001 | 3 | { |
26002 | 3 | 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")); |
26003 | 3 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
26004 | 3 | if (_res == NULL && PyErr_Occurred()) { |
26005 | 3 | p->error_indicator = 1; |
26006 | 3 | p->level--; |
26007 | 3 | return NULL; |
26008 | 3 | } |
26009 | 0 | goto done; |
26010 | 3 | } |
26011 | 665 | p->mark = _mark; |
26012 | 665 | D(fprintf(stderr, "%*c%s invalid_for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
26013 | 665 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'for' star_targets 'in' star_expressions NEWLINE")); |
26014 | 665 | } |
26015 | 0 | { // 'async'? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT |
26016 | 665 | if (p->error_indicator) { |
26017 | 5 | p->level--; |
26018 | 5 | return NULL; |
26019 | 5 | } |
26020 | 660 | 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")); |
26021 | 660 | Token * _keyword; |
26022 | 660 | Token * _literal; |
26023 | 660 | void *_opt_var; |
26024 | 660 | UNUSED(_opt_var); // Silence compiler warnings |
26025 | 660 | Token * a; |
26026 | 660 | Token * newline_var; |
26027 | 660 | expr_ty star_expressions_var; |
26028 | 660 | expr_ty star_targets_var; |
26029 | 660 | if ( |
26030 | 660 | (_opt_var = _PyPegen_expect_token(p, 707), !p->error_indicator) // 'async'? |
26031 | 660 | && |
26032 | 660 | (a = _PyPegen_expect_token(p, 703)) // token='for' |
26033 | 612 | && |
26034 | 612 | (star_targets_var = star_targets_rule(p)) // star_targets |
26035 | 596 | && |
26036 | 596 | (_keyword = _PyPegen_expect_token(p, 704)) // token='in' |
26037 | 582 | && |
26038 | 582 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
26039 | 578 | && |
26040 | 578 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
26041 | 576 | && |
26042 | 576 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
26043 | 68 | && |
26044 | 68 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
26045 | 660 | ) |
26046 | 4 | { |
26047 | 4 | 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")); |
26048 | 4 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'for' statement on line %d" , a -> lineno ); |
26049 | 4 | if (_res == NULL && PyErr_Occurred()) { |
26050 | 4 | p->error_indicator = 1; |
26051 | 4 | p->level--; |
26052 | 4 | return NULL; |
26053 | 4 | } |
26054 | 0 | goto done; |
26055 | 4 | } |
26056 | 656 | p->mark = _mark; |
26057 | 656 | D(fprintf(stderr, "%*c%s invalid_for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
26058 | 656 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT")); |
26059 | 656 | } |
26060 | 656 | _res = NULL; |
26061 | 656 | done: |
26062 | 656 | p->level--; |
26063 | 656 | return _res; |
26064 | 656 | } |
26065 | | |
26066 | | // invalid_def_raw: |
26067 | | // | 'async'? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT |
26068 | | // | 'async'? 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block |
26069 | | static void * |
26070 | | invalid_def_raw_rule(Parser *p) |
26071 | 3.91k | { |
26072 | 3.91k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
26073 | 0 | _Pypegen_stack_overflow(p); |
26074 | 0 | } |
26075 | 3.91k | if (p->error_indicator) { |
26076 | 0 | p->level--; |
26077 | 0 | return NULL; |
26078 | 0 | } |
26079 | 3.91k | void * _res = NULL; |
26080 | 3.91k | int _mark = p->mark; |
26081 | 3.91k | { // 'async'? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT |
26082 | 3.91k | if (p->error_indicator) { |
26083 | 0 | p->level--; |
26084 | 0 | return NULL; |
26085 | 0 | } |
26086 | 3.91k | D(fprintf(stderr, "%*c> invalid_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT")); |
26087 | 3.91k | Token * _literal; |
26088 | 3.91k | Token * _literal_1; |
26089 | 3.91k | Token * _literal_2; |
26090 | 3.91k | void *_opt_var; |
26091 | 3.91k | UNUSED(_opt_var); // Silence compiler warnings |
26092 | 3.91k | void *_opt_var_1; |
26093 | 3.91k | UNUSED(_opt_var_1); // Silence compiler warnings |
26094 | 3.91k | void *_opt_var_2; |
26095 | 3.91k | UNUSED(_opt_var_2); // Silence compiler warnings |
26096 | 3.91k | void *_opt_var_3; |
26097 | 3.91k | UNUSED(_opt_var_3); // Silence compiler warnings |
26098 | 3.91k | Token * a; |
26099 | 3.91k | expr_ty name_var; |
26100 | 3.91k | Token * newline_var; |
26101 | 3.91k | if ( |
26102 | 3.91k | (_opt_var = _PyPegen_expect_token(p, 707), !p->error_indicator) // 'async'? |
26103 | 3.91k | && |
26104 | 3.91k | (a = _PyPegen_expect_token(p, 708)) // token='def' |
26105 | 2.65k | && |
26106 | 2.65k | (name_var = _PyPegen_name_token(p)) // NAME |
26107 | 2.64k | && |
26108 | 2.64k | (_opt_var_1 = type_params_rule(p), !p->error_indicator) // type_params? |
26109 | 2.63k | && |
26110 | 2.63k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
26111 | 2.56k | && |
26112 | 2.56k | (_opt_var_2 = params_rule(p), !p->error_indicator) // params? |
26113 | 2.52k | && |
26114 | 2.52k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
26115 | 2.37k | && |
26116 | 2.37k | (_opt_var_3 = _tmp_26_rule(p), !p->error_indicator) // ['->' expression] |
26117 | 2.37k | && |
26118 | 2.37k | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
26119 | 2.31k | && |
26120 | 2.31k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
26121 | 154 | && |
26122 | 154 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
26123 | 3.91k | ) |
26124 | 22 | { |
26125 | 22 | D(fprintf(stderr, "%*c+ invalid_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT")); |
26126 | 22 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after function definition on line %d" , a -> lineno ); |
26127 | 22 | if (_res == NULL && PyErr_Occurred()) { |
26128 | 22 | p->error_indicator = 1; |
26129 | 22 | p->level--; |
26130 | 22 | return NULL; |
26131 | 22 | } |
26132 | 0 | goto done; |
26133 | 22 | } |
26134 | 3.89k | p->mark = _mark; |
26135 | 3.89k | D(fprintf(stderr, "%*c%s invalid_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
26136 | 3.89k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT")); |
26137 | 3.89k | } |
26138 | 0 | { // 'async'? 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block |
26139 | 3.89k | if (p->error_indicator) { |
26140 | 59 | p->level--; |
26141 | 59 | return NULL; |
26142 | 59 | } |
26143 | 3.83k | D(fprintf(stderr, "%*c> invalid_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'? 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block")); |
26144 | 3.83k | Token * _keyword; |
26145 | 3.83k | Token * _literal; |
26146 | 3.83k | Token * _literal_1; |
26147 | 3.83k | Token * _literal_2; |
26148 | 3.83k | void *_opt_var; |
26149 | 3.83k | UNUSED(_opt_var); // Silence compiler warnings |
26150 | 3.83k | void *_opt_var_1; |
26151 | 3.83k | UNUSED(_opt_var_1); // Silence compiler warnings |
26152 | 3.83k | void *_opt_var_2; |
26153 | 3.83k | UNUSED(_opt_var_2); // Silence compiler warnings |
26154 | 3.83k | void *_opt_var_3; |
26155 | 3.83k | UNUSED(_opt_var_3); // Silence compiler warnings |
26156 | 3.83k | void *_opt_var_4; |
26157 | 3.83k | UNUSED(_opt_var_4); // Silence compiler warnings |
26158 | 3.83k | asdl_stmt_seq* block_var; |
26159 | 3.83k | expr_ty name_var; |
26160 | 3.83k | if ( |
26161 | 3.83k | (_opt_var = _PyPegen_expect_token(p, 707), !p->error_indicator) // 'async'? |
26162 | 3.83k | && |
26163 | 3.83k | (_keyword = _PyPegen_expect_token(p, 708)) // token='def' |
26164 | 2.56k | && |
26165 | 2.56k | (name_var = _PyPegen_name_token(p)) // NAME |
26166 | 2.56k | && |
26167 | 2.56k | (_opt_var_1 = type_params_rule(p), !p->error_indicator) // type_params? |
26168 | 2.56k | && |
26169 | 2.56k | (_literal = _PyPegen_expect_forced_token(p, 7, "(")) // forced_token='(' |
26170 | 2.49k | && |
26171 | 2.49k | (_opt_var_2 = params_rule(p), !p->error_indicator) // params? |
26172 | 2.49k | && |
26173 | 2.49k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
26174 | 2.34k | && |
26175 | 2.34k | (_opt_var_3 = _tmp_26_rule(p), !p->error_indicator) // ['->' expression] |
26176 | 2.34k | && |
26177 | 2.34k | (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' |
26178 | 2.28k | && |
26179 | 2.28k | (_opt_var_4 = func_type_comment_rule(p), !p->error_indicator) // func_type_comment? |
26180 | 2.28k | && |
26181 | 2.28k | (block_var = block_rule(p)) // block |
26182 | 3.83k | ) |
26183 | 2.20k | { |
26184 | 2.20k | D(fprintf(stderr, "%*c+ invalid_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block")); |
26185 | 2.20k | _res = _PyPegen_dummy_name(p, _opt_var, _keyword, name_var, _opt_var_1, _literal, _opt_var_2, _literal_1, _opt_var_3, _literal_2, _opt_var_4, block_var); |
26186 | 2.20k | goto done; |
26187 | 2.20k | } |
26188 | 1.62k | p->mark = _mark; |
26189 | 1.62k | D(fprintf(stderr, "%*c%s invalid_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
26190 | 1.62k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'? 'def' NAME type_params? &&'(' params? ')' ['->' expression] &&':' func_type_comment? block")); |
26191 | 1.62k | } |
26192 | 1.62k | _res = NULL; |
26193 | 3.83k | done: |
26194 | 3.83k | p->level--; |
26195 | 3.83k | return _res; |
26196 | 1.62k | } |
26197 | | |
26198 | | // invalid_class_def_raw: |
26199 | | // | 'class' NAME type_params? ['(' arguments? ')'] NEWLINE |
26200 | | // | 'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT |
26201 | | static void * |
26202 | | invalid_class_def_raw_rule(Parser *p) |
26203 | 1.12k | { |
26204 | 1.12k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
26205 | 0 | _Pypegen_stack_overflow(p); |
26206 | 0 | } |
26207 | 1.12k | if (p->error_indicator) { |
26208 | 0 | p->level--; |
26209 | 0 | return NULL; |
26210 | 0 | } |
26211 | 1.12k | void * _res = NULL; |
26212 | 1.12k | int _mark = p->mark; |
26213 | 1.12k | { // 'class' NAME type_params? ['(' arguments? ')'] NEWLINE |
26214 | 1.12k | if (p->error_indicator) { |
26215 | 0 | p->level--; |
26216 | 0 | return NULL; |
26217 | 0 | } |
26218 | 1.12k | D(fprintf(stderr, "%*c> invalid_class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] NEWLINE")); |
26219 | 1.12k | Token * _keyword; |
26220 | 1.12k | void *_opt_var; |
26221 | 1.12k | UNUSED(_opt_var); // Silence compiler warnings |
26222 | 1.12k | void *_opt_var_1; |
26223 | 1.12k | UNUSED(_opt_var_1); // Silence compiler warnings |
26224 | 1.12k | expr_ty name_var; |
26225 | 1.12k | Token * newline_var; |
26226 | 1.12k | if ( |
26227 | 1.12k | (_keyword = _PyPegen_expect_token(p, 710)) // token='class' |
26228 | 918 | && |
26229 | 918 | (name_var = _PyPegen_name_token(p)) // NAME |
26230 | 910 | && |
26231 | 910 | (_opt_var = type_params_rule(p), !p->error_indicator) // type_params? |
26232 | 908 | && |
26233 | 908 | (_opt_var_1 = _tmp_25_rule(p), !p->error_indicator) // ['(' arguments? ')'] |
26234 | 907 | && |
26235 | 907 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
26236 | 1.12k | ) |
26237 | 7 | { |
26238 | 7 | D(fprintf(stderr, "%*c+ invalid_class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] NEWLINE")); |
26239 | 7 | _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); |
26240 | 7 | if (_res == NULL && PyErr_Occurred()) { |
26241 | 7 | p->error_indicator = 1; |
26242 | 7 | p->level--; |
26243 | 7 | return NULL; |
26244 | 7 | } |
26245 | 0 | goto done; |
26246 | 7 | } |
26247 | 1.12k | p->mark = _mark; |
26248 | 1.12k | D(fprintf(stderr, "%*c%s invalid_class_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
26249 | 1.12k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] NEWLINE")); |
26250 | 1.12k | } |
26251 | 0 | { // 'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT |
26252 | 1.12k | if (p->error_indicator) { |
26253 | 3 | p->level--; |
26254 | 3 | return NULL; |
26255 | 3 | } |
26256 | 1.11k | D(fprintf(stderr, "%*c> invalid_class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT")); |
26257 | 1.11k | Token * _literal; |
26258 | 1.11k | void *_opt_var; |
26259 | 1.11k | UNUSED(_opt_var); // Silence compiler warnings |
26260 | 1.11k | void *_opt_var_1; |
26261 | 1.11k | UNUSED(_opt_var_1); // Silence compiler warnings |
26262 | 1.11k | Token * a; |
26263 | 1.11k | expr_ty name_var; |
26264 | 1.11k | Token * newline_var; |
26265 | 1.11k | if ( |
26266 | 1.11k | (a = _PyPegen_expect_token(p, 710)) // token='class' |
26267 | 908 | && |
26268 | 908 | (name_var = _PyPegen_name_token(p)) // NAME |
26269 | 900 | && |
26270 | 900 | (_opt_var = type_params_rule(p), !p->error_indicator) // type_params? |
26271 | 900 | && |
26272 | 900 | (_opt_var_1 = _tmp_25_rule(p), !p->error_indicator) // ['(' arguments? ')'] |
26273 | 900 | && |
26274 | 900 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
26275 | 877 | && |
26276 | 877 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
26277 | 119 | && |
26278 | 119 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
26279 | 1.11k | ) |
26280 | 8 | { |
26281 | 8 | D(fprintf(stderr, "%*c+ invalid_class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT")); |
26282 | 8 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block after class definition on line %d" , a -> lineno ); |
26283 | 8 | if (_res == NULL && PyErr_Occurred()) { |
26284 | 8 | p->error_indicator = 1; |
26285 | 8 | p->level--; |
26286 | 8 | return NULL; |
26287 | 8 | } |
26288 | 0 | goto done; |
26289 | 8 | } |
26290 | 1.10k | p->mark = _mark; |
26291 | 1.10k | D(fprintf(stderr, "%*c%s invalid_class_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
26292 | 1.10k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT")); |
26293 | 1.10k | } |
26294 | 1.10k | _res = NULL; |
26295 | 1.10k | done: |
26296 | 1.10k | p->level--; |
26297 | 1.10k | return _res; |
26298 | 1.10k | } |
26299 | | |
26300 | | // invalid_double_starred_kvpairs: |
26301 | | // | ','.double_starred_kvpair+ ',' invalid_kvpair |
26302 | | // | expression ':' '*' bitwise_or |
26303 | | // | expression ':' &('}' | ',') |
26304 | | static void * |
26305 | | invalid_double_starred_kvpairs_rule(Parser *p) |
26306 | 11.5k | { |
26307 | 11.5k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
26308 | 0 | _Pypegen_stack_overflow(p); |
26309 | 0 | } |
26310 | 11.5k | if (p->error_indicator) { |
26311 | 0 | p->level--; |
26312 | 0 | return NULL; |
26313 | 0 | } |
26314 | 11.5k | void * _res = NULL; |
26315 | 11.5k | int _mark = p->mark; |
26316 | 11.5k | { // ','.double_starred_kvpair+ ',' invalid_kvpair |
26317 | 11.5k | if (p->error_indicator) { |
26318 | 0 | p->level--; |
26319 | 0 | return NULL; |
26320 | 0 | } |
26321 | 11.5k | D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair")); |
26322 | 11.5k | asdl_seq * _gather_84_var; |
26323 | 11.5k | Token * _literal; |
26324 | 11.5k | void *invalid_kvpair_var; |
26325 | 11.5k | if ( |
26326 | 11.5k | (_gather_84_var = _gather_84_rule(p)) // ','.double_starred_kvpair+ |
26327 | 2.79k | && |
26328 | 2.79k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
26329 | 687 | && |
26330 | 687 | (invalid_kvpair_var = invalid_kvpair_rule(p)) // invalid_kvpair |
26331 | 11.5k | ) |
26332 | 0 | { |
26333 | 0 | D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair")); |
26334 | 0 | _res = _PyPegen_dummy_name(p, _gather_84_var, _literal, invalid_kvpair_var); |
26335 | 0 | goto done; |
26336 | 0 | } |
26337 | 11.5k | p->mark = _mark; |
26338 | 11.5k | D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ', |
26339 | 11.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair")); |
26340 | 11.5k | } |
26341 | 0 | { // expression ':' '*' bitwise_or |
26342 | 11.5k | if (p->error_indicator) { |
26343 | 44 | p->level--; |
26344 | 44 | return NULL; |
26345 | 44 | } |
26346 | 11.5k | D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or")); |
26347 | 11.5k | Token * _literal; |
26348 | 11.5k | Token * a; |
26349 | 11.5k | expr_ty bitwise_or_var; |
26350 | 11.5k | expr_ty expression_var; |
26351 | 11.5k | if ( |
26352 | 11.5k | (expression_var = expression_rule(p)) // expression |
26353 | 7.72k | && |
26354 | 7.72k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
26355 | 3.39k | && |
26356 | 3.39k | (a = _PyPegen_expect_token(p, 16)) // token='*' |
26357 | 411 | && |
26358 | 411 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
26359 | 11.5k | ) |
26360 | 1 | { |
26361 | 1 | D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or")); |
26362 | 1 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "cannot use a starred expression in a dictionary value" ); |
26363 | 1 | if (_res == NULL && PyErr_Occurred()) { |
26364 | 1 | p->error_indicator = 1; |
26365 | 1 | p->level--; |
26366 | 1 | return NULL; |
26367 | 1 | } |
26368 | 0 | goto done; |
26369 | 1 | } |
26370 | 11.5k | p->mark = _mark; |
26371 | 11.5k | D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ', |
26372 | 11.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' '*' bitwise_or")); |
26373 | 11.5k | } |
26374 | 0 | { // expression ':' &('}' | ',') |
26375 | 11.5k | if (p->error_indicator) { |
26376 | 237 | p->level--; |
26377 | 237 | return NULL; |
26378 | 237 | } |
26379 | 11.2k | D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')")); |
26380 | 11.2k | Token * a; |
26381 | 11.2k | expr_ty expression_var; |
26382 | 11.2k | if ( |
26383 | 11.2k | (expression_var = expression_rule(p)) // expression |
26384 | 7.48k | && |
26385 | 7.48k | (a = _PyPegen_expect_token(p, 11)) // token=':' |
26386 | 3.15k | && |
26387 | 3.15k | _PyPegen_lookahead(1, _tmp_149_rule, p) |
26388 | 11.2k | ) |
26389 | 3 | { |
26390 | 3 | D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')")); |
26391 | 3 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression expected after dictionary key and ':'" ); |
26392 | 3 | if (_res == NULL && PyErr_Occurred()) { |
26393 | 3 | p->error_indicator = 1; |
26394 | 3 | p->level--; |
26395 | 3 | return NULL; |
26396 | 3 | } |
26397 | 0 | goto done; |
26398 | 3 | } |
26399 | 11.2k | p->mark = _mark; |
26400 | 11.2k | D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ', |
26401 | 11.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' &('}' | ',')")); |
26402 | 11.2k | } |
26403 | 11.2k | _res = NULL; |
26404 | 11.2k | done: |
26405 | 11.2k | p->level--; |
26406 | 11.2k | return _res; |
26407 | 11.2k | } |
26408 | | |
26409 | | // invalid_kvpair: |
26410 | | // | expression !(':') |
26411 | | // | expression ':' '*' bitwise_or |
26412 | | // | expression ':' &('}' | ',') |
26413 | | static void * |
26414 | | invalid_kvpair_rule(Parser *p) |
26415 | 687 | { |
26416 | 687 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
26417 | 0 | _Pypegen_stack_overflow(p); |
26418 | 0 | } |
26419 | 687 | if (p->error_indicator) { |
26420 | 0 | p->level--; |
26421 | 0 | return NULL; |
26422 | 0 | } |
26423 | 687 | void * _res = NULL; |
26424 | 687 | int _mark = p->mark; |
26425 | 687 | { // expression !(':') |
26426 | 687 | if (p->error_indicator) { |
26427 | 0 | p->level--; |
26428 | 0 | return NULL; |
26429 | 0 | } |
26430 | 687 | D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !(':')")); |
26431 | 687 | expr_ty a; |
26432 | 687 | if ( |
26433 | 687 | (a = expression_rule(p)) // expression |
26434 | 125 | && |
26435 | 125 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11) // token=(':') |
26436 | 687 | ) |
26437 | 4 | { |
26438 | 4 | D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !(':')")); |
26439 | 4 | _res = RAISE_ERROR_KNOWN_LOCATION ( p , PyExc_SyntaxError , a -> lineno , a -> end_col_offset - 1 , a -> end_lineno , - 1 , "':' expected after dictionary key" ); |
26440 | 4 | if (_res == NULL && PyErr_Occurred()) { |
26441 | 4 | p->error_indicator = 1; |
26442 | 4 | p->level--; |
26443 | 4 | return NULL; |
26444 | 4 | } |
26445 | 0 | goto done; |
26446 | 4 | } |
26447 | 683 | p->mark = _mark; |
26448 | 683 | D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
26449 | 683 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !(':')")); |
26450 | 683 | } |
26451 | 0 | { // expression ':' '*' bitwise_or |
26452 | 683 | if (p->error_indicator) { |
26453 | 0 | p->level--; |
26454 | 0 | return NULL; |
26455 | 0 | } |
26456 | 683 | D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or")); |
26457 | 683 | Token * _literal; |
26458 | 683 | Token * a; |
26459 | 683 | expr_ty bitwise_or_var; |
26460 | 683 | expr_ty expression_var; |
26461 | 683 | if ( |
26462 | 683 | (expression_var = expression_rule(p)) // expression |
26463 | 121 | && |
26464 | 121 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
26465 | 121 | && |
26466 | 121 | (a = _PyPegen_expect_token(p, 16)) // token='*' |
26467 | 102 | && |
26468 | 102 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
26469 | 683 | ) |
26470 | 2 | { |
26471 | 2 | D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or")); |
26472 | 2 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "cannot use a starred expression in a dictionary value" ); |
26473 | 2 | if (_res == NULL && PyErr_Occurred()) { |
26474 | 2 | p->error_indicator = 1; |
26475 | 2 | p->level--; |
26476 | 2 | return NULL; |
26477 | 2 | } |
26478 | 0 | goto done; |
26479 | 2 | } |
26480 | 681 | p->mark = _mark; |
26481 | 681 | D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
26482 | 681 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' '*' bitwise_or")); |
26483 | 681 | } |
26484 | 0 | { // expression ':' &('}' | ',') |
26485 | 681 | if (p->error_indicator) { |
26486 | 37 | p->level--; |
26487 | 37 | return NULL; |
26488 | 37 | } |
26489 | 644 | D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')")); |
26490 | 644 | Token * a; |
26491 | 644 | expr_ty expression_var; |
26492 | 644 | if ( |
26493 | 644 | (expression_var = expression_rule(p)) // expression |
26494 | 82 | && |
26495 | 82 | (a = _PyPegen_expect_token(p, 11)) // token=':' |
26496 | 82 | && |
26497 | 82 | _PyPegen_lookahead(1, _tmp_149_rule, p) |
26498 | 644 | ) |
26499 | 1 | { |
26500 | 1 | D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')")); |
26501 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression expected after dictionary key and ':'" ); |
26502 | 1 | if (_res == NULL && PyErr_Occurred()) { |
26503 | 1 | p->error_indicator = 1; |
26504 | 1 | p->level--; |
26505 | 1 | return NULL; |
26506 | 1 | } |
26507 | 0 | goto done; |
26508 | 1 | } |
26509 | 643 | p->mark = _mark; |
26510 | 643 | D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
26511 | 643 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' &('}' | ',')")); |
26512 | 643 | } |
26513 | 643 | _res = NULL; |
26514 | 643 | done: |
26515 | 643 | p->level--; |
26516 | 643 | return _res; |
26517 | 643 | } |
26518 | | |
26519 | | // invalid_starred_expression_unpacking: '*' expression '=' expression |
26520 | | static void * |
26521 | | invalid_starred_expression_unpacking_rule(Parser *p) |
26522 | 143k | { |
26523 | 143k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
26524 | 1 | _Pypegen_stack_overflow(p); |
26525 | 1 | } |
26526 | 143k | if (p->error_indicator) { |
26527 | 1 | p->level--; |
26528 | 1 | return NULL; |
26529 | 1 | } |
26530 | 143k | void * _res = NULL; |
26531 | 143k | int _mark = p->mark; |
26532 | 143k | { // '*' expression '=' expression |
26533 | 143k | if (p->error_indicator) { |
26534 | 0 | p->level--; |
26535 | 0 | return NULL; |
26536 | 0 | } |
26537 | 143k | D(fprintf(stderr, "%*c> invalid_starred_expression_unpacking[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression '=' expression")); |
26538 | 143k | Token * _literal; |
26539 | 143k | Token * a; |
26540 | 143k | expr_ty b; |
26541 | 143k | expr_ty expression_var; |
26542 | 143k | if ( |
26543 | 143k | (a = _PyPegen_expect_token(p, 16)) // token='*' |
26544 | 12.4k | && |
26545 | 12.4k | (expression_var = expression_rule(p)) // expression |
26546 | 11.2k | && |
26547 | 11.2k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
26548 | 673 | && |
26549 | 673 | (b = expression_rule(p)) // expression |
26550 | 143k | ) |
26551 | 2 | { |
26552 | 2 | D(fprintf(stderr, "%*c+ invalid_starred_expression_unpacking[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression '=' expression")); |
26553 | 2 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to iterable argument unpacking" ); |
26554 | 2 | if (_res == NULL && PyErr_Occurred()) { |
26555 | 2 | p->error_indicator = 1; |
26556 | 2 | p->level--; |
26557 | 2 | return NULL; |
26558 | 2 | } |
26559 | 0 | goto done; |
26560 | 2 | } |
26561 | 143k | p->mark = _mark; |
26562 | 143k | D(fprintf(stderr, "%*c%s invalid_starred_expression_unpacking[%d-%d]: %s failed!\n", p->level, ' ', |
26563 | 143k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression '=' expression")); |
26564 | 143k | } |
26565 | 143k | _res = NULL; |
26566 | 143k | done: |
26567 | 143k | p->level--; |
26568 | 143k | return _res; |
26569 | 143k | } |
26570 | | |
26571 | | // invalid_starred_expression: '*' |
26572 | | static void * |
26573 | | invalid_starred_expression_rule(Parser *p) |
26574 | 130k | { |
26575 | 130k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
26576 | 0 | _Pypegen_stack_overflow(p); |
26577 | 0 | } |
26578 | 130k | if (p->error_indicator) { |
26579 | 0 | p->level--; |
26580 | 0 | return NULL; |
26581 | 0 | } |
26582 | 130k | void * _res = NULL; |
26583 | 130k | int _mark = p->mark; |
26584 | 130k | { // '*' |
26585 | 130k | if (p->error_indicator) { |
26586 | 0 | p->level--; |
26587 | 0 | return NULL; |
26588 | 0 | } |
26589 | 130k | D(fprintf(stderr, "%*c> invalid_starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); |
26590 | 130k | Token * _literal; |
26591 | 130k | if ( |
26592 | 130k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
26593 | 130k | ) |
26594 | 54 | { |
26595 | 54 | D(fprintf(stderr, "%*c+ invalid_starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); |
26596 | 54 | _res = RAISE_SYNTAX_ERROR ( "Invalid star expression" ); |
26597 | 54 | if (_res == NULL && PyErr_Occurred()) { |
26598 | 54 | p->error_indicator = 1; |
26599 | 54 | p->level--; |
26600 | 54 | return NULL; |
26601 | 54 | } |
26602 | 0 | goto done; |
26603 | 54 | } |
26604 | 130k | p->mark = _mark; |
26605 | 130k | D(fprintf(stderr, "%*c%s invalid_starred_expression[%d-%d]: %s failed!\n", p->level, ' ', |
26606 | 130k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); |
26607 | 130k | } |
26608 | 130k | _res = NULL; |
26609 | 130k | done: |
26610 | 130k | p->level--; |
26611 | 130k | return _res; |
26612 | 130k | } |
26613 | | |
26614 | | // invalid_fstring_replacement_field: |
26615 | | // | '{' '=' |
26616 | | // | '{' '!' |
26617 | | // | '{' ':' |
26618 | | // | '{' '}' |
26619 | | // | '{' !annotated_rhs |
26620 | | // | '{' annotated_rhs !('=' | '!' | ':' | '}') |
26621 | | // | '{' annotated_rhs '=' !('!' | ':' | '}') |
26622 | | // | '{' annotated_rhs '='? invalid_fstring_conversion_character |
26623 | | // | '{' annotated_rhs '='? ['!' NAME] !(':' | '}') |
26624 | | // | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' |
26625 | | // | '{' annotated_rhs '='? ['!' NAME] !'}' |
26626 | | static void * |
26627 | | invalid_fstring_replacement_field_rule(Parser *p) |
26628 | 9.99k | { |
26629 | 9.99k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
26630 | 1 | _Pypegen_stack_overflow(p); |
26631 | 1 | } |
26632 | 9.99k | if (p->error_indicator) { |
26633 | 1 | p->level--; |
26634 | 1 | return NULL; |
26635 | 1 | } |
26636 | 9.98k | void * _res = NULL; |
26637 | 9.98k | int _mark = p->mark; |
26638 | 9.98k | { // '{' '=' |
26639 | 9.98k | if (p->error_indicator) { |
26640 | 0 | p->level--; |
26641 | 0 | return NULL; |
26642 | 0 | } |
26643 | 9.98k | D(fprintf(stderr, "%*c> invalid_fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '='")); |
26644 | 9.98k | Token * _literal; |
26645 | 9.98k | Token * a; |
26646 | 9.98k | if ( |
26647 | 9.98k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
26648 | 318 | && |
26649 | 318 | (a = _PyPegen_expect_token(p, 22)) // token='=' |
26650 | 9.98k | ) |
26651 | 27 | { |
26652 | 27 | D(fprintf(stderr, "%*c+ invalid_fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '='")); |
26653 | 27 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before '='" ); |
26654 | 27 | if (_res == NULL && PyErr_Occurred()) { |
26655 | 27 | p->error_indicator = 1; |
26656 | 27 | p->level--; |
26657 | 27 | return NULL; |
26658 | 27 | } |
26659 | 0 | goto done; |
26660 | 27 | } |
26661 | 9.96k | p->mark = _mark; |
26662 | 9.96k | D(fprintf(stderr, "%*c%s invalid_fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
26663 | 9.96k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '='")); |
26664 | 9.96k | } |
26665 | 0 | { // '{' '!' |
26666 | 9.96k | if (p->error_indicator) { |
26667 | 0 | p->level--; |
26668 | 0 | return NULL; |
26669 | 0 | } |
26670 | 9.96k | D(fprintf(stderr, "%*c> invalid_fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '!'")); |
26671 | 9.96k | Token * _literal; |
26672 | 9.96k | Token * a; |
26673 | 9.96k | if ( |
26674 | 9.96k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
26675 | 291 | && |
26676 | 291 | (a = _PyPegen_expect_token(p, 54)) // token='!' |
26677 | 9.96k | ) |
26678 | 9 | { |
26679 | 9 | D(fprintf(stderr, "%*c+ invalid_fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '!'")); |
26680 | 9 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before '!'" ); |
26681 | 9 | if (_res == NULL && PyErr_Occurred()) { |
26682 | 9 | p->error_indicator = 1; |
26683 | 9 | p->level--; |
26684 | 9 | return NULL; |
26685 | 9 | } |
26686 | 0 | goto done; |
26687 | 9 | } |
26688 | 9.95k | p->mark = _mark; |
26689 | 9.95k | D(fprintf(stderr, "%*c%s invalid_fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
26690 | 9.95k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '!'")); |
26691 | 9.95k | } |
26692 | 0 | { // '{' ':' |
26693 | 9.95k | if (p->error_indicator) { |
26694 | 0 | p->level--; |
26695 | 0 | return NULL; |
26696 | 0 | } |
26697 | 9.95k | D(fprintf(stderr, "%*c> invalid_fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' ':'")); |
26698 | 9.95k | Token * _literal; |
26699 | 9.95k | Token * a; |
26700 | 9.95k | if ( |
26701 | 9.95k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
26702 | 282 | && |
26703 | 282 | (a = _PyPegen_expect_token(p, 11)) // token=':' |
26704 | 9.95k | ) |
26705 | 59 | { |
26706 | 59 | D(fprintf(stderr, "%*c+ invalid_fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' ':'")); |
26707 | 59 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before ':'" ); |
26708 | 59 | if (_res == NULL && PyErr_Occurred()) { |
26709 | 59 | p->error_indicator = 1; |
26710 | 59 | p->level--; |
26711 | 59 | return NULL; |
26712 | 59 | } |
26713 | 0 | goto done; |
26714 | 59 | } |
26715 | 9.89k | p->mark = _mark; |
26716 | 9.89k | D(fprintf(stderr, "%*c%s invalid_fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
26717 | 9.89k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' ':'")); |
26718 | 9.89k | } |
26719 | 0 | { // '{' '}' |
26720 | 9.89k | if (p->error_indicator) { |
26721 | 0 | p->level--; |
26722 | 0 | return NULL; |
26723 | 0 | } |
26724 | 9.89k | D(fprintf(stderr, "%*c> invalid_fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '}'")); |
26725 | 9.89k | Token * _literal; |
26726 | 9.89k | Token * a; |
26727 | 9.89k | if ( |
26728 | 9.89k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
26729 | 223 | && |
26730 | 223 | (a = _PyPegen_expect_token(p, 26)) // token='}' |
26731 | 9.89k | ) |
26732 | 14 | { |
26733 | 14 | D(fprintf(stderr, "%*c+ invalid_fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '}'")); |
26734 | 14 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before '}'" ); |
26735 | 14 | if (_res == NULL && PyErr_Occurred()) { |
26736 | 14 | p->error_indicator = 1; |
26737 | 14 | p->level--; |
26738 | 14 | return NULL; |
26739 | 14 | } |
26740 | 0 | goto done; |
26741 | 14 | } |
26742 | 9.88k | p->mark = _mark; |
26743 | 9.88k | D(fprintf(stderr, "%*c%s invalid_fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
26744 | 9.88k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '}'")); |
26745 | 9.88k | } |
26746 | 0 | { // '{' !annotated_rhs |
26747 | 9.88k | if (p->error_indicator) { |
26748 | 0 | p->level--; |
26749 | 0 | return NULL; |
26750 | 0 | } |
26751 | 9.88k | D(fprintf(stderr, "%*c> invalid_fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' !annotated_rhs")); |
26752 | 9.88k | Token * _literal; |
26753 | 9.88k | if ( |
26754 | 9.88k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
26755 | 209 | && |
26756 | 209 | _PyPegen_lookahead_for_expr(0, annotated_rhs_rule, p) |
26757 | 9.88k | ) |
26758 | 36 | { |
26759 | 36 | D(fprintf(stderr, "%*c+ invalid_fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' !annotated_rhs")); |
26760 | 36 | _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting a valid expression after '{'" ); |
26761 | 36 | if (_res == NULL && PyErr_Occurred()) { |
26762 | 36 | p->error_indicator = 1; |
26763 | 36 | p->level--; |
26764 | 36 | return NULL; |
26765 | 36 | } |
26766 | 0 | goto done; |
26767 | 36 | } |
26768 | 9.84k | p->mark = _mark; |
26769 | 9.84k | D(fprintf(stderr, "%*c%s invalid_fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
26770 | 9.84k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' !annotated_rhs")); |
26771 | 9.84k | } |
26772 | 0 | { // '{' annotated_rhs !('=' | '!' | ':' | '}') |
26773 | 9.84k | if (p->error_indicator) { |
26774 | 0 | p->level--; |
26775 | 0 | return NULL; |
26776 | 0 | } |
26777 | 9.84k | D(fprintf(stderr, "%*c> invalid_fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs !('=' | '!' | ':' | '}')")); |
26778 | 9.84k | Token * _literal; |
26779 | 9.84k | expr_ty annotated_rhs_var; |
26780 | 9.84k | if ( |
26781 | 9.84k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
26782 | 173 | && |
26783 | 173 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
26784 | 173 | && |
26785 | 173 | _PyPegen_lookahead(0, _tmp_150_rule, p) |
26786 | 9.84k | ) |
26787 | 26 | { |
26788 | 26 | D(fprintf(stderr, "%*c+ invalid_fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs !('=' | '!' | ':' | '}')")); |
26789 | 26 | _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '=', or '!', or ':', or '}'" ); |
26790 | 26 | if (_res == NULL && PyErr_Occurred()) { |
26791 | 26 | p->error_indicator = 1; |
26792 | 26 | p->level--; |
26793 | 26 | return NULL; |
26794 | 26 | } |
26795 | 0 | goto done; |
26796 | 26 | } |
26797 | 9.81k | p->mark = _mark; |
26798 | 9.81k | D(fprintf(stderr, "%*c%s invalid_fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
26799 | 9.81k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs !('=' | '!' | ':' | '}')")); |
26800 | 9.81k | } |
26801 | 0 | { // '{' annotated_rhs '=' !('!' | ':' | '}') |
26802 | 9.81k | if (p->error_indicator) { |
26803 | 0 | p->level--; |
26804 | 0 | return NULL; |
26805 | 0 | } |
26806 | 9.81k | D(fprintf(stderr, "%*c> invalid_fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '=' !('!' | ':' | '}')")); |
26807 | 9.81k | Token * _literal; |
26808 | 9.81k | Token * _literal_1; |
26809 | 9.81k | expr_ty annotated_rhs_var; |
26810 | 9.81k | if ( |
26811 | 9.81k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
26812 | 147 | && |
26813 | 147 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
26814 | 147 | && |
26815 | 147 | (_literal_1 = _PyPegen_expect_token(p, 22)) // token='=' |
26816 | 17 | && |
26817 | 17 | _PyPegen_lookahead(0, _tmp_151_rule, p) |
26818 | 9.81k | ) |
26819 | 12 | { |
26820 | 12 | D(fprintf(stderr, "%*c+ invalid_fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '=' !('!' | ':' | '}')")); |
26821 | 12 | _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '!', or ':', or '}'" ); |
26822 | 12 | if (_res == NULL && PyErr_Occurred()) { |
26823 | 12 | p->error_indicator = 1; |
26824 | 12 | p->level--; |
26825 | 12 | return NULL; |
26826 | 12 | } |
26827 | 0 | goto done; |
26828 | 12 | } |
26829 | 9.80k | p->mark = _mark; |
26830 | 9.80k | D(fprintf(stderr, "%*c%s invalid_fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
26831 | 9.80k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '=' !('!' | ':' | '}')")); |
26832 | 9.80k | } |
26833 | 0 | { // '{' annotated_rhs '='? invalid_fstring_conversion_character |
26834 | 9.80k | if (p->error_indicator) { |
26835 | 0 | p->level--; |
26836 | 0 | return NULL; |
26837 | 0 | } |
26838 | 9.80k | D(fprintf(stderr, "%*c> invalid_fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? invalid_fstring_conversion_character")); |
26839 | 9.80k | Token * _literal; |
26840 | 9.80k | void *_opt_var; |
26841 | 9.80k | UNUSED(_opt_var); // Silence compiler warnings |
26842 | 9.80k | expr_ty annotated_rhs_var; |
26843 | 9.80k | void *invalid_fstring_conversion_character_var; |
26844 | 9.80k | if ( |
26845 | 9.80k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
26846 | 135 | && |
26847 | 135 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
26848 | 135 | && |
26849 | 135 | (_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='? |
26850 | 135 | && |
26851 | 135 | (invalid_fstring_conversion_character_var = invalid_fstring_conversion_character_rule(p)) // invalid_fstring_conversion_character |
26852 | 9.80k | ) |
26853 | 0 | { |
26854 | 0 | D(fprintf(stderr, "%*c+ invalid_fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? invalid_fstring_conversion_character")); |
26855 | 0 | _res = _PyPegen_dummy_name(p, _literal, annotated_rhs_var, _opt_var, invalid_fstring_conversion_character_var); |
26856 | 0 | goto done; |
26857 | 0 | } |
26858 | 9.80k | p->mark = _mark; |
26859 | 9.80k | D(fprintf(stderr, "%*c%s invalid_fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
26860 | 9.80k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? invalid_fstring_conversion_character")); |
26861 | 9.80k | } |
26862 | 0 | { // '{' annotated_rhs '='? ['!' NAME] !(':' | '}') |
26863 | 9.80k | if (p->error_indicator) { |
26864 | 9 | p->level--; |
26865 | 9 | return NULL; |
26866 | 9 | } |
26867 | 9.79k | D(fprintf(stderr, "%*c> invalid_fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !(':' | '}')")); |
26868 | 9.79k | Token * _literal; |
26869 | 9.79k | void *_opt_var; |
26870 | 9.79k | UNUSED(_opt_var); // Silence compiler warnings |
26871 | 9.79k | void *_opt_var_1; |
26872 | 9.79k | UNUSED(_opt_var_1); // Silence compiler warnings |
26873 | 9.79k | expr_ty annotated_rhs_var; |
26874 | 9.79k | if ( |
26875 | 9.79k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
26876 | 126 | && |
26877 | 126 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
26878 | 126 | && |
26879 | 126 | (_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='? |
26880 | 126 | && |
26881 | 126 | (_opt_var_1 = _tmp_152_rule(p), !p->error_indicator) // ['!' NAME] |
26882 | 126 | && |
26883 | 126 | _PyPegen_lookahead(0, _tmp_153_rule, p) |
26884 | 9.79k | ) |
26885 | 3 | { |
26886 | 3 | D(fprintf(stderr, "%*c+ invalid_fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !(':' | '}')")); |
26887 | 3 | _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting ':' or '}'" ); |
26888 | 3 | if (_res == NULL && PyErr_Occurred()) { |
26889 | 3 | p->error_indicator = 1; |
26890 | 3 | p->level--; |
26891 | 3 | return NULL; |
26892 | 3 | } |
26893 | 0 | goto done; |
26894 | 3 | } |
26895 | 9.79k | p->mark = _mark; |
26896 | 9.79k | D(fprintf(stderr, "%*c%s invalid_fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
26897 | 9.79k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !(':' | '}')")); |
26898 | 9.79k | } |
26899 | 0 | { // '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' |
26900 | 9.79k | if (p->error_indicator) { |
26901 | 0 | p->level--; |
26902 | 0 | return NULL; |
26903 | 0 | } |
26904 | 9.79k | D(fprintf(stderr, "%*c> invalid_fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}'")); |
26905 | 9.79k | Token * _literal; |
26906 | 9.79k | Token * _literal_1; |
26907 | 9.79k | asdl_seq * _loop0_76_var; |
26908 | 9.79k | void *_opt_var; |
26909 | 9.79k | UNUSED(_opt_var); // Silence compiler warnings |
26910 | 9.79k | void *_opt_var_1; |
26911 | 9.79k | UNUSED(_opt_var_1); // Silence compiler warnings |
26912 | 9.79k | expr_ty annotated_rhs_var; |
26913 | 9.79k | if ( |
26914 | 9.79k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
26915 | 123 | && |
26916 | 123 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
26917 | 123 | && |
26918 | 123 | (_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='? |
26919 | 123 | && |
26920 | 123 | (_opt_var_1 = _tmp_152_rule(p), !p->error_indicator) // ['!' NAME] |
26921 | 123 | && |
26922 | 123 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
26923 | 123 | && |
26924 | 123 | (_loop0_76_var = _loop0_76_rule(p)) // fstring_format_spec* |
26925 | 123 | && |
26926 | 123 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 26) // token='}' |
26927 | 9.79k | ) |
26928 | 123 | { |
26929 | 123 | D(fprintf(stderr, "%*c+ invalid_fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}'")); |
26930 | 123 | _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '}', or format specs" ); |
26931 | 123 | if (_res == NULL && PyErr_Occurred()) { |
26932 | 123 | p->error_indicator = 1; |
26933 | 123 | p->level--; |
26934 | 123 | return NULL; |
26935 | 123 | } |
26936 | 0 | goto done; |
26937 | 123 | } |
26938 | 9.67k | p->mark = _mark; |
26939 | 9.67k | D(fprintf(stderr, "%*c%s invalid_fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
26940 | 9.67k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}'")); |
26941 | 9.67k | } |
26942 | 0 | { // '{' annotated_rhs '='? ['!' NAME] !'}' |
26943 | 9.67k | if (p->error_indicator) { |
26944 | 0 | p->level--; |
26945 | 0 | return NULL; |
26946 | 0 | } |
26947 | 9.67k | D(fprintf(stderr, "%*c> invalid_fstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !'}'")); |
26948 | 9.67k | Token * _literal; |
26949 | 9.67k | void *_opt_var; |
26950 | 9.67k | UNUSED(_opt_var); // Silence compiler warnings |
26951 | 9.67k | void *_opt_var_1; |
26952 | 9.67k | UNUSED(_opt_var_1); // Silence compiler warnings |
26953 | 9.67k | expr_ty annotated_rhs_var; |
26954 | 9.67k | if ( |
26955 | 9.67k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
26956 | 0 | && |
26957 | 0 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
26958 | 0 | && |
26959 | 0 | (_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='? |
26960 | 0 | && |
26961 | 0 | (_opt_var_1 = _tmp_152_rule(p), !p->error_indicator) // ['!' NAME] |
26962 | 0 | && |
26963 | 0 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 26) // token='}' |
26964 | 9.67k | ) |
26965 | 0 | { |
26966 | 0 | D(fprintf(stderr, "%*c+ invalid_fstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !'}'")); |
26967 | 0 | _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '}'" ); |
26968 | 0 | if (_res == NULL && PyErr_Occurred()) { |
26969 | 0 | p->error_indicator = 1; |
26970 | 0 | p->level--; |
26971 | 0 | return NULL; |
26972 | 0 | } |
26973 | 0 | goto done; |
26974 | 0 | } |
26975 | 9.67k | p->mark = _mark; |
26976 | 9.67k | D(fprintf(stderr, "%*c%s invalid_fstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
26977 | 9.67k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !'}'")); |
26978 | 9.67k | } |
26979 | 9.67k | _res = NULL; |
26980 | 9.67k | done: |
26981 | 9.67k | p->level--; |
26982 | 9.67k | return _res; |
26983 | 9.67k | } |
26984 | | |
26985 | | // invalid_fstring_conversion_character: '!' &(':' | '}') | '!' !NAME |
26986 | | static void * |
26987 | | invalid_fstring_conversion_character_rule(Parser *p) |
26988 | 135 | { |
26989 | 135 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
26990 | 0 | _Pypegen_stack_overflow(p); |
26991 | 0 | } |
26992 | 135 | if (p->error_indicator) { |
26993 | 0 | p->level--; |
26994 | 0 | return NULL; |
26995 | 0 | } |
26996 | 135 | void * _res = NULL; |
26997 | 135 | int _mark = p->mark; |
26998 | 135 | { // '!' &(':' | '}') |
26999 | 135 | if (p->error_indicator) { |
27000 | 0 | p->level--; |
27001 | 0 | return NULL; |
27002 | 0 | } |
27003 | 135 | D(fprintf(stderr, "%*c> invalid_fstring_conversion_character[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' &(':' | '}')")); |
27004 | 135 | Token * _literal; |
27005 | 135 | if ( |
27006 | 135 | (_literal = _PyPegen_expect_token(p, 54)) // token='!' |
27007 | 13 | && |
27008 | 13 | _PyPegen_lookahead(1, _tmp_153_rule, p) |
27009 | 135 | ) |
27010 | 3 | { |
27011 | 3 | D(fprintf(stderr, "%*c+ invalid_fstring_conversion_character[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' &(':' | '}')")); |
27012 | 3 | _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: missing conversion character" ); |
27013 | 3 | if (_res == NULL && PyErr_Occurred()) { |
27014 | 3 | p->error_indicator = 1; |
27015 | 3 | p->level--; |
27016 | 3 | return NULL; |
27017 | 3 | } |
27018 | 0 | goto done; |
27019 | 3 | } |
27020 | 132 | p->mark = _mark; |
27021 | 132 | D(fprintf(stderr, "%*c%s invalid_fstring_conversion_character[%d-%d]: %s failed!\n", p->level, ' ', |
27022 | 132 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' &(':' | '}')")); |
27023 | 132 | } |
27024 | 0 | { // '!' !NAME |
27025 | 132 | if (p->error_indicator) { |
27026 | 0 | p->level--; |
27027 | 0 | return NULL; |
27028 | 0 | } |
27029 | 132 | D(fprintf(stderr, "%*c> invalid_fstring_conversion_character[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' !NAME")); |
27030 | 132 | Token * _literal; |
27031 | 132 | if ( |
27032 | 132 | (_literal = _PyPegen_expect_token(p, 54)) // token='!' |
27033 | 10 | && |
27034 | 10 | _PyPegen_lookahead_for_expr(0, _PyPegen_name_token, p) |
27035 | 132 | ) |
27036 | 6 | { |
27037 | 6 | D(fprintf(stderr, "%*c+ invalid_fstring_conversion_character[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' !NAME")); |
27038 | 6 | _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: invalid conversion character" ); |
27039 | 6 | if (_res == NULL && PyErr_Occurred()) { |
27040 | 6 | p->error_indicator = 1; |
27041 | 6 | p->level--; |
27042 | 6 | return NULL; |
27043 | 6 | } |
27044 | 0 | goto done; |
27045 | 6 | } |
27046 | 126 | p->mark = _mark; |
27047 | 126 | D(fprintf(stderr, "%*c%s invalid_fstring_conversion_character[%d-%d]: %s failed!\n", p->level, ' ', |
27048 | 126 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' !NAME")); |
27049 | 126 | } |
27050 | 126 | _res = NULL; |
27051 | 126 | done: |
27052 | 126 | p->level--; |
27053 | 126 | return _res; |
27054 | 126 | } |
27055 | | |
27056 | | // invalid_tstring_replacement_field: |
27057 | | // | '{' '=' |
27058 | | // | '{' '!' |
27059 | | // | '{' ':' |
27060 | | // | '{' '}' |
27061 | | // | '{' !annotated_rhs |
27062 | | // | '{' annotated_rhs !('=' | '!' | ':' | '}') |
27063 | | // | '{' annotated_rhs '=' !('!' | ':' | '}') |
27064 | | // | '{' annotated_rhs '='? invalid_tstring_conversion_character |
27065 | | // | '{' annotated_rhs '='? ['!' NAME] !(':' | '}') |
27066 | | // | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' |
27067 | | // | '{' annotated_rhs '='? ['!' NAME] !'}' |
27068 | | static void * |
27069 | | invalid_tstring_replacement_field_rule(Parser *p) |
27070 | 4.93k | { |
27071 | 4.93k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
27072 | 1 | _Pypegen_stack_overflow(p); |
27073 | 1 | } |
27074 | 4.93k | if (p->error_indicator) { |
27075 | 1 | p->level--; |
27076 | 1 | return NULL; |
27077 | 1 | } |
27078 | 4.93k | void * _res = NULL; |
27079 | 4.93k | int _mark = p->mark; |
27080 | 4.93k | { // '{' '=' |
27081 | 4.93k | if (p->error_indicator) { |
27082 | 0 | p->level--; |
27083 | 0 | return NULL; |
27084 | 0 | } |
27085 | 4.93k | D(fprintf(stderr, "%*c> invalid_tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '='")); |
27086 | 4.93k | Token * _literal; |
27087 | 4.93k | Token * a; |
27088 | 4.93k | if ( |
27089 | 4.93k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
27090 | 133 | && |
27091 | 133 | (a = _PyPegen_expect_token(p, 22)) // token='=' |
27092 | 4.93k | ) |
27093 | 8 | { |
27094 | 8 | D(fprintf(stderr, "%*c+ invalid_tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '='")); |
27095 | 8 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "t-string: valid expression required before '='" ); |
27096 | 8 | if (_res == NULL && PyErr_Occurred()) { |
27097 | 8 | p->error_indicator = 1; |
27098 | 8 | p->level--; |
27099 | 8 | return NULL; |
27100 | 8 | } |
27101 | 0 | goto done; |
27102 | 8 | } |
27103 | 4.92k | p->mark = _mark; |
27104 | 4.92k | D(fprintf(stderr, "%*c%s invalid_tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
27105 | 4.92k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '='")); |
27106 | 4.92k | } |
27107 | 0 | { // '{' '!' |
27108 | 4.92k | if (p->error_indicator) { |
27109 | 0 | p->level--; |
27110 | 0 | return NULL; |
27111 | 0 | } |
27112 | 4.92k | D(fprintf(stderr, "%*c> invalid_tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '!'")); |
27113 | 4.92k | Token * _literal; |
27114 | 4.92k | Token * a; |
27115 | 4.92k | if ( |
27116 | 4.92k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
27117 | 125 | && |
27118 | 125 | (a = _PyPegen_expect_token(p, 54)) // token='!' |
27119 | 4.92k | ) |
27120 | 14 | { |
27121 | 14 | D(fprintf(stderr, "%*c+ invalid_tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '!'")); |
27122 | 14 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "t-string: valid expression required before '!'" ); |
27123 | 14 | if (_res == NULL && PyErr_Occurred()) { |
27124 | 14 | p->error_indicator = 1; |
27125 | 14 | p->level--; |
27126 | 14 | return NULL; |
27127 | 14 | } |
27128 | 0 | goto done; |
27129 | 14 | } |
27130 | 4.91k | p->mark = _mark; |
27131 | 4.91k | D(fprintf(stderr, "%*c%s invalid_tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
27132 | 4.91k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '!'")); |
27133 | 4.91k | } |
27134 | 0 | { // '{' ':' |
27135 | 4.91k | if (p->error_indicator) { |
27136 | 0 | p->level--; |
27137 | 0 | return NULL; |
27138 | 0 | } |
27139 | 4.91k | D(fprintf(stderr, "%*c> invalid_tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' ':'")); |
27140 | 4.91k | Token * _literal; |
27141 | 4.91k | Token * a; |
27142 | 4.91k | if ( |
27143 | 4.91k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
27144 | 111 | && |
27145 | 111 | (a = _PyPegen_expect_token(p, 11)) // token=':' |
27146 | 4.91k | ) |
27147 | 14 | { |
27148 | 14 | D(fprintf(stderr, "%*c+ invalid_tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' ':'")); |
27149 | 14 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "t-string: valid expression required before ':'" ); |
27150 | 14 | if (_res == NULL && PyErr_Occurred()) { |
27151 | 14 | p->error_indicator = 1; |
27152 | 14 | p->level--; |
27153 | 14 | return NULL; |
27154 | 14 | } |
27155 | 0 | goto done; |
27156 | 14 | } |
27157 | 4.89k | p->mark = _mark; |
27158 | 4.89k | D(fprintf(stderr, "%*c%s invalid_tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
27159 | 4.89k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' ':'")); |
27160 | 4.89k | } |
27161 | 0 | { // '{' '}' |
27162 | 4.89k | if (p->error_indicator) { |
27163 | 0 | p->level--; |
27164 | 0 | return NULL; |
27165 | 0 | } |
27166 | 4.89k | D(fprintf(stderr, "%*c> invalid_tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '}'")); |
27167 | 4.89k | Token * _literal; |
27168 | 4.89k | Token * a; |
27169 | 4.89k | if ( |
27170 | 4.89k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
27171 | 97 | && |
27172 | 97 | (a = _PyPegen_expect_token(p, 26)) // token='}' |
27173 | 4.89k | ) |
27174 | 14 | { |
27175 | 14 | D(fprintf(stderr, "%*c+ invalid_tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '}'")); |
27176 | 14 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "t-string: valid expression required before '}'" ); |
27177 | 14 | if (_res == NULL && PyErr_Occurred()) { |
27178 | 14 | p->error_indicator = 1; |
27179 | 14 | p->level--; |
27180 | 14 | return NULL; |
27181 | 14 | } |
27182 | 0 | goto done; |
27183 | 14 | } |
27184 | 4.88k | p->mark = _mark; |
27185 | 4.88k | D(fprintf(stderr, "%*c%s invalid_tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
27186 | 4.88k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '}'")); |
27187 | 4.88k | } |
27188 | 0 | { // '{' !annotated_rhs |
27189 | 4.88k | if (p->error_indicator) { |
27190 | 0 | p->level--; |
27191 | 0 | return NULL; |
27192 | 0 | } |
27193 | 4.88k | D(fprintf(stderr, "%*c> invalid_tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' !annotated_rhs")); |
27194 | 4.88k | Token * _literal; |
27195 | 4.88k | if ( |
27196 | 4.88k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
27197 | 83 | && |
27198 | 83 | _PyPegen_lookahead_for_expr(0, annotated_rhs_rule, p) |
27199 | 4.88k | ) |
27200 | 25 | { |
27201 | 25 | D(fprintf(stderr, "%*c+ invalid_tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' !annotated_rhs")); |
27202 | 25 | _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "t-string: expecting a valid expression after '{'" ); |
27203 | 25 | if (_res == NULL && PyErr_Occurred()) { |
27204 | 25 | p->error_indicator = 1; |
27205 | 25 | p->level--; |
27206 | 25 | return NULL; |
27207 | 25 | } |
27208 | 0 | goto done; |
27209 | 25 | } |
27210 | 4.85k | p->mark = _mark; |
27211 | 4.85k | D(fprintf(stderr, "%*c%s invalid_tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
27212 | 4.85k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' !annotated_rhs")); |
27213 | 4.85k | } |
27214 | 0 | { // '{' annotated_rhs !('=' | '!' | ':' | '}') |
27215 | 4.85k | if (p->error_indicator) { |
27216 | 0 | p->level--; |
27217 | 0 | return NULL; |
27218 | 0 | } |
27219 | 4.85k | D(fprintf(stderr, "%*c> invalid_tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs !('=' | '!' | ':' | '}')")); |
27220 | 4.85k | Token * _literal; |
27221 | 4.85k | expr_ty annotated_rhs_var; |
27222 | 4.85k | if ( |
27223 | 4.85k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
27224 | 58 | && |
27225 | 58 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
27226 | 58 | && |
27227 | 58 | _PyPegen_lookahead(0, _tmp_150_rule, p) |
27228 | 4.85k | ) |
27229 | 11 | { |
27230 | 11 | D(fprintf(stderr, "%*c+ invalid_tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs !('=' | '!' | ':' | '}')")); |
27231 | 11 | _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "t-string: expecting '=', or '!', or ':', or '}'" ); |
27232 | 11 | if (_res == NULL && PyErr_Occurred()) { |
27233 | 11 | p->error_indicator = 1; |
27234 | 11 | p->level--; |
27235 | 11 | return NULL; |
27236 | 11 | } |
27237 | 0 | goto done; |
27238 | 11 | } |
27239 | 4.84k | p->mark = _mark; |
27240 | 4.84k | D(fprintf(stderr, "%*c%s invalid_tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
27241 | 4.84k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs !('=' | '!' | ':' | '}')")); |
27242 | 4.84k | } |
27243 | 0 | { // '{' annotated_rhs '=' !('!' | ':' | '}') |
27244 | 4.84k | if (p->error_indicator) { |
27245 | 0 | p->level--; |
27246 | 0 | return NULL; |
27247 | 0 | } |
27248 | 4.84k | D(fprintf(stderr, "%*c> invalid_tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '=' !('!' | ':' | '}')")); |
27249 | 4.84k | Token * _literal; |
27250 | 4.84k | Token * _literal_1; |
27251 | 4.84k | expr_ty annotated_rhs_var; |
27252 | 4.84k | if ( |
27253 | 4.84k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
27254 | 47 | && |
27255 | 47 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
27256 | 47 | && |
27257 | 47 | (_literal_1 = _PyPegen_expect_token(p, 22)) // token='=' |
27258 | 5 | && |
27259 | 5 | _PyPegen_lookahead(0, _tmp_151_rule, p) |
27260 | 4.84k | ) |
27261 | 3 | { |
27262 | 3 | D(fprintf(stderr, "%*c+ invalid_tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '=' !('!' | ':' | '}')")); |
27263 | 3 | _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "t-string: expecting '!', or ':', or '}'" ); |
27264 | 3 | if (_res == NULL && PyErr_Occurred()) { |
27265 | 3 | p->error_indicator = 1; |
27266 | 3 | p->level--; |
27267 | 3 | return NULL; |
27268 | 3 | } |
27269 | 0 | goto done; |
27270 | 3 | } |
27271 | 4.84k | p->mark = _mark; |
27272 | 4.84k | D(fprintf(stderr, "%*c%s invalid_tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
27273 | 4.84k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '=' !('!' | ':' | '}')")); |
27274 | 4.84k | } |
27275 | 0 | { // '{' annotated_rhs '='? invalid_tstring_conversion_character |
27276 | 4.84k | if (p->error_indicator) { |
27277 | 0 | p->level--; |
27278 | 0 | return NULL; |
27279 | 0 | } |
27280 | 4.84k | D(fprintf(stderr, "%*c> invalid_tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? invalid_tstring_conversion_character")); |
27281 | 4.84k | Token * _literal; |
27282 | 4.84k | void *_opt_var; |
27283 | 4.84k | UNUSED(_opt_var); // Silence compiler warnings |
27284 | 4.84k | expr_ty annotated_rhs_var; |
27285 | 4.84k | void *invalid_tstring_conversion_character_var; |
27286 | 4.84k | if ( |
27287 | 4.84k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
27288 | 44 | && |
27289 | 44 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
27290 | 44 | && |
27291 | 44 | (_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='? |
27292 | 44 | && |
27293 | 44 | (invalid_tstring_conversion_character_var = invalid_tstring_conversion_character_rule(p)) // invalid_tstring_conversion_character |
27294 | 4.84k | ) |
27295 | 0 | { |
27296 | 0 | D(fprintf(stderr, "%*c+ invalid_tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? invalid_tstring_conversion_character")); |
27297 | 0 | _res = _PyPegen_dummy_name(p, _literal, annotated_rhs_var, _opt_var, invalid_tstring_conversion_character_var); |
27298 | 0 | goto done; |
27299 | 0 | } |
27300 | 4.84k | p->mark = _mark; |
27301 | 4.84k | D(fprintf(stderr, "%*c%s invalid_tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
27302 | 4.84k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? invalid_tstring_conversion_character")); |
27303 | 4.84k | } |
27304 | 0 | { // '{' annotated_rhs '='? ['!' NAME] !(':' | '}') |
27305 | 4.84k | if (p->error_indicator) { |
27306 | 13 | p->level--; |
27307 | 13 | return NULL; |
27308 | 13 | } |
27309 | 4.83k | D(fprintf(stderr, "%*c> invalid_tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !(':' | '}')")); |
27310 | 4.83k | Token * _literal; |
27311 | 4.83k | void *_opt_var; |
27312 | 4.83k | UNUSED(_opt_var); // Silence compiler warnings |
27313 | 4.83k | void *_opt_var_1; |
27314 | 4.83k | UNUSED(_opt_var_1); // Silence compiler warnings |
27315 | 4.83k | expr_ty annotated_rhs_var; |
27316 | 4.83k | if ( |
27317 | 4.83k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
27318 | 31 | && |
27319 | 31 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
27320 | 31 | && |
27321 | 31 | (_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='? |
27322 | 31 | && |
27323 | 31 | (_opt_var_1 = _tmp_152_rule(p), !p->error_indicator) // ['!' NAME] |
27324 | 31 | && |
27325 | 31 | _PyPegen_lookahead(0, _tmp_153_rule, p) |
27326 | 4.83k | ) |
27327 | 4 | { |
27328 | 4 | D(fprintf(stderr, "%*c+ invalid_tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !(':' | '}')")); |
27329 | 4 | _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "t-string: expecting ':' or '}'" ); |
27330 | 4 | if (_res == NULL && PyErr_Occurred()) { |
27331 | 4 | p->error_indicator = 1; |
27332 | 4 | p->level--; |
27333 | 4 | return NULL; |
27334 | 4 | } |
27335 | 0 | goto done; |
27336 | 4 | } |
27337 | 4.82k | p->mark = _mark; |
27338 | 4.82k | D(fprintf(stderr, "%*c%s invalid_tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
27339 | 4.82k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !(':' | '}')")); |
27340 | 4.82k | } |
27341 | 0 | { // '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' |
27342 | 4.82k | if (p->error_indicator) { |
27343 | 0 | p->level--; |
27344 | 0 | return NULL; |
27345 | 0 | } |
27346 | 4.82k | D(fprintf(stderr, "%*c> invalid_tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}'")); |
27347 | 4.82k | Token * _literal; |
27348 | 4.82k | Token * _literal_1; |
27349 | 4.82k | asdl_seq * _loop0_76_var; |
27350 | 4.82k | void *_opt_var; |
27351 | 4.82k | UNUSED(_opt_var); // Silence compiler warnings |
27352 | 4.82k | void *_opt_var_1; |
27353 | 4.82k | UNUSED(_opt_var_1); // Silence compiler warnings |
27354 | 4.82k | expr_ty annotated_rhs_var; |
27355 | 4.82k | if ( |
27356 | 4.82k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
27357 | 27 | && |
27358 | 27 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
27359 | 27 | && |
27360 | 27 | (_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='? |
27361 | 27 | && |
27362 | 27 | (_opt_var_1 = _tmp_152_rule(p), !p->error_indicator) // ['!' NAME] |
27363 | 27 | && |
27364 | 27 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
27365 | 27 | && |
27366 | 27 | (_loop0_76_var = _loop0_76_rule(p)) // fstring_format_spec* |
27367 | 27 | && |
27368 | 27 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 26) // token='}' |
27369 | 4.82k | ) |
27370 | 27 | { |
27371 | 27 | D(fprintf(stderr, "%*c+ invalid_tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}'")); |
27372 | 27 | _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "t-string: expecting '}', or format specs" ); |
27373 | 27 | if (_res == NULL && PyErr_Occurred()) { |
27374 | 27 | p->error_indicator = 1; |
27375 | 27 | p->level--; |
27376 | 27 | return NULL; |
27377 | 27 | } |
27378 | 0 | goto done; |
27379 | 27 | } |
27380 | 4.80k | p->mark = _mark; |
27381 | 4.80k | D(fprintf(stderr, "%*c%s invalid_tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
27382 | 4.80k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}'")); |
27383 | 4.80k | } |
27384 | 0 | { // '{' annotated_rhs '='? ['!' NAME] !'}' |
27385 | 4.80k | if (p->error_indicator) { |
27386 | 0 | p->level--; |
27387 | 0 | return NULL; |
27388 | 0 | } |
27389 | 4.80k | D(fprintf(stderr, "%*c> invalid_tstring_replacement_field[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !'}'")); |
27390 | 4.80k | Token * _literal; |
27391 | 4.80k | void *_opt_var; |
27392 | 4.80k | UNUSED(_opt_var); // Silence compiler warnings |
27393 | 4.80k | void *_opt_var_1; |
27394 | 4.80k | UNUSED(_opt_var_1); // Silence compiler warnings |
27395 | 4.80k | expr_ty annotated_rhs_var; |
27396 | 4.80k | if ( |
27397 | 4.80k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
27398 | 0 | && |
27399 | 0 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
27400 | 0 | && |
27401 | 0 | (_opt_var = _PyPegen_expect_token(p, 22), !p->error_indicator) // '='? |
27402 | 0 | && |
27403 | 0 | (_opt_var_1 = _tmp_152_rule(p), !p->error_indicator) // ['!' NAME] |
27404 | 0 | && |
27405 | 0 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 26) // token='}' |
27406 | 4.80k | ) |
27407 | 0 | { |
27408 | 0 | D(fprintf(stderr, "%*c+ invalid_tstring_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !'}'")); |
27409 | 0 | _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "t-string: expecting '}'" ); |
27410 | 0 | if (_res == NULL && PyErr_Occurred()) { |
27411 | 0 | p->error_indicator = 1; |
27412 | 0 | p->level--; |
27413 | 0 | return NULL; |
27414 | 0 | } |
27415 | 0 | goto done; |
27416 | 0 | } |
27417 | 4.80k | p->mark = _mark; |
27418 | 4.80k | D(fprintf(stderr, "%*c%s invalid_tstring_replacement_field[%d-%d]: %s failed!\n", p->level, ' ', |
27419 | 4.80k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !'}'")); |
27420 | 4.80k | } |
27421 | 4.80k | _res = NULL; |
27422 | 4.80k | done: |
27423 | 4.80k | p->level--; |
27424 | 4.80k | return _res; |
27425 | 4.80k | } |
27426 | | |
27427 | | // invalid_tstring_conversion_character: '!' &(':' | '}') | '!' !NAME |
27428 | | static void * |
27429 | | invalid_tstring_conversion_character_rule(Parser *p) |
27430 | 44 | { |
27431 | 44 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
27432 | 0 | _Pypegen_stack_overflow(p); |
27433 | 0 | } |
27434 | 44 | if (p->error_indicator) { |
27435 | 0 | p->level--; |
27436 | 0 | return NULL; |
27437 | 0 | } |
27438 | 44 | void * _res = NULL; |
27439 | 44 | int _mark = p->mark; |
27440 | 44 | { // '!' &(':' | '}') |
27441 | 44 | if (p->error_indicator) { |
27442 | 0 | p->level--; |
27443 | 0 | return NULL; |
27444 | 0 | } |
27445 | 44 | D(fprintf(stderr, "%*c> invalid_tstring_conversion_character[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' &(':' | '}')")); |
27446 | 44 | Token * _literal; |
27447 | 44 | if ( |
27448 | 44 | (_literal = _PyPegen_expect_token(p, 54)) // token='!' |
27449 | 17 | && |
27450 | 17 | _PyPegen_lookahead(1, _tmp_153_rule, p) |
27451 | 44 | ) |
27452 | 4 | { |
27453 | 4 | D(fprintf(stderr, "%*c+ invalid_tstring_conversion_character[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' &(':' | '}')")); |
27454 | 4 | _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "t-string: missing conversion character" ); |
27455 | 4 | if (_res == NULL && PyErr_Occurred()) { |
27456 | 4 | p->error_indicator = 1; |
27457 | 4 | p->level--; |
27458 | 4 | return NULL; |
27459 | 4 | } |
27460 | 0 | goto done; |
27461 | 4 | } |
27462 | 40 | p->mark = _mark; |
27463 | 40 | D(fprintf(stderr, "%*c%s invalid_tstring_conversion_character[%d-%d]: %s failed!\n", p->level, ' ', |
27464 | 40 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' &(':' | '}')")); |
27465 | 40 | } |
27466 | 0 | { // '!' !NAME |
27467 | 40 | if (p->error_indicator) { |
27468 | 0 | p->level--; |
27469 | 0 | return NULL; |
27470 | 0 | } |
27471 | 40 | D(fprintf(stderr, "%*c> invalid_tstring_conversion_character[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' !NAME")); |
27472 | 40 | Token * _literal; |
27473 | 40 | if ( |
27474 | 40 | (_literal = _PyPegen_expect_token(p, 54)) // token='!' |
27475 | 13 | && |
27476 | 13 | _PyPegen_lookahead_for_expr(0, _PyPegen_name_token, p) |
27477 | 40 | ) |
27478 | 9 | { |
27479 | 9 | D(fprintf(stderr, "%*c+ invalid_tstring_conversion_character[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' !NAME")); |
27480 | 9 | _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "t-string: invalid conversion character" ); |
27481 | 9 | if (_res == NULL && PyErr_Occurred()) { |
27482 | 9 | p->error_indicator = 1; |
27483 | 9 | p->level--; |
27484 | 9 | return NULL; |
27485 | 9 | } |
27486 | 0 | goto done; |
27487 | 9 | } |
27488 | 31 | p->mark = _mark; |
27489 | 31 | D(fprintf(stderr, "%*c%s invalid_tstring_conversion_character[%d-%d]: %s failed!\n", p->level, ' ', |
27490 | 31 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' !NAME")); |
27491 | 31 | } |
27492 | 31 | _res = NULL; |
27493 | 31 | done: |
27494 | 31 | p->level--; |
27495 | 31 | return _res; |
27496 | 31 | } |
27497 | | |
27498 | | // invalid_string_tstring_concat: |
27499 | | // | ((fstring | string))+ tstring |
27500 | | // | tstring+ (fstring | string) |
27501 | | static void * |
27502 | | invalid_string_tstring_concat_rule(Parser *p) |
27503 | 25.4k | { |
27504 | 25.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
27505 | 1 | _Pypegen_stack_overflow(p); |
27506 | 1 | } |
27507 | 25.4k | if (p->error_indicator) { |
27508 | 1 | p->level--; |
27509 | 1 | return NULL; |
27510 | 1 | } |
27511 | 25.4k | void * _res = NULL; |
27512 | 25.4k | int _mark = p->mark; |
27513 | 25.4k | { // ((fstring | string))+ tstring |
27514 | 25.4k | if (p->error_indicator) { |
27515 | 0 | p->level--; |
27516 | 0 | return NULL; |
27517 | 0 | } |
27518 | 25.4k | D(fprintf(stderr, "%*c> invalid_string_tstring_concat[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((fstring | string))+ tstring")); |
27519 | 25.4k | asdl_seq * a; |
27520 | 25.4k | expr_ty b; |
27521 | 25.4k | if ( |
27522 | 25.4k | (a = _loop1_80_rule(p)) // ((fstring | string))+ |
27523 | 4.64k | && |
27524 | 4.64k | (b = (expr_ty)tstring_rule(p)) // tstring |
27525 | 25.4k | ) |
27526 | 4 | { |
27527 | 4 | D(fprintf(stderr, "%*c+ invalid_string_tstring_concat[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((fstring | string))+ tstring")); |
27528 | 4 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( PyPegen_last_item ( a , expr_ty ) , b , "cannot mix t-string literals with string or bytes literals" ); |
27529 | 4 | if (_res == NULL && PyErr_Occurred()) { |
27530 | 4 | p->error_indicator = 1; |
27531 | 4 | p->level--; |
27532 | 4 | return NULL; |
27533 | 4 | } |
27534 | 0 | goto done; |
27535 | 4 | } |
27536 | 25.4k | p->mark = _mark; |
27537 | 25.4k | D(fprintf(stderr, "%*c%s invalid_string_tstring_concat[%d-%d]: %s failed!\n", p->level, ' ', |
27538 | 25.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((fstring | string))+ tstring")); |
27539 | 25.4k | } |
27540 | 0 | { // tstring+ (fstring | string) |
27541 | 25.4k | if (p->error_indicator) { |
27542 | 1.71k | p->level--; |
27543 | 1.71k | return NULL; |
27544 | 1.71k | } |
27545 | 23.7k | D(fprintf(stderr, "%*c> invalid_string_tstring_concat[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tstring+ (fstring | string)")); |
27546 | 23.7k | asdl_seq * a; |
27547 | 23.7k | expr_ty b; |
27548 | 23.7k | if ( |
27549 | 23.7k | (a = _loop1_81_rule(p)) // tstring+ |
27550 | 1.39k | && |
27551 | 1.39k | (b = (expr_ty)_tmp_154_rule(p)) // fstring | string |
27552 | 23.7k | ) |
27553 | 16 | { |
27554 | 16 | D(fprintf(stderr, "%*c+ invalid_string_tstring_concat[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tstring+ (fstring | string)")); |
27555 | 16 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( PyPegen_last_item ( a , expr_ty ) , b , "cannot mix t-string literals with string or bytes literals" ); |
27556 | 16 | if (_res == NULL && PyErr_Occurred()) { |
27557 | 16 | p->error_indicator = 1; |
27558 | 16 | p->level--; |
27559 | 16 | return NULL; |
27560 | 16 | } |
27561 | 0 | goto done; |
27562 | 16 | } |
27563 | 23.7k | p->mark = _mark; |
27564 | 23.7k | D(fprintf(stderr, "%*c%s invalid_string_tstring_concat[%d-%d]: %s failed!\n", p->level, ' ', |
27565 | 23.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tstring+ (fstring | string)")); |
27566 | 23.7k | } |
27567 | 23.7k | _res = NULL; |
27568 | 23.7k | done: |
27569 | 23.7k | p->level--; |
27570 | 23.7k | return _res; |
27571 | 23.7k | } |
27572 | | |
27573 | | // invalid_arithmetic: sum ('+' | '-' | '*' | '/' | '%' | '//' | '@') 'not' inversion |
27574 | | static void * |
27575 | | invalid_arithmetic_rule(Parser *p) |
27576 | 280k | { |
27577 | 280k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
27578 | 0 | _Pypegen_stack_overflow(p); |
27579 | 0 | } |
27580 | 280k | if (p->error_indicator) { |
27581 | 0 | p->level--; |
27582 | 0 | return NULL; |
27583 | 0 | } |
27584 | 280k | void * _res = NULL; |
27585 | 280k | int _mark = p->mark; |
27586 | 280k | { // sum ('+' | '-' | '*' | '/' | '%' | '//' | '@') 'not' inversion |
27587 | 280k | if (p->error_indicator) { |
27588 | 0 | p->level--; |
27589 | 0 | return NULL; |
27590 | 0 | } |
27591 | 280k | D(fprintf(stderr, "%*c> invalid_arithmetic[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum ('+' | '-' | '*' | '/' | '%' | '//' | '@') 'not' inversion")); |
27592 | 280k | void *_tmp_155_var; |
27593 | 280k | Token * a; |
27594 | 280k | expr_ty b; |
27595 | 280k | expr_ty sum_var; |
27596 | 280k | if ( |
27597 | 280k | (sum_var = sum_rule(p)) // sum |
27598 | 204k | && |
27599 | 204k | (_tmp_155_var = _tmp_155_rule(p)) // '+' | '-' | '*' | '/' | '%' | '//' | '@' |
27600 | 3.75k | && |
27601 | 3.75k | (a = _PyPegen_expect_token(p, 712)) // token='not' |
27602 | 217 | && |
27603 | 217 | (b = inversion_rule(p)) // inversion |
27604 | 280k | ) |
27605 | 9 | { |
27606 | 9 | D(fprintf(stderr, "%*c+ invalid_arithmetic[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum ('+' | '-' | '*' | '/' | '%' | '//' | '@') 'not' inversion")); |
27607 | 9 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "'not' after an operator must be parenthesized" ); |
27608 | 9 | if (_res == NULL && PyErr_Occurred()) { |
27609 | 9 | p->error_indicator = 1; |
27610 | 9 | p->level--; |
27611 | 9 | return NULL; |
27612 | 9 | } |
27613 | 0 | goto done; |
27614 | 9 | } |
27615 | 280k | p->mark = _mark; |
27616 | 280k | D(fprintf(stderr, "%*c%s invalid_arithmetic[%d-%d]: %s failed!\n", p->level, ' ', |
27617 | 280k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum ('+' | '-' | '*' | '/' | '%' | '//' | '@') 'not' inversion")); |
27618 | 280k | } |
27619 | 280k | _res = NULL; |
27620 | 280k | done: |
27621 | 280k | p->level--; |
27622 | 280k | return _res; |
27623 | 280k | } |
27624 | | |
27625 | | // invalid_factor: ('+' | '-' | '~') 'not' factor |
27626 | | static void * |
27627 | | invalid_factor_rule(Parser *p) |
27628 | 292k | { |
27629 | 292k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
27630 | 0 | _Pypegen_stack_overflow(p); |
27631 | 0 | } |
27632 | 292k | if (p->error_indicator) { |
27633 | 0 | p->level--; |
27634 | 0 | return NULL; |
27635 | 0 | } |
27636 | 292k | void * _res = NULL; |
27637 | 292k | int _mark = p->mark; |
27638 | 292k | { // ('+' | '-' | '~') 'not' factor |
27639 | 292k | if (p->error_indicator) { |
27640 | 0 | p->level--; |
27641 | 0 | return NULL; |
27642 | 0 | } |
27643 | 292k | D(fprintf(stderr, "%*c> invalid_factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('+' | '-' | '~') 'not' factor")); |
27644 | 292k | void *_tmp_156_var; |
27645 | 292k | Token * a; |
27646 | 292k | expr_ty b; |
27647 | 292k | if ( |
27648 | 292k | (_tmp_156_var = _tmp_156_rule(p)) // '+' | '-' | '~' |
27649 | 10.3k | && |
27650 | 10.3k | (a = _PyPegen_expect_token(p, 712)) // token='not' |
27651 | 67 | && |
27652 | 67 | (b = factor_rule(p)) // factor |
27653 | 292k | ) |
27654 | 1 | { |
27655 | 1 | D(fprintf(stderr, "%*c+ invalid_factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('+' | '-' | '~') 'not' factor")); |
27656 | 1 | _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "'not' after an operator must be parenthesized" ); |
27657 | 1 | if (_res == NULL && PyErr_Occurred()) { |
27658 | 1 | p->error_indicator = 1; |
27659 | 1 | p->level--; |
27660 | 1 | return NULL; |
27661 | 1 | } |
27662 | 0 | goto done; |
27663 | 1 | } |
27664 | 292k | p->mark = _mark; |
27665 | 292k | D(fprintf(stderr, "%*c%s invalid_factor[%d-%d]: %s failed!\n", p->level, ' ', |
27666 | 292k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('+' | '-' | '~') 'not' factor")); |
27667 | 292k | } |
27668 | 292k | _res = NULL; |
27669 | 292k | done: |
27670 | 292k | p->level--; |
27671 | 292k | return _res; |
27672 | 292k | } |
27673 | | |
27674 | | // invalid_type_params: '[' ']' |
27675 | | static void * |
27676 | | invalid_type_params_rule(Parser *p) |
27677 | 8.22k | { |
27678 | 8.22k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
27679 | 0 | _Pypegen_stack_overflow(p); |
27680 | 0 | } |
27681 | 8.22k | if (p->error_indicator) { |
27682 | 0 | p->level--; |
27683 | 0 | return NULL; |
27684 | 0 | } |
27685 | 8.22k | void * _res = NULL; |
27686 | 8.22k | int _mark = p->mark; |
27687 | 8.22k | { // '[' ']' |
27688 | 8.22k | if (p->error_indicator) { |
27689 | 0 | p->level--; |
27690 | 0 | return NULL; |
27691 | 0 | } |
27692 | 8.22k | D(fprintf(stderr, "%*c> invalid_type_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' ']'")); |
27693 | 8.22k | Token * _literal; |
27694 | 8.22k | Token * token; |
27695 | 8.22k | if ( |
27696 | 8.22k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
27697 | 826 | && |
27698 | 826 | (token = _PyPegen_expect_token(p, 10)) // token=']' |
27699 | 8.22k | ) |
27700 | 3 | { |
27701 | 3 | D(fprintf(stderr, "%*c+ invalid_type_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' ']'")); |
27702 | 3 | _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( token , "Type parameter list cannot be empty" ); |
27703 | 3 | if (_res == NULL && PyErr_Occurred()) { |
27704 | 3 | p->error_indicator = 1; |
27705 | 3 | p->level--; |
27706 | 3 | return NULL; |
27707 | 3 | } |
27708 | 0 | goto done; |
27709 | 3 | } |
27710 | 8.22k | p->mark = _mark; |
27711 | 8.22k | D(fprintf(stderr, "%*c%s invalid_type_params[%d-%d]: %s failed!\n", p->level, ' ', |
27712 | 8.22k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' ']'")); |
27713 | 8.22k | } |
27714 | 8.22k | _res = NULL; |
27715 | 8.22k | done: |
27716 | 8.22k | p->level--; |
27717 | 8.22k | return _res; |
27718 | 8.22k | } |
27719 | | |
27720 | | // _loop0_1: NEWLINE |
27721 | | static asdl_seq * |
27722 | | _loop0_1_rule(Parser *p) |
27723 | 75 | { |
27724 | 75 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
27725 | 0 | _Pypegen_stack_overflow(p); |
27726 | 0 | } |
27727 | 75 | if (p->error_indicator) { |
27728 | 0 | p->level--; |
27729 | 0 | return NULL; |
27730 | 0 | } |
27731 | 75 | void *_res = NULL; |
27732 | 75 | int _mark = p->mark; |
27733 | 75 | void **_children = PyMem_Malloc(sizeof(void *)); |
27734 | 75 | if (!_children) { |
27735 | 0 | p->error_indicator = 1; |
27736 | 0 | PyErr_NoMemory(); |
27737 | 0 | p->level--; |
27738 | 0 | return NULL; |
27739 | 0 | } |
27740 | 75 | Py_ssize_t _children_capacity = 1; |
27741 | 75 | Py_ssize_t _n = 0; |
27742 | 75 | { // NEWLINE |
27743 | 75 | if (p->error_indicator) { |
27744 | 0 | p->level--; |
27745 | 0 | return NULL; |
27746 | 0 | } |
27747 | 75 | D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
27748 | 75 | Token * newline_var; |
27749 | 75 | while ( |
27750 | 75 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
27751 | 75 | ) |
27752 | 0 | { |
27753 | 0 | _res = newline_var; |
27754 | 0 | if (_n == _children_capacity) { |
27755 | 0 | _children_capacity *= 2; |
27756 | 0 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27757 | 0 | if (!_new_children) { |
27758 | 0 | PyMem_Free(_children); |
27759 | 0 | p->error_indicator = 1; |
27760 | 0 | PyErr_NoMemory(); |
27761 | 0 | p->level--; |
27762 | 0 | return NULL; |
27763 | 0 | } |
27764 | 0 | _children = _new_children; |
27765 | 0 | } |
27766 | 0 | _children[_n++] = _res; |
27767 | 0 | _mark = p->mark; |
27768 | 0 | } |
27769 | 75 | p->mark = _mark; |
27770 | 75 | D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ', |
27771 | 75 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
27772 | 75 | } |
27773 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27774 | 75 | if (!_seq) { |
27775 | 0 | PyMem_Free(_children); |
27776 | 0 | p->error_indicator = 1; |
27777 | 0 | PyErr_NoMemory(); |
27778 | 0 | p->level--; |
27779 | 0 | return NULL; |
27780 | 0 | } |
27781 | 75 | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27782 | 75 | PyMem_Free(_children); |
27783 | 75 | p->level--; |
27784 | 75 | return _seq; |
27785 | 75 | } |
27786 | | |
27787 | | // _loop1_2: statement |
27788 | | static asdl_seq * |
27789 | | _loop1_2_rule(Parser *p) |
27790 | 54.2k | { |
27791 | 54.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
27792 | 0 | _Pypegen_stack_overflow(p); |
27793 | 0 | } |
27794 | 54.2k | if (p->error_indicator) { |
27795 | 0 | p->level--; |
27796 | 0 | return NULL; |
27797 | 0 | } |
27798 | 54.2k | void *_res = NULL; |
27799 | 54.2k | int _mark = p->mark; |
27800 | 54.2k | void **_children = PyMem_Malloc(sizeof(void *)); |
27801 | 54.2k | if (!_children) { |
27802 | 0 | p->error_indicator = 1; |
27803 | 0 | PyErr_NoMemory(); |
27804 | 0 | p->level--; |
27805 | 0 | return NULL; |
27806 | 0 | } |
27807 | 54.2k | Py_ssize_t _children_capacity = 1; |
27808 | 54.2k | Py_ssize_t _n = 0; |
27809 | 54.2k | { // statement |
27810 | 54.2k | if (p->error_indicator) { |
27811 | 0 | p->level--; |
27812 | 0 | return NULL; |
27813 | 0 | } |
27814 | 54.2k | D(fprintf(stderr, "%*c> _loop1_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement")); |
27815 | 54.2k | asdl_stmt_seq* statement_var; |
27816 | 54.2k | while ( |
27817 | 176k | (statement_var = statement_rule(p)) // statement |
27818 | 54.2k | ) |
27819 | 122k | { |
27820 | 122k | _res = statement_var; |
27821 | 122k | if (_n == _children_capacity) { |
27822 | 27.5k | _children_capacity *= 2; |
27823 | 27.5k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27824 | 27.5k | if (!_new_children) { |
27825 | 0 | PyMem_Free(_children); |
27826 | 0 | p->error_indicator = 1; |
27827 | 0 | PyErr_NoMemory(); |
27828 | 0 | p->level--; |
27829 | 0 | return NULL; |
27830 | 0 | } |
27831 | 27.5k | _children = _new_children; |
27832 | 27.5k | } |
27833 | 122k | _children[_n++] = _res; |
27834 | 122k | _mark = p->mark; |
27835 | 122k | } |
27836 | 54.2k | p->mark = _mark; |
27837 | 54.2k | D(fprintf(stderr, "%*c%s _loop1_2[%d-%d]: %s failed!\n", p->level, ' ', |
27838 | 54.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement")); |
27839 | 54.2k | } |
27840 | 54.2k | if (_n == 0 || p->error_indicator) { |
27841 | 20.8k | PyMem_Free(_children); |
27842 | 20.8k | p->level--; |
27843 | 20.8k | return NULL; |
27844 | 20.8k | } |
27845 | 33.4k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27846 | 33.4k | if (!_seq) { |
27847 | 0 | PyMem_Free(_children); |
27848 | 0 | p->error_indicator = 1; |
27849 | 0 | PyErr_NoMemory(); |
27850 | 0 | p->level--; |
27851 | 0 | return NULL; |
27852 | 0 | } |
27853 | 152k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27854 | 33.4k | PyMem_Free(_children); |
27855 | 33.4k | p->level--; |
27856 | 33.4k | return _seq; |
27857 | 33.4k | } |
27858 | | |
27859 | | // _loop0_3: ';' simple_stmt |
27860 | | static asdl_seq * |
27861 | | _loop0_3_rule(Parser *p) |
27862 | 12.8k | { |
27863 | 12.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
27864 | 0 | _Pypegen_stack_overflow(p); |
27865 | 0 | } |
27866 | 12.8k | if (p->error_indicator) { |
27867 | 0 | p->level--; |
27868 | 0 | return NULL; |
27869 | 0 | } |
27870 | 12.8k | void *_res = NULL; |
27871 | 12.8k | int _mark = p->mark; |
27872 | 12.8k | void **_children = PyMem_Malloc(sizeof(void *)); |
27873 | 12.8k | if (!_children) { |
27874 | 0 | p->error_indicator = 1; |
27875 | 0 | PyErr_NoMemory(); |
27876 | 0 | p->level--; |
27877 | 0 | return NULL; |
27878 | 0 | } |
27879 | 12.8k | Py_ssize_t _children_capacity = 1; |
27880 | 12.8k | Py_ssize_t _n = 0; |
27881 | 12.8k | { // ';' simple_stmt |
27882 | 12.8k | if (p->error_indicator) { |
27883 | 0 | p->level--; |
27884 | 0 | return NULL; |
27885 | 0 | } |
27886 | 12.8k | D(fprintf(stderr, "%*c> _loop0_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' simple_stmt")); |
27887 | 12.8k | Token * _literal; |
27888 | 12.8k | stmt_ty elem; |
27889 | 12.8k | while ( |
27890 | 33.8k | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
27891 | 22.4k | && |
27892 | 22.4k | (elem = simple_stmt_rule(p)) // simple_stmt |
27893 | 12.8k | ) |
27894 | 21.0k | { |
27895 | 21.0k | _res = elem; |
27896 | 21.0k | if (_res == NULL && PyErr_Occurred()) { |
27897 | 0 | p->error_indicator = 1; |
27898 | 0 | PyMem_Free(_children); |
27899 | 0 | p->level--; |
27900 | 0 | return NULL; |
27901 | 0 | } |
27902 | 21.0k | if (_n == _children_capacity) { |
27903 | 3.24k | _children_capacity *= 2; |
27904 | 3.24k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
27905 | 3.24k | if (!_new_children) { |
27906 | 0 | PyMem_Free(_children); |
27907 | 0 | p->error_indicator = 1; |
27908 | 0 | PyErr_NoMemory(); |
27909 | 0 | p->level--; |
27910 | 0 | return NULL; |
27911 | 0 | } |
27912 | 3.24k | _children = _new_children; |
27913 | 3.24k | } |
27914 | 21.0k | _children[_n++] = _res; |
27915 | 21.0k | _mark = p->mark; |
27916 | 21.0k | } |
27917 | 12.8k | p->mark = _mark; |
27918 | 12.8k | D(fprintf(stderr, "%*c%s _loop0_3[%d-%d]: %s failed!\n", p->level, ' ', |
27919 | 12.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' simple_stmt")); |
27920 | 12.8k | } |
27921 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
27922 | 12.8k | if (!_seq) { |
27923 | 0 | PyMem_Free(_children); |
27924 | 0 | p->error_indicator = 1; |
27925 | 0 | PyErr_NoMemory(); |
27926 | 0 | p->level--; |
27927 | 0 | return NULL; |
27928 | 0 | } |
27929 | 33.8k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
27930 | 12.8k | PyMem_Free(_children); |
27931 | 12.8k | p->level--; |
27932 | 12.8k | return _seq; |
27933 | 12.8k | } |
27934 | | |
27935 | | // _gather_4: simple_stmt _loop0_3 |
27936 | | static asdl_seq * |
27937 | | _gather_4_rule(Parser *p) |
27938 | 53.9k | { |
27939 | 53.9k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
27940 | 0 | _Pypegen_stack_overflow(p); |
27941 | 0 | } |
27942 | 53.9k | if (p->error_indicator) { |
27943 | 0 | p->level--; |
27944 | 0 | return NULL; |
27945 | 0 | } |
27946 | 53.9k | asdl_seq * _res = NULL; |
27947 | 53.9k | int _mark = p->mark; |
27948 | 53.9k | { // simple_stmt _loop0_3 |
27949 | 53.9k | if (p->error_indicator) { |
27950 | 0 | p->level--; |
27951 | 0 | return NULL; |
27952 | 0 | } |
27953 | 53.9k | D(fprintf(stderr, "%*c> _gather_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_3")); |
27954 | 53.9k | stmt_ty elem; |
27955 | 53.9k | asdl_seq * seq; |
27956 | 53.9k | if ( |
27957 | 53.9k | (elem = simple_stmt_rule(p)) // simple_stmt |
27958 | 12.8k | && |
27959 | 12.8k | (seq = _loop0_3_rule(p)) // _loop0_3 |
27960 | 53.9k | ) |
27961 | 12.8k | { |
27962 | 12.8k | D(fprintf(stderr, "%*c+ _gather_4[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_3")); |
27963 | 12.8k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
27964 | 12.8k | goto done; |
27965 | 12.8k | } |
27966 | 41.1k | p->mark = _mark; |
27967 | 41.1k | D(fprintf(stderr, "%*c%s _gather_4[%d-%d]: %s failed!\n", p->level, ' ', |
27968 | 41.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt _loop0_3")); |
27969 | 41.1k | } |
27970 | 41.1k | _res = NULL; |
27971 | 53.9k | done: |
27972 | 53.9k | p->level--; |
27973 | 53.9k | return _res; |
27974 | 41.1k | } |
27975 | | |
27976 | | // _tmp_5: 'import' | 'from' |
27977 | | static void * |
27978 | | _tmp_5_rule(Parser *p) |
27979 | 62.1k | { |
27980 | 62.1k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
27981 | 0 | _Pypegen_stack_overflow(p); |
27982 | 0 | } |
27983 | 62.1k | if (p->error_indicator) { |
27984 | 0 | p->level--; |
27985 | 0 | return NULL; |
27986 | 0 | } |
27987 | 62.1k | void * _res = NULL; |
27988 | 62.1k | int _mark = p->mark; |
27989 | 62.1k | { // 'import' |
27990 | 62.1k | if (p->error_indicator) { |
27991 | 0 | p->level--; |
27992 | 0 | return NULL; |
27993 | 0 | } |
27994 | 62.1k | D(fprintf(stderr, "%*c> _tmp_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'")); |
27995 | 62.1k | Token * _keyword; |
27996 | 62.1k | if ( |
27997 | 62.1k | (_keyword = _PyPegen_expect_token(p, 643)) // token='import' |
27998 | 62.1k | ) |
27999 | 2.97k | { |
28000 | 2.97k | D(fprintf(stderr, "%*c+ _tmp_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'")); |
28001 | 2.97k | _res = _keyword; |
28002 | 2.97k | goto done; |
28003 | 2.97k | } |
28004 | 59.1k | p->mark = _mark; |
28005 | 59.1k | D(fprintf(stderr, "%*c%s _tmp_5[%d-%d]: %s failed!\n", p->level, ' ', |
28006 | 59.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'")); |
28007 | 59.1k | } |
28008 | 0 | { // 'from' |
28009 | 59.1k | if (p->error_indicator) { |
28010 | 0 | p->level--; |
28011 | 0 | return NULL; |
28012 | 0 | } |
28013 | 59.1k | D(fprintf(stderr, "%*c> _tmp_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'")); |
28014 | 59.1k | Token * _keyword; |
28015 | 59.1k | if ( |
28016 | 59.1k | (_keyword = _PyPegen_expect_token(p, 642)) // token='from' |
28017 | 59.1k | ) |
28018 | 3.32k | { |
28019 | 3.32k | D(fprintf(stderr, "%*c+ _tmp_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'")); |
28020 | 3.32k | _res = _keyword; |
28021 | 3.32k | goto done; |
28022 | 3.32k | } |
28023 | 55.8k | p->mark = _mark; |
28024 | 55.8k | D(fprintf(stderr, "%*c%s _tmp_5[%d-%d]: %s failed!\n", p->level, ' ', |
28025 | 55.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'")); |
28026 | 55.8k | } |
28027 | 55.8k | _res = NULL; |
28028 | 62.1k | done: |
28029 | 62.1k | p->level--; |
28030 | 62.1k | return _res; |
28031 | 55.8k | } |
28032 | | |
28033 | | // _tmp_6: 'def' | '@' | 'async' |
28034 | | static void * |
28035 | | _tmp_6_rule(Parser *p) |
28036 | 176k | { |
28037 | 176k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28038 | 0 | _Pypegen_stack_overflow(p); |
28039 | 0 | } |
28040 | 176k | if (p->error_indicator) { |
28041 | 0 | p->level--; |
28042 | 0 | return NULL; |
28043 | 0 | } |
28044 | 176k | void * _res = NULL; |
28045 | 176k | int _mark = p->mark; |
28046 | 176k | { // 'def' |
28047 | 176k | if (p->error_indicator) { |
28048 | 0 | p->level--; |
28049 | 0 | return NULL; |
28050 | 0 | } |
28051 | 176k | D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'")); |
28052 | 176k | Token * _keyword; |
28053 | 176k | if ( |
28054 | 176k | (_keyword = _PyPegen_expect_token(p, 708)) // token='def' |
28055 | 176k | ) |
28056 | 11.4k | { |
28057 | 11.4k | D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'")); |
28058 | 11.4k | _res = _keyword; |
28059 | 11.4k | goto done; |
28060 | 11.4k | } |
28061 | 165k | p->mark = _mark; |
28062 | 165k | D(fprintf(stderr, "%*c%s _tmp_6[%d-%d]: %s failed!\n", p->level, ' ', |
28063 | 165k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'")); |
28064 | 165k | } |
28065 | 0 | { // '@' |
28066 | 165k | if (p->error_indicator) { |
28067 | 868 | p->level--; |
28068 | 868 | return NULL; |
28069 | 868 | } |
28070 | 164k | D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); |
28071 | 164k | Token * _literal; |
28072 | 164k | if ( |
28073 | 164k | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
28074 | 164k | ) |
28075 | 1.76k | { |
28076 | 1.76k | D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); |
28077 | 1.76k | _res = _literal; |
28078 | 1.76k | goto done; |
28079 | 1.76k | } |
28080 | 162k | p->mark = _mark; |
28081 | 162k | D(fprintf(stderr, "%*c%s _tmp_6[%d-%d]: %s failed!\n", p->level, ' ', |
28082 | 162k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); |
28083 | 162k | } |
28084 | 0 | { // 'async' |
28085 | 162k | if (p->error_indicator) { |
28086 | 0 | p->level--; |
28087 | 0 | return NULL; |
28088 | 0 | } |
28089 | 162k | D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'")); |
28090 | 162k | Token * _keyword; |
28091 | 162k | if ( |
28092 | 162k | (_keyword = _PyPegen_expect_token(p, 707)) // token='async' |
28093 | 162k | ) |
28094 | 2.17k | { |
28095 | 2.17k | D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'")); |
28096 | 2.17k | _res = _keyword; |
28097 | 2.17k | goto done; |
28098 | 2.17k | } |
28099 | 160k | p->mark = _mark; |
28100 | 160k | D(fprintf(stderr, "%*c%s _tmp_6[%d-%d]: %s failed!\n", p->level, ' ', |
28101 | 160k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'")); |
28102 | 160k | } |
28103 | 160k | _res = NULL; |
28104 | 176k | done: |
28105 | 176k | p->level--; |
28106 | 176k | return _res; |
28107 | 160k | } |
28108 | | |
28109 | | // _tmp_7: 'class' | '@' |
28110 | | static void * |
28111 | | _tmp_7_rule(Parser *p) |
28112 | 153k | { |
28113 | 153k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28114 | 0 | _Pypegen_stack_overflow(p); |
28115 | 0 | } |
28116 | 153k | if (p->error_indicator) { |
28117 | 0 | p->level--; |
28118 | 0 | return NULL; |
28119 | 0 | } |
28120 | 153k | void * _res = NULL; |
28121 | 153k | int _mark = p->mark; |
28122 | 153k | { // 'class' |
28123 | 153k | if (p->error_indicator) { |
28124 | 0 | p->level--; |
28125 | 0 | return NULL; |
28126 | 0 | } |
28127 | 153k | D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'")); |
28128 | 153k | Token * _keyword; |
28129 | 153k | if ( |
28130 | 153k | (_keyword = _PyPegen_expect_token(p, 710)) // token='class' |
28131 | 153k | ) |
28132 | 3.25k | { |
28133 | 3.25k | D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'")); |
28134 | 3.25k | _res = _keyword; |
28135 | 3.25k | goto done; |
28136 | 3.25k | } |
28137 | 150k | p->mark = _mark; |
28138 | 150k | D(fprintf(stderr, "%*c%s _tmp_7[%d-%d]: %s failed!\n", p->level, ' ', |
28139 | 150k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'")); |
28140 | 150k | } |
28141 | 0 | { // '@' |
28142 | 150k | if (p->error_indicator) { |
28143 | 0 | p->level--; |
28144 | 0 | return NULL; |
28145 | 0 | } |
28146 | 150k | D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); |
28147 | 150k | Token * _literal; |
28148 | 150k | if ( |
28149 | 150k | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
28150 | 150k | ) |
28151 | 643 | { |
28152 | 643 | D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); |
28153 | 643 | _res = _literal; |
28154 | 643 | goto done; |
28155 | 643 | } |
28156 | 149k | p->mark = _mark; |
28157 | 149k | D(fprintf(stderr, "%*c%s _tmp_7[%d-%d]: %s failed!\n", p->level, ' ', |
28158 | 149k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); |
28159 | 149k | } |
28160 | 149k | _res = NULL; |
28161 | 153k | done: |
28162 | 153k | p->level--; |
28163 | 153k | return _res; |
28164 | 149k | } |
28165 | | |
28166 | | // _tmp_8: 'with' | 'async' |
28167 | | static void * |
28168 | | _tmp_8_rule(Parser *p) |
28169 | 150k | { |
28170 | 150k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28171 | 0 | _Pypegen_stack_overflow(p); |
28172 | 0 | } |
28173 | 150k | if (p->error_indicator) { |
28174 | 0 | p->level--; |
28175 | 0 | return NULL; |
28176 | 0 | } |
28177 | 150k | void * _res = NULL; |
28178 | 150k | int _mark = p->mark; |
28179 | 150k | { // 'with' |
28180 | 150k | if (p->error_indicator) { |
28181 | 0 | p->level--; |
28182 | 0 | return NULL; |
28183 | 0 | } |
28184 | 150k | D(fprintf(stderr, "%*c> _tmp_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'")); |
28185 | 150k | Token * _keyword; |
28186 | 150k | if ( |
28187 | 150k | (_keyword = _PyPegen_expect_token(p, 656)) // token='with' |
28188 | 150k | ) |
28189 | 2.61k | { |
28190 | 2.61k | D(fprintf(stderr, "%*c+ _tmp_8[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'")); |
28191 | 2.61k | _res = _keyword; |
28192 | 2.61k | goto done; |
28193 | 2.61k | } |
28194 | 147k | p->mark = _mark; |
28195 | 147k | D(fprintf(stderr, "%*c%s _tmp_8[%d-%d]: %s failed!\n", p->level, ' ', |
28196 | 147k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'")); |
28197 | 147k | } |
28198 | 0 | { // 'async' |
28199 | 147k | if (p->error_indicator) { |
28200 | 0 | p->level--; |
28201 | 0 | return NULL; |
28202 | 0 | } |
28203 | 147k | D(fprintf(stderr, "%*c> _tmp_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'")); |
28204 | 147k | Token * _keyword; |
28205 | 147k | if ( |
28206 | 147k | (_keyword = _PyPegen_expect_token(p, 707)) // token='async' |
28207 | 147k | ) |
28208 | 1.83k | { |
28209 | 1.83k | D(fprintf(stderr, "%*c+ _tmp_8[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'")); |
28210 | 1.83k | _res = _keyword; |
28211 | 1.83k | goto done; |
28212 | 1.83k | } |
28213 | 145k | p->mark = _mark; |
28214 | 145k | D(fprintf(stderr, "%*c%s _tmp_8[%d-%d]: %s failed!\n", p->level, ' ', |
28215 | 145k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'")); |
28216 | 145k | } |
28217 | 145k | _res = NULL; |
28218 | 150k | done: |
28219 | 150k | p->level--; |
28220 | 150k | return _res; |
28221 | 145k | } |
28222 | | |
28223 | | // _tmp_9: 'for' | 'async' |
28224 | | static void * |
28225 | | _tmp_9_rule(Parser *p) |
28226 | 147k | { |
28227 | 147k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28228 | 0 | _Pypegen_stack_overflow(p); |
28229 | 0 | } |
28230 | 147k | if (p->error_indicator) { |
28231 | 0 | p->level--; |
28232 | 0 | return NULL; |
28233 | 0 | } |
28234 | 147k | void * _res = NULL; |
28235 | 147k | int _mark = p->mark; |
28236 | 147k | { // 'for' |
28237 | 147k | if (p->error_indicator) { |
28238 | 0 | p->level--; |
28239 | 0 | return NULL; |
28240 | 0 | } |
28241 | 147k | D(fprintf(stderr, "%*c> _tmp_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'")); |
28242 | 147k | Token * _keyword; |
28243 | 147k | if ( |
28244 | 147k | (_keyword = _PyPegen_expect_token(p, 703)) // token='for' |
28245 | 147k | ) |
28246 | 2.14k | { |
28247 | 2.14k | D(fprintf(stderr, "%*c+ _tmp_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'")); |
28248 | 2.14k | _res = _keyword; |
28249 | 2.14k | goto done; |
28250 | 2.14k | } |
28251 | 144k | p->mark = _mark; |
28252 | 144k | D(fprintf(stderr, "%*c%s _tmp_9[%d-%d]: %s failed!\n", p->level, ' ', |
28253 | 144k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'")); |
28254 | 144k | } |
28255 | 0 | { // 'async' |
28256 | 144k | if (p->error_indicator) { |
28257 | 0 | p->level--; |
28258 | 0 | return NULL; |
28259 | 0 | } |
28260 | 144k | D(fprintf(stderr, "%*c> _tmp_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'")); |
28261 | 144k | Token * _keyword; |
28262 | 144k | if ( |
28263 | 144k | (_keyword = _PyPegen_expect_token(p, 707)) // token='async' |
28264 | 144k | ) |
28265 | 793 | { |
28266 | 793 | D(fprintf(stderr, "%*c+ _tmp_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'")); |
28267 | 793 | _res = _keyword; |
28268 | 793 | goto done; |
28269 | 793 | } |
28270 | 144k | p->mark = _mark; |
28271 | 144k | D(fprintf(stderr, "%*c%s _tmp_9[%d-%d]: %s failed!\n", p->level, ' ', |
28272 | 144k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'async'")); |
28273 | 144k | } |
28274 | 144k | _res = NULL; |
28275 | 147k | done: |
28276 | 147k | p->level--; |
28277 | 147k | return _res; |
28278 | 144k | } |
28279 | | |
28280 | | // _tmp_10: '=' annotated_rhs |
28281 | | static void * |
28282 | | _tmp_10_rule(Parser *p) |
28283 | 3.16k | { |
28284 | 3.16k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28285 | 0 | _Pypegen_stack_overflow(p); |
28286 | 0 | } |
28287 | 3.16k | if (p->error_indicator) { |
28288 | 0 | p->level--; |
28289 | 0 | return NULL; |
28290 | 0 | } |
28291 | 3.16k | void * _res = NULL; |
28292 | 3.16k | int _mark = p->mark; |
28293 | 3.16k | { // '=' annotated_rhs |
28294 | 3.16k | if (p->error_indicator) { |
28295 | 0 | p->level--; |
28296 | 0 | return NULL; |
28297 | 0 | } |
28298 | 3.16k | D(fprintf(stderr, "%*c> _tmp_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
28299 | 3.16k | Token * _literal; |
28300 | 3.16k | expr_ty d; |
28301 | 3.16k | if ( |
28302 | 3.16k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
28303 | 474 | && |
28304 | 474 | (d = annotated_rhs_rule(p)) // annotated_rhs |
28305 | 3.16k | ) |
28306 | 460 | { |
28307 | 460 | D(fprintf(stderr, "%*c+ _tmp_10[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
28308 | 460 | _res = d; |
28309 | 460 | if (_res == NULL && PyErr_Occurred()) { |
28310 | 0 | p->error_indicator = 1; |
28311 | 0 | p->level--; |
28312 | 0 | return NULL; |
28313 | 0 | } |
28314 | 460 | goto done; |
28315 | 460 | } |
28316 | 2.70k | p->mark = _mark; |
28317 | 2.70k | D(fprintf(stderr, "%*c%s _tmp_10[%d-%d]: %s failed!\n", p->level, ' ', |
28318 | 2.70k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); |
28319 | 2.70k | } |
28320 | 2.70k | _res = NULL; |
28321 | 3.16k | done: |
28322 | 3.16k | p->level--; |
28323 | 3.16k | return _res; |
28324 | 2.70k | } |
28325 | | |
28326 | | // _tmp_11: '(' single_target ')' | single_subscript_attribute_target |
28327 | | static void * |
28328 | | _tmp_11_rule(Parser *p) |
28329 | 189k | { |
28330 | 189k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28331 | 0 | _Pypegen_stack_overflow(p); |
28332 | 0 | } |
28333 | 189k | if (p->error_indicator) { |
28334 | 0 | p->level--; |
28335 | 0 | return NULL; |
28336 | 0 | } |
28337 | 189k | void * _res = NULL; |
28338 | 189k | int _mark = p->mark; |
28339 | 189k | { // '(' single_target ')' |
28340 | 189k | if (p->error_indicator) { |
28341 | 0 | p->level--; |
28342 | 0 | return NULL; |
28343 | 0 | } |
28344 | 189k | D(fprintf(stderr, "%*c> _tmp_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
28345 | 189k | Token * _literal; |
28346 | 189k | Token * _literal_1; |
28347 | 189k | expr_ty b; |
28348 | 189k | if ( |
28349 | 189k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
28350 | 3.45k | && |
28351 | 3.45k | (b = single_target_rule(p)) // single_target |
28352 | 1.68k | && |
28353 | 1.68k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
28354 | 189k | ) |
28355 | 308 | { |
28356 | 308 | D(fprintf(stderr, "%*c+ _tmp_11[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'")); |
28357 | 308 | _res = b; |
28358 | 308 | if (_res == NULL && PyErr_Occurred()) { |
28359 | 0 | p->error_indicator = 1; |
28360 | 0 | p->level--; |
28361 | 0 | return NULL; |
28362 | 0 | } |
28363 | 308 | goto done; |
28364 | 308 | } |
28365 | 189k | p->mark = _mark; |
28366 | 189k | D(fprintf(stderr, "%*c%s _tmp_11[%d-%d]: %s failed!\n", p->level, ' ', |
28367 | 189k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); |
28368 | 189k | } |
28369 | 0 | { // single_subscript_attribute_target |
28370 | 189k | if (p->error_indicator) { |
28371 | 152 | p->level--; |
28372 | 152 | return NULL; |
28373 | 152 | } |
28374 | 189k | D(fprintf(stderr, "%*c> _tmp_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
28375 | 189k | expr_ty single_subscript_attribute_target_var; |
28376 | 189k | if ( |
28377 | 189k | (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target |
28378 | 189k | ) |
28379 | 6.05k | { |
28380 | 6.05k | D(fprintf(stderr, "%*c+ _tmp_11[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target")); |
28381 | 6.05k | _res = single_subscript_attribute_target_var; |
28382 | 6.05k | goto done; |
28383 | 6.05k | } |
28384 | 183k | p->mark = _mark; |
28385 | 183k | D(fprintf(stderr, "%*c%s _tmp_11[%d-%d]: %s failed!\n", p->level, ' ', |
28386 | 183k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); |
28387 | 183k | } |
28388 | 183k | _res = NULL; |
28389 | 189k | done: |
28390 | 189k | p->level--; |
28391 | 189k | return _res; |
28392 | 183k | } |
28393 | | |
28394 | | // _loop1_12: (star_targets '=') |
28395 | | static asdl_seq * |
28396 | | _loop1_12_rule(Parser *p) |
28397 | 186k | { |
28398 | 186k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28399 | 0 | _Pypegen_stack_overflow(p); |
28400 | 0 | } |
28401 | 186k | if (p->error_indicator) { |
28402 | 0 | p->level--; |
28403 | 0 | return NULL; |
28404 | 0 | } |
28405 | 186k | void *_res = NULL; |
28406 | 186k | int _mark = p->mark; |
28407 | 186k | void **_children = PyMem_Malloc(sizeof(void *)); |
28408 | 186k | if (!_children) { |
28409 | 0 | p->error_indicator = 1; |
28410 | 0 | PyErr_NoMemory(); |
28411 | 0 | p->level--; |
28412 | 0 | return NULL; |
28413 | 0 | } |
28414 | 186k | Py_ssize_t _children_capacity = 1; |
28415 | 186k | Py_ssize_t _n = 0; |
28416 | 186k | { // (star_targets '=') |
28417 | 186k | if (p->error_indicator) { |
28418 | 0 | p->level--; |
28419 | 0 | return NULL; |
28420 | 0 | } |
28421 | 186k | D(fprintf(stderr, "%*c> _loop1_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); |
28422 | 186k | void *_tmp_157_var; |
28423 | 186k | while ( |
28424 | 206k | (_tmp_157_var = _tmp_157_rule(p)) // star_targets '=' |
28425 | 186k | ) |
28426 | 19.9k | { |
28427 | 19.9k | _res = _tmp_157_var; |
28428 | 19.9k | if (_n == _children_capacity) { |
28429 | 392 | _children_capacity *= 2; |
28430 | 392 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28431 | 392 | if (!_new_children) { |
28432 | 0 | PyMem_Free(_children); |
28433 | 0 | p->error_indicator = 1; |
28434 | 0 | PyErr_NoMemory(); |
28435 | 0 | p->level--; |
28436 | 0 | return NULL; |
28437 | 0 | } |
28438 | 392 | _children = _new_children; |
28439 | 392 | } |
28440 | 19.9k | _children[_n++] = _res; |
28441 | 19.9k | _mark = p->mark; |
28442 | 19.9k | } |
28443 | 186k | p->mark = _mark; |
28444 | 186k | D(fprintf(stderr, "%*c%s _loop1_12[%d-%d]: %s failed!\n", p->level, ' ', |
28445 | 186k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); |
28446 | 186k | } |
28447 | 186k | if (_n == 0 || p->error_indicator) { |
28448 | 168k | PyMem_Free(_children); |
28449 | 168k | p->level--; |
28450 | 168k | return NULL; |
28451 | 168k | } |
28452 | 18.4k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28453 | 18.4k | if (!_seq) { |
28454 | 0 | PyMem_Free(_children); |
28455 | 0 | p->error_indicator = 1; |
28456 | 0 | PyErr_NoMemory(); |
28457 | 0 | p->level--; |
28458 | 0 | return NULL; |
28459 | 0 | } |
28460 | 38.3k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28461 | 18.4k | PyMem_Free(_children); |
28462 | 18.4k | p->level--; |
28463 | 18.4k | return _seq; |
28464 | 18.4k | } |
28465 | | |
28466 | | // _loop0_13: ',' NAME |
28467 | | static asdl_seq * |
28468 | | _loop0_13_rule(Parser *p) |
28469 | 1.33k | { |
28470 | 1.33k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28471 | 0 | _Pypegen_stack_overflow(p); |
28472 | 0 | } |
28473 | 1.33k | if (p->error_indicator) { |
28474 | 0 | p->level--; |
28475 | 0 | return NULL; |
28476 | 0 | } |
28477 | 1.33k | void *_res = NULL; |
28478 | 1.33k | int _mark = p->mark; |
28479 | 1.33k | void **_children = PyMem_Malloc(sizeof(void *)); |
28480 | 1.33k | if (!_children) { |
28481 | 0 | p->error_indicator = 1; |
28482 | 0 | PyErr_NoMemory(); |
28483 | 0 | p->level--; |
28484 | 0 | return NULL; |
28485 | 0 | } |
28486 | 1.33k | Py_ssize_t _children_capacity = 1; |
28487 | 1.33k | Py_ssize_t _n = 0; |
28488 | 1.33k | { // ',' NAME |
28489 | 1.33k | if (p->error_indicator) { |
28490 | 0 | p->level--; |
28491 | 0 | return NULL; |
28492 | 0 | } |
28493 | 1.33k | D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME")); |
28494 | 1.33k | Token * _literal; |
28495 | 1.33k | expr_ty elem; |
28496 | 1.33k | while ( |
28497 | 3.38k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
28498 | 2.07k | && |
28499 | 2.07k | (elem = _PyPegen_name_token(p)) // NAME |
28500 | 1.33k | ) |
28501 | 2.05k | { |
28502 | 2.05k | _res = elem; |
28503 | 2.05k | if (_res == NULL && PyErr_Occurred()) { |
28504 | 0 | p->error_indicator = 1; |
28505 | 0 | PyMem_Free(_children); |
28506 | 0 | p->level--; |
28507 | 0 | return NULL; |
28508 | 0 | } |
28509 | 2.05k | if (_n == _children_capacity) { |
28510 | 490 | _children_capacity *= 2; |
28511 | 490 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28512 | 490 | if (!_new_children) { |
28513 | 0 | PyMem_Free(_children); |
28514 | 0 | p->error_indicator = 1; |
28515 | 0 | PyErr_NoMemory(); |
28516 | 0 | p->level--; |
28517 | 0 | return NULL; |
28518 | 0 | } |
28519 | 490 | _children = _new_children; |
28520 | 490 | } |
28521 | 2.05k | _children[_n++] = _res; |
28522 | 2.05k | _mark = p->mark; |
28523 | 2.05k | } |
28524 | 1.33k | p->mark = _mark; |
28525 | 1.33k | D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ', |
28526 | 1.33k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); |
28527 | 1.33k | } |
28528 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28529 | 1.33k | if (!_seq) { |
28530 | 0 | PyMem_Free(_children); |
28531 | 0 | p->error_indicator = 1; |
28532 | 0 | PyErr_NoMemory(); |
28533 | 0 | p->level--; |
28534 | 0 | return NULL; |
28535 | 0 | } |
28536 | 3.38k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28537 | 1.33k | PyMem_Free(_children); |
28538 | 1.33k | p->level--; |
28539 | 1.33k | return _seq; |
28540 | 1.33k | } |
28541 | | |
28542 | | // _gather_14: NAME _loop0_13 |
28543 | | static asdl_seq * |
28544 | | _gather_14_rule(Parser *p) |
28545 | 1.34k | { |
28546 | 1.34k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28547 | 0 | _Pypegen_stack_overflow(p); |
28548 | 0 | } |
28549 | 1.34k | if (p->error_indicator) { |
28550 | 0 | p->level--; |
28551 | 0 | return NULL; |
28552 | 0 | } |
28553 | 1.34k | asdl_seq * _res = NULL; |
28554 | 1.34k | int _mark = p->mark; |
28555 | 1.34k | { // NAME _loop0_13 |
28556 | 1.34k | if (p->error_indicator) { |
28557 | 0 | p->level--; |
28558 | 0 | return NULL; |
28559 | 0 | } |
28560 | 1.34k | D(fprintf(stderr, "%*c> _gather_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_13")); |
28561 | 1.34k | expr_ty elem; |
28562 | 1.34k | asdl_seq * seq; |
28563 | 1.34k | if ( |
28564 | 1.34k | (elem = _PyPegen_name_token(p)) // NAME |
28565 | 1.33k | && |
28566 | 1.33k | (seq = _loop0_13_rule(p)) // _loop0_13 |
28567 | 1.34k | ) |
28568 | 1.33k | { |
28569 | 1.33k | D(fprintf(stderr, "%*c+ _gather_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_13")); |
28570 | 1.33k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
28571 | 1.33k | goto done; |
28572 | 1.33k | } |
28573 | 10 | p->mark = _mark; |
28574 | 10 | D(fprintf(stderr, "%*c%s _gather_14[%d-%d]: %s failed!\n", p->level, ' ', |
28575 | 10 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_13")); |
28576 | 10 | } |
28577 | 10 | _res = NULL; |
28578 | 1.34k | done: |
28579 | 1.34k | p->level--; |
28580 | 1.34k | return _res; |
28581 | 10 | } |
28582 | | |
28583 | | // _tmp_15: ';' | NEWLINE |
28584 | | static void * |
28585 | | _tmp_15_rule(Parser *p) |
28586 | 1.32k | { |
28587 | 1.32k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28588 | 0 | _Pypegen_stack_overflow(p); |
28589 | 0 | } |
28590 | 1.32k | if (p->error_indicator) { |
28591 | 0 | p->level--; |
28592 | 0 | return NULL; |
28593 | 0 | } |
28594 | 1.32k | void * _res = NULL; |
28595 | 1.32k | int _mark = p->mark; |
28596 | 1.32k | { // ';' |
28597 | 1.32k | if (p->error_indicator) { |
28598 | 0 | p->level--; |
28599 | 0 | return NULL; |
28600 | 0 | } |
28601 | 1.32k | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'")); |
28602 | 1.32k | Token * _literal; |
28603 | 1.32k | if ( |
28604 | 1.32k | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
28605 | 1.32k | ) |
28606 | 547 | { |
28607 | 547 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'")); |
28608 | 547 | _res = _literal; |
28609 | 547 | goto done; |
28610 | 547 | } |
28611 | 779 | p->mark = _mark; |
28612 | 779 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
28613 | 779 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'")); |
28614 | 779 | } |
28615 | 0 | { // NEWLINE |
28616 | 779 | if (p->error_indicator) { |
28617 | 0 | p->level--; |
28618 | 0 | return NULL; |
28619 | 0 | } |
28620 | 779 | D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
28621 | 779 | Token * newline_var; |
28622 | 779 | if ( |
28623 | 779 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
28624 | 779 | ) |
28625 | 479 | { |
28626 | 479 | D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
28627 | 479 | _res = newline_var; |
28628 | 479 | goto done; |
28629 | 479 | } |
28630 | 300 | p->mark = _mark; |
28631 | 300 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
28632 | 300 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
28633 | 300 | } |
28634 | 300 | _res = NULL; |
28635 | 1.32k | done: |
28636 | 1.32k | p->level--; |
28637 | 1.32k | return _res; |
28638 | 300 | } |
28639 | | |
28640 | | // _tmp_16: ',' expression |
28641 | | static void * |
28642 | | _tmp_16_rule(Parser *p) |
28643 | 6.35k | { |
28644 | 6.35k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28645 | 0 | _Pypegen_stack_overflow(p); |
28646 | 0 | } |
28647 | 6.35k | if (p->error_indicator) { |
28648 | 0 | p->level--; |
28649 | 0 | return NULL; |
28650 | 0 | } |
28651 | 6.35k | void * _res = NULL; |
28652 | 6.35k | int _mark = p->mark; |
28653 | 6.35k | { // ',' expression |
28654 | 6.35k | if (p->error_indicator) { |
28655 | 0 | p->level--; |
28656 | 0 | return NULL; |
28657 | 0 | } |
28658 | 6.35k | D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
28659 | 6.35k | Token * _literal; |
28660 | 6.35k | expr_ty z; |
28661 | 6.35k | if ( |
28662 | 6.35k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
28663 | 4.05k | && |
28664 | 4.05k | (z = expression_rule(p)) // expression |
28665 | 6.35k | ) |
28666 | 1.85k | { |
28667 | 1.85k | D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); |
28668 | 1.85k | _res = z; |
28669 | 1.85k | if (_res == NULL && PyErr_Occurred()) { |
28670 | 0 | p->error_indicator = 1; |
28671 | 0 | p->level--; |
28672 | 0 | return NULL; |
28673 | 0 | } |
28674 | 1.85k | goto done; |
28675 | 1.85k | } |
28676 | 4.50k | p->mark = _mark; |
28677 | 4.50k | D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', |
28678 | 4.50k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
28679 | 4.50k | } |
28680 | 4.50k | _res = NULL; |
28681 | 6.35k | done: |
28682 | 6.35k | p->level--; |
28683 | 6.35k | return _res; |
28684 | 4.50k | } |
28685 | | |
28686 | | // _loop0_17: ('.' | '...') |
28687 | | static asdl_seq * |
28688 | | _loop0_17_rule(Parser *p) |
28689 | 3.32k | { |
28690 | 3.32k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28691 | 0 | _Pypegen_stack_overflow(p); |
28692 | 0 | } |
28693 | 3.32k | if (p->error_indicator) { |
28694 | 0 | p->level--; |
28695 | 0 | return NULL; |
28696 | 0 | } |
28697 | 3.32k | void *_res = NULL; |
28698 | 3.32k | int _mark = p->mark; |
28699 | 3.32k | void **_children = PyMem_Malloc(sizeof(void *)); |
28700 | 3.32k | if (!_children) { |
28701 | 0 | p->error_indicator = 1; |
28702 | 0 | PyErr_NoMemory(); |
28703 | 0 | p->level--; |
28704 | 0 | return NULL; |
28705 | 0 | } |
28706 | 3.32k | Py_ssize_t _children_capacity = 1; |
28707 | 3.32k | Py_ssize_t _n = 0; |
28708 | 3.32k | { // ('.' | '...') |
28709 | 3.32k | if (p->error_indicator) { |
28710 | 0 | p->level--; |
28711 | 0 | return NULL; |
28712 | 0 | } |
28713 | 3.32k | D(fprintf(stderr, "%*c> _loop0_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); |
28714 | 3.32k | void *_tmp_158_var; |
28715 | 3.32k | while ( |
28716 | 6.52k | (_tmp_158_var = _tmp_158_rule(p)) // '.' | '...' |
28717 | 3.32k | ) |
28718 | 3.20k | { |
28719 | 3.20k | _res = _tmp_158_var; |
28720 | 3.20k | if (_n == _children_capacity) { |
28721 | 721 | _children_capacity *= 2; |
28722 | 721 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28723 | 721 | if (!_new_children) { |
28724 | 0 | PyMem_Free(_children); |
28725 | 0 | p->error_indicator = 1; |
28726 | 0 | PyErr_NoMemory(); |
28727 | 0 | p->level--; |
28728 | 0 | return NULL; |
28729 | 0 | } |
28730 | 721 | _children = _new_children; |
28731 | 721 | } |
28732 | 3.20k | _children[_n++] = _res; |
28733 | 3.20k | _mark = p->mark; |
28734 | 3.20k | } |
28735 | 3.32k | p->mark = _mark; |
28736 | 3.32k | D(fprintf(stderr, "%*c%s _loop0_17[%d-%d]: %s failed!\n", p->level, ' ', |
28737 | 3.32k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); |
28738 | 3.32k | } |
28739 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28740 | 3.32k | if (!_seq) { |
28741 | 0 | PyMem_Free(_children); |
28742 | 0 | p->error_indicator = 1; |
28743 | 0 | PyErr_NoMemory(); |
28744 | 0 | p->level--; |
28745 | 0 | return NULL; |
28746 | 0 | } |
28747 | 6.52k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28748 | 3.32k | PyMem_Free(_children); |
28749 | 3.32k | p->level--; |
28750 | 3.32k | return _seq; |
28751 | 3.32k | } |
28752 | | |
28753 | | // _loop1_18: ('.' | '...') |
28754 | | static asdl_seq * |
28755 | | _loop1_18_rule(Parser *p) |
28756 | 1.30k | { |
28757 | 1.30k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28758 | 0 | _Pypegen_stack_overflow(p); |
28759 | 0 | } |
28760 | 1.30k | if (p->error_indicator) { |
28761 | 0 | p->level--; |
28762 | 0 | return NULL; |
28763 | 0 | } |
28764 | 1.30k | void *_res = NULL; |
28765 | 1.30k | int _mark = p->mark; |
28766 | 1.30k | void **_children = PyMem_Malloc(sizeof(void *)); |
28767 | 1.30k | if (!_children) { |
28768 | 0 | p->error_indicator = 1; |
28769 | 0 | PyErr_NoMemory(); |
28770 | 0 | p->level--; |
28771 | 0 | return NULL; |
28772 | 0 | } |
28773 | 1.30k | Py_ssize_t _children_capacity = 1; |
28774 | 1.30k | Py_ssize_t _n = 0; |
28775 | 1.30k | { // ('.' | '...') |
28776 | 1.30k | if (p->error_indicator) { |
28777 | 0 | p->level--; |
28778 | 0 | return NULL; |
28779 | 0 | } |
28780 | 1.30k | D(fprintf(stderr, "%*c> _loop1_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); |
28781 | 1.30k | void *_tmp_158_var; |
28782 | 1.30k | while ( |
28783 | 3.93k | (_tmp_158_var = _tmp_158_rule(p)) // '.' | '...' |
28784 | 1.30k | ) |
28785 | 2.62k | { |
28786 | 2.62k | _res = _tmp_158_var; |
28787 | 2.62k | if (_n == _children_capacity) { |
28788 | 714 | _children_capacity *= 2; |
28789 | 714 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28790 | 714 | if (!_new_children) { |
28791 | 0 | PyMem_Free(_children); |
28792 | 0 | p->error_indicator = 1; |
28793 | 0 | PyErr_NoMemory(); |
28794 | 0 | p->level--; |
28795 | 0 | return NULL; |
28796 | 0 | } |
28797 | 714 | _children = _new_children; |
28798 | 714 | } |
28799 | 2.62k | _children[_n++] = _res; |
28800 | 2.62k | _mark = p->mark; |
28801 | 2.62k | } |
28802 | 1.30k | p->mark = _mark; |
28803 | 1.30k | D(fprintf(stderr, "%*c%s _loop1_18[%d-%d]: %s failed!\n", p->level, ' ', |
28804 | 1.30k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); |
28805 | 1.30k | } |
28806 | 1.30k | if (_n == 0 || p->error_indicator) { |
28807 | 63 | PyMem_Free(_children); |
28808 | 63 | p->level--; |
28809 | 63 | return NULL; |
28810 | 63 | } |
28811 | 1.24k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28812 | 1.24k | if (!_seq) { |
28813 | 0 | PyMem_Free(_children); |
28814 | 0 | p->error_indicator = 1; |
28815 | 0 | PyErr_NoMemory(); |
28816 | 0 | p->level--; |
28817 | 0 | return NULL; |
28818 | 0 | } |
28819 | 3.87k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28820 | 1.24k | PyMem_Free(_children); |
28821 | 1.24k | p->level--; |
28822 | 1.24k | return _seq; |
28823 | 1.24k | } |
28824 | | |
28825 | | // _loop0_19: ',' import_from_as_name |
28826 | | static asdl_seq * |
28827 | | _loop0_19_rule(Parser *p) |
28828 | 2.58k | { |
28829 | 2.58k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28830 | 0 | _Pypegen_stack_overflow(p); |
28831 | 0 | } |
28832 | 2.58k | if (p->error_indicator) { |
28833 | 0 | p->level--; |
28834 | 0 | return NULL; |
28835 | 0 | } |
28836 | 2.58k | void *_res = NULL; |
28837 | 2.58k | int _mark = p->mark; |
28838 | 2.58k | void **_children = PyMem_Malloc(sizeof(void *)); |
28839 | 2.58k | if (!_children) { |
28840 | 0 | p->error_indicator = 1; |
28841 | 0 | PyErr_NoMemory(); |
28842 | 0 | p->level--; |
28843 | 0 | return NULL; |
28844 | 0 | } |
28845 | 2.58k | Py_ssize_t _children_capacity = 1; |
28846 | 2.58k | Py_ssize_t _n = 0; |
28847 | 2.58k | { // ',' import_from_as_name |
28848 | 2.58k | if (p->error_indicator) { |
28849 | 0 | p->level--; |
28850 | 0 | return NULL; |
28851 | 0 | } |
28852 | 2.58k | D(fprintf(stderr, "%*c> _loop0_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name")); |
28853 | 2.58k | Token * _literal; |
28854 | 2.58k | alias_ty elem; |
28855 | 2.58k | while ( |
28856 | 5.37k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
28857 | 2.85k | && |
28858 | 2.85k | (elem = import_from_as_name_rule(p)) // import_from_as_name |
28859 | 2.58k | ) |
28860 | 2.78k | { |
28861 | 2.78k | _res = elem; |
28862 | 2.78k | if (_res == NULL && PyErr_Occurred()) { |
28863 | 0 | p->error_indicator = 1; |
28864 | 0 | PyMem_Free(_children); |
28865 | 0 | p->level--; |
28866 | 0 | return NULL; |
28867 | 0 | } |
28868 | 2.78k | if (_n == _children_capacity) { |
28869 | 544 | _children_capacity *= 2; |
28870 | 544 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
28871 | 544 | if (!_new_children) { |
28872 | 0 | PyMem_Free(_children); |
28873 | 0 | p->error_indicator = 1; |
28874 | 0 | PyErr_NoMemory(); |
28875 | 0 | p->level--; |
28876 | 0 | return NULL; |
28877 | 0 | } |
28878 | 544 | _children = _new_children; |
28879 | 544 | } |
28880 | 2.78k | _children[_n++] = _res; |
28881 | 2.78k | _mark = p->mark; |
28882 | 2.78k | } |
28883 | 2.58k | p->mark = _mark; |
28884 | 2.58k | D(fprintf(stderr, "%*c%s _loop0_19[%d-%d]: %s failed!\n", p->level, ' ', |
28885 | 2.58k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name")); |
28886 | 2.58k | } |
28887 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
28888 | 2.58k | if (!_seq) { |
28889 | 0 | PyMem_Free(_children); |
28890 | 0 | p->error_indicator = 1; |
28891 | 0 | PyErr_NoMemory(); |
28892 | 0 | p->level--; |
28893 | 0 | return NULL; |
28894 | 0 | } |
28895 | 5.37k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
28896 | 2.58k | PyMem_Free(_children); |
28897 | 2.58k | p->level--; |
28898 | 2.58k | return _seq; |
28899 | 2.58k | } |
28900 | | |
28901 | | // _gather_20: import_from_as_name _loop0_19 |
28902 | | static asdl_seq * |
28903 | | _gather_20_rule(Parser *p) |
28904 | 3.24k | { |
28905 | 3.24k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28906 | 0 | _Pypegen_stack_overflow(p); |
28907 | 0 | } |
28908 | 3.24k | if (p->error_indicator) { |
28909 | 0 | p->level--; |
28910 | 0 | return NULL; |
28911 | 0 | } |
28912 | 3.24k | asdl_seq * _res = NULL; |
28913 | 3.24k | int _mark = p->mark; |
28914 | 3.24k | { // import_from_as_name _loop0_19 |
28915 | 3.24k | if (p->error_indicator) { |
28916 | 0 | p->level--; |
28917 | 0 | return NULL; |
28918 | 0 | } |
28919 | 3.24k | D(fprintf(stderr, "%*c> _gather_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_19")); |
28920 | 3.24k | alias_ty elem; |
28921 | 3.24k | asdl_seq * seq; |
28922 | 3.24k | if ( |
28923 | 3.24k | (elem = import_from_as_name_rule(p)) // import_from_as_name |
28924 | 2.58k | && |
28925 | 2.58k | (seq = _loop0_19_rule(p)) // _loop0_19 |
28926 | 3.24k | ) |
28927 | 2.58k | { |
28928 | 2.58k | D(fprintf(stderr, "%*c+ _gather_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_19")); |
28929 | 2.58k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
28930 | 2.58k | goto done; |
28931 | 2.58k | } |
28932 | 656 | p->mark = _mark; |
28933 | 656 | D(fprintf(stderr, "%*c%s _gather_20[%d-%d]: %s failed!\n", p->level, ' ', |
28934 | 656 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_19")); |
28935 | 656 | } |
28936 | 656 | _res = NULL; |
28937 | 3.24k | done: |
28938 | 3.24k | p->level--; |
28939 | 3.24k | return _res; |
28940 | 656 | } |
28941 | | |
28942 | | // _tmp_21: 'as' NAME |
28943 | | static void * |
28944 | | _tmp_21_rule(Parser *p) |
28945 | 18.8k | { |
28946 | 18.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28947 | 0 | _Pypegen_stack_overflow(p); |
28948 | 0 | } |
28949 | 18.8k | if (p->error_indicator) { |
28950 | 0 | p->level--; |
28951 | 0 | return NULL; |
28952 | 0 | } |
28953 | 18.8k | void * _res = NULL; |
28954 | 18.8k | int _mark = p->mark; |
28955 | 18.8k | { // 'as' NAME |
28956 | 18.8k | if (p->error_indicator) { |
28957 | 0 | p->level--; |
28958 | 0 | return NULL; |
28959 | 0 | } |
28960 | 18.8k | D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
28961 | 18.8k | Token * _keyword; |
28962 | 18.8k | expr_ty z; |
28963 | 18.8k | if ( |
28964 | 18.8k | (_keyword = _PyPegen_expect_token(p, 689)) // token='as' |
28965 | 1.81k | && |
28966 | 1.81k | (z = _PyPegen_name_token(p)) // NAME |
28967 | 18.8k | ) |
28968 | 1.75k | { |
28969 | 1.75k | D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); |
28970 | 1.75k | _res = z; |
28971 | 1.75k | if (_res == NULL && PyErr_Occurred()) { |
28972 | 0 | p->error_indicator = 1; |
28973 | 0 | p->level--; |
28974 | 0 | return NULL; |
28975 | 0 | } |
28976 | 1.75k | goto done; |
28977 | 1.75k | } |
28978 | 17.0k | p->mark = _mark; |
28979 | 17.0k | D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ', |
28980 | 17.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
28981 | 17.0k | } |
28982 | 17.0k | _res = NULL; |
28983 | 18.8k | done: |
28984 | 18.8k | p->level--; |
28985 | 18.8k | return _res; |
28986 | 17.0k | } |
28987 | | |
28988 | | // _loop0_22: ',' dotted_as_name |
28989 | | static asdl_seq * |
28990 | | _loop0_22_rule(Parser *p) |
28991 | 2.93k | { |
28992 | 2.93k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
28993 | 0 | _Pypegen_stack_overflow(p); |
28994 | 0 | } |
28995 | 2.93k | if (p->error_indicator) { |
28996 | 0 | p->level--; |
28997 | 0 | return NULL; |
28998 | 0 | } |
28999 | 2.93k | void *_res = NULL; |
29000 | 2.93k | int _mark = p->mark; |
29001 | 2.93k | void **_children = PyMem_Malloc(sizeof(void *)); |
29002 | 2.93k | if (!_children) { |
29003 | 0 | p->error_indicator = 1; |
29004 | 0 | PyErr_NoMemory(); |
29005 | 0 | p->level--; |
29006 | 0 | return NULL; |
29007 | 0 | } |
29008 | 2.93k | Py_ssize_t _children_capacity = 1; |
29009 | 2.93k | Py_ssize_t _n = 0; |
29010 | 2.93k | { // ',' dotted_as_name |
29011 | 2.93k | if (p->error_indicator) { |
29012 | 0 | p->level--; |
29013 | 0 | return NULL; |
29014 | 0 | } |
29015 | 2.93k | D(fprintf(stderr, "%*c> _loop0_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name")); |
29016 | 2.93k | Token * _literal; |
29017 | 2.93k | alias_ty elem; |
29018 | 2.93k | while ( |
29019 | 10.0k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
29020 | 7.22k | && |
29021 | 7.22k | (elem = dotted_as_name_rule(p)) // dotted_as_name |
29022 | 2.93k | ) |
29023 | 7.16k | { |
29024 | 7.16k | _res = elem; |
29025 | 7.16k | if (_res == NULL && PyErr_Occurred()) { |
29026 | 0 | p->error_indicator = 1; |
29027 | 0 | PyMem_Free(_children); |
29028 | 0 | p->level--; |
29029 | 0 | return NULL; |
29030 | 0 | } |
29031 | 7.16k | if (_n == _children_capacity) { |
29032 | 1.28k | _children_capacity *= 2; |
29033 | 1.28k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29034 | 1.28k | if (!_new_children) { |
29035 | 0 | PyMem_Free(_children); |
29036 | 0 | p->error_indicator = 1; |
29037 | 0 | PyErr_NoMemory(); |
29038 | 0 | p->level--; |
29039 | 0 | return NULL; |
29040 | 0 | } |
29041 | 1.28k | _children = _new_children; |
29042 | 1.28k | } |
29043 | 7.16k | _children[_n++] = _res; |
29044 | 7.16k | _mark = p->mark; |
29045 | 7.16k | } |
29046 | 2.93k | p->mark = _mark; |
29047 | 2.93k | D(fprintf(stderr, "%*c%s _loop0_22[%d-%d]: %s failed!\n", p->level, ' ', |
29048 | 2.93k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name")); |
29049 | 2.93k | } |
29050 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29051 | 2.93k | if (!_seq) { |
29052 | 0 | PyMem_Free(_children); |
29053 | 0 | p->error_indicator = 1; |
29054 | 0 | PyErr_NoMemory(); |
29055 | 0 | p->level--; |
29056 | 0 | return NULL; |
29057 | 0 | } |
29058 | 10.0k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29059 | 2.93k | PyMem_Free(_children); |
29060 | 2.93k | p->level--; |
29061 | 2.93k | return _seq; |
29062 | 2.93k | } |
29063 | | |
29064 | | // _gather_23: dotted_as_name _loop0_22 |
29065 | | static asdl_seq * |
29066 | | _gather_23_rule(Parser *p) |
29067 | 2.97k | { |
29068 | 2.97k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29069 | 0 | _Pypegen_stack_overflow(p); |
29070 | 0 | } |
29071 | 2.97k | if (p->error_indicator) { |
29072 | 0 | p->level--; |
29073 | 0 | return NULL; |
29074 | 0 | } |
29075 | 2.97k | asdl_seq * _res = NULL; |
29076 | 2.97k | int _mark = p->mark; |
29077 | 2.97k | { // dotted_as_name _loop0_22 |
29078 | 2.97k | if (p->error_indicator) { |
29079 | 0 | p->level--; |
29080 | 0 | return NULL; |
29081 | 0 | } |
29082 | 2.97k | D(fprintf(stderr, "%*c> _gather_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_22")); |
29083 | 2.97k | alias_ty elem; |
29084 | 2.97k | asdl_seq * seq; |
29085 | 2.97k | if ( |
29086 | 2.97k | (elem = dotted_as_name_rule(p)) // dotted_as_name |
29087 | 2.93k | && |
29088 | 2.93k | (seq = _loop0_22_rule(p)) // _loop0_22 |
29089 | 2.97k | ) |
29090 | 2.93k | { |
29091 | 2.93k | D(fprintf(stderr, "%*c+ _gather_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_22")); |
29092 | 2.93k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
29093 | 2.93k | goto done; |
29094 | 2.93k | } |
29095 | 40 | p->mark = _mark; |
29096 | 40 | D(fprintf(stderr, "%*c%s _gather_23[%d-%d]: %s failed!\n", p->level, ' ', |
29097 | 40 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_22")); |
29098 | 40 | } |
29099 | 40 | _res = NULL; |
29100 | 2.97k | done: |
29101 | 2.97k | p->level--; |
29102 | 2.97k | return _res; |
29103 | 40 | } |
29104 | | |
29105 | | // _loop1_24: ('@' named_expression NEWLINE) |
29106 | | static asdl_seq * |
29107 | | _loop1_24_rule(Parser *p) |
29108 | 19.3k | { |
29109 | 19.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29110 | 0 | _Pypegen_stack_overflow(p); |
29111 | 0 | } |
29112 | 19.3k | if (p->error_indicator) { |
29113 | 0 | p->level--; |
29114 | 0 | return NULL; |
29115 | 0 | } |
29116 | 19.3k | void *_res = NULL; |
29117 | 19.3k | int _mark = p->mark; |
29118 | 19.3k | void **_children = PyMem_Malloc(sizeof(void *)); |
29119 | 19.3k | if (!_children) { |
29120 | 0 | p->error_indicator = 1; |
29121 | 0 | PyErr_NoMemory(); |
29122 | 0 | p->level--; |
29123 | 0 | return NULL; |
29124 | 0 | } |
29125 | 19.3k | Py_ssize_t _children_capacity = 1; |
29126 | 19.3k | Py_ssize_t _n = 0; |
29127 | 19.3k | { // ('@' named_expression NEWLINE) |
29128 | 19.3k | if (p->error_indicator) { |
29129 | 0 | p->level--; |
29130 | 0 | return NULL; |
29131 | 0 | } |
29132 | 19.3k | D(fprintf(stderr, "%*c> _loop1_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); |
29133 | 19.3k | void *_tmp_159_var; |
29134 | 19.3k | while ( |
29135 | 23.8k | (_tmp_159_var = _tmp_159_rule(p)) // '@' named_expression NEWLINE |
29136 | 19.3k | ) |
29137 | 4.53k | { |
29138 | 4.53k | _res = _tmp_159_var; |
29139 | 4.53k | if (_n == _children_capacity) { |
29140 | 664 | _children_capacity *= 2; |
29141 | 664 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29142 | 664 | if (!_new_children) { |
29143 | 0 | PyMem_Free(_children); |
29144 | 0 | p->error_indicator = 1; |
29145 | 0 | PyErr_NoMemory(); |
29146 | 0 | p->level--; |
29147 | 0 | return NULL; |
29148 | 0 | } |
29149 | 664 | _children = _new_children; |
29150 | 664 | } |
29151 | 4.53k | _children[_n++] = _res; |
29152 | 4.53k | _mark = p->mark; |
29153 | 4.53k | } |
29154 | 19.3k | p->mark = _mark; |
29155 | 19.3k | D(fprintf(stderr, "%*c%s _loop1_24[%d-%d]: %s failed!\n", p->level, ' ', |
29156 | 19.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); |
29157 | 19.3k | } |
29158 | 19.3k | if (_n == 0 || p->error_indicator) { |
29159 | 17.0k | PyMem_Free(_children); |
29160 | 17.0k | p->level--; |
29161 | 17.0k | return NULL; |
29162 | 17.0k | } |
29163 | 2.23k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29164 | 2.23k | if (!_seq) { |
29165 | 0 | PyMem_Free(_children); |
29166 | 0 | p->error_indicator = 1; |
29167 | 0 | PyErr_NoMemory(); |
29168 | 0 | p->level--; |
29169 | 0 | return NULL; |
29170 | 0 | } |
29171 | 6.77k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29172 | 2.23k | PyMem_Free(_children); |
29173 | 2.23k | p->level--; |
29174 | 2.23k | return _seq; |
29175 | 2.23k | } |
29176 | | |
29177 | | // _tmp_25: '(' arguments? ')' |
29178 | | static void * |
29179 | | _tmp_25_rule(Parser *p) |
29180 | 5.41k | { |
29181 | 5.41k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29182 | 0 | _Pypegen_stack_overflow(p); |
29183 | 0 | } |
29184 | 5.41k | if (p->error_indicator) { |
29185 | 0 | p->level--; |
29186 | 0 | return NULL; |
29187 | 0 | } |
29188 | 5.41k | void * _res = NULL; |
29189 | 5.41k | int _mark = p->mark; |
29190 | 5.41k | { // '(' arguments? ')' |
29191 | 5.41k | if (p->error_indicator) { |
29192 | 0 | p->level--; |
29193 | 0 | return NULL; |
29194 | 0 | } |
29195 | 5.41k | D(fprintf(stderr, "%*c> _tmp_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); |
29196 | 5.41k | Token * _literal; |
29197 | 5.41k | Token * _literal_1; |
29198 | 5.41k | void *z; |
29199 | 5.41k | if ( |
29200 | 5.41k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
29201 | 1.94k | && |
29202 | 1.94k | (z = arguments_rule(p), !p->error_indicator) // arguments? |
29203 | 1.94k | && |
29204 | 1.94k | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
29205 | 5.41k | ) |
29206 | 1.93k | { |
29207 | 1.93k | D(fprintf(stderr, "%*c+ _tmp_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); |
29208 | 1.93k | _res = z; |
29209 | 1.93k | if (_res == NULL && PyErr_Occurred()) { |
29210 | 0 | p->error_indicator = 1; |
29211 | 0 | p->level--; |
29212 | 0 | return NULL; |
29213 | 0 | } |
29214 | 1.93k | goto done; |
29215 | 1.93k | } |
29216 | 3.48k | p->mark = _mark; |
29217 | 3.48k | D(fprintf(stderr, "%*c%s _tmp_25[%d-%d]: %s failed!\n", p->level, ' ', |
29218 | 3.48k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); |
29219 | 3.48k | } |
29220 | 3.48k | _res = NULL; |
29221 | 5.41k | done: |
29222 | 5.41k | p->level--; |
29223 | 5.41k | return _res; |
29224 | 3.48k | } |
29225 | | |
29226 | | // _tmp_26: '->' expression |
29227 | | static void * |
29228 | | _tmp_26_rule(Parser *p) |
29229 | 14.7k | { |
29230 | 14.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29231 | 0 | _Pypegen_stack_overflow(p); |
29232 | 0 | } |
29233 | 14.7k | if (p->error_indicator) { |
29234 | 0 | p->level--; |
29235 | 0 | return NULL; |
29236 | 0 | } |
29237 | 14.7k | void * _res = NULL; |
29238 | 14.7k | int _mark = p->mark; |
29239 | 14.7k | { // '->' expression |
29240 | 14.7k | if (p->error_indicator) { |
29241 | 0 | p->level--; |
29242 | 0 | return NULL; |
29243 | 0 | } |
29244 | 14.7k | D(fprintf(stderr, "%*c> _tmp_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); |
29245 | 14.7k | Token * _literal; |
29246 | 14.7k | expr_ty z; |
29247 | 14.7k | if ( |
29248 | 14.7k | (_literal = _PyPegen_expect_token(p, 51)) // token='->' |
29249 | 624 | && |
29250 | 624 | (z = expression_rule(p)) // expression |
29251 | 14.7k | ) |
29252 | 618 | { |
29253 | 618 | D(fprintf(stderr, "%*c+ _tmp_26[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); |
29254 | 618 | _res = z; |
29255 | 618 | if (_res == NULL && PyErr_Occurred()) { |
29256 | 0 | p->error_indicator = 1; |
29257 | 0 | p->level--; |
29258 | 0 | return NULL; |
29259 | 0 | } |
29260 | 618 | goto done; |
29261 | 618 | } |
29262 | 14.1k | p->mark = _mark; |
29263 | 14.1k | D(fprintf(stderr, "%*c%s _tmp_26[%d-%d]: %s failed!\n", p->level, ' ', |
29264 | 14.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); |
29265 | 14.1k | } |
29266 | 14.1k | _res = NULL; |
29267 | 14.7k | done: |
29268 | 14.7k | p->level--; |
29269 | 14.7k | return _res; |
29270 | 14.1k | } |
29271 | | |
29272 | | // _loop0_27: param_no_default |
29273 | | static asdl_seq * |
29274 | | _loop0_27_rule(Parser *p) |
29275 | 69.3k | { |
29276 | 69.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29277 | 0 | _Pypegen_stack_overflow(p); |
29278 | 0 | } |
29279 | 69.3k | if (p->error_indicator) { |
29280 | 0 | p->level--; |
29281 | 0 | return NULL; |
29282 | 0 | } |
29283 | 69.3k | void *_res = NULL; |
29284 | 69.3k | int _mark = p->mark; |
29285 | 69.3k | void **_children = PyMem_Malloc(sizeof(void *)); |
29286 | 69.3k | if (!_children) { |
29287 | 0 | p->error_indicator = 1; |
29288 | 0 | PyErr_NoMemory(); |
29289 | 0 | p->level--; |
29290 | 0 | return NULL; |
29291 | 0 | } |
29292 | 69.3k | Py_ssize_t _children_capacity = 1; |
29293 | 69.3k | Py_ssize_t _n = 0; |
29294 | 69.3k | { // param_no_default |
29295 | 69.3k | if (p->error_indicator) { |
29296 | 0 | p->level--; |
29297 | 0 | return NULL; |
29298 | 0 | } |
29299 | 69.3k | D(fprintf(stderr, "%*c> _loop0_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
29300 | 69.3k | arg_ty param_no_default_var; |
29301 | 69.3k | while ( |
29302 | 98.9k | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
29303 | 69.3k | ) |
29304 | 29.5k | { |
29305 | 29.5k | _res = param_no_default_var; |
29306 | 29.5k | if (_n == _children_capacity) { |
29307 | 8.53k | _children_capacity *= 2; |
29308 | 8.53k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29309 | 8.53k | if (!_new_children) { |
29310 | 0 | PyMem_Free(_children); |
29311 | 0 | p->error_indicator = 1; |
29312 | 0 | PyErr_NoMemory(); |
29313 | 0 | p->level--; |
29314 | 0 | return NULL; |
29315 | 0 | } |
29316 | 8.53k | _children = _new_children; |
29317 | 8.53k | } |
29318 | 29.5k | _children[_n++] = _res; |
29319 | 29.5k | _mark = p->mark; |
29320 | 29.5k | } |
29321 | 69.3k | p->mark = _mark; |
29322 | 69.3k | D(fprintf(stderr, "%*c%s _loop0_27[%d-%d]: %s failed!\n", p->level, ' ', |
29323 | 69.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
29324 | 69.3k | } |
29325 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29326 | 69.3k | if (!_seq) { |
29327 | 0 | PyMem_Free(_children); |
29328 | 0 | p->error_indicator = 1; |
29329 | 0 | PyErr_NoMemory(); |
29330 | 0 | p->level--; |
29331 | 0 | return NULL; |
29332 | 0 | } |
29333 | 98.9k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29334 | 69.3k | PyMem_Free(_children); |
29335 | 69.3k | p->level--; |
29336 | 69.3k | return _seq; |
29337 | 69.3k | } |
29338 | | |
29339 | | // _loop0_28: param_with_default |
29340 | | static asdl_seq * |
29341 | | _loop0_28_rule(Parser *p) |
29342 | 8.36k | { |
29343 | 8.36k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29344 | 0 | _Pypegen_stack_overflow(p); |
29345 | 0 | } |
29346 | 8.36k | if (p->error_indicator) { |
29347 | 2 | p->level--; |
29348 | 2 | return NULL; |
29349 | 2 | } |
29350 | 8.36k | void *_res = NULL; |
29351 | 8.36k | int _mark = p->mark; |
29352 | 8.36k | void **_children = PyMem_Malloc(sizeof(void *)); |
29353 | 8.36k | if (!_children) { |
29354 | 0 | p->error_indicator = 1; |
29355 | 0 | PyErr_NoMemory(); |
29356 | 0 | p->level--; |
29357 | 0 | return NULL; |
29358 | 0 | } |
29359 | 8.36k | Py_ssize_t _children_capacity = 1; |
29360 | 8.36k | Py_ssize_t _n = 0; |
29361 | 8.36k | { // param_with_default |
29362 | 8.36k | if (p->error_indicator) { |
29363 | 0 | p->level--; |
29364 | 0 | return NULL; |
29365 | 0 | } |
29366 | 8.36k | D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
29367 | 8.36k | NameDefaultPair* param_with_default_var; |
29368 | 8.36k | while ( |
29369 | 11.0k | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
29370 | 8.36k | ) |
29371 | 2.68k | { |
29372 | 2.68k | _res = param_with_default_var; |
29373 | 2.68k | if (_n == _children_capacity) { |
29374 | 572 | _children_capacity *= 2; |
29375 | 572 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29376 | 572 | if (!_new_children) { |
29377 | 0 | PyMem_Free(_children); |
29378 | 0 | p->error_indicator = 1; |
29379 | 0 | PyErr_NoMemory(); |
29380 | 0 | p->level--; |
29381 | 0 | return NULL; |
29382 | 0 | } |
29383 | 572 | _children = _new_children; |
29384 | 572 | } |
29385 | 2.68k | _children[_n++] = _res; |
29386 | 2.68k | _mark = p->mark; |
29387 | 2.68k | } |
29388 | 8.36k | p->mark = _mark; |
29389 | 8.36k | D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ', |
29390 | 8.36k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
29391 | 8.36k | } |
29392 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29393 | 8.36k | if (!_seq) { |
29394 | 0 | PyMem_Free(_children); |
29395 | 0 | p->error_indicator = 1; |
29396 | 0 | PyErr_NoMemory(); |
29397 | 0 | p->level--; |
29398 | 0 | return NULL; |
29399 | 0 | } |
29400 | 11.0k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29401 | 8.36k | PyMem_Free(_children); |
29402 | 8.36k | p->level--; |
29403 | 8.36k | return _seq; |
29404 | 8.36k | } |
29405 | | |
29406 | | // _loop1_29: param_no_default |
29407 | | static asdl_seq * |
29408 | | _loop1_29_rule(Parser *p) |
29409 | 75.9k | { |
29410 | 75.9k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29411 | 0 | _Pypegen_stack_overflow(p); |
29412 | 0 | } |
29413 | 75.9k | if (p->error_indicator) { |
29414 | 0 | p->level--; |
29415 | 0 | return NULL; |
29416 | 0 | } |
29417 | 75.9k | void *_res = NULL; |
29418 | 75.9k | int _mark = p->mark; |
29419 | 75.9k | void **_children = PyMem_Malloc(sizeof(void *)); |
29420 | 75.9k | if (!_children) { |
29421 | 0 | p->error_indicator = 1; |
29422 | 0 | PyErr_NoMemory(); |
29423 | 0 | p->level--; |
29424 | 0 | return NULL; |
29425 | 0 | } |
29426 | 75.9k | Py_ssize_t _children_capacity = 1; |
29427 | 75.9k | Py_ssize_t _n = 0; |
29428 | 75.9k | { // param_no_default |
29429 | 75.9k | if (p->error_indicator) { |
29430 | 0 | p->level--; |
29431 | 0 | return NULL; |
29432 | 0 | } |
29433 | 75.9k | D(fprintf(stderr, "%*c> _loop1_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
29434 | 75.9k | arg_ty param_no_default_var; |
29435 | 75.9k | while ( |
29436 | 120k | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
29437 | 75.9k | ) |
29438 | 44.0k | { |
29439 | 44.0k | _res = param_no_default_var; |
29440 | 44.0k | if (_n == _children_capacity) { |
29441 | 12.3k | _children_capacity *= 2; |
29442 | 12.3k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29443 | 12.3k | if (!_new_children) { |
29444 | 0 | PyMem_Free(_children); |
29445 | 0 | p->error_indicator = 1; |
29446 | 0 | PyErr_NoMemory(); |
29447 | 0 | p->level--; |
29448 | 0 | return NULL; |
29449 | 0 | } |
29450 | 12.3k | _children = _new_children; |
29451 | 12.3k | } |
29452 | 44.0k | _children[_n++] = _res; |
29453 | 44.0k | _mark = p->mark; |
29454 | 44.0k | } |
29455 | 75.9k | p->mark = _mark; |
29456 | 75.9k | D(fprintf(stderr, "%*c%s _loop1_29[%d-%d]: %s failed!\n", p->level, ' ', |
29457 | 75.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
29458 | 75.9k | } |
29459 | 75.9k | if (_n == 0 || p->error_indicator) { |
29460 | 47.7k | PyMem_Free(_children); |
29461 | 47.7k | p->level--; |
29462 | 47.7k | return NULL; |
29463 | 47.7k | } |
29464 | 28.2k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29465 | 28.2k | if (!_seq) { |
29466 | 0 | PyMem_Free(_children); |
29467 | 0 | p->error_indicator = 1; |
29468 | 0 | PyErr_NoMemory(); |
29469 | 0 | p->level--; |
29470 | 0 | return NULL; |
29471 | 0 | } |
29472 | 72.2k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29473 | 28.2k | PyMem_Free(_children); |
29474 | 28.2k | p->level--; |
29475 | 28.2k | return _seq; |
29476 | 28.2k | } |
29477 | | |
29478 | | // _loop1_30: param_with_default |
29479 | | static asdl_seq * |
29480 | | _loop1_30_rule(Parser *p) |
29481 | 69.9k | { |
29482 | 69.9k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29483 | 0 | _Pypegen_stack_overflow(p); |
29484 | 0 | } |
29485 | 69.9k | if (p->error_indicator) { |
29486 | 0 | p->level--; |
29487 | 0 | return NULL; |
29488 | 0 | } |
29489 | 69.9k | void *_res = NULL; |
29490 | 69.9k | int _mark = p->mark; |
29491 | 69.9k | void **_children = PyMem_Malloc(sizeof(void *)); |
29492 | 69.9k | if (!_children) { |
29493 | 0 | p->error_indicator = 1; |
29494 | 0 | PyErr_NoMemory(); |
29495 | 0 | p->level--; |
29496 | 0 | return NULL; |
29497 | 0 | } |
29498 | 69.9k | Py_ssize_t _children_capacity = 1; |
29499 | 69.9k | Py_ssize_t _n = 0; |
29500 | 69.9k | { // param_with_default |
29501 | 69.9k | if (p->error_indicator) { |
29502 | 0 | p->level--; |
29503 | 0 | return NULL; |
29504 | 0 | } |
29505 | 69.9k | D(fprintf(stderr, "%*c> _loop1_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); |
29506 | 69.9k | NameDefaultPair* param_with_default_var; |
29507 | 69.9k | while ( |
29508 | 91.4k | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
29509 | 69.9k | ) |
29510 | 21.4k | { |
29511 | 21.4k | _res = param_with_default_var; |
29512 | 21.4k | if (_n == _children_capacity) { |
29513 | 2.32k | _children_capacity *= 2; |
29514 | 2.32k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29515 | 2.32k | if (!_new_children) { |
29516 | 0 | PyMem_Free(_children); |
29517 | 0 | p->error_indicator = 1; |
29518 | 0 | PyErr_NoMemory(); |
29519 | 0 | p->level--; |
29520 | 0 | return NULL; |
29521 | 0 | } |
29522 | 2.32k | _children = _new_children; |
29523 | 2.32k | } |
29524 | 21.4k | _children[_n++] = _res; |
29525 | 21.4k | _mark = p->mark; |
29526 | 21.4k | } |
29527 | 69.9k | p->mark = _mark; |
29528 | 69.9k | D(fprintf(stderr, "%*c%s _loop1_30[%d-%d]: %s failed!\n", p->level, ' ', |
29529 | 69.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
29530 | 69.9k | } |
29531 | 69.9k | if (_n == 0 || p->error_indicator) { |
29532 | 57.3k | PyMem_Free(_children); |
29533 | 57.3k | p->level--; |
29534 | 57.3k | return NULL; |
29535 | 57.3k | } |
29536 | 12.6k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29537 | 12.6k | if (!_seq) { |
29538 | 0 | PyMem_Free(_children); |
29539 | 0 | p->error_indicator = 1; |
29540 | 0 | PyErr_NoMemory(); |
29541 | 0 | p->level--; |
29542 | 0 | return NULL; |
29543 | 0 | } |
29544 | 34.1k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29545 | 12.6k | PyMem_Free(_children); |
29546 | 12.6k | p->level--; |
29547 | 12.6k | return _seq; |
29548 | 12.6k | } |
29549 | | |
29550 | | // _loop0_31: param_maybe_default |
29551 | | static asdl_seq * |
29552 | | _loop0_31_rule(Parser *p) |
29553 | 10.5k | { |
29554 | 10.5k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29555 | 0 | _Pypegen_stack_overflow(p); |
29556 | 0 | } |
29557 | 10.5k | if (p->error_indicator) { |
29558 | 0 | p->level--; |
29559 | 0 | return NULL; |
29560 | 0 | } |
29561 | 10.5k | void *_res = NULL; |
29562 | 10.5k | int _mark = p->mark; |
29563 | 10.5k | void **_children = PyMem_Malloc(sizeof(void *)); |
29564 | 10.5k | if (!_children) { |
29565 | 0 | p->error_indicator = 1; |
29566 | 0 | PyErr_NoMemory(); |
29567 | 0 | p->level--; |
29568 | 0 | return NULL; |
29569 | 0 | } |
29570 | 10.5k | Py_ssize_t _children_capacity = 1; |
29571 | 10.5k | Py_ssize_t _n = 0; |
29572 | 10.5k | { // param_maybe_default |
29573 | 10.5k | if (p->error_indicator) { |
29574 | 0 | p->level--; |
29575 | 0 | return NULL; |
29576 | 0 | } |
29577 | 10.5k | D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); |
29578 | 10.5k | NameDefaultPair* param_maybe_default_var; |
29579 | 10.5k | while ( |
29580 | 16.8k | (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default |
29581 | 10.5k | ) |
29582 | 6.33k | { |
29583 | 6.33k | _res = param_maybe_default_var; |
29584 | 6.33k | if (_n == _children_capacity) { |
29585 | 1.13k | _children_capacity *= 2; |
29586 | 1.13k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29587 | 1.13k | if (!_new_children) { |
29588 | 0 | PyMem_Free(_children); |
29589 | 0 | p->error_indicator = 1; |
29590 | 0 | PyErr_NoMemory(); |
29591 | 0 | p->level--; |
29592 | 0 | return NULL; |
29593 | 0 | } |
29594 | 1.13k | _children = _new_children; |
29595 | 1.13k | } |
29596 | 6.33k | _children[_n++] = _res; |
29597 | 6.33k | _mark = p->mark; |
29598 | 6.33k | } |
29599 | 10.5k | p->mark = _mark; |
29600 | 10.5k | D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ', |
29601 | 10.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); |
29602 | 10.5k | } |
29603 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29604 | 10.5k | if (!_seq) { |
29605 | 0 | PyMem_Free(_children); |
29606 | 0 | p->error_indicator = 1; |
29607 | 0 | PyErr_NoMemory(); |
29608 | 0 | p->level--; |
29609 | 0 | return NULL; |
29610 | 0 | } |
29611 | 16.8k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29612 | 10.5k | PyMem_Free(_children); |
29613 | 10.5k | p->level--; |
29614 | 10.5k | return _seq; |
29615 | 10.5k | } |
29616 | | |
29617 | | // _loop1_32: param_maybe_default |
29618 | | static asdl_seq * |
29619 | | _loop1_32_rule(Parser *p) |
29620 | 6.56k | { |
29621 | 6.56k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29622 | 0 | _Pypegen_stack_overflow(p); |
29623 | 0 | } |
29624 | 6.56k | if (p->error_indicator) { |
29625 | 0 | p->level--; |
29626 | 0 | return NULL; |
29627 | 0 | } |
29628 | 6.56k | void *_res = NULL; |
29629 | 6.56k | int _mark = p->mark; |
29630 | 6.56k | void **_children = PyMem_Malloc(sizeof(void *)); |
29631 | 6.56k | if (!_children) { |
29632 | 0 | p->error_indicator = 1; |
29633 | 0 | PyErr_NoMemory(); |
29634 | 0 | p->level--; |
29635 | 0 | return NULL; |
29636 | 0 | } |
29637 | 6.56k | Py_ssize_t _children_capacity = 1; |
29638 | 6.56k | Py_ssize_t _n = 0; |
29639 | 6.56k | { // param_maybe_default |
29640 | 6.56k | if (p->error_indicator) { |
29641 | 0 | p->level--; |
29642 | 0 | return NULL; |
29643 | 0 | } |
29644 | 6.56k | D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default")); |
29645 | 6.56k | NameDefaultPair* param_maybe_default_var; |
29646 | 6.56k | while ( |
29647 | 11.9k | (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default |
29648 | 6.56k | ) |
29649 | 5.41k | { |
29650 | 5.41k | _res = param_maybe_default_var; |
29651 | 5.41k | if (_n == _children_capacity) { |
29652 | 783 | _children_capacity *= 2; |
29653 | 783 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29654 | 783 | if (!_new_children) { |
29655 | 0 | PyMem_Free(_children); |
29656 | 0 | p->error_indicator = 1; |
29657 | 0 | PyErr_NoMemory(); |
29658 | 0 | p->level--; |
29659 | 0 | return NULL; |
29660 | 0 | } |
29661 | 783 | _children = _new_children; |
29662 | 783 | } |
29663 | 5.41k | _children[_n++] = _res; |
29664 | 5.41k | _mark = p->mark; |
29665 | 5.41k | } |
29666 | 6.56k | p->mark = _mark; |
29667 | 6.56k | D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ', |
29668 | 6.56k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); |
29669 | 6.56k | } |
29670 | 6.56k | if (_n == 0 || p->error_indicator) { |
29671 | 3.30k | PyMem_Free(_children); |
29672 | 3.30k | p->level--; |
29673 | 3.30k | return NULL; |
29674 | 3.30k | } |
29675 | 3.25k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29676 | 3.25k | if (!_seq) { |
29677 | 0 | PyMem_Free(_children); |
29678 | 0 | p->error_indicator = 1; |
29679 | 0 | PyErr_NoMemory(); |
29680 | 0 | p->level--; |
29681 | 0 | return NULL; |
29682 | 0 | } |
29683 | 8.54k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29684 | 3.25k | PyMem_Free(_children); |
29685 | 3.25k | p->level--; |
29686 | 3.25k | return _seq; |
29687 | 3.25k | } |
29688 | | |
29689 | | // _loop0_33: ',' with_item |
29690 | | static asdl_seq * |
29691 | | _loop0_33_rule(Parser *p) |
29692 | 4.51k | { |
29693 | 4.51k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29694 | 0 | _Pypegen_stack_overflow(p); |
29695 | 0 | } |
29696 | 4.51k | if (p->error_indicator) { |
29697 | 0 | p->level--; |
29698 | 0 | return NULL; |
29699 | 0 | } |
29700 | 4.51k | void *_res = NULL; |
29701 | 4.51k | int _mark = p->mark; |
29702 | 4.51k | void **_children = PyMem_Malloc(sizeof(void *)); |
29703 | 4.51k | if (!_children) { |
29704 | 0 | p->error_indicator = 1; |
29705 | 0 | PyErr_NoMemory(); |
29706 | 0 | p->level--; |
29707 | 0 | return NULL; |
29708 | 0 | } |
29709 | 4.51k | Py_ssize_t _children_capacity = 1; |
29710 | 4.51k | Py_ssize_t _n = 0; |
29711 | 4.51k | { // ',' with_item |
29712 | 4.51k | if (p->error_indicator) { |
29713 | 0 | p->level--; |
29714 | 0 | return NULL; |
29715 | 0 | } |
29716 | 4.51k | D(fprintf(stderr, "%*c> _loop0_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item")); |
29717 | 4.51k | Token * _literal; |
29718 | 4.51k | withitem_ty elem; |
29719 | 4.51k | while ( |
29720 | 8.48k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
29721 | 4.79k | && |
29722 | 4.79k | (elem = with_item_rule(p)) // with_item |
29723 | 4.51k | ) |
29724 | 3.96k | { |
29725 | 3.96k | _res = elem; |
29726 | 3.96k | if (_res == NULL && PyErr_Occurred()) { |
29727 | 0 | p->error_indicator = 1; |
29728 | 0 | PyMem_Free(_children); |
29729 | 0 | p->level--; |
29730 | 0 | return NULL; |
29731 | 0 | } |
29732 | 3.96k | if (_n == _children_capacity) { |
29733 | 585 | _children_capacity *= 2; |
29734 | 585 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29735 | 585 | if (!_new_children) { |
29736 | 0 | PyMem_Free(_children); |
29737 | 0 | p->error_indicator = 1; |
29738 | 0 | PyErr_NoMemory(); |
29739 | 0 | p->level--; |
29740 | 0 | return NULL; |
29741 | 0 | } |
29742 | 585 | _children = _new_children; |
29743 | 585 | } |
29744 | 3.96k | _children[_n++] = _res; |
29745 | 3.96k | _mark = p->mark; |
29746 | 3.96k | } |
29747 | 4.51k | p->mark = _mark; |
29748 | 4.51k | D(fprintf(stderr, "%*c%s _loop0_33[%d-%d]: %s failed!\n", p->level, ' ', |
29749 | 4.51k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
29750 | 4.51k | } |
29751 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29752 | 4.51k | if (!_seq) { |
29753 | 0 | PyMem_Free(_children); |
29754 | 0 | p->error_indicator = 1; |
29755 | 0 | PyErr_NoMemory(); |
29756 | 0 | p->level--; |
29757 | 0 | return NULL; |
29758 | 0 | } |
29759 | 8.48k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29760 | 4.51k | PyMem_Free(_children); |
29761 | 4.51k | p->level--; |
29762 | 4.51k | return _seq; |
29763 | 4.51k | } |
29764 | | |
29765 | | // _gather_34: with_item _loop0_33 |
29766 | | static asdl_seq * |
29767 | | _gather_34_rule(Parser *p) |
29768 | 5.18k | { |
29769 | 5.18k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29770 | 0 | _Pypegen_stack_overflow(p); |
29771 | 0 | } |
29772 | 5.18k | if (p->error_indicator) { |
29773 | 0 | p->level--; |
29774 | 0 | return NULL; |
29775 | 0 | } |
29776 | 5.18k | asdl_seq * _res = NULL; |
29777 | 5.18k | int _mark = p->mark; |
29778 | 5.18k | { // with_item _loop0_33 |
29779 | 5.18k | if (p->error_indicator) { |
29780 | 0 | p->level--; |
29781 | 0 | return NULL; |
29782 | 0 | } |
29783 | 5.18k | D(fprintf(stderr, "%*c> _gather_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_33")); |
29784 | 5.18k | withitem_ty elem; |
29785 | 5.18k | asdl_seq * seq; |
29786 | 5.18k | if ( |
29787 | 5.18k | (elem = with_item_rule(p)) // with_item |
29788 | 4.51k | && |
29789 | 4.51k | (seq = _loop0_33_rule(p)) // _loop0_33 |
29790 | 5.18k | ) |
29791 | 4.51k | { |
29792 | 4.51k | D(fprintf(stderr, "%*c+ _gather_34[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_33")); |
29793 | 4.51k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
29794 | 4.51k | goto done; |
29795 | 4.51k | } |
29796 | 672 | p->mark = _mark; |
29797 | 672 | D(fprintf(stderr, "%*c%s _gather_34[%d-%d]: %s failed!\n", p->level, ' ', |
29798 | 672 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_33")); |
29799 | 672 | } |
29800 | 672 | _res = NULL; |
29801 | 5.18k | done: |
29802 | 5.18k | p->level--; |
29803 | 5.18k | return _res; |
29804 | 672 | } |
29805 | | |
29806 | | // _tmp_35: ',' | ')' | ':' |
29807 | | static void * |
29808 | | _tmp_35_rule(Parser *p) |
29809 | 1.29k | { |
29810 | 1.29k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29811 | 0 | _Pypegen_stack_overflow(p); |
29812 | 0 | } |
29813 | 1.29k | if (p->error_indicator) { |
29814 | 0 | p->level--; |
29815 | 0 | return NULL; |
29816 | 0 | } |
29817 | 1.29k | void * _res = NULL; |
29818 | 1.29k | int _mark = p->mark; |
29819 | 1.29k | { // ',' |
29820 | 1.29k | if (p->error_indicator) { |
29821 | 0 | p->level--; |
29822 | 0 | return NULL; |
29823 | 0 | } |
29824 | 1.29k | D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
29825 | 1.29k | Token * _literal; |
29826 | 1.29k | if ( |
29827 | 1.29k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
29828 | 1.29k | ) |
29829 | 576 | { |
29830 | 576 | D(fprintf(stderr, "%*c+ _tmp_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
29831 | 576 | _res = _literal; |
29832 | 576 | goto done; |
29833 | 576 | } |
29834 | 721 | p->mark = _mark; |
29835 | 721 | D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ', |
29836 | 721 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
29837 | 721 | } |
29838 | 0 | { // ')' |
29839 | 721 | if (p->error_indicator) { |
29840 | 0 | p->level--; |
29841 | 0 | return NULL; |
29842 | 0 | } |
29843 | 721 | D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
29844 | 721 | Token * _literal; |
29845 | 721 | if ( |
29846 | 721 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
29847 | 721 | ) |
29848 | 30 | { |
29849 | 30 | D(fprintf(stderr, "%*c+ _tmp_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
29850 | 30 | _res = _literal; |
29851 | 30 | goto done; |
29852 | 30 | } |
29853 | 691 | p->mark = _mark; |
29854 | 691 | D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ', |
29855 | 691 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
29856 | 691 | } |
29857 | 0 | { // ':' |
29858 | 691 | if (p->error_indicator) { |
29859 | 0 | p->level--; |
29860 | 0 | return NULL; |
29861 | 0 | } |
29862 | 691 | D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
29863 | 691 | Token * _literal; |
29864 | 691 | if ( |
29865 | 691 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
29866 | 691 | ) |
29867 | 676 | { |
29868 | 676 | D(fprintf(stderr, "%*c+ _tmp_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
29869 | 676 | _res = _literal; |
29870 | 676 | goto done; |
29871 | 676 | } |
29872 | 15 | p->mark = _mark; |
29873 | 15 | D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ', |
29874 | 15 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
29875 | 15 | } |
29876 | 15 | _res = NULL; |
29877 | 1.29k | done: |
29878 | 1.29k | p->level--; |
29879 | 1.29k | return _res; |
29880 | 15 | } |
29881 | | |
29882 | | // _loop1_36: except_block |
29883 | | static asdl_seq * |
29884 | | _loop1_36_rule(Parser *p) |
29885 | 6.70k | { |
29886 | 6.70k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29887 | 0 | _Pypegen_stack_overflow(p); |
29888 | 0 | } |
29889 | 6.70k | if (p->error_indicator) { |
29890 | 0 | p->level--; |
29891 | 0 | return NULL; |
29892 | 0 | } |
29893 | 6.70k | void *_res = NULL; |
29894 | 6.70k | int _mark = p->mark; |
29895 | 6.70k | void **_children = PyMem_Malloc(sizeof(void *)); |
29896 | 6.70k | if (!_children) { |
29897 | 0 | p->error_indicator = 1; |
29898 | 0 | PyErr_NoMemory(); |
29899 | 0 | p->level--; |
29900 | 0 | return NULL; |
29901 | 0 | } |
29902 | 6.70k | Py_ssize_t _children_capacity = 1; |
29903 | 6.70k | Py_ssize_t _n = 0; |
29904 | 6.70k | { // except_block |
29905 | 6.70k | if (p->error_indicator) { |
29906 | 0 | p->level--; |
29907 | 0 | return NULL; |
29908 | 0 | } |
29909 | 6.70k | D(fprintf(stderr, "%*c> _loop1_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block")); |
29910 | 6.70k | excepthandler_ty except_block_var; |
29911 | 6.70k | while ( |
29912 | 13.2k | (except_block_var = except_block_rule(p)) // except_block |
29913 | 6.70k | ) |
29914 | 6.51k | { |
29915 | 6.51k | _res = except_block_var; |
29916 | 6.51k | if (_n == _children_capacity) { |
29917 | 1.09k | _children_capacity *= 2; |
29918 | 1.09k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29919 | 1.09k | if (!_new_children) { |
29920 | 0 | PyMem_Free(_children); |
29921 | 0 | p->error_indicator = 1; |
29922 | 0 | PyErr_NoMemory(); |
29923 | 0 | p->level--; |
29924 | 0 | return NULL; |
29925 | 0 | } |
29926 | 1.09k | _children = _new_children; |
29927 | 1.09k | } |
29928 | 6.51k | _children[_n++] = _res; |
29929 | 6.51k | _mark = p->mark; |
29930 | 6.51k | } |
29931 | 6.70k | p->mark = _mark; |
29932 | 6.70k | D(fprintf(stderr, "%*c%s _loop1_36[%d-%d]: %s failed!\n", p->level, ' ', |
29933 | 6.70k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block")); |
29934 | 6.70k | } |
29935 | 6.70k | if (_n == 0 || p->error_indicator) { |
29936 | 3.07k | PyMem_Free(_children); |
29937 | 3.07k | p->level--; |
29938 | 3.07k | return NULL; |
29939 | 3.07k | } |
29940 | 3.63k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
29941 | 3.63k | if (!_seq) { |
29942 | 0 | PyMem_Free(_children); |
29943 | 0 | p->error_indicator = 1; |
29944 | 0 | PyErr_NoMemory(); |
29945 | 0 | p->level--; |
29946 | 0 | return NULL; |
29947 | 0 | } |
29948 | 10.1k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
29949 | 3.63k | PyMem_Free(_children); |
29950 | 3.63k | p->level--; |
29951 | 3.63k | return _seq; |
29952 | 3.63k | } |
29953 | | |
29954 | | // _loop1_37: except_star_block |
29955 | | static asdl_seq * |
29956 | | _loop1_37_rule(Parser *p) |
29957 | 3.74k | { |
29958 | 3.74k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
29959 | 0 | _Pypegen_stack_overflow(p); |
29960 | 0 | } |
29961 | 3.74k | if (p->error_indicator) { |
29962 | 0 | p->level--; |
29963 | 0 | return NULL; |
29964 | 0 | } |
29965 | 3.74k | void *_res = NULL; |
29966 | 3.74k | int _mark = p->mark; |
29967 | 3.74k | void **_children = PyMem_Malloc(sizeof(void *)); |
29968 | 3.74k | if (!_children) { |
29969 | 0 | p->error_indicator = 1; |
29970 | 0 | PyErr_NoMemory(); |
29971 | 0 | p->level--; |
29972 | 0 | return NULL; |
29973 | 0 | } |
29974 | 3.74k | Py_ssize_t _children_capacity = 1; |
29975 | 3.74k | Py_ssize_t _n = 0; |
29976 | 3.74k | { // except_star_block |
29977 | 3.74k | if (p->error_indicator) { |
29978 | 0 | p->level--; |
29979 | 0 | return NULL; |
29980 | 0 | } |
29981 | 3.74k | D(fprintf(stderr, "%*c> _loop1_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_star_block")); |
29982 | 3.74k | excepthandler_ty except_star_block_var; |
29983 | 3.74k | while ( |
29984 | 7.64k | (except_star_block_var = except_star_block_rule(p)) // except_star_block |
29985 | 3.74k | ) |
29986 | 3.90k | { |
29987 | 3.90k | _res = except_star_block_var; |
29988 | 3.90k | if (_n == _children_capacity) { |
29989 | 432 | _children_capacity *= 2; |
29990 | 432 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
29991 | 432 | if (!_new_children) { |
29992 | 0 | PyMem_Free(_children); |
29993 | 0 | p->error_indicator = 1; |
29994 | 0 | PyErr_NoMemory(); |
29995 | 0 | p->level--; |
29996 | 0 | return NULL; |
29997 | 0 | } |
29998 | 432 | _children = _new_children; |
29999 | 432 | } |
30000 | 3.90k | _children[_n++] = _res; |
30001 | 3.90k | _mark = p->mark; |
30002 | 3.90k | } |
30003 | 3.74k | p->mark = _mark; |
30004 | 3.74k | D(fprintf(stderr, "%*c%s _loop1_37[%d-%d]: %s failed!\n", p->level, ' ', |
30005 | 3.74k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_star_block")); |
30006 | 3.74k | } |
30007 | 3.74k | if (_n == 0 || p->error_indicator) { |
30008 | 1.49k | PyMem_Free(_children); |
30009 | 1.49k | p->level--; |
30010 | 1.49k | return NULL; |
30011 | 1.49k | } |
30012 | 2.24k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30013 | 2.24k | if (!_seq) { |
30014 | 0 | PyMem_Free(_children); |
30015 | 0 | p->error_indicator = 1; |
30016 | 0 | PyErr_NoMemory(); |
30017 | 0 | p->level--; |
30018 | 0 | return NULL; |
30019 | 0 | } |
30020 | 6.14k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30021 | 2.24k | PyMem_Free(_children); |
30022 | 2.24k | p->level--; |
30023 | 2.24k | return _seq; |
30024 | 2.24k | } |
30025 | | |
30026 | | // _loop1_38: case_block |
30027 | | static asdl_seq * |
30028 | | _loop1_38_rule(Parser *p) |
30029 | 1.90k | { |
30030 | 1.90k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30031 | 0 | _Pypegen_stack_overflow(p); |
30032 | 0 | } |
30033 | 1.90k | if (p->error_indicator) { |
30034 | 0 | p->level--; |
30035 | 0 | return NULL; |
30036 | 0 | } |
30037 | 1.90k | void *_res = NULL; |
30038 | 1.90k | int _mark = p->mark; |
30039 | 1.90k | void **_children = PyMem_Malloc(sizeof(void *)); |
30040 | 1.90k | if (!_children) { |
30041 | 0 | p->error_indicator = 1; |
30042 | 0 | PyErr_NoMemory(); |
30043 | 0 | p->level--; |
30044 | 0 | return NULL; |
30045 | 0 | } |
30046 | 1.90k | Py_ssize_t _children_capacity = 1; |
30047 | 1.90k | Py_ssize_t _n = 0; |
30048 | 1.90k | { // case_block |
30049 | 1.90k | if (p->error_indicator) { |
30050 | 0 | p->level--; |
30051 | 0 | return NULL; |
30052 | 0 | } |
30053 | 1.90k | D(fprintf(stderr, "%*c> _loop1_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "case_block")); |
30054 | 1.90k | match_case_ty case_block_var; |
30055 | 1.90k | while ( |
30056 | 5.13k | (case_block_var = case_block_rule(p)) // case_block |
30057 | 1.90k | ) |
30058 | 3.22k | { |
30059 | 3.22k | _res = case_block_var; |
30060 | 3.22k | if (_n == _children_capacity) { |
30061 | 577 | _children_capacity *= 2; |
30062 | 577 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30063 | 577 | if (!_new_children) { |
30064 | 0 | PyMem_Free(_children); |
30065 | 0 | p->error_indicator = 1; |
30066 | 0 | PyErr_NoMemory(); |
30067 | 0 | p->level--; |
30068 | 0 | return NULL; |
30069 | 0 | } |
30070 | 577 | _children = _new_children; |
30071 | 577 | } |
30072 | 3.22k | _children[_n++] = _res; |
30073 | 3.22k | _mark = p->mark; |
30074 | 3.22k | } |
30075 | 1.90k | p->mark = _mark; |
30076 | 1.90k | D(fprintf(stderr, "%*c%s _loop1_38[%d-%d]: %s failed!\n", p->level, ' ', |
30077 | 1.90k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "case_block")); |
30078 | 1.90k | } |
30079 | 1.90k | if (_n == 0 || p->error_indicator) { |
30080 | 1.14k | PyMem_Free(_children); |
30081 | 1.14k | p->level--; |
30082 | 1.14k | return NULL; |
30083 | 1.14k | } |
30084 | 767 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30085 | 767 | if (!_seq) { |
30086 | 0 | PyMem_Free(_children); |
30087 | 0 | p->error_indicator = 1; |
30088 | 0 | PyErr_NoMemory(); |
30089 | 0 | p->level--; |
30090 | 0 | return NULL; |
30091 | 0 | } |
30092 | 3.96k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30093 | 767 | PyMem_Free(_children); |
30094 | 767 | p->level--; |
30095 | 767 | return _seq; |
30096 | 767 | } |
30097 | | |
30098 | | // _loop0_39: '|' closed_pattern |
30099 | | static asdl_seq * |
30100 | | _loop0_39_rule(Parser *p) |
30101 | 130k | { |
30102 | 130k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30103 | 0 | _Pypegen_stack_overflow(p); |
30104 | 0 | } |
30105 | 130k | if (p->error_indicator) { |
30106 | 27 | p->level--; |
30107 | 27 | return NULL; |
30108 | 27 | } |
30109 | 130k | void *_res = NULL; |
30110 | 130k | int _mark = p->mark; |
30111 | 130k | void **_children = PyMem_Malloc(sizeof(void *)); |
30112 | 130k | if (!_children) { |
30113 | 0 | p->error_indicator = 1; |
30114 | 0 | PyErr_NoMemory(); |
30115 | 0 | p->level--; |
30116 | 0 | return NULL; |
30117 | 0 | } |
30118 | 130k | Py_ssize_t _children_capacity = 1; |
30119 | 130k | Py_ssize_t _n = 0; |
30120 | 130k | { // '|' closed_pattern |
30121 | 130k | if (p->error_indicator) { |
30122 | 0 | p->level--; |
30123 | 0 | return NULL; |
30124 | 0 | } |
30125 | 130k | D(fprintf(stderr, "%*c> _loop0_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern")); |
30126 | 130k | Token * _literal; |
30127 | 130k | pattern_ty elem; |
30128 | 130k | while ( |
30129 | 142k | (_literal = _PyPegen_expect_token(p, 18)) // token='|' |
30130 | 14.7k | && |
30131 | 14.7k | (elem = closed_pattern_rule(p)) // closed_pattern |
30132 | 130k | ) |
30133 | 11.1k | { |
30134 | 11.1k | _res = elem; |
30135 | 11.1k | if (_res == NULL && PyErr_Occurred()) { |
30136 | 0 | p->error_indicator = 1; |
30137 | 0 | PyMem_Free(_children); |
30138 | 0 | p->level--; |
30139 | 0 | return NULL; |
30140 | 0 | } |
30141 | 11.1k | if (_n == _children_capacity) { |
30142 | 1.69k | _children_capacity *= 2; |
30143 | 1.69k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30144 | 1.69k | if (!_new_children) { |
30145 | 0 | PyMem_Free(_children); |
30146 | 0 | p->error_indicator = 1; |
30147 | 0 | PyErr_NoMemory(); |
30148 | 0 | p->level--; |
30149 | 0 | return NULL; |
30150 | 0 | } |
30151 | 1.69k | _children = _new_children; |
30152 | 1.69k | } |
30153 | 11.1k | _children[_n++] = _res; |
30154 | 11.1k | _mark = p->mark; |
30155 | 11.1k | } |
30156 | 130k | p->mark = _mark; |
30157 | 130k | D(fprintf(stderr, "%*c%s _loop0_39[%d-%d]: %s failed!\n", p->level, ' ', |
30158 | 130k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' closed_pattern")); |
30159 | 130k | } |
30160 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30161 | 130k | if (!_seq) { |
30162 | 0 | PyMem_Free(_children); |
30163 | 0 | p->error_indicator = 1; |
30164 | 0 | PyErr_NoMemory(); |
30165 | 0 | p->level--; |
30166 | 0 | return NULL; |
30167 | 0 | } |
30168 | 142k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30169 | 130k | PyMem_Free(_children); |
30170 | 130k | p->level--; |
30171 | 130k | return _seq; |
30172 | 130k | } |
30173 | | |
30174 | | // _gather_40: closed_pattern _loop0_39 |
30175 | | static asdl_seq * |
30176 | | _gather_40_rule(Parser *p) |
30177 | 210k | { |
30178 | 210k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30179 | 0 | _Pypegen_stack_overflow(p); |
30180 | 0 | } |
30181 | 210k | if (p->error_indicator) { |
30182 | 0 | p->level--; |
30183 | 0 | return NULL; |
30184 | 0 | } |
30185 | 210k | asdl_seq * _res = NULL; |
30186 | 210k | int _mark = p->mark; |
30187 | 210k | { // closed_pattern _loop0_39 |
30188 | 210k | if (p->error_indicator) { |
30189 | 0 | p->level--; |
30190 | 0 | return NULL; |
30191 | 0 | } |
30192 | 210k | D(fprintf(stderr, "%*c> _gather_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_39")); |
30193 | 210k | pattern_ty elem; |
30194 | 210k | asdl_seq * seq; |
30195 | 210k | if ( |
30196 | 210k | (elem = closed_pattern_rule(p)) // closed_pattern |
30197 | 130k | && |
30198 | 130k | (seq = _loop0_39_rule(p)) // _loop0_39 |
30199 | 210k | ) |
30200 | 130k | { |
30201 | 130k | D(fprintf(stderr, "%*c+ _gather_40[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_39")); |
30202 | 130k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
30203 | 130k | goto done; |
30204 | 130k | } |
30205 | 79.1k | p->mark = _mark; |
30206 | 79.1k | D(fprintf(stderr, "%*c%s _gather_40[%d-%d]: %s failed!\n", p->level, ' ', |
30207 | 79.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern _loop0_39")); |
30208 | 79.1k | } |
30209 | 79.1k | _res = NULL; |
30210 | 210k | done: |
30211 | 210k | p->level--; |
30212 | 210k | return _res; |
30213 | 79.1k | } |
30214 | | |
30215 | | // _tmp_41: '+' | '-' |
30216 | | static void * |
30217 | | _tmp_41_rule(Parser *p) |
30218 | 5.06k | { |
30219 | 5.06k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30220 | 0 | _Pypegen_stack_overflow(p); |
30221 | 0 | } |
30222 | 5.06k | if (p->error_indicator) { |
30223 | 0 | p->level--; |
30224 | 0 | return NULL; |
30225 | 0 | } |
30226 | 5.06k | void * _res = NULL; |
30227 | 5.06k | int _mark = p->mark; |
30228 | 5.06k | { // '+' |
30229 | 5.06k | if (p->error_indicator) { |
30230 | 0 | p->level--; |
30231 | 0 | return NULL; |
30232 | 0 | } |
30233 | 5.06k | D(fprintf(stderr, "%*c> _tmp_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'")); |
30234 | 5.06k | Token * _literal; |
30235 | 5.06k | if ( |
30236 | 5.06k | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
30237 | 5.06k | ) |
30238 | 218 | { |
30239 | 218 | D(fprintf(stderr, "%*c+ _tmp_41[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'")); |
30240 | 218 | _res = _literal; |
30241 | 218 | goto done; |
30242 | 218 | } |
30243 | 4.84k | p->mark = _mark; |
30244 | 4.84k | D(fprintf(stderr, "%*c%s _tmp_41[%d-%d]: %s failed!\n", p->level, ' ', |
30245 | 4.84k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'")); |
30246 | 4.84k | } |
30247 | 0 | { // '-' |
30248 | 4.84k | if (p->error_indicator) { |
30249 | 11 | p->level--; |
30250 | 11 | return NULL; |
30251 | 11 | } |
30252 | 4.83k | D(fprintf(stderr, "%*c> _tmp_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'")); |
30253 | 4.83k | Token * _literal; |
30254 | 4.83k | if ( |
30255 | 4.83k | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
30256 | 4.83k | ) |
30257 | 408 | { |
30258 | 408 | D(fprintf(stderr, "%*c+ _tmp_41[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'")); |
30259 | 408 | _res = _literal; |
30260 | 408 | goto done; |
30261 | 408 | } |
30262 | 4.42k | p->mark = _mark; |
30263 | 4.42k | D(fprintf(stderr, "%*c%s _tmp_41[%d-%d]: %s failed!\n", p->level, ' ', |
30264 | 4.42k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'")); |
30265 | 4.42k | } |
30266 | 4.42k | _res = NULL; |
30267 | 5.05k | done: |
30268 | 5.05k | p->level--; |
30269 | 5.05k | return _res; |
30270 | 4.42k | } |
30271 | | |
30272 | | // _tmp_42: STRING | FSTRING_START | TSTRING_START |
30273 | | static void * |
30274 | | _tmp_42_rule(Parser *p) |
30275 | 815k | { |
30276 | 815k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30277 | 1 | _Pypegen_stack_overflow(p); |
30278 | 1 | } |
30279 | 815k | if (p->error_indicator) { |
30280 | 1 | p->level--; |
30281 | 1 | return NULL; |
30282 | 1 | } |
30283 | 815k | void * _res = NULL; |
30284 | 815k | int _mark = p->mark; |
30285 | 815k | { // STRING |
30286 | 815k | if (p->error_indicator) { |
30287 | 0 | p->level--; |
30288 | 0 | return NULL; |
30289 | 0 | } |
30290 | 815k | D(fprintf(stderr, "%*c> _tmp_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); |
30291 | 815k | expr_ty string_var; |
30292 | 815k | if ( |
30293 | 815k | (string_var = _PyPegen_string_token(p)) // STRING |
30294 | 815k | ) |
30295 | 85.4k | { |
30296 | 85.4k | D(fprintf(stderr, "%*c+ _tmp_42[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING")); |
30297 | 85.4k | _res = string_var; |
30298 | 85.4k | goto done; |
30299 | 85.4k | } |
30300 | 730k | p->mark = _mark; |
30301 | 730k | D(fprintf(stderr, "%*c%s _tmp_42[%d-%d]: %s failed!\n", p->level, ' ', |
30302 | 730k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); |
30303 | 730k | } |
30304 | 0 | { // FSTRING_START |
30305 | 730k | if (p->error_indicator) { |
30306 | 0 | p->level--; |
30307 | 0 | return NULL; |
30308 | 0 | } |
30309 | 730k | D(fprintf(stderr, "%*c> _tmp_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "FSTRING_START")); |
30310 | 730k | Token * fstring_start_var; |
30311 | 730k | if ( |
30312 | 730k | (fstring_start_var = _PyPegen_expect_token(p, FSTRING_START)) // token='FSTRING_START' |
30313 | 730k | ) |
30314 | 21.4k | { |
30315 | 21.4k | D(fprintf(stderr, "%*c+ _tmp_42[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_START")); |
30316 | 21.4k | _res = fstring_start_var; |
30317 | 21.4k | goto done; |
30318 | 21.4k | } |
30319 | 708k | p->mark = _mark; |
30320 | 708k | D(fprintf(stderr, "%*c%s _tmp_42[%d-%d]: %s failed!\n", p->level, ' ', |
30321 | 708k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "FSTRING_START")); |
30322 | 708k | } |
30323 | 0 | { // TSTRING_START |
30324 | 708k | if (p->error_indicator) { |
30325 | 0 | p->level--; |
30326 | 0 | return NULL; |
30327 | 0 | } |
30328 | 708k | D(fprintf(stderr, "%*c> _tmp_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TSTRING_START")); |
30329 | 708k | Token * tstring_start_var; |
30330 | 708k | if ( |
30331 | 708k | (tstring_start_var = _PyPegen_expect_token(p, TSTRING_START)) // token='TSTRING_START' |
30332 | 708k | ) |
30333 | 9.27k | { |
30334 | 9.27k | D(fprintf(stderr, "%*c+ _tmp_42[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TSTRING_START")); |
30335 | 9.27k | _res = tstring_start_var; |
30336 | 9.27k | goto done; |
30337 | 9.27k | } |
30338 | 699k | p->mark = _mark; |
30339 | 699k | D(fprintf(stderr, "%*c%s _tmp_42[%d-%d]: %s failed!\n", p->level, ' ', |
30340 | 699k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TSTRING_START")); |
30341 | 699k | } |
30342 | 699k | _res = NULL; |
30343 | 815k | done: |
30344 | 815k | p->level--; |
30345 | 815k | return _res; |
30346 | 699k | } |
30347 | | |
30348 | | // _tmp_43: '.' | '(' | '=' |
30349 | | static void * |
30350 | | _tmp_43_rule(Parser *p) |
30351 | 27.7k | { |
30352 | 27.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30353 | 0 | _Pypegen_stack_overflow(p); |
30354 | 0 | } |
30355 | 27.7k | if (p->error_indicator) { |
30356 | 0 | p->level--; |
30357 | 0 | return NULL; |
30358 | 0 | } |
30359 | 27.7k | void * _res = NULL; |
30360 | 27.7k | int _mark = p->mark; |
30361 | 27.7k | { // '.' |
30362 | 27.7k | if (p->error_indicator) { |
30363 | 0 | p->level--; |
30364 | 0 | return NULL; |
30365 | 0 | } |
30366 | 27.7k | D(fprintf(stderr, "%*c> _tmp_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
30367 | 27.7k | Token * _literal; |
30368 | 27.7k | if ( |
30369 | 27.7k | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
30370 | 27.7k | ) |
30371 | 488 | { |
30372 | 488 | D(fprintf(stderr, "%*c+ _tmp_43[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
30373 | 488 | _res = _literal; |
30374 | 488 | goto done; |
30375 | 488 | } |
30376 | 27.2k | p->mark = _mark; |
30377 | 27.2k | D(fprintf(stderr, "%*c%s _tmp_43[%d-%d]: %s failed!\n", p->level, ' ', |
30378 | 27.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
30379 | 27.2k | } |
30380 | 0 | { // '(' |
30381 | 27.2k | if (p->error_indicator) { |
30382 | 32 | p->level--; |
30383 | 32 | return NULL; |
30384 | 32 | } |
30385 | 27.2k | D(fprintf(stderr, "%*c> _tmp_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
30386 | 27.2k | Token * _literal; |
30387 | 27.2k | if ( |
30388 | 27.2k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
30389 | 27.2k | ) |
30390 | 8.43k | { |
30391 | 8.43k | D(fprintf(stderr, "%*c+ _tmp_43[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
30392 | 8.43k | _res = _literal; |
30393 | 8.43k | goto done; |
30394 | 8.43k | } |
30395 | 18.7k | p->mark = _mark; |
30396 | 18.7k | D(fprintf(stderr, "%*c%s _tmp_43[%d-%d]: %s failed!\n", p->level, ' ', |
30397 | 18.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
30398 | 18.7k | } |
30399 | 0 | { // '=' |
30400 | 18.7k | if (p->error_indicator) { |
30401 | 0 | p->level--; |
30402 | 0 | return NULL; |
30403 | 0 | } |
30404 | 18.7k | D(fprintf(stderr, "%*c> _tmp_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); |
30405 | 18.7k | Token * _literal; |
30406 | 18.7k | if ( |
30407 | 18.7k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
30408 | 18.7k | ) |
30409 | 2.99k | { |
30410 | 2.99k | D(fprintf(stderr, "%*c+ _tmp_43[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); |
30411 | 2.99k | _res = _literal; |
30412 | 2.99k | goto done; |
30413 | 2.99k | } |
30414 | 15.7k | p->mark = _mark; |
30415 | 15.7k | D(fprintf(stderr, "%*c%s _tmp_43[%d-%d]: %s failed!\n", p->level, ' ', |
30416 | 15.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); |
30417 | 15.7k | } |
30418 | 15.7k | _res = NULL; |
30419 | 27.7k | done: |
30420 | 27.7k | p->level--; |
30421 | 27.7k | return _res; |
30422 | 15.7k | } |
30423 | | |
30424 | | // _loop0_44: ',' maybe_star_pattern |
30425 | | static asdl_seq * |
30426 | | _loop0_44_rule(Parser *p) |
30427 | 1.75k | { |
30428 | 1.75k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30429 | 0 | _Pypegen_stack_overflow(p); |
30430 | 0 | } |
30431 | 1.75k | if (p->error_indicator) { |
30432 | 1 | p->level--; |
30433 | 1 | return NULL; |
30434 | 1 | } |
30435 | 1.75k | void *_res = NULL; |
30436 | 1.75k | int _mark = p->mark; |
30437 | 1.75k | void **_children = PyMem_Malloc(sizeof(void *)); |
30438 | 1.75k | if (!_children) { |
30439 | 0 | p->error_indicator = 1; |
30440 | 0 | PyErr_NoMemory(); |
30441 | 0 | p->level--; |
30442 | 0 | return NULL; |
30443 | 0 | } |
30444 | 1.75k | Py_ssize_t _children_capacity = 1; |
30445 | 1.75k | Py_ssize_t _n = 0; |
30446 | 1.75k | { // ',' maybe_star_pattern |
30447 | 1.75k | if (p->error_indicator) { |
30448 | 0 | p->level--; |
30449 | 0 | return NULL; |
30450 | 0 | } |
30451 | 1.75k | D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' maybe_star_pattern")); |
30452 | 1.75k | Token * _literal; |
30453 | 1.75k | pattern_ty elem; |
30454 | 1.75k | while ( |
30455 | 12.4k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
30456 | 11.7k | && |
30457 | 11.7k | (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern |
30458 | 1.75k | ) |
30459 | 10.6k | { |
30460 | 10.6k | _res = elem; |
30461 | 10.6k | if (_res == NULL && PyErr_Occurred()) { |
30462 | 0 | p->error_indicator = 1; |
30463 | 0 | PyMem_Free(_children); |
30464 | 0 | p->level--; |
30465 | 0 | return NULL; |
30466 | 0 | } |
30467 | 10.6k | if (_n == _children_capacity) { |
30468 | 1.46k | _children_capacity *= 2; |
30469 | 1.46k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30470 | 1.46k | if (!_new_children) { |
30471 | 0 | PyMem_Free(_children); |
30472 | 0 | p->error_indicator = 1; |
30473 | 0 | PyErr_NoMemory(); |
30474 | 0 | p->level--; |
30475 | 0 | return NULL; |
30476 | 0 | } |
30477 | 1.46k | _children = _new_children; |
30478 | 1.46k | } |
30479 | 10.6k | _children[_n++] = _res; |
30480 | 10.6k | _mark = p->mark; |
30481 | 10.6k | } |
30482 | 1.75k | p->mark = _mark; |
30483 | 1.75k | D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ', |
30484 | 1.75k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' maybe_star_pattern")); |
30485 | 1.75k | } |
30486 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30487 | 1.75k | if (!_seq) { |
30488 | 0 | PyMem_Free(_children); |
30489 | 0 | p->error_indicator = 1; |
30490 | 0 | PyErr_NoMemory(); |
30491 | 0 | p->level--; |
30492 | 0 | return NULL; |
30493 | 0 | } |
30494 | 12.4k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30495 | 1.75k | PyMem_Free(_children); |
30496 | 1.75k | p->level--; |
30497 | 1.75k | return _seq; |
30498 | 1.75k | } |
30499 | | |
30500 | | // _gather_45: maybe_star_pattern _loop0_44 |
30501 | | static asdl_seq * |
30502 | | _gather_45_rule(Parser *p) |
30503 | 4.08k | { |
30504 | 4.08k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30505 | 0 | _Pypegen_stack_overflow(p); |
30506 | 0 | } |
30507 | 4.08k | if (p->error_indicator) { |
30508 | 0 | p->level--; |
30509 | 0 | return NULL; |
30510 | 0 | } |
30511 | 4.08k | asdl_seq * _res = NULL; |
30512 | 4.08k | int _mark = p->mark; |
30513 | 4.08k | { // maybe_star_pattern _loop0_44 |
30514 | 4.08k | if (p->error_indicator) { |
30515 | 0 | p->level--; |
30516 | 0 | return NULL; |
30517 | 0 | } |
30518 | 4.08k | D(fprintf(stderr, "%*c> _gather_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_44")); |
30519 | 4.08k | pattern_ty elem; |
30520 | 4.08k | asdl_seq * seq; |
30521 | 4.08k | if ( |
30522 | 4.08k | (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern |
30523 | 1.75k | && |
30524 | 1.75k | (seq = _loop0_44_rule(p)) // _loop0_44 |
30525 | 4.08k | ) |
30526 | 1.75k | { |
30527 | 1.75k | D(fprintf(stderr, "%*c+ _gather_45[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_44")); |
30528 | 1.75k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
30529 | 1.75k | goto done; |
30530 | 1.75k | } |
30531 | 2.32k | p->mark = _mark; |
30532 | 2.32k | D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ', |
30533 | 2.32k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern _loop0_44")); |
30534 | 2.32k | } |
30535 | 2.32k | _res = NULL; |
30536 | 4.08k | done: |
30537 | 4.08k | p->level--; |
30538 | 4.08k | return _res; |
30539 | 2.32k | } |
30540 | | |
30541 | | // _loop0_46: ',' key_value_pattern |
30542 | | static asdl_seq * |
30543 | | _loop0_46_rule(Parser *p) |
30544 | 1.18k | { |
30545 | 1.18k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30546 | 0 | _Pypegen_stack_overflow(p); |
30547 | 0 | } |
30548 | 1.18k | if (p->error_indicator) { |
30549 | 1 | p->level--; |
30550 | 1 | return NULL; |
30551 | 1 | } |
30552 | 1.18k | void *_res = NULL; |
30553 | 1.18k | int _mark = p->mark; |
30554 | 1.18k | void **_children = PyMem_Malloc(sizeof(void *)); |
30555 | 1.18k | if (!_children) { |
30556 | 0 | p->error_indicator = 1; |
30557 | 0 | PyErr_NoMemory(); |
30558 | 0 | p->level--; |
30559 | 0 | return NULL; |
30560 | 0 | } |
30561 | 1.18k | Py_ssize_t _children_capacity = 1; |
30562 | 1.18k | Py_ssize_t _n = 0; |
30563 | 1.18k | { // ',' key_value_pattern |
30564 | 1.18k | if (p->error_indicator) { |
30565 | 0 | p->level--; |
30566 | 0 | return NULL; |
30567 | 0 | } |
30568 | 1.18k | D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); |
30569 | 1.18k | Token * _literal; |
30570 | 1.18k | KeyPatternPair* elem; |
30571 | 1.18k | while ( |
30572 | 2.05k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
30573 | 1.10k | && |
30574 | 1.10k | (elem = key_value_pattern_rule(p)) // key_value_pattern |
30575 | 1.18k | ) |
30576 | 872 | { |
30577 | 872 | _res = elem; |
30578 | 872 | if (_res == NULL && PyErr_Occurred()) { |
30579 | 0 | p->error_indicator = 1; |
30580 | 0 | PyMem_Free(_children); |
30581 | 0 | p->level--; |
30582 | 0 | return NULL; |
30583 | 0 | } |
30584 | 872 | if (_n == _children_capacity) { |
30585 | 251 | _children_capacity *= 2; |
30586 | 251 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30587 | 251 | if (!_new_children) { |
30588 | 0 | PyMem_Free(_children); |
30589 | 0 | p->error_indicator = 1; |
30590 | 0 | PyErr_NoMemory(); |
30591 | 0 | p->level--; |
30592 | 0 | return NULL; |
30593 | 0 | } |
30594 | 251 | _children = _new_children; |
30595 | 251 | } |
30596 | 872 | _children[_n++] = _res; |
30597 | 872 | _mark = p->mark; |
30598 | 872 | } |
30599 | 1.18k | p->mark = _mark; |
30600 | 1.18k | D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ', |
30601 | 1.18k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern")); |
30602 | 1.18k | } |
30603 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30604 | 1.18k | if (!_seq) { |
30605 | 0 | PyMem_Free(_children); |
30606 | 0 | p->error_indicator = 1; |
30607 | 0 | PyErr_NoMemory(); |
30608 | 0 | p->level--; |
30609 | 0 | return NULL; |
30610 | 0 | } |
30611 | 2.05k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30612 | 1.18k | PyMem_Free(_children); |
30613 | 1.18k | p->level--; |
30614 | 1.18k | return _seq; |
30615 | 1.18k | } |
30616 | | |
30617 | | // _gather_47: key_value_pattern _loop0_46 |
30618 | | static asdl_seq * |
30619 | | _gather_47_rule(Parser *p) |
30620 | 2.36k | { |
30621 | 2.36k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30622 | 0 | _Pypegen_stack_overflow(p); |
30623 | 0 | } |
30624 | 2.36k | if (p->error_indicator) { |
30625 | 0 | p->level--; |
30626 | 0 | return NULL; |
30627 | 0 | } |
30628 | 2.36k | asdl_seq * _res = NULL; |
30629 | 2.36k | int _mark = p->mark; |
30630 | 2.36k | { // key_value_pattern _loop0_46 |
30631 | 2.36k | if (p->error_indicator) { |
30632 | 0 | p->level--; |
30633 | 0 | return NULL; |
30634 | 0 | } |
30635 | 2.36k | D(fprintf(stderr, "%*c> _gather_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_46")); |
30636 | 2.36k | KeyPatternPair* elem; |
30637 | 2.36k | asdl_seq * seq; |
30638 | 2.36k | if ( |
30639 | 2.36k | (elem = key_value_pattern_rule(p)) // key_value_pattern |
30640 | 1.18k | && |
30641 | 1.18k | (seq = _loop0_46_rule(p)) // _loop0_46 |
30642 | 2.36k | ) |
30643 | 1.18k | { |
30644 | 1.18k | D(fprintf(stderr, "%*c+ _gather_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_46")); |
30645 | 1.18k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
30646 | 1.18k | goto done; |
30647 | 1.18k | } |
30648 | 1.18k | p->mark = _mark; |
30649 | 1.18k | D(fprintf(stderr, "%*c%s _gather_47[%d-%d]: %s failed!\n", p->level, ' ', |
30650 | 1.18k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_46")); |
30651 | 1.18k | } |
30652 | 1.18k | _res = NULL; |
30653 | 2.36k | done: |
30654 | 2.36k | p->level--; |
30655 | 2.36k | return _res; |
30656 | 1.18k | } |
30657 | | |
30658 | | // _tmp_48: literal_expr | attr |
30659 | | static void * |
30660 | | _tmp_48_rule(Parser *p) |
30661 | 3.46k | { |
30662 | 3.46k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30663 | 0 | _Pypegen_stack_overflow(p); |
30664 | 0 | } |
30665 | 3.46k | if (p->error_indicator) { |
30666 | 0 | p->level--; |
30667 | 0 | return NULL; |
30668 | 0 | } |
30669 | 3.46k | void * _res = NULL; |
30670 | 3.46k | int _mark = p->mark; |
30671 | 3.46k | { // literal_expr |
30672 | 3.46k | if (p->error_indicator) { |
30673 | 0 | p->level--; |
30674 | 0 | return NULL; |
30675 | 0 | } |
30676 | 3.46k | D(fprintf(stderr, "%*c> _tmp_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_expr")); |
30677 | 3.46k | expr_ty literal_expr_var; |
30678 | 3.46k | if ( |
30679 | 3.46k | (literal_expr_var = literal_expr_rule(p)) // literal_expr |
30680 | 3.46k | ) |
30681 | 3.17k | { |
30682 | 3.17k | D(fprintf(stderr, "%*c+ _tmp_48[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_expr")); |
30683 | 3.17k | _res = literal_expr_var; |
30684 | 3.17k | goto done; |
30685 | 3.17k | } |
30686 | 290 | p->mark = _mark; |
30687 | 290 | D(fprintf(stderr, "%*c%s _tmp_48[%d-%d]: %s failed!\n", p->level, ' ', |
30688 | 290 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_expr")); |
30689 | 290 | } |
30690 | 0 | { // attr |
30691 | 290 | if (p->error_indicator) { |
30692 | 16 | p->level--; |
30693 | 16 | return NULL; |
30694 | 16 | } |
30695 | 274 | D(fprintf(stderr, "%*c> _tmp_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr")); |
30696 | 274 | expr_ty attr_var; |
30697 | 274 | if ( |
30698 | 274 | (attr_var = attr_rule(p)) // attr |
30699 | 274 | ) |
30700 | 21 | { |
30701 | 21 | D(fprintf(stderr, "%*c+ _tmp_48[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr")); |
30702 | 21 | _res = attr_var; |
30703 | 21 | goto done; |
30704 | 21 | } |
30705 | 253 | p->mark = _mark; |
30706 | 253 | D(fprintf(stderr, "%*c%s _tmp_48[%d-%d]: %s failed!\n", p->level, ' ', |
30707 | 253 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr")); |
30708 | 253 | } |
30709 | 253 | _res = NULL; |
30710 | 3.44k | done: |
30711 | 3.44k | p->level--; |
30712 | 3.44k | return _res; |
30713 | 253 | } |
30714 | | |
30715 | | // _loop0_49: ',' pattern |
30716 | | static asdl_seq * |
30717 | | _loop0_49_rule(Parser *p) |
30718 | 8.58k | { |
30719 | 8.58k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30720 | 0 | _Pypegen_stack_overflow(p); |
30721 | 0 | } |
30722 | 8.58k | if (p->error_indicator) { |
30723 | 1 | p->level--; |
30724 | 1 | return NULL; |
30725 | 1 | } |
30726 | 8.58k | void *_res = NULL; |
30727 | 8.58k | int _mark = p->mark; |
30728 | 8.58k | void **_children = PyMem_Malloc(sizeof(void *)); |
30729 | 8.58k | if (!_children) { |
30730 | 0 | p->error_indicator = 1; |
30731 | 0 | PyErr_NoMemory(); |
30732 | 0 | p->level--; |
30733 | 0 | return NULL; |
30734 | 0 | } |
30735 | 8.58k | Py_ssize_t _children_capacity = 1; |
30736 | 8.58k | Py_ssize_t _n = 0; |
30737 | 8.58k | { // ',' pattern |
30738 | 8.58k | if (p->error_indicator) { |
30739 | 0 | p->level--; |
30740 | 0 | return NULL; |
30741 | 0 | } |
30742 | 8.58k | D(fprintf(stderr, "%*c> _loop0_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); |
30743 | 8.58k | Token * _literal; |
30744 | 8.58k | pattern_ty elem; |
30745 | 8.58k | while ( |
30746 | 12.9k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
30747 | 8.89k | && |
30748 | 8.89k | (elem = pattern_rule(p)) // pattern |
30749 | 8.58k | ) |
30750 | 4.33k | { |
30751 | 4.33k | _res = elem; |
30752 | 4.33k | if (_res == NULL && PyErr_Occurred()) { |
30753 | 0 | p->error_indicator = 1; |
30754 | 0 | PyMem_Free(_children); |
30755 | 0 | p->level--; |
30756 | 0 | return NULL; |
30757 | 0 | } |
30758 | 4.33k | if (_n == _children_capacity) { |
30759 | 945 | _children_capacity *= 2; |
30760 | 945 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30761 | 945 | if (!_new_children) { |
30762 | 0 | PyMem_Free(_children); |
30763 | 0 | p->error_indicator = 1; |
30764 | 0 | PyErr_NoMemory(); |
30765 | 0 | p->level--; |
30766 | 0 | return NULL; |
30767 | 0 | } |
30768 | 945 | _children = _new_children; |
30769 | 945 | } |
30770 | 4.33k | _children[_n++] = _res; |
30771 | 4.33k | _mark = p->mark; |
30772 | 4.33k | } |
30773 | 8.58k | p->mark = _mark; |
30774 | 8.58k | D(fprintf(stderr, "%*c%s _loop0_49[%d-%d]: %s failed!\n", p->level, ' ', |
30775 | 8.58k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); |
30776 | 8.58k | } |
30777 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30778 | 8.58k | if (!_seq) { |
30779 | 0 | PyMem_Free(_children); |
30780 | 0 | p->error_indicator = 1; |
30781 | 0 | PyErr_NoMemory(); |
30782 | 0 | p->level--; |
30783 | 0 | return NULL; |
30784 | 0 | } |
30785 | 12.9k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30786 | 8.58k | PyMem_Free(_children); |
30787 | 8.58k | p->level--; |
30788 | 8.58k | return _seq; |
30789 | 8.58k | } |
30790 | | |
30791 | | // _gather_50: pattern _loop0_49 |
30792 | | static asdl_seq * |
30793 | | _gather_50_rule(Parser *p) |
30794 | 16.3k | { |
30795 | 16.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30796 | 0 | _Pypegen_stack_overflow(p); |
30797 | 0 | } |
30798 | 16.3k | if (p->error_indicator) { |
30799 | 0 | p->level--; |
30800 | 0 | return NULL; |
30801 | 0 | } |
30802 | 16.3k | asdl_seq * _res = NULL; |
30803 | 16.3k | int _mark = p->mark; |
30804 | 16.3k | { // pattern _loop0_49 |
30805 | 16.3k | if (p->error_indicator) { |
30806 | 0 | p->level--; |
30807 | 0 | return NULL; |
30808 | 0 | } |
30809 | 16.3k | D(fprintf(stderr, "%*c> _gather_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_49")); |
30810 | 16.3k | pattern_ty elem; |
30811 | 16.3k | asdl_seq * seq; |
30812 | 16.3k | if ( |
30813 | 16.3k | (elem = pattern_rule(p)) // pattern |
30814 | 8.58k | && |
30815 | 8.58k | (seq = _loop0_49_rule(p)) // _loop0_49 |
30816 | 16.3k | ) |
30817 | 8.58k | { |
30818 | 8.58k | D(fprintf(stderr, "%*c+ _gather_50[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_49")); |
30819 | 8.58k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
30820 | 8.58k | goto done; |
30821 | 8.58k | } |
30822 | 7.74k | p->mark = _mark; |
30823 | 7.74k | D(fprintf(stderr, "%*c%s _gather_50[%d-%d]: %s failed!\n", p->level, ' ', |
30824 | 7.74k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_49")); |
30825 | 7.74k | } |
30826 | 7.74k | _res = NULL; |
30827 | 16.3k | done: |
30828 | 16.3k | p->level--; |
30829 | 16.3k | return _res; |
30830 | 7.74k | } |
30831 | | |
30832 | | // _loop0_51: ',' keyword_pattern |
30833 | | static asdl_seq * |
30834 | | _loop0_51_rule(Parser *p) |
30835 | 3.93k | { |
30836 | 3.93k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30837 | 0 | _Pypegen_stack_overflow(p); |
30838 | 0 | } |
30839 | 3.93k | if (p->error_indicator) { |
30840 | 1 | p->level--; |
30841 | 1 | return NULL; |
30842 | 1 | } |
30843 | 3.93k | void *_res = NULL; |
30844 | 3.93k | int _mark = p->mark; |
30845 | 3.93k | void **_children = PyMem_Malloc(sizeof(void *)); |
30846 | 3.93k | if (!_children) { |
30847 | 0 | p->error_indicator = 1; |
30848 | 0 | PyErr_NoMemory(); |
30849 | 0 | p->level--; |
30850 | 0 | return NULL; |
30851 | 0 | } |
30852 | 3.93k | Py_ssize_t _children_capacity = 1; |
30853 | 3.93k | Py_ssize_t _n = 0; |
30854 | 3.93k | { // ',' keyword_pattern |
30855 | 3.93k | if (p->error_indicator) { |
30856 | 0 | p->level--; |
30857 | 0 | return NULL; |
30858 | 0 | } |
30859 | 3.93k | D(fprintf(stderr, "%*c> _loop0_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); |
30860 | 3.93k | Token * _literal; |
30861 | 3.93k | KeyPatternPair* elem; |
30862 | 3.93k | while ( |
30863 | 5.95k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
30864 | 4.24k | && |
30865 | 4.24k | (elem = keyword_pattern_rule(p)) // keyword_pattern |
30866 | 3.93k | ) |
30867 | 2.01k | { |
30868 | 2.01k | _res = elem; |
30869 | 2.01k | if (_res == NULL && PyErr_Occurred()) { |
30870 | 0 | p->error_indicator = 1; |
30871 | 0 | PyMem_Free(_children); |
30872 | 0 | p->level--; |
30873 | 0 | return NULL; |
30874 | 0 | } |
30875 | 2.01k | if (_n == _children_capacity) { |
30876 | 908 | _children_capacity *= 2; |
30877 | 908 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30878 | 908 | if (!_new_children) { |
30879 | 0 | PyMem_Free(_children); |
30880 | 0 | p->error_indicator = 1; |
30881 | 0 | PyErr_NoMemory(); |
30882 | 0 | p->level--; |
30883 | 0 | return NULL; |
30884 | 0 | } |
30885 | 908 | _children = _new_children; |
30886 | 908 | } |
30887 | 2.01k | _children[_n++] = _res; |
30888 | 2.01k | _mark = p->mark; |
30889 | 2.01k | } |
30890 | 3.93k | p->mark = _mark; |
30891 | 3.93k | D(fprintf(stderr, "%*c%s _loop0_51[%d-%d]: %s failed!\n", p->level, ' ', |
30892 | 3.93k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern")); |
30893 | 3.93k | } |
30894 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
30895 | 3.93k | if (!_seq) { |
30896 | 0 | PyMem_Free(_children); |
30897 | 0 | p->error_indicator = 1; |
30898 | 0 | PyErr_NoMemory(); |
30899 | 0 | p->level--; |
30900 | 0 | return NULL; |
30901 | 0 | } |
30902 | 5.95k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
30903 | 3.93k | PyMem_Free(_children); |
30904 | 3.93k | p->level--; |
30905 | 3.93k | return _seq; |
30906 | 3.93k | } |
30907 | | |
30908 | | // _gather_52: keyword_pattern _loop0_51 |
30909 | | static asdl_seq * |
30910 | | _gather_52_rule(Parser *p) |
30911 | 10.4k | { |
30912 | 10.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30913 | 0 | _Pypegen_stack_overflow(p); |
30914 | 0 | } |
30915 | 10.4k | if (p->error_indicator) { |
30916 | 0 | p->level--; |
30917 | 0 | return NULL; |
30918 | 0 | } |
30919 | 10.4k | asdl_seq * _res = NULL; |
30920 | 10.4k | int _mark = p->mark; |
30921 | 10.4k | { // keyword_pattern _loop0_51 |
30922 | 10.4k | if (p->error_indicator) { |
30923 | 0 | p->level--; |
30924 | 0 | return NULL; |
30925 | 0 | } |
30926 | 10.4k | D(fprintf(stderr, "%*c> _gather_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_51")); |
30927 | 10.4k | KeyPatternPair* elem; |
30928 | 10.4k | asdl_seq * seq; |
30929 | 10.4k | if ( |
30930 | 10.4k | (elem = keyword_pattern_rule(p)) // keyword_pattern |
30931 | 3.93k | && |
30932 | 3.93k | (seq = _loop0_51_rule(p)) // _loop0_51 |
30933 | 10.4k | ) |
30934 | 3.93k | { |
30935 | 3.93k | D(fprintf(stderr, "%*c+ _gather_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_51")); |
30936 | 3.93k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
30937 | 3.93k | goto done; |
30938 | 3.93k | } |
30939 | 6.53k | p->mark = _mark; |
30940 | 6.53k | D(fprintf(stderr, "%*c%s _gather_52[%d-%d]: %s failed!\n", p->level, ' ', |
30941 | 6.53k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_51")); |
30942 | 6.53k | } |
30943 | 6.53k | _res = NULL; |
30944 | 10.4k | done: |
30945 | 10.4k | p->level--; |
30946 | 10.4k | return _res; |
30947 | 6.53k | } |
30948 | | |
30949 | | // _loop0_53: ',' type_param |
30950 | | static asdl_seq * |
30951 | | _loop0_53_rule(Parser *p) |
30952 | 1.19k | { |
30953 | 1.19k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
30954 | 0 | _Pypegen_stack_overflow(p); |
30955 | 0 | } |
30956 | 1.19k | if (p->error_indicator) { |
30957 | 0 | p->level--; |
30958 | 0 | return NULL; |
30959 | 0 | } |
30960 | 1.19k | void *_res = NULL; |
30961 | 1.19k | int _mark = p->mark; |
30962 | 1.19k | void **_children = PyMem_Malloc(sizeof(void *)); |
30963 | 1.19k | if (!_children) { |
30964 | 0 | p->error_indicator = 1; |
30965 | 0 | PyErr_NoMemory(); |
30966 | 0 | p->level--; |
30967 | 0 | return NULL; |
30968 | 0 | } |
30969 | 1.19k | Py_ssize_t _children_capacity = 1; |
30970 | 1.19k | Py_ssize_t _n = 0; |
30971 | 1.19k | { // ',' type_param |
30972 | 1.19k | if (p->error_indicator) { |
30973 | 0 | p->level--; |
30974 | 0 | return NULL; |
30975 | 0 | } |
30976 | 1.19k | D(fprintf(stderr, "%*c> _loop0_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' type_param")); |
30977 | 1.19k | Token * _literal; |
30978 | 1.19k | type_param_ty elem; |
30979 | 1.19k | while ( |
30980 | 11.2k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
30981 | 10.8k | && |
30982 | 10.8k | (elem = type_param_rule(p)) // type_param |
30983 | 1.19k | ) |
30984 | 10.0k | { |
30985 | 10.0k | _res = elem; |
30986 | 10.0k | if (_res == NULL && PyErr_Occurred()) { |
30987 | 0 | p->error_indicator = 1; |
30988 | 0 | PyMem_Free(_children); |
30989 | 0 | p->level--; |
30990 | 0 | return NULL; |
30991 | 0 | } |
30992 | 10.0k | if (_n == _children_capacity) { |
30993 | 933 | _children_capacity *= 2; |
30994 | 933 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
30995 | 933 | if (!_new_children) { |
30996 | 0 | PyMem_Free(_children); |
30997 | 0 | p->error_indicator = 1; |
30998 | 0 | PyErr_NoMemory(); |
30999 | 0 | p->level--; |
31000 | 0 | return NULL; |
31001 | 0 | } |
31002 | 933 | _children = _new_children; |
31003 | 933 | } |
31004 | 10.0k | _children[_n++] = _res; |
31005 | 10.0k | _mark = p->mark; |
31006 | 10.0k | } |
31007 | 1.19k | p->mark = _mark; |
31008 | 1.19k | D(fprintf(stderr, "%*c%s _loop0_53[%d-%d]: %s failed!\n", p->level, ' ', |
31009 | 1.19k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' type_param")); |
31010 | 1.19k | } |
31011 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31012 | 1.19k | if (!_seq) { |
31013 | 0 | PyMem_Free(_children); |
31014 | 0 | p->error_indicator = 1; |
31015 | 0 | PyErr_NoMemory(); |
31016 | 0 | p->level--; |
31017 | 0 | return NULL; |
31018 | 0 | } |
31019 | 11.2k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31020 | 1.19k | PyMem_Free(_children); |
31021 | 1.19k | p->level--; |
31022 | 1.19k | return _seq; |
31023 | 1.19k | } |
31024 | | |
31025 | | // _gather_54: type_param _loop0_53 |
31026 | | static asdl_seq * |
31027 | | _gather_54_rule(Parser *p) |
31028 | 1.23k | { |
31029 | 1.23k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31030 | 0 | _Pypegen_stack_overflow(p); |
31031 | 0 | } |
31032 | 1.23k | if (p->error_indicator) { |
31033 | 0 | p->level--; |
31034 | 0 | return NULL; |
31035 | 0 | } |
31036 | 1.23k | asdl_seq * _res = NULL; |
31037 | 1.23k | int _mark = p->mark; |
31038 | 1.23k | { // type_param _loop0_53 |
31039 | 1.23k | if (p->error_indicator) { |
31040 | 0 | p->level--; |
31041 | 0 | return NULL; |
31042 | 0 | } |
31043 | 1.23k | D(fprintf(stderr, "%*c> _gather_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "type_param _loop0_53")); |
31044 | 1.23k | type_param_ty elem; |
31045 | 1.23k | asdl_seq * seq; |
31046 | 1.23k | if ( |
31047 | 1.23k | (elem = type_param_rule(p)) // type_param |
31048 | 1.19k | && |
31049 | 1.19k | (seq = _loop0_53_rule(p)) // _loop0_53 |
31050 | 1.23k | ) |
31051 | 1.19k | { |
31052 | 1.19k | D(fprintf(stderr, "%*c+ _gather_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "type_param _loop0_53")); |
31053 | 1.19k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
31054 | 1.19k | goto done; |
31055 | 1.19k | } |
31056 | 41 | p->mark = _mark; |
31057 | 41 | D(fprintf(stderr, "%*c%s _gather_54[%d-%d]: %s failed!\n", p->level, ' ', |
31058 | 41 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "type_param _loop0_53")); |
31059 | 41 | } |
31060 | 41 | _res = NULL; |
31061 | 1.23k | done: |
31062 | 1.23k | p->level--; |
31063 | 1.23k | return _res; |
31064 | 41 | } |
31065 | | |
31066 | | // _loop1_55: (',' expression) |
31067 | | static asdl_seq * |
31068 | | _loop1_55_rule(Parser *p) |
31069 | 3.76k | { |
31070 | 3.76k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31071 | 0 | _Pypegen_stack_overflow(p); |
31072 | 0 | } |
31073 | 3.76k | if (p->error_indicator) { |
31074 | 0 | p->level--; |
31075 | 0 | return NULL; |
31076 | 0 | } |
31077 | 3.76k | void *_res = NULL; |
31078 | 3.76k | int _mark = p->mark; |
31079 | 3.76k | void **_children = PyMem_Malloc(sizeof(void *)); |
31080 | 3.76k | if (!_children) { |
31081 | 0 | p->error_indicator = 1; |
31082 | 0 | PyErr_NoMemory(); |
31083 | 0 | p->level--; |
31084 | 0 | return NULL; |
31085 | 0 | } |
31086 | 3.76k | Py_ssize_t _children_capacity = 1; |
31087 | 3.76k | Py_ssize_t _n = 0; |
31088 | 3.76k | { // (',' expression) |
31089 | 3.76k | if (p->error_indicator) { |
31090 | 0 | p->level--; |
31091 | 0 | return NULL; |
31092 | 0 | } |
31093 | 3.76k | D(fprintf(stderr, "%*c> _loop1_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); |
31094 | 3.76k | void *_tmp_16_var; |
31095 | 3.76k | while ( |
31096 | 5.35k | (_tmp_16_var = _tmp_16_rule(p)) // ',' expression |
31097 | 3.76k | ) |
31098 | 1.59k | { |
31099 | 1.59k | _res = _tmp_16_var; |
31100 | 1.59k | if (_n == _children_capacity) { |
31101 | 295 | _children_capacity *= 2; |
31102 | 295 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31103 | 295 | if (!_new_children) { |
31104 | 0 | PyMem_Free(_children); |
31105 | 0 | p->error_indicator = 1; |
31106 | 0 | PyErr_NoMemory(); |
31107 | 0 | p->level--; |
31108 | 0 | return NULL; |
31109 | 0 | } |
31110 | 295 | _children = _new_children; |
31111 | 295 | } |
31112 | 1.59k | _children[_n++] = _res; |
31113 | 1.59k | _mark = p->mark; |
31114 | 1.59k | } |
31115 | 3.76k | p->mark = _mark; |
31116 | 3.76k | D(fprintf(stderr, "%*c%s _loop1_55[%d-%d]: %s failed!\n", p->level, ' ', |
31117 | 3.76k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); |
31118 | 3.76k | } |
31119 | 3.76k | if (_n == 0 || p->error_indicator) { |
31120 | 2.82k | PyMem_Free(_children); |
31121 | 2.82k | p->level--; |
31122 | 2.82k | return NULL; |
31123 | 2.82k | } |
31124 | 934 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31125 | 934 | if (!_seq) { |
31126 | 0 | PyMem_Free(_children); |
31127 | 0 | p->error_indicator = 1; |
31128 | 0 | PyErr_NoMemory(); |
31129 | 0 | p->level--; |
31130 | 0 | return NULL; |
31131 | 0 | } |
31132 | 2.52k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31133 | 934 | PyMem_Free(_children); |
31134 | 934 | p->level--; |
31135 | 934 | return _seq; |
31136 | 934 | } |
31137 | | |
31138 | | // _loop1_56: (',' star_expression) |
31139 | | static asdl_seq * |
31140 | | _loop1_56_rule(Parser *p) |
31141 | 214k | { |
31142 | 214k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31143 | 0 | _Pypegen_stack_overflow(p); |
31144 | 0 | } |
31145 | 214k | if (p->error_indicator) { |
31146 | 0 | p->level--; |
31147 | 0 | return NULL; |
31148 | 0 | } |
31149 | 214k | void *_res = NULL; |
31150 | 214k | int _mark = p->mark; |
31151 | 214k | void **_children = PyMem_Malloc(sizeof(void *)); |
31152 | 214k | if (!_children) { |
31153 | 0 | p->error_indicator = 1; |
31154 | 0 | PyErr_NoMemory(); |
31155 | 0 | p->level--; |
31156 | 0 | return NULL; |
31157 | 0 | } |
31158 | 214k | Py_ssize_t _children_capacity = 1; |
31159 | 214k | Py_ssize_t _n = 0; |
31160 | 214k | { // (',' star_expression) |
31161 | 214k | if (p->error_indicator) { |
31162 | 0 | p->level--; |
31163 | 0 | return NULL; |
31164 | 0 | } |
31165 | 214k | D(fprintf(stderr, "%*c> _loop1_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); |
31166 | 214k | void *_tmp_160_var; |
31167 | 214k | while ( |
31168 | 230k | (_tmp_160_var = _tmp_160_rule(p)) // ',' star_expression |
31169 | 214k | ) |
31170 | 15.9k | { |
31171 | 15.9k | _res = _tmp_160_var; |
31172 | 15.9k | if (_n == _children_capacity) { |
31173 | 2.69k | _children_capacity *= 2; |
31174 | 2.69k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31175 | 2.69k | if (!_new_children) { |
31176 | 0 | PyMem_Free(_children); |
31177 | 0 | p->error_indicator = 1; |
31178 | 0 | PyErr_NoMemory(); |
31179 | 0 | p->level--; |
31180 | 0 | return NULL; |
31181 | 0 | } |
31182 | 2.69k | _children = _new_children; |
31183 | 2.69k | } |
31184 | 15.9k | _children[_n++] = _res; |
31185 | 15.9k | _mark = p->mark; |
31186 | 15.9k | } |
31187 | 214k | p->mark = _mark; |
31188 | 214k | D(fprintf(stderr, "%*c%s _loop1_56[%d-%d]: %s failed!\n", p->level, ' ', |
31189 | 214k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); |
31190 | 214k | } |
31191 | 214k | if (_n == 0 || p->error_indicator) { |
31192 | 209k | PyMem_Free(_children); |
31193 | 209k | p->level--; |
31194 | 209k | return NULL; |
31195 | 209k | } |
31196 | 5.32k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31197 | 5.32k | if (!_seq) { |
31198 | 0 | PyMem_Free(_children); |
31199 | 0 | p->error_indicator = 1; |
31200 | 0 | PyErr_NoMemory(); |
31201 | 0 | p->level--; |
31202 | 0 | return NULL; |
31203 | 0 | } |
31204 | 20.9k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31205 | 5.32k | PyMem_Free(_children); |
31206 | 5.32k | p->level--; |
31207 | 5.32k | return _seq; |
31208 | 5.32k | } |
31209 | | |
31210 | | // _loop0_57: ',' star_named_expression |
31211 | | static asdl_seq * |
31212 | | _loop0_57_rule(Parser *p) |
31213 | 40.8k | { |
31214 | 40.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31215 | 0 | _Pypegen_stack_overflow(p); |
31216 | 0 | } |
31217 | 40.8k | if (p->error_indicator) { |
31218 | 0 | p->level--; |
31219 | 0 | return NULL; |
31220 | 0 | } |
31221 | 40.8k | void *_res = NULL; |
31222 | 40.8k | int _mark = p->mark; |
31223 | 40.8k | void **_children = PyMem_Malloc(sizeof(void *)); |
31224 | 40.8k | if (!_children) { |
31225 | 0 | p->error_indicator = 1; |
31226 | 0 | PyErr_NoMemory(); |
31227 | 0 | p->level--; |
31228 | 0 | return NULL; |
31229 | 0 | } |
31230 | 40.8k | Py_ssize_t _children_capacity = 1; |
31231 | 40.8k | Py_ssize_t _n = 0; |
31232 | 40.8k | { // ',' star_named_expression |
31233 | 40.8k | if (p->error_indicator) { |
31234 | 0 | p->level--; |
31235 | 0 | return NULL; |
31236 | 0 | } |
31237 | 40.8k | D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); |
31238 | 40.8k | Token * _literal; |
31239 | 40.8k | expr_ty elem; |
31240 | 40.8k | while ( |
31241 | 107k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
31242 | 72.1k | && |
31243 | 72.1k | (elem = star_named_expression_rule(p)) // star_named_expression |
31244 | 40.8k | ) |
31245 | 67.0k | { |
31246 | 67.0k | _res = elem; |
31247 | 67.0k | if (_res == NULL && PyErr_Occurred()) { |
31248 | 0 | p->error_indicator = 1; |
31249 | 0 | PyMem_Free(_children); |
31250 | 0 | p->level--; |
31251 | 0 | return NULL; |
31252 | 0 | } |
31253 | 67.0k | if (_n == _children_capacity) { |
31254 | 9.93k | _children_capacity *= 2; |
31255 | 9.93k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31256 | 9.93k | if (!_new_children) { |
31257 | 0 | PyMem_Free(_children); |
31258 | 0 | p->error_indicator = 1; |
31259 | 0 | PyErr_NoMemory(); |
31260 | 0 | p->level--; |
31261 | 0 | return NULL; |
31262 | 0 | } |
31263 | 9.93k | _children = _new_children; |
31264 | 9.93k | } |
31265 | 67.0k | _children[_n++] = _res; |
31266 | 67.0k | _mark = p->mark; |
31267 | 67.0k | } |
31268 | 40.8k | p->mark = _mark; |
31269 | 40.8k | D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ', |
31270 | 40.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); |
31271 | 40.8k | } |
31272 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31273 | 40.8k | if (!_seq) { |
31274 | 0 | PyMem_Free(_children); |
31275 | 0 | p->error_indicator = 1; |
31276 | 0 | PyErr_NoMemory(); |
31277 | 0 | p->level--; |
31278 | 0 | return NULL; |
31279 | 0 | } |
31280 | 107k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31281 | 40.8k | PyMem_Free(_children); |
31282 | 40.8k | p->level--; |
31283 | 40.8k | return _seq; |
31284 | 40.8k | } |
31285 | | |
31286 | | // _gather_58: star_named_expression _loop0_57 |
31287 | | static asdl_seq * |
31288 | | _gather_58_rule(Parser *p) |
31289 | 85.2k | { |
31290 | 85.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31291 | 1 | _Pypegen_stack_overflow(p); |
31292 | 1 | } |
31293 | 85.2k | if (p->error_indicator) { |
31294 | 1 | p->level--; |
31295 | 1 | return NULL; |
31296 | 1 | } |
31297 | 85.2k | asdl_seq * _res = NULL; |
31298 | 85.2k | int _mark = p->mark; |
31299 | 85.2k | { // star_named_expression _loop0_57 |
31300 | 85.2k | if (p->error_indicator) { |
31301 | 0 | p->level--; |
31302 | 0 | return NULL; |
31303 | 0 | } |
31304 | 85.2k | D(fprintf(stderr, "%*c> _gather_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_57")); |
31305 | 85.2k | expr_ty elem; |
31306 | 85.2k | asdl_seq * seq; |
31307 | 85.2k | if ( |
31308 | 85.2k | (elem = star_named_expression_rule(p)) // star_named_expression |
31309 | 40.8k | && |
31310 | 40.8k | (seq = _loop0_57_rule(p)) // _loop0_57 |
31311 | 85.2k | ) |
31312 | 40.8k | { |
31313 | 40.8k | D(fprintf(stderr, "%*c+ _gather_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_57")); |
31314 | 40.8k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
31315 | 40.8k | goto done; |
31316 | 40.8k | } |
31317 | 44.4k | p->mark = _mark; |
31318 | 44.4k | D(fprintf(stderr, "%*c%s _gather_58[%d-%d]: %s failed!\n", p->level, ' ', |
31319 | 44.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_57")); |
31320 | 44.4k | } |
31321 | 44.4k | _res = NULL; |
31322 | 85.2k | done: |
31323 | 85.2k | p->level--; |
31324 | 85.2k | return _res; |
31325 | 44.4k | } |
31326 | | |
31327 | | // _loop1_59: ('or' conjunction) |
31328 | | static asdl_seq * |
31329 | | _loop1_59_rule(Parser *p) |
31330 | 398k | { |
31331 | 398k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31332 | 0 | _Pypegen_stack_overflow(p); |
31333 | 0 | } |
31334 | 398k | if (p->error_indicator) { |
31335 | 0 | p->level--; |
31336 | 0 | return NULL; |
31337 | 0 | } |
31338 | 398k | void *_res = NULL; |
31339 | 398k | int _mark = p->mark; |
31340 | 398k | void **_children = PyMem_Malloc(sizeof(void *)); |
31341 | 398k | if (!_children) { |
31342 | 0 | p->error_indicator = 1; |
31343 | 0 | PyErr_NoMemory(); |
31344 | 0 | p->level--; |
31345 | 0 | return NULL; |
31346 | 0 | } |
31347 | 398k | Py_ssize_t _children_capacity = 1; |
31348 | 398k | Py_ssize_t _n = 0; |
31349 | 398k | { // ('or' conjunction) |
31350 | 398k | if (p->error_indicator) { |
31351 | 0 | p->level--; |
31352 | 0 | return NULL; |
31353 | 0 | } |
31354 | 398k | D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); |
31355 | 398k | void *_tmp_161_var; |
31356 | 398k | while ( |
31357 | 403k | (_tmp_161_var = _tmp_161_rule(p)) // 'or' conjunction |
31358 | 398k | ) |
31359 | 5.24k | { |
31360 | 5.24k | _res = _tmp_161_var; |
31361 | 5.24k | if (_n == _children_capacity) { |
31362 | 665 | _children_capacity *= 2; |
31363 | 665 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31364 | 665 | if (!_new_children) { |
31365 | 0 | PyMem_Free(_children); |
31366 | 0 | p->error_indicator = 1; |
31367 | 0 | PyErr_NoMemory(); |
31368 | 0 | p->level--; |
31369 | 0 | return NULL; |
31370 | 0 | } |
31371 | 665 | _children = _new_children; |
31372 | 665 | } |
31373 | 5.24k | _children[_n++] = _res; |
31374 | 5.24k | _mark = p->mark; |
31375 | 5.24k | } |
31376 | 398k | p->mark = _mark; |
31377 | 398k | D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ', |
31378 | 398k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); |
31379 | 398k | } |
31380 | 398k | if (_n == 0 || p->error_indicator) { |
31381 | 396k | PyMem_Free(_children); |
31382 | 396k | p->level--; |
31383 | 396k | return NULL; |
31384 | 396k | } |
31385 | 1.74k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31386 | 1.74k | if (!_seq) { |
31387 | 0 | PyMem_Free(_children); |
31388 | 0 | p->error_indicator = 1; |
31389 | 0 | PyErr_NoMemory(); |
31390 | 0 | p->level--; |
31391 | 0 | return NULL; |
31392 | 0 | } |
31393 | 6.83k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31394 | 1.74k | PyMem_Free(_children); |
31395 | 1.74k | p->level--; |
31396 | 1.74k | return _seq; |
31397 | 1.74k | } |
31398 | | |
31399 | | // _loop1_60: ('and' inversion) |
31400 | | static asdl_seq * |
31401 | | _loop1_60_rule(Parser *p) |
31402 | 403k | { |
31403 | 403k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31404 | 0 | _Pypegen_stack_overflow(p); |
31405 | 0 | } |
31406 | 403k | if (p->error_indicator) { |
31407 | 0 | p->level--; |
31408 | 0 | return NULL; |
31409 | 0 | } |
31410 | 403k | void *_res = NULL; |
31411 | 403k | int _mark = p->mark; |
31412 | 403k | void **_children = PyMem_Malloc(sizeof(void *)); |
31413 | 403k | if (!_children) { |
31414 | 0 | p->error_indicator = 1; |
31415 | 0 | PyErr_NoMemory(); |
31416 | 0 | p->level--; |
31417 | 0 | return NULL; |
31418 | 0 | } |
31419 | 403k | Py_ssize_t _children_capacity = 1; |
31420 | 403k | Py_ssize_t _n = 0; |
31421 | 403k | { // ('and' inversion) |
31422 | 403k | if (p->error_indicator) { |
31423 | 0 | p->level--; |
31424 | 0 | return NULL; |
31425 | 0 | } |
31426 | 403k | D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); |
31427 | 403k | void *_tmp_162_var; |
31428 | 403k | while ( |
31429 | 407k | (_tmp_162_var = _tmp_162_rule(p)) // 'and' inversion |
31430 | 403k | ) |
31431 | 3.77k | { |
31432 | 3.77k | _res = _tmp_162_var; |
31433 | 3.77k | if (_n == _children_capacity) { |
31434 | 1.22k | _children_capacity *= 2; |
31435 | 1.22k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31436 | 1.22k | if (!_new_children) { |
31437 | 0 | PyMem_Free(_children); |
31438 | 0 | p->error_indicator = 1; |
31439 | 0 | PyErr_NoMemory(); |
31440 | 0 | p->level--; |
31441 | 0 | return NULL; |
31442 | 0 | } |
31443 | 1.22k | _children = _new_children; |
31444 | 1.22k | } |
31445 | 3.77k | _children[_n++] = _res; |
31446 | 3.77k | _mark = p->mark; |
31447 | 3.77k | } |
31448 | 403k | p->mark = _mark; |
31449 | 403k | D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ', |
31450 | 403k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); |
31451 | 403k | } |
31452 | 403k | if (_n == 0 || p->error_indicator) { |
31453 | 401k | PyMem_Free(_children); |
31454 | 401k | p->level--; |
31455 | 401k | return NULL; |
31456 | 401k | } |
31457 | 1.86k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31458 | 1.86k | if (!_seq) { |
31459 | 0 | PyMem_Free(_children); |
31460 | 0 | p->error_indicator = 1; |
31461 | 0 | PyErr_NoMemory(); |
31462 | 0 | p->level--; |
31463 | 0 | return NULL; |
31464 | 0 | } |
31465 | 5.44k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31466 | 1.86k | PyMem_Free(_children); |
31467 | 1.86k | p->level--; |
31468 | 1.86k | return _seq; |
31469 | 1.86k | } |
31470 | | |
31471 | | // _loop1_61: compare_op_bitwise_or_pair |
31472 | | static asdl_seq * |
31473 | | _loop1_61_rule(Parser *p) |
31474 | 409k | { |
31475 | 409k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31476 | 0 | _Pypegen_stack_overflow(p); |
31477 | 0 | } |
31478 | 409k | if (p->error_indicator) { |
31479 | 0 | p->level--; |
31480 | 0 | return NULL; |
31481 | 0 | } |
31482 | 409k | void *_res = NULL; |
31483 | 409k | int _mark = p->mark; |
31484 | 409k | void **_children = PyMem_Malloc(sizeof(void *)); |
31485 | 409k | if (!_children) { |
31486 | 0 | p->error_indicator = 1; |
31487 | 0 | PyErr_NoMemory(); |
31488 | 0 | p->level--; |
31489 | 0 | return NULL; |
31490 | 0 | } |
31491 | 409k | Py_ssize_t _children_capacity = 1; |
31492 | 409k | Py_ssize_t _n = 0; |
31493 | 409k | { // compare_op_bitwise_or_pair |
31494 | 409k | if (p->error_indicator) { |
31495 | 0 | p->level--; |
31496 | 0 | return NULL; |
31497 | 0 | } |
31498 | 409k | D(fprintf(stderr, "%*c> _loop1_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); |
31499 | 409k | CmpopExprPair* compare_op_bitwise_or_pair_var; |
31500 | 409k | while ( |
31501 | 429k | (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair |
31502 | 409k | ) |
31503 | 20.5k | { |
31504 | 20.5k | _res = compare_op_bitwise_or_pair_var; |
31505 | 20.5k | if (_n == _children_capacity) { |
31506 | 3.84k | _children_capacity *= 2; |
31507 | 3.84k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31508 | 3.84k | if (!_new_children) { |
31509 | 0 | PyMem_Free(_children); |
31510 | 0 | p->error_indicator = 1; |
31511 | 0 | PyErr_NoMemory(); |
31512 | 0 | p->level--; |
31513 | 0 | return NULL; |
31514 | 0 | } |
31515 | 3.84k | _children = _new_children; |
31516 | 3.84k | } |
31517 | 20.5k | _children[_n++] = _res; |
31518 | 20.5k | _mark = p->mark; |
31519 | 20.5k | } |
31520 | 409k | p->mark = _mark; |
31521 | 409k | D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ', |
31522 | 409k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); |
31523 | 409k | } |
31524 | 409k | if (_n == 0 || p->error_indicator) { |
31525 | 398k | PyMem_Free(_children); |
31526 | 398k | p->level--; |
31527 | 398k | return NULL; |
31528 | 398k | } |
31529 | 11.1k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31530 | 11.1k | if (!_seq) { |
31531 | 0 | PyMem_Free(_children); |
31532 | 0 | p->error_indicator = 1; |
31533 | 0 | PyErr_NoMemory(); |
31534 | 0 | p->level--; |
31535 | 0 | return NULL; |
31536 | 0 | } |
31537 | 31.1k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31538 | 11.1k | PyMem_Free(_children); |
31539 | 11.1k | p->level--; |
31540 | 11.1k | return _seq; |
31541 | 11.1k | } |
31542 | | |
31543 | | // _tmp_62: '!=' |
31544 | | static void * |
31545 | | _tmp_62_rule(Parser *p) |
31546 | 427k | { |
31547 | 427k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31548 | 0 | _Pypegen_stack_overflow(p); |
31549 | 0 | } |
31550 | 427k | if (p->error_indicator) { |
31551 | 0 | p->level--; |
31552 | 0 | return NULL; |
31553 | 0 | } |
31554 | 427k | void * _res = NULL; |
31555 | 427k | int _mark = p->mark; |
31556 | 427k | { // '!=' |
31557 | 427k | if (p->error_indicator) { |
31558 | 0 | p->level--; |
31559 | 0 | return NULL; |
31560 | 0 | } |
31561 | 427k | D(fprintf(stderr, "%*c> _tmp_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); |
31562 | 427k | Token * tok; |
31563 | 427k | if ( |
31564 | 427k | (tok = _PyPegen_expect_token(p, 28)) // token='!=' |
31565 | 427k | ) |
31566 | 1.38k | { |
31567 | 1.38k | D(fprintf(stderr, "%*c+ _tmp_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); |
31568 | 1.38k | _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok; |
31569 | 1.38k | if (_res == NULL && PyErr_Occurred()) { |
31570 | 1 | p->error_indicator = 1; |
31571 | 1 | p->level--; |
31572 | 1 | return NULL; |
31573 | 1 | } |
31574 | 1.38k | goto done; |
31575 | 1.38k | } |
31576 | 425k | p->mark = _mark; |
31577 | 425k | D(fprintf(stderr, "%*c%s _tmp_62[%d-%d]: %s failed!\n", p->level, ' ', |
31578 | 425k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); |
31579 | 425k | } |
31580 | 425k | _res = NULL; |
31581 | 427k | done: |
31582 | 427k | p->level--; |
31583 | 427k | return _res; |
31584 | 425k | } |
31585 | | |
31586 | | // _loop0_63: ',' (slice | starred_expression) |
31587 | | static asdl_seq * |
31588 | | _loop0_63_rule(Parser *p) |
31589 | 2.34k | { |
31590 | 2.34k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31591 | 0 | _Pypegen_stack_overflow(p); |
31592 | 0 | } |
31593 | 2.34k | if (p->error_indicator) { |
31594 | 0 | p->level--; |
31595 | 0 | return NULL; |
31596 | 0 | } |
31597 | 2.34k | void *_res = NULL; |
31598 | 2.34k | int _mark = p->mark; |
31599 | 2.34k | void **_children = PyMem_Malloc(sizeof(void *)); |
31600 | 2.34k | if (!_children) { |
31601 | 0 | p->error_indicator = 1; |
31602 | 0 | PyErr_NoMemory(); |
31603 | 0 | p->level--; |
31604 | 0 | return NULL; |
31605 | 0 | } |
31606 | 2.34k | Py_ssize_t _children_capacity = 1; |
31607 | 2.34k | Py_ssize_t _n = 0; |
31608 | 2.34k | { // ',' (slice | starred_expression) |
31609 | 2.34k | if (p->error_indicator) { |
31610 | 0 | p->level--; |
31611 | 0 | return NULL; |
31612 | 0 | } |
31613 | 2.34k | D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (slice | starred_expression)")); |
31614 | 2.34k | Token * _literal; |
31615 | 2.34k | void *elem; |
31616 | 2.34k | while ( |
31617 | 17.1k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
31618 | 15.7k | && |
31619 | 15.7k | (elem = _tmp_163_rule(p)) // slice | starred_expression |
31620 | 2.34k | ) |
31621 | 14.7k | { |
31622 | 14.7k | _res = elem; |
31623 | 14.7k | if (_res == NULL && PyErr_Occurred()) { |
31624 | 0 | p->error_indicator = 1; |
31625 | 0 | PyMem_Free(_children); |
31626 | 0 | p->level--; |
31627 | 0 | return NULL; |
31628 | 0 | } |
31629 | 14.7k | if (_n == _children_capacity) { |
31630 | 2.07k | _children_capacity *= 2; |
31631 | 2.07k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
31632 | 2.07k | if (!_new_children) { |
31633 | 0 | PyMem_Free(_children); |
31634 | 0 | p->error_indicator = 1; |
31635 | 0 | PyErr_NoMemory(); |
31636 | 0 | p->level--; |
31637 | 0 | return NULL; |
31638 | 0 | } |
31639 | 2.07k | _children = _new_children; |
31640 | 2.07k | } |
31641 | 14.7k | _children[_n++] = _res; |
31642 | 14.7k | _mark = p->mark; |
31643 | 14.7k | } |
31644 | 2.34k | p->mark = _mark; |
31645 | 2.34k | D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', |
31646 | 2.34k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (slice | starred_expression)")); |
31647 | 2.34k | } |
31648 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
31649 | 2.34k | if (!_seq) { |
31650 | 0 | PyMem_Free(_children); |
31651 | 0 | p->error_indicator = 1; |
31652 | 0 | PyErr_NoMemory(); |
31653 | 0 | p->level--; |
31654 | 0 | return NULL; |
31655 | 0 | } |
31656 | 17.1k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
31657 | 2.34k | PyMem_Free(_children); |
31658 | 2.34k | p->level--; |
31659 | 2.34k | return _seq; |
31660 | 2.34k | } |
31661 | | |
31662 | | // _gather_64: (slice | starred_expression) _loop0_63 |
31663 | | static asdl_seq * |
31664 | | _gather_64_rule(Parser *p) |
31665 | 4.24k | { |
31666 | 4.24k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31667 | 0 | _Pypegen_stack_overflow(p); |
31668 | 0 | } |
31669 | 4.24k | if (p->error_indicator) { |
31670 | 0 | p->level--; |
31671 | 0 | return NULL; |
31672 | 0 | } |
31673 | 4.24k | asdl_seq * _res = NULL; |
31674 | 4.24k | int _mark = p->mark; |
31675 | 4.24k | { // (slice | starred_expression) _loop0_63 |
31676 | 4.24k | if (p->error_indicator) { |
31677 | 0 | p->level--; |
31678 | 0 | return NULL; |
31679 | 0 | } |
31680 | 4.24k | D(fprintf(stderr, "%*c> _gather_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(slice | starred_expression) _loop0_63")); |
31681 | 4.24k | void *elem; |
31682 | 4.24k | asdl_seq * seq; |
31683 | 4.24k | if ( |
31684 | 4.24k | (elem = _tmp_163_rule(p)) // slice | starred_expression |
31685 | 2.34k | && |
31686 | 2.34k | (seq = _loop0_63_rule(p)) // _loop0_63 |
31687 | 4.24k | ) |
31688 | 2.34k | { |
31689 | 2.34k | D(fprintf(stderr, "%*c+ _gather_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(slice | starred_expression) _loop0_63")); |
31690 | 2.34k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
31691 | 2.34k | goto done; |
31692 | 2.34k | } |
31693 | 1.90k | p->mark = _mark; |
31694 | 1.90k | D(fprintf(stderr, "%*c%s _gather_64[%d-%d]: %s failed!\n", p->level, ' ', |
31695 | 1.90k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(slice | starred_expression) _loop0_63")); |
31696 | 1.90k | } |
31697 | 1.90k | _res = NULL; |
31698 | 4.24k | done: |
31699 | 4.24k | p->level--; |
31700 | 4.24k | return _res; |
31701 | 1.90k | } |
31702 | | |
31703 | | // _tmp_65: ':' expression? |
31704 | | static void * |
31705 | | _tmp_65_rule(Parser *p) |
31706 | 13.7k | { |
31707 | 13.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31708 | 0 | _Pypegen_stack_overflow(p); |
31709 | 0 | } |
31710 | 13.7k | if (p->error_indicator) { |
31711 | 0 | p->level--; |
31712 | 0 | return NULL; |
31713 | 0 | } |
31714 | 13.7k | void * _res = NULL; |
31715 | 13.7k | int _mark = p->mark; |
31716 | 13.7k | { // ':' expression? |
31717 | 13.7k | if (p->error_indicator) { |
31718 | 0 | p->level--; |
31719 | 0 | return NULL; |
31720 | 0 | } |
31721 | 13.7k | D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); |
31722 | 13.7k | Token * _literal; |
31723 | 13.7k | void *d; |
31724 | 13.7k | if ( |
31725 | 13.7k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
31726 | 5.21k | && |
31727 | 5.21k | (d = expression_rule(p), !p->error_indicator) // expression? |
31728 | 13.7k | ) |
31729 | 5.01k | { |
31730 | 5.01k | D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); |
31731 | 5.01k | _res = d; |
31732 | 5.01k | if (_res == NULL && PyErr_Occurred()) { |
31733 | 0 | p->error_indicator = 1; |
31734 | 0 | p->level--; |
31735 | 0 | return NULL; |
31736 | 0 | } |
31737 | 5.01k | goto done; |
31738 | 5.01k | } |
31739 | 8.69k | p->mark = _mark; |
31740 | 8.69k | D(fprintf(stderr, "%*c%s _tmp_65[%d-%d]: %s failed!\n", p->level, ' ', |
31741 | 8.69k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); |
31742 | 8.69k | } |
31743 | 8.69k | _res = NULL; |
31744 | 13.7k | done: |
31745 | 13.7k | p->level--; |
31746 | 13.7k | return _res; |
31747 | 8.69k | } |
31748 | | |
31749 | | // _tmp_66: tuple | group | genexp |
31750 | | static void * |
31751 | | _tmp_66_rule(Parser *p) |
31752 | 76.0k | { |
31753 | 76.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31754 | 0 | _Pypegen_stack_overflow(p); |
31755 | 0 | } |
31756 | 76.0k | if (p->error_indicator) { |
31757 | 0 | p->level--; |
31758 | 0 | return NULL; |
31759 | 0 | } |
31760 | 76.0k | void * _res = NULL; |
31761 | 76.0k | int _mark = p->mark; |
31762 | 76.0k | { // tuple |
31763 | 76.0k | if (p->error_indicator) { |
31764 | 0 | p->level--; |
31765 | 0 | return NULL; |
31766 | 0 | } |
31767 | 76.0k | D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); |
31768 | 76.0k | expr_ty tuple_var; |
31769 | 76.0k | if ( |
31770 | 76.0k | (tuple_var = tuple_rule(p)) // tuple |
31771 | 76.0k | ) |
31772 | 38.8k | { |
31773 | 38.8k | D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); |
31774 | 38.8k | _res = tuple_var; |
31775 | 38.8k | goto done; |
31776 | 38.8k | } |
31777 | 37.1k | p->mark = _mark; |
31778 | 37.1k | D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', |
31779 | 37.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); |
31780 | 37.1k | } |
31781 | 0 | { // group |
31782 | 37.1k | if (p->error_indicator) { |
31783 | 5.30k | p->level--; |
31784 | 5.30k | return NULL; |
31785 | 5.30k | } |
31786 | 31.8k | D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); |
31787 | 31.8k | expr_ty group_var; |
31788 | 31.8k | if ( |
31789 | 31.8k | (group_var = group_rule(p)) // group |
31790 | 31.8k | ) |
31791 | 10.2k | { |
31792 | 10.2k | D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group")); |
31793 | 10.2k | _res = group_var; |
31794 | 10.2k | goto done; |
31795 | 10.2k | } |
31796 | 21.6k | p->mark = _mark; |
31797 | 21.6k | D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', |
31798 | 21.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); |
31799 | 21.6k | } |
31800 | 0 | { // genexp |
31801 | 21.6k | if (p->error_indicator) { |
31802 | 872 | p->level--; |
31803 | 872 | return NULL; |
31804 | 872 | } |
31805 | 20.7k | D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); |
31806 | 20.7k | expr_ty genexp_var; |
31807 | 20.7k | if ( |
31808 | 20.7k | (genexp_var = genexp_rule(p)) // genexp |
31809 | 20.7k | ) |
31810 | 3.01k | { |
31811 | 3.01k | D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); |
31812 | 3.01k | _res = genexp_var; |
31813 | 3.01k | goto done; |
31814 | 3.01k | } |
31815 | 17.7k | p->mark = _mark; |
31816 | 17.7k | D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', |
31817 | 17.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); |
31818 | 17.7k | } |
31819 | 17.7k | _res = NULL; |
31820 | 69.8k | done: |
31821 | 69.8k | p->level--; |
31822 | 69.8k | return _res; |
31823 | 17.7k | } |
31824 | | |
31825 | | // _tmp_67: list | listcomp |
31826 | | static void * |
31827 | | _tmp_67_rule(Parser *p) |
31828 | 47.4k | { |
31829 | 47.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31830 | 0 | _Pypegen_stack_overflow(p); |
31831 | 0 | } |
31832 | 47.4k | if (p->error_indicator) { |
31833 | 0 | p->level--; |
31834 | 0 | return NULL; |
31835 | 0 | } |
31836 | 47.4k | void * _res = NULL; |
31837 | 47.4k | int _mark = p->mark; |
31838 | 47.4k | { // list |
31839 | 47.4k | if (p->error_indicator) { |
31840 | 0 | p->level--; |
31841 | 0 | return NULL; |
31842 | 0 | } |
31843 | 47.4k | D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); |
31844 | 47.4k | expr_ty list_var; |
31845 | 47.4k | if ( |
31846 | 47.4k | (list_var = list_rule(p)) // list |
31847 | 47.4k | ) |
31848 | 15.3k | { |
31849 | 15.3k | D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); |
31850 | 15.3k | _res = list_var; |
31851 | 15.3k | goto done; |
31852 | 15.3k | } |
31853 | 32.1k | p->mark = _mark; |
31854 | 32.1k | D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', |
31855 | 32.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); |
31856 | 32.1k | } |
31857 | 0 | { // listcomp |
31858 | 32.1k | if (p->error_indicator) { |
31859 | 11.7k | p->level--; |
31860 | 11.7k | return NULL; |
31861 | 11.7k | } |
31862 | 20.3k | D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); |
31863 | 20.3k | expr_ty listcomp_var; |
31864 | 20.3k | if ( |
31865 | 20.3k | (listcomp_var = listcomp_rule(p)) // listcomp |
31866 | 20.3k | ) |
31867 | 1.53k | { |
31868 | 1.53k | D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp")); |
31869 | 1.53k | _res = listcomp_var; |
31870 | 1.53k | goto done; |
31871 | 1.53k | } |
31872 | 18.8k | p->mark = _mark; |
31873 | 18.8k | D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', |
31874 | 18.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); |
31875 | 18.8k | } |
31876 | 18.8k | _res = NULL; |
31877 | 35.7k | done: |
31878 | 35.7k | p->level--; |
31879 | 35.7k | return _res; |
31880 | 18.8k | } |
31881 | | |
31882 | | // _tmp_68: dict | set | dictcomp | setcomp |
31883 | | static void * |
31884 | | _tmp_68_rule(Parser *p) |
31885 | 21.8k | { |
31886 | 21.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31887 | 0 | _Pypegen_stack_overflow(p); |
31888 | 0 | } |
31889 | 21.8k | if (p->error_indicator) { |
31890 | 0 | p->level--; |
31891 | 0 | return NULL; |
31892 | 0 | } |
31893 | 21.8k | void * _res = NULL; |
31894 | 21.8k | int _mark = p->mark; |
31895 | 21.8k | { // dict |
31896 | 21.8k | if (p->error_indicator) { |
31897 | 0 | p->level--; |
31898 | 0 | return NULL; |
31899 | 0 | } |
31900 | 21.8k | D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); |
31901 | 21.8k | expr_ty dict_var; |
31902 | 21.8k | if ( |
31903 | 21.8k | (dict_var = dict_rule(p)) // dict |
31904 | 21.8k | ) |
31905 | 4.33k | { |
31906 | 4.33k | D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict")); |
31907 | 4.33k | _res = dict_var; |
31908 | 4.33k | goto done; |
31909 | 4.33k | } |
31910 | 17.5k | p->mark = _mark; |
31911 | 17.5k | D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', |
31912 | 17.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); |
31913 | 17.5k | } |
31914 | 0 | { // set |
31915 | 17.5k | if (p->error_indicator) { |
31916 | 6.29k | p->level--; |
31917 | 6.29k | return NULL; |
31918 | 6.29k | } |
31919 | 11.2k | D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); |
31920 | 11.2k | expr_ty set_var; |
31921 | 11.2k | if ( |
31922 | 11.2k | (set_var = set_rule(p)) // set |
31923 | 11.2k | ) |
31924 | 1.48k | { |
31925 | 1.48k | D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); |
31926 | 1.48k | _res = set_var; |
31927 | 1.48k | goto done; |
31928 | 1.48k | } |
31929 | 9.78k | p->mark = _mark; |
31930 | 9.78k | D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', |
31931 | 9.78k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); |
31932 | 9.78k | } |
31933 | 0 | { // dictcomp |
31934 | 9.78k | if (p->error_indicator) { |
31935 | 274 | p->level--; |
31936 | 274 | return NULL; |
31937 | 274 | } |
31938 | 9.50k | D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); |
31939 | 9.50k | expr_ty dictcomp_var; |
31940 | 9.50k | if ( |
31941 | 9.50k | (dictcomp_var = dictcomp_rule(p)) // dictcomp |
31942 | 9.50k | ) |
31943 | 1.44k | { |
31944 | 1.44k | D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp")); |
31945 | 1.44k | _res = dictcomp_var; |
31946 | 1.44k | goto done; |
31947 | 1.44k | } |
31948 | 8.06k | p->mark = _mark; |
31949 | 8.06k | D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', |
31950 | 8.06k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); |
31951 | 8.06k | } |
31952 | 0 | { // setcomp |
31953 | 8.06k | if (p->error_indicator) { |
31954 | 199 | p->level--; |
31955 | 199 | return NULL; |
31956 | 199 | } |
31957 | 7.86k | D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); |
31958 | 7.86k | expr_ty setcomp_var; |
31959 | 7.86k | if ( |
31960 | 7.86k | (setcomp_var = setcomp_rule(p)) // setcomp |
31961 | 7.86k | ) |
31962 | 560 | { |
31963 | 560 | D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp")); |
31964 | 560 | _res = setcomp_var; |
31965 | 560 | goto done; |
31966 | 560 | } |
31967 | 7.30k | p->mark = _mark; |
31968 | 7.30k | D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', |
31969 | 7.30k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); |
31970 | 7.30k | } |
31971 | 7.30k | _res = NULL; |
31972 | 15.1k | done: |
31973 | 15.1k | p->level--; |
31974 | 15.1k | return _res; |
31975 | 7.30k | } |
31976 | | |
31977 | | // _tmp_69: yield_expr | named_expression |
31978 | | static void * |
31979 | | _tmp_69_rule(Parser *p) |
31980 | 31.8k | { |
31981 | 31.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
31982 | 0 | _Pypegen_stack_overflow(p); |
31983 | 0 | } |
31984 | 31.8k | if (p->error_indicator) { |
31985 | 0 | p->level--; |
31986 | 0 | return NULL; |
31987 | 0 | } |
31988 | 31.8k | void * _res = NULL; |
31989 | 31.8k | int _mark = p->mark; |
31990 | 31.8k | { // yield_expr |
31991 | 31.8k | if (p->error_indicator) { |
31992 | 0 | p->level--; |
31993 | 0 | return NULL; |
31994 | 0 | } |
31995 | 31.8k | D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
31996 | 31.8k | expr_ty yield_expr_var; |
31997 | 31.8k | if ( |
31998 | 31.8k | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
31999 | 31.8k | ) |
32000 | 601 | { |
32001 | 601 | D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
32002 | 601 | _res = yield_expr_var; |
32003 | 601 | goto done; |
32004 | 601 | } |
32005 | 31.2k | p->mark = _mark; |
32006 | 31.2k | D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', |
32007 | 31.2k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
32008 | 31.2k | } |
32009 | 0 | { // named_expression |
32010 | 31.2k | if (p->error_indicator) { |
32011 | 306 | p->level--; |
32012 | 306 | return NULL; |
32013 | 306 | } |
32014 | 30.9k | D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); |
32015 | 30.9k | expr_ty named_expression_var; |
32016 | 30.9k | if ( |
32017 | 30.9k | (named_expression_var = named_expression_rule(p)) // named_expression |
32018 | 30.9k | ) |
32019 | 22.7k | { |
32020 | 22.7k | D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression")); |
32021 | 22.7k | _res = named_expression_var; |
32022 | 22.7k | goto done; |
32023 | 22.7k | } |
32024 | 8.21k | p->mark = _mark; |
32025 | 8.21k | D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', |
32026 | 8.21k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
32027 | 8.21k | } |
32028 | 8.21k | _res = NULL; |
32029 | 31.5k | done: |
32030 | 31.5k | p->level--; |
32031 | 31.5k | return _res; |
32032 | 8.21k | } |
32033 | | |
32034 | | // _loop0_70: lambda_param_no_default |
32035 | | static asdl_seq * |
32036 | | _loop0_70_rule(Parser *p) |
32037 | 71.6k | { |
32038 | 71.6k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32039 | 0 | _Pypegen_stack_overflow(p); |
32040 | 0 | } |
32041 | 71.6k | if (p->error_indicator) { |
32042 | 0 | p->level--; |
32043 | 0 | return NULL; |
32044 | 0 | } |
32045 | 71.6k | void *_res = NULL; |
32046 | 71.6k | int _mark = p->mark; |
32047 | 71.6k | void **_children = PyMem_Malloc(sizeof(void *)); |
32048 | 71.6k | if (!_children) { |
32049 | 0 | p->error_indicator = 1; |
32050 | 0 | PyErr_NoMemory(); |
32051 | 0 | p->level--; |
32052 | 0 | return NULL; |
32053 | 0 | } |
32054 | 71.6k | Py_ssize_t _children_capacity = 1; |
32055 | 71.6k | Py_ssize_t _n = 0; |
32056 | 71.6k | { // lambda_param_no_default |
32057 | 71.6k | if (p->error_indicator) { |
32058 | 0 | p->level--; |
32059 | 0 | return NULL; |
32060 | 0 | } |
32061 | 71.6k | D(fprintf(stderr, "%*c> _loop0_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
32062 | 71.6k | arg_ty lambda_param_no_default_var; |
32063 | 71.6k | while ( |
32064 | 120k | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
32065 | 71.6k | ) |
32066 | 48.3k | { |
32067 | 48.3k | _res = lambda_param_no_default_var; |
32068 | 48.3k | if (_n == _children_capacity) { |
32069 | 2.80k | _children_capacity *= 2; |
32070 | 2.80k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32071 | 2.80k | if (!_new_children) { |
32072 | 0 | PyMem_Free(_children); |
32073 | 0 | p->error_indicator = 1; |
32074 | 0 | PyErr_NoMemory(); |
32075 | 0 | p->level--; |
32076 | 0 | return NULL; |
32077 | 0 | } |
32078 | 2.80k | _children = _new_children; |
32079 | 2.80k | } |
32080 | 48.3k | _children[_n++] = _res; |
32081 | 48.3k | _mark = p->mark; |
32082 | 48.3k | } |
32083 | 71.6k | p->mark = _mark; |
32084 | 71.6k | D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n", p->level, ' ', |
32085 | 71.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
32086 | 71.6k | } |
32087 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32088 | 71.6k | if (!_seq) { |
32089 | 0 | PyMem_Free(_children); |
32090 | 0 | p->error_indicator = 1; |
32091 | 0 | PyErr_NoMemory(); |
32092 | 0 | p->level--; |
32093 | 0 | return NULL; |
32094 | 0 | } |
32095 | 120k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32096 | 71.6k | PyMem_Free(_children); |
32097 | 71.6k | p->level--; |
32098 | 71.6k | return _seq; |
32099 | 71.6k | } |
32100 | | |
32101 | | // _loop0_71: lambda_param_with_default |
32102 | | static asdl_seq * |
32103 | | _loop0_71_rule(Parser *p) |
32104 | 3.24k | { |
32105 | 3.24k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32106 | 0 | _Pypegen_stack_overflow(p); |
32107 | 0 | } |
32108 | 3.24k | if (p->error_indicator) { |
32109 | 3 | p->level--; |
32110 | 3 | return NULL; |
32111 | 3 | } |
32112 | 3.24k | void *_res = NULL; |
32113 | 3.24k | int _mark = p->mark; |
32114 | 3.24k | void **_children = PyMem_Malloc(sizeof(void *)); |
32115 | 3.24k | if (!_children) { |
32116 | 0 | p->error_indicator = 1; |
32117 | 0 | PyErr_NoMemory(); |
32118 | 0 | p->level--; |
32119 | 0 | return NULL; |
32120 | 0 | } |
32121 | 3.24k | Py_ssize_t _children_capacity = 1; |
32122 | 3.24k | Py_ssize_t _n = 0; |
32123 | 3.24k | { // lambda_param_with_default |
32124 | 3.24k | if (p->error_indicator) { |
32125 | 0 | p->level--; |
32126 | 0 | return NULL; |
32127 | 0 | } |
32128 | 3.24k | D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
32129 | 3.24k | NameDefaultPair* lambda_param_with_default_var; |
32130 | 3.24k | while ( |
32131 | 5.02k | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
32132 | 3.24k | ) |
32133 | 1.78k | { |
32134 | 1.78k | _res = lambda_param_with_default_var; |
32135 | 1.78k | if (_n == _children_capacity) { |
32136 | 545 | _children_capacity *= 2; |
32137 | 545 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32138 | 545 | if (!_new_children) { |
32139 | 0 | PyMem_Free(_children); |
32140 | 0 | p->error_indicator = 1; |
32141 | 0 | PyErr_NoMemory(); |
32142 | 0 | p->level--; |
32143 | 0 | return NULL; |
32144 | 0 | } |
32145 | 545 | _children = _new_children; |
32146 | 545 | } |
32147 | 1.78k | _children[_n++] = _res; |
32148 | 1.78k | _mark = p->mark; |
32149 | 1.78k | } |
32150 | 3.24k | p->mark = _mark; |
32151 | 3.24k | D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', |
32152 | 3.24k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
32153 | 3.24k | } |
32154 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32155 | 3.24k | if (!_seq) { |
32156 | 0 | PyMem_Free(_children); |
32157 | 0 | p->error_indicator = 1; |
32158 | 0 | PyErr_NoMemory(); |
32159 | 0 | p->level--; |
32160 | 0 | return NULL; |
32161 | 0 | } |
32162 | 5.02k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32163 | 3.24k | PyMem_Free(_children); |
32164 | 3.24k | p->level--; |
32165 | 3.24k | return _seq; |
32166 | 3.24k | } |
32167 | | |
32168 | | // _loop1_72: lambda_param_no_default |
32169 | | static asdl_seq * |
32170 | | _loop1_72_rule(Parser *p) |
32171 | 71.5k | { |
32172 | 71.5k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32173 | 0 | _Pypegen_stack_overflow(p); |
32174 | 0 | } |
32175 | 71.5k | if (p->error_indicator) { |
32176 | 0 | p->level--; |
32177 | 0 | return NULL; |
32178 | 0 | } |
32179 | 71.5k | void *_res = NULL; |
32180 | 71.5k | int _mark = p->mark; |
32181 | 71.5k | void **_children = PyMem_Malloc(sizeof(void *)); |
32182 | 71.5k | if (!_children) { |
32183 | 0 | p->error_indicator = 1; |
32184 | 0 | PyErr_NoMemory(); |
32185 | 0 | p->level--; |
32186 | 0 | return NULL; |
32187 | 0 | } |
32188 | 71.5k | Py_ssize_t _children_capacity = 1; |
32189 | 71.5k | Py_ssize_t _n = 0; |
32190 | 71.5k | { // lambda_param_no_default |
32191 | 71.5k | if (p->error_indicator) { |
32192 | 0 | p->level--; |
32193 | 0 | return NULL; |
32194 | 0 | } |
32195 | 71.5k | D(fprintf(stderr, "%*c> _loop1_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
32196 | 71.5k | arg_ty lambda_param_no_default_var; |
32197 | 71.5k | while ( |
32198 | 135k | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
32199 | 71.5k | ) |
32200 | 64.0k | { |
32201 | 64.0k | _res = lambda_param_no_default_var; |
32202 | 64.0k | if (_n == _children_capacity) { |
32203 | 5.14k | _children_capacity *= 2; |
32204 | 5.14k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32205 | 5.14k | if (!_new_children) { |
32206 | 0 | PyMem_Free(_children); |
32207 | 0 | p->error_indicator = 1; |
32208 | 0 | PyErr_NoMemory(); |
32209 | 0 | p->level--; |
32210 | 0 | return NULL; |
32211 | 0 | } |
32212 | 5.14k | _children = _new_children; |
32213 | 5.14k | } |
32214 | 64.0k | _children[_n++] = _res; |
32215 | 64.0k | _mark = p->mark; |
32216 | 64.0k | } |
32217 | 71.5k | p->mark = _mark; |
32218 | 71.5k | D(fprintf(stderr, "%*c%s _loop1_72[%d-%d]: %s failed!\n", p->level, ' ', |
32219 | 71.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
32220 | 71.5k | } |
32221 | 71.5k | if (_n == 0 || p->error_indicator) { |
32222 | 59.6k | PyMem_Free(_children); |
32223 | 59.6k | p->level--; |
32224 | 59.6k | return NULL; |
32225 | 59.6k | } |
32226 | 11.9k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32227 | 11.9k | if (!_seq) { |
32228 | 0 | PyMem_Free(_children); |
32229 | 0 | p->error_indicator = 1; |
32230 | 0 | PyErr_NoMemory(); |
32231 | 0 | p->level--; |
32232 | 0 | return NULL; |
32233 | 0 | } |
32234 | 76.0k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32235 | 11.9k | PyMem_Free(_children); |
32236 | 11.9k | p->level--; |
32237 | 11.9k | return _seq; |
32238 | 11.9k | } |
32239 | | |
32240 | | // _loop1_73: lambda_param_with_default |
32241 | | static asdl_seq * |
32242 | | _loop1_73_rule(Parser *p) |
32243 | 71.3k | { |
32244 | 71.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32245 | 0 | _Pypegen_stack_overflow(p); |
32246 | 0 | } |
32247 | 71.3k | if (p->error_indicator) { |
32248 | 0 | p->level--; |
32249 | 0 | return NULL; |
32250 | 0 | } |
32251 | 71.3k | void *_res = NULL; |
32252 | 71.3k | int _mark = p->mark; |
32253 | 71.3k | void **_children = PyMem_Malloc(sizeof(void *)); |
32254 | 71.3k | if (!_children) { |
32255 | 0 | p->error_indicator = 1; |
32256 | 0 | PyErr_NoMemory(); |
32257 | 0 | p->level--; |
32258 | 0 | return NULL; |
32259 | 0 | } |
32260 | 71.3k | Py_ssize_t _children_capacity = 1; |
32261 | 71.3k | Py_ssize_t _n = 0; |
32262 | 71.3k | { // lambda_param_with_default |
32263 | 71.3k | if (p->error_indicator) { |
32264 | 0 | p->level--; |
32265 | 0 | return NULL; |
32266 | 0 | } |
32267 | 71.3k | D(fprintf(stderr, "%*c> _loop1_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); |
32268 | 71.3k | NameDefaultPair* lambda_param_with_default_var; |
32269 | 71.3k | while ( |
32270 | 89.9k | (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default |
32271 | 71.3k | ) |
32272 | 18.6k | { |
32273 | 18.6k | _res = lambda_param_with_default_var; |
32274 | 18.6k | if (_n == _children_capacity) { |
32275 | 3.27k | _children_capacity *= 2; |
32276 | 3.27k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32277 | 3.27k | if (!_new_children) { |
32278 | 0 | PyMem_Free(_children); |
32279 | 0 | p->error_indicator = 1; |
32280 | 0 | PyErr_NoMemory(); |
32281 | 0 | p->level--; |
32282 | 0 | return NULL; |
32283 | 0 | } |
32284 | 3.27k | _children = _new_children; |
32285 | 3.27k | } |
32286 | 18.6k | _children[_n++] = _res; |
32287 | 18.6k | _mark = p->mark; |
32288 | 18.6k | } |
32289 | 71.3k | p->mark = _mark; |
32290 | 71.3k | D(fprintf(stderr, "%*c%s _loop1_73[%d-%d]: %s failed!\n", p->level, ' ', |
32291 | 71.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
32292 | 71.3k | } |
32293 | 71.3k | if (_n == 0 || p->error_indicator) { |
32294 | 58.6k | PyMem_Free(_children); |
32295 | 58.6k | p->level--; |
32296 | 58.6k | return NULL; |
32297 | 58.6k | } |
32298 | 12.6k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32299 | 12.6k | if (!_seq) { |
32300 | 0 | PyMem_Free(_children); |
32301 | 0 | p->error_indicator = 1; |
32302 | 0 | PyErr_NoMemory(); |
32303 | 0 | p->level--; |
32304 | 0 | return NULL; |
32305 | 0 | } |
32306 | 31.0k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32307 | 12.6k | PyMem_Free(_children); |
32308 | 12.6k | p->level--; |
32309 | 12.6k | return _seq; |
32310 | 12.6k | } |
32311 | | |
32312 | | // _loop0_74: lambda_param_maybe_default |
32313 | | static asdl_seq * |
32314 | | _loop0_74_rule(Parser *p) |
32315 | 14.9k | { |
32316 | 14.9k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32317 | 0 | _Pypegen_stack_overflow(p); |
32318 | 0 | } |
32319 | 14.9k | if (p->error_indicator) { |
32320 | 0 | p->level--; |
32321 | 0 | return NULL; |
32322 | 0 | } |
32323 | 14.9k | void *_res = NULL; |
32324 | 14.9k | int _mark = p->mark; |
32325 | 14.9k | void **_children = PyMem_Malloc(sizeof(void *)); |
32326 | 14.9k | if (!_children) { |
32327 | 0 | p->error_indicator = 1; |
32328 | 0 | PyErr_NoMemory(); |
32329 | 0 | p->level--; |
32330 | 0 | return NULL; |
32331 | 0 | } |
32332 | 14.9k | Py_ssize_t _children_capacity = 1; |
32333 | 14.9k | Py_ssize_t _n = 0; |
32334 | 14.9k | { // lambda_param_maybe_default |
32335 | 14.9k | if (p->error_indicator) { |
32336 | 0 | p->level--; |
32337 | 0 | return NULL; |
32338 | 0 | } |
32339 | 14.9k | D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); |
32340 | 14.9k | NameDefaultPair* lambda_param_maybe_default_var; |
32341 | 14.9k | while ( |
32342 | 24.2k | (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default |
32343 | 14.9k | ) |
32344 | 9.31k | { |
32345 | 9.31k | _res = lambda_param_maybe_default_var; |
32346 | 9.31k | if (_n == _children_capacity) { |
32347 | 1.35k | _children_capacity *= 2; |
32348 | 1.35k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32349 | 1.35k | if (!_new_children) { |
32350 | 0 | PyMem_Free(_children); |
32351 | 0 | p->error_indicator = 1; |
32352 | 0 | PyErr_NoMemory(); |
32353 | 0 | p->level--; |
32354 | 0 | return NULL; |
32355 | 0 | } |
32356 | 1.35k | _children = _new_children; |
32357 | 1.35k | } |
32358 | 9.31k | _children[_n++] = _res; |
32359 | 9.31k | _mark = p->mark; |
32360 | 9.31k | } |
32361 | 14.9k | p->mark = _mark; |
32362 | 14.9k | D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ', |
32363 | 14.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); |
32364 | 14.9k | } |
32365 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32366 | 14.9k | if (!_seq) { |
32367 | 0 | PyMem_Free(_children); |
32368 | 0 | p->error_indicator = 1; |
32369 | 0 | PyErr_NoMemory(); |
32370 | 0 | p->level--; |
32371 | 0 | return NULL; |
32372 | 0 | } |
32373 | 24.2k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32374 | 14.9k | PyMem_Free(_children); |
32375 | 14.9k | p->level--; |
32376 | 14.9k | return _seq; |
32377 | 14.9k | } |
32378 | | |
32379 | | // _loop1_75: lambda_param_maybe_default |
32380 | | static asdl_seq * |
32381 | | _loop1_75_rule(Parser *p) |
32382 | 8.59k | { |
32383 | 8.59k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32384 | 0 | _Pypegen_stack_overflow(p); |
32385 | 0 | } |
32386 | 8.59k | if (p->error_indicator) { |
32387 | 0 | p->level--; |
32388 | 0 | return NULL; |
32389 | 0 | } |
32390 | 8.59k | void *_res = NULL; |
32391 | 8.59k | int _mark = p->mark; |
32392 | 8.59k | void **_children = PyMem_Malloc(sizeof(void *)); |
32393 | 8.59k | if (!_children) { |
32394 | 0 | p->error_indicator = 1; |
32395 | 0 | PyErr_NoMemory(); |
32396 | 0 | p->level--; |
32397 | 0 | return NULL; |
32398 | 0 | } |
32399 | 8.59k | Py_ssize_t _children_capacity = 1; |
32400 | 8.59k | Py_ssize_t _n = 0; |
32401 | 8.59k | { // lambda_param_maybe_default |
32402 | 8.59k | if (p->error_indicator) { |
32403 | 0 | p->level--; |
32404 | 0 | return NULL; |
32405 | 0 | } |
32406 | 8.59k | D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); |
32407 | 8.59k | NameDefaultPair* lambda_param_maybe_default_var; |
32408 | 8.59k | while ( |
32409 | 17.1k | (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default |
32410 | 8.59k | ) |
32411 | 8.57k | { |
32412 | 8.57k | _res = lambda_param_maybe_default_var; |
32413 | 8.57k | if (_n == _children_capacity) { |
32414 | 1.08k | _children_capacity *= 2; |
32415 | 1.08k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32416 | 1.08k | if (!_new_children) { |
32417 | 0 | PyMem_Free(_children); |
32418 | 0 | p->error_indicator = 1; |
32419 | 0 | PyErr_NoMemory(); |
32420 | 0 | p->level--; |
32421 | 0 | return NULL; |
32422 | 0 | } |
32423 | 1.08k | _children = _new_children; |
32424 | 1.08k | } |
32425 | 8.57k | _children[_n++] = _res; |
32426 | 8.57k | _mark = p->mark; |
32427 | 8.57k | } |
32428 | 8.59k | p->mark = _mark; |
32429 | 8.59k | D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ', |
32430 | 8.59k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); |
32431 | 8.59k | } |
32432 | 8.59k | if (_n == 0 || p->error_indicator) { |
32433 | 6.00k | PyMem_Free(_children); |
32434 | 6.00k | p->level--; |
32435 | 6.00k | return NULL; |
32436 | 6.00k | } |
32437 | 2.59k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32438 | 2.59k | if (!_seq) { |
32439 | 0 | PyMem_Free(_children); |
32440 | 0 | p->error_indicator = 1; |
32441 | 0 | PyErr_NoMemory(); |
32442 | 0 | p->level--; |
32443 | 0 | return NULL; |
32444 | 0 | } |
32445 | 11.1k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32446 | 2.59k | PyMem_Free(_children); |
32447 | 2.59k | p->level--; |
32448 | 2.59k | return _seq; |
32449 | 2.59k | } |
32450 | | |
32451 | | // _loop0_76: fstring_format_spec |
32452 | | static asdl_seq * |
32453 | | _loop0_76_rule(Parser *p) |
32454 | 3.58k | { |
32455 | 3.58k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32456 | 0 | _Pypegen_stack_overflow(p); |
32457 | 0 | } |
32458 | 3.58k | if (p->error_indicator) { |
32459 | 0 | p->level--; |
32460 | 0 | return NULL; |
32461 | 0 | } |
32462 | 3.58k | void *_res = NULL; |
32463 | 3.58k | int _mark = p->mark; |
32464 | 3.58k | void **_children = PyMem_Malloc(sizeof(void *)); |
32465 | 3.58k | if (!_children) { |
32466 | 0 | p->error_indicator = 1; |
32467 | 0 | PyErr_NoMemory(); |
32468 | 0 | p->level--; |
32469 | 0 | return NULL; |
32470 | 0 | } |
32471 | 3.58k | Py_ssize_t _children_capacity = 1; |
32472 | 3.58k | Py_ssize_t _n = 0; |
32473 | 3.58k | { // fstring_format_spec |
32474 | 3.58k | if (p->error_indicator) { |
32475 | 0 | p->level--; |
32476 | 0 | return NULL; |
32477 | 0 | } |
32478 | 3.58k | D(fprintf(stderr, "%*c> _loop0_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_format_spec")); |
32479 | 3.58k | expr_ty fstring_format_spec_var; |
32480 | 3.58k | while ( |
32481 | 12.7k | (fstring_format_spec_var = fstring_format_spec_rule(p)) // fstring_format_spec |
32482 | 3.58k | ) |
32483 | 9.17k | { |
32484 | 9.17k | _res = fstring_format_spec_var; |
32485 | 9.17k | if (_n == _children_capacity) { |
32486 | 1.92k | _children_capacity *= 2; |
32487 | 1.92k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32488 | 1.92k | if (!_new_children) { |
32489 | 0 | PyMem_Free(_children); |
32490 | 0 | p->error_indicator = 1; |
32491 | 0 | PyErr_NoMemory(); |
32492 | 0 | p->level--; |
32493 | 0 | return NULL; |
32494 | 0 | } |
32495 | 1.92k | _children = _new_children; |
32496 | 1.92k | } |
32497 | 9.17k | _children[_n++] = _res; |
32498 | 9.17k | _mark = p->mark; |
32499 | 9.17k | } |
32500 | 3.58k | p->mark = _mark; |
32501 | 3.58k | D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ', |
32502 | 3.58k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_format_spec")); |
32503 | 3.58k | } |
32504 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32505 | 3.58k | if (!_seq) { |
32506 | 0 | PyMem_Free(_children); |
32507 | 0 | p->error_indicator = 1; |
32508 | 0 | PyErr_NoMemory(); |
32509 | 0 | p->level--; |
32510 | 0 | return NULL; |
32511 | 0 | } |
32512 | 12.7k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32513 | 3.58k | PyMem_Free(_children); |
32514 | 3.58k | p->level--; |
32515 | 3.58k | return _seq; |
32516 | 3.58k | } |
32517 | | |
32518 | | // _loop0_77: fstring_middle |
32519 | | static asdl_seq * |
32520 | | _loop0_77_rule(Parser *p) |
32521 | 16.1k | { |
32522 | 16.1k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32523 | 1 | _Pypegen_stack_overflow(p); |
32524 | 1 | } |
32525 | 16.1k | if (p->error_indicator) { |
32526 | 1 | p->level--; |
32527 | 1 | return NULL; |
32528 | 1 | } |
32529 | 16.1k | void *_res = NULL; |
32530 | 16.1k | int _mark = p->mark; |
32531 | 16.1k | void **_children = PyMem_Malloc(sizeof(void *)); |
32532 | 16.1k | if (!_children) { |
32533 | 0 | p->error_indicator = 1; |
32534 | 0 | PyErr_NoMemory(); |
32535 | 0 | p->level--; |
32536 | 0 | return NULL; |
32537 | 0 | } |
32538 | 16.1k | Py_ssize_t _children_capacity = 1; |
32539 | 16.1k | Py_ssize_t _n = 0; |
32540 | 16.1k | { // fstring_middle |
32541 | 16.1k | if (p->error_indicator) { |
32542 | 0 | p->level--; |
32543 | 0 | return NULL; |
32544 | 0 | } |
32545 | 16.1k | D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring_middle")); |
32546 | 16.1k | expr_ty fstring_middle_var; |
32547 | 16.1k | while ( |
32548 | 54.4k | (fstring_middle_var = fstring_middle_rule(p)) // fstring_middle |
32549 | 16.1k | ) |
32550 | 38.2k | { |
32551 | 38.2k | _res = fstring_middle_var; |
32552 | 38.2k | if (_n == _children_capacity) { |
32553 | 6.39k | _children_capacity *= 2; |
32554 | 6.39k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32555 | 6.39k | if (!_new_children) { |
32556 | 0 | PyMem_Free(_children); |
32557 | 0 | p->error_indicator = 1; |
32558 | 0 | PyErr_NoMemory(); |
32559 | 0 | p->level--; |
32560 | 0 | return NULL; |
32561 | 0 | } |
32562 | 6.39k | _children = _new_children; |
32563 | 6.39k | } |
32564 | 38.2k | _children[_n++] = _res; |
32565 | 38.2k | _mark = p->mark; |
32566 | 38.2k | } |
32567 | 16.1k | p->mark = _mark; |
32568 | 16.1k | D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ', |
32569 | 16.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring_middle")); |
32570 | 16.1k | } |
32571 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32572 | 16.1k | if (!_seq) { |
32573 | 0 | PyMem_Free(_children); |
32574 | 0 | p->error_indicator = 1; |
32575 | 0 | PyErr_NoMemory(); |
32576 | 0 | p->level--; |
32577 | 0 | return NULL; |
32578 | 0 | } |
32579 | 54.4k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32580 | 16.1k | PyMem_Free(_children); |
32581 | 16.1k | p->level--; |
32582 | 16.1k | return _seq; |
32583 | 16.1k | } |
32584 | | |
32585 | | // _loop0_78: tstring_format_spec |
32586 | | static asdl_seq * |
32587 | | _loop0_78_rule(Parser *p) |
32588 | 2.74k | { |
32589 | 2.74k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32590 | 0 | _Pypegen_stack_overflow(p); |
32591 | 0 | } |
32592 | 2.74k | if (p->error_indicator) { |
32593 | 0 | p->level--; |
32594 | 0 | return NULL; |
32595 | 0 | } |
32596 | 2.74k | void *_res = NULL; |
32597 | 2.74k | int _mark = p->mark; |
32598 | 2.74k | void **_children = PyMem_Malloc(sizeof(void *)); |
32599 | 2.74k | if (!_children) { |
32600 | 0 | p->error_indicator = 1; |
32601 | 0 | PyErr_NoMemory(); |
32602 | 0 | p->level--; |
32603 | 0 | return NULL; |
32604 | 0 | } |
32605 | 2.74k | Py_ssize_t _children_capacity = 1; |
32606 | 2.74k | Py_ssize_t _n = 0; |
32607 | 2.74k | { // tstring_format_spec |
32608 | 2.74k | if (p->error_indicator) { |
32609 | 0 | p->level--; |
32610 | 0 | return NULL; |
32611 | 0 | } |
32612 | 2.74k | D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tstring_format_spec")); |
32613 | 2.74k | expr_ty tstring_format_spec_var; |
32614 | 2.74k | while ( |
32615 | 5.78k | (tstring_format_spec_var = tstring_format_spec_rule(p)) // tstring_format_spec |
32616 | 2.74k | ) |
32617 | 3.03k | { |
32618 | 3.03k | _res = tstring_format_spec_var; |
32619 | 3.03k | if (_n == _children_capacity) { |
32620 | 462 | _children_capacity *= 2; |
32621 | 462 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32622 | 462 | if (!_new_children) { |
32623 | 0 | PyMem_Free(_children); |
32624 | 0 | p->error_indicator = 1; |
32625 | 0 | PyErr_NoMemory(); |
32626 | 0 | p->level--; |
32627 | 0 | return NULL; |
32628 | 0 | } |
32629 | 462 | _children = _new_children; |
32630 | 462 | } |
32631 | 3.03k | _children[_n++] = _res; |
32632 | 3.03k | _mark = p->mark; |
32633 | 3.03k | } |
32634 | 2.74k | p->mark = _mark; |
32635 | 2.74k | D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ', |
32636 | 2.74k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tstring_format_spec")); |
32637 | 2.74k | } |
32638 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32639 | 2.74k | if (!_seq) { |
32640 | 0 | PyMem_Free(_children); |
32641 | 0 | p->error_indicator = 1; |
32642 | 0 | PyErr_NoMemory(); |
32643 | 0 | p->level--; |
32644 | 0 | return NULL; |
32645 | 0 | } |
32646 | 5.78k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32647 | 2.74k | PyMem_Free(_children); |
32648 | 2.74k | p->level--; |
32649 | 2.74k | return _seq; |
32650 | 2.74k | } |
32651 | | |
32652 | | // _loop0_79: tstring_middle |
32653 | | static asdl_seq * |
32654 | | _loop0_79_rule(Parser *p) |
32655 | 6.43k | { |
32656 | 6.43k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32657 | 0 | _Pypegen_stack_overflow(p); |
32658 | 0 | } |
32659 | 6.43k | if (p->error_indicator) { |
32660 | 0 | p->level--; |
32661 | 0 | return NULL; |
32662 | 0 | } |
32663 | 6.43k | void *_res = NULL; |
32664 | 6.43k | int _mark = p->mark; |
32665 | 6.43k | void **_children = PyMem_Malloc(sizeof(void *)); |
32666 | 6.43k | if (!_children) { |
32667 | 0 | p->error_indicator = 1; |
32668 | 0 | PyErr_NoMemory(); |
32669 | 0 | p->level--; |
32670 | 0 | return NULL; |
32671 | 0 | } |
32672 | 6.43k | Py_ssize_t _children_capacity = 1; |
32673 | 6.43k | Py_ssize_t _n = 0; |
32674 | 6.43k | { // tstring_middle |
32675 | 6.43k | if (p->error_indicator) { |
32676 | 0 | p->level--; |
32677 | 0 | return NULL; |
32678 | 0 | } |
32679 | 6.43k | D(fprintf(stderr, "%*c> _loop0_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tstring_middle")); |
32680 | 6.43k | expr_ty tstring_middle_var; |
32681 | 6.43k | while ( |
32682 | 19.8k | (tstring_middle_var = tstring_middle_rule(p)) // tstring_middle |
32683 | 6.43k | ) |
32684 | 13.4k | { |
32685 | 13.4k | _res = tstring_middle_var; |
32686 | 13.4k | if (_n == _children_capacity) { |
32687 | 2.78k | _children_capacity *= 2; |
32688 | 2.78k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32689 | 2.78k | if (!_new_children) { |
32690 | 0 | PyMem_Free(_children); |
32691 | 0 | p->error_indicator = 1; |
32692 | 0 | PyErr_NoMemory(); |
32693 | 0 | p->level--; |
32694 | 0 | return NULL; |
32695 | 0 | } |
32696 | 2.78k | _children = _new_children; |
32697 | 2.78k | } |
32698 | 13.4k | _children[_n++] = _res; |
32699 | 13.4k | _mark = p->mark; |
32700 | 13.4k | } |
32701 | 6.43k | p->mark = _mark; |
32702 | 6.43k | D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ', |
32703 | 6.43k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tstring_middle")); |
32704 | 6.43k | } |
32705 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32706 | 6.43k | if (!_seq) { |
32707 | 0 | PyMem_Free(_children); |
32708 | 0 | p->error_indicator = 1; |
32709 | 0 | PyErr_NoMemory(); |
32710 | 0 | p->level--; |
32711 | 0 | return NULL; |
32712 | 0 | } |
32713 | 19.8k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32714 | 6.43k | PyMem_Free(_children); |
32715 | 6.43k | p->level--; |
32716 | 6.43k | return _seq; |
32717 | 6.43k | } |
32718 | | |
32719 | | // _loop1_80: (fstring | string) |
32720 | | static asdl_seq * |
32721 | | _loop1_80_rule(Parser *p) |
32722 | 120k | { |
32723 | 120k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32724 | 1 | _Pypegen_stack_overflow(p); |
32725 | 1 | } |
32726 | 120k | if (p->error_indicator) { |
32727 | 1 | p->level--; |
32728 | 1 | return NULL; |
32729 | 1 | } |
32730 | 120k | void *_res = NULL; |
32731 | 120k | int _mark = p->mark; |
32732 | 120k | void **_children = PyMem_Malloc(sizeof(void *)); |
32733 | 120k | if (!_children) { |
32734 | 0 | p->error_indicator = 1; |
32735 | 0 | PyErr_NoMemory(); |
32736 | 0 | p->level--; |
32737 | 0 | return NULL; |
32738 | 0 | } |
32739 | 120k | Py_ssize_t _children_capacity = 1; |
32740 | 120k | Py_ssize_t _n = 0; |
32741 | 120k | { // (fstring | string) |
32742 | 120k | if (p->error_indicator) { |
32743 | 0 | p->level--; |
32744 | 0 | return NULL; |
32745 | 0 | } |
32746 | 120k | D(fprintf(stderr, "%*c> _loop1_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(fstring | string)")); |
32747 | 120k | void *_tmp_154_var; |
32748 | 120k | while ( |
32749 | 201k | (_tmp_154_var = _tmp_154_rule(p)) // fstring | string |
32750 | 120k | ) |
32751 | 81.1k | { |
32752 | 81.1k | _res = _tmp_154_var; |
32753 | 81.1k | if (_n == _children_capacity) { |
32754 | 7.92k | _children_capacity *= 2; |
32755 | 7.92k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32756 | 7.92k | if (!_new_children) { |
32757 | 0 | PyMem_Free(_children); |
32758 | 0 | p->error_indicator = 1; |
32759 | 0 | PyErr_NoMemory(); |
32760 | 0 | p->level--; |
32761 | 0 | return NULL; |
32762 | 0 | } |
32763 | 7.92k | _children = _new_children; |
32764 | 7.92k | } |
32765 | 81.1k | _children[_n++] = _res; |
32766 | 81.1k | _mark = p->mark; |
32767 | 81.1k | } |
32768 | 120k | p->mark = _mark; |
32769 | 120k | D(fprintf(stderr, "%*c%s _loop1_80[%d-%d]: %s failed!\n", p->level, ' ', |
32770 | 120k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(fstring | string)")); |
32771 | 120k | } |
32772 | 120k | if (_n == 0 || p->error_indicator) { |
32773 | 69.7k | PyMem_Free(_children); |
32774 | 69.7k | p->level--; |
32775 | 69.7k | return NULL; |
32776 | 69.7k | } |
32777 | 50.7k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32778 | 50.7k | if (!_seq) { |
32779 | 0 | PyMem_Free(_children); |
32780 | 0 | p->error_indicator = 1; |
32781 | 0 | PyErr_NoMemory(); |
32782 | 0 | p->level--; |
32783 | 0 | return NULL; |
32784 | 0 | } |
32785 | 130k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32786 | 50.7k | PyMem_Free(_children); |
32787 | 50.7k | p->level--; |
32788 | 50.7k | return _seq; |
32789 | 50.7k | } |
32790 | | |
32791 | | // _loop1_81: tstring |
32792 | | static asdl_seq * |
32793 | | _loop1_81_rule(Parser *p) |
32794 | 71.7k | { |
32795 | 71.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32796 | 0 | _Pypegen_stack_overflow(p); |
32797 | 0 | } |
32798 | 71.7k | if (p->error_indicator) { |
32799 | 0 | p->level--; |
32800 | 0 | return NULL; |
32801 | 0 | } |
32802 | 71.7k | void *_res = NULL; |
32803 | 71.7k | int _mark = p->mark; |
32804 | 71.7k | void **_children = PyMem_Malloc(sizeof(void *)); |
32805 | 71.7k | if (!_children) { |
32806 | 0 | p->error_indicator = 1; |
32807 | 0 | PyErr_NoMemory(); |
32808 | 0 | p->level--; |
32809 | 0 | return NULL; |
32810 | 0 | } |
32811 | 71.7k | Py_ssize_t _children_capacity = 1; |
32812 | 71.7k | Py_ssize_t _n = 0; |
32813 | 71.7k | { // tstring |
32814 | 71.7k | if (p->error_indicator) { |
32815 | 0 | p->level--; |
32816 | 0 | return NULL; |
32817 | 0 | } |
32818 | 71.7k | D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tstring")); |
32819 | 71.7k | expr_ty tstring_var; |
32820 | 71.7k | while ( |
32821 | 77.3k | (tstring_var = tstring_rule(p)) // tstring |
32822 | 71.7k | ) |
32823 | 5.61k | { |
32824 | 5.61k | _res = tstring_var; |
32825 | 5.61k | if (_n == _children_capacity) { |
32826 | 392 | _children_capacity *= 2; |
32827 | 392 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32828 | 392 | if (!_new_children) { |
32829 | 0 | PyMem_Free(_children); |
32830 | 0 | p->error_indicator = 1; |
32831 | 0 | PyErr_NoMemory(); |
32832 | 0 | p->level--; |
32833 | 0 | return NULL; |
32834 | 0 | } |
32835 | 392 | _children = _new_children; |
32836 | 392 | } |
32837 | 5.61k | _children[_n++] = _res; |
32838 | 5.61k | _mark = p->mark; |
32839 | 5.61k | } |
32840 | 71.7k | p->mark = _mark; |
32841 | 71.7k | D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', |
32842 | 71.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tstring")); |
32843 | 71.7k | } |
32844 | 71.7k | if (_n == 0 || p->error_indicator) { |
32845 | 67.1k | PyMem_Free(_children); |
32846 | 67.1k | p->level--; |
32847 | 67.1k | return NULL; |
32848 | 67.1k | } |
32849 | 4.58k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32850 | 4.58k | if (!_seq) { |
32851 | 0 | PyMem_Free(_children); |
32852 | 0 | p->error_indicator = 1; |
32853 | 0 | PyErr_NoMemory(); |
32854 | 0 | p->level--; |
32855 | 0 | return NULL; |
32856 | 0 | } |
32857 | 10.0k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32858 | 4.58k | PyMem_Free(_children); |
32859 | 4.58k | p->level--; |
32860 | 4.58k | return _seq; |
32861 | 4.58k | } |
32862 | | |
32863 | | // _tmp_82: star_named_expression ',' star_named_expressions? |
32864 | | static void * |
32865 | | _tmp_82_rule(Parser *p) |
32866 | 84.7k | { |
32867 | 84.7k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32868 | 1 | _Pypegen_stack_overflow(p); |
32869 | 1 | } |
32870 | 84.7k | if (p->error_indicator) { |
32871 | 1 | p->level--; |
32872 | 1 | return NULL; |
32873 | 1 | } |
32874 | 84.7k | void * _res = NULL; |
32875 | 84.7k | int _mark = p->mark; |
32876 | 84.7k | { // star_named_expression ',' star_named_expressions? |
32877 | 84.7k | if (p->error_indicator) { |
32878 | 0 | p->level--; |
32879 | 0 | return NULL; |
32880 | 0 | } |
32881 | 84.7k | D(fprintf(stderr, "%*c> _tmp_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
32882 | 84.7k | Token * _literal; |
32883 | 84.7k | expr_ty y; |
32884 | 84.7k | void *z; |
32885 | 84.7k | if ( |
32886 | 84.7k | (y = star_named_expression_rule(p)) // star_named_expression |
32887 | 39.7k | && |
32888 | 39.7k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
32889 | 15.6k | && |
32890 | 15.6k | (z = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions? |
32891 | 84.7k | ) |
32892 | 15.4k | { |
32893 | 15.4k | D(fprintf(stderr, "%*c+ _tmp_82[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
32894 | 15.4k | _res = _PyPegen_seq_insert_in_front ( p , y , z ); |
32895 | 15.4k | if (_res == NULL && PyErr_Occurred()) { |
32896 | 0 | p->error_indicator = 1; |
32897 | 0 | p->level--; |
32898 | 0 | return NULL; |
32899 | 0 | } |
32900 | 15.4k | goto done; |
32901 | 15.4k | } |
32902 | 69.3k | p->mark = _mark; |
32903 | 69.3k | D(fprintf(stderr, "%*c%s _tmp_82[%d-%d]: %s failed!\n", p->level, ' ', |
32904 | 69.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); |
32905 | 69.3k | } |
32906 | 69.3k | _res = NULL; |
32907 | 84.7k | done: |
32908 | 84.7k | p->level--; |
32909 | 84.7k | return _res; |
32910 | 69.3k | } |
32911 | | |
32912 | | // _loop0_83: ',' double_starred_kvpair |
32913 | | static asdl_seq * |
32914 | | _loop0_83_rule(Parser *p) |
32915 | 7.92k | { |
32916 | 7.92k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32917 | 0 | _Pypegen_stack_overflow(p); |
32918 | 0 | } |
32919 | 7.92k | if (p->error_indicator) { |
32920 | 0 | p->level--; |
32921 | 0 | return NULL; |
32922 | 0 | } |
32923 | 7.92k | void *_res = NULL; |
32924 | 7.92k | int _mark = p->mark; |
32925 | 7.92k | void **_children = PyMem_Malloc(sizeof(void *)); |
32926 | 7.92k | if (!_children) { |
32927 | 0 | p->error_indicator = 1; |
32928 | 0 | PyErr_NoMemory(); |
32929 | 0 | p->level--; |
32930 | 0 | return NULL; |
32931 | 0 | } |
32932 | 7.92k | Py_ssize_t _children_capacity = 1; |
32933 | 7.92k | Py_ssize_t _n = 0; |
32934 | 7.92k | { // ',' double_starred_kvpair |
32935 | 7.92k | if (p->error_indicator) { |
32936 | 0 | p->level--; |
32937 | 0 | return NULL; |
32938 | 0 | } |
32939 | 7.92k | D(fprintf(stderr, "%*c> _loop0_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); |
32940 | 7.92k | Token * _literal; |
32941 | 7.92k | KeyValuePair* elem; |
32942 | 7.92k | while ( |
32943 | 41.5k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
32944 | 35.4k | && |
32945 | 35.4k | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
32946 | 7.92k | ) |
32947 | 33.6k | { |
32948 | 33.6k | _res = elem; |
32949 | 33.6k | if (_res == NULL && PyErr_Occurred()) { |
32950 | 0 | p->error_indicator = 1; |
32951 | 0 | PyMem_Free(_children); |
32952 | 0 | p->level--; |
32953 | 0 | return NULL; |
32954 | 0 | } |
32955 | 33.6k | if (_n == _children_capacity) { |
32956 | 1.99k | _children_capacity *= 2; |
32957 | 1.99k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
32958 | 1.99k | if (!_new_children) { |
32959 | 0 | PyMem_Free(_children); |
32960 | 0 | p->error_indicator = 1; |
32961 | 0 | PyErr_NoMemory(); |
32962 | 0 | p->level--; |
32963 | 0 | return NULL; |
32964 | 0 | } |
32965 | 1.99k | _children = _new_children; |
32966 | 1.99k | } |
32967 | 33.6k | _children[_n++] = _res; |
32968 | 33.6k | _mark = p->mark; |
32969 | 33.6k | } |
32970 | 7.92k | p->mark = _mark; |
32971 | 7.92k | D(fprintf(stderr, "%*c%s _loop0_83[%d-%d]: %s failed!\n", p->level, ' ', |
32972 | 7.92k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); |
32973 | 7.92k | } |
32974 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
32975 | 7.92k | if (!_seq) { |
32976 | 0 | PyMem_Free(_children); |
32977 | 0 | p->error_indicator = 1; |
32978 | 0 | PyErr_NoMemory(); |
32979 | 0 | p->level--; |
32980 | 0 | return NULL; |
32981 | 0 | } |
32982 | 41.5k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
32983 | 7.92k | PyMem_Free(_children); |
32984 | 7.92k | p->level--; |
32985 | 7.92k | return _seq; |
32986 | 7.92k | } |
32987 | | |
32988 | | // _gather_84: double_starred_kvpair _loop0_83 |
32989 | | static asdl_seq * |
32990 | | _gather_84_rule(Parser *p) |
32991 | 33.4k | { |
32992 | 33.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
32993 | 2 | _Pypegen_stack_overflow(p); |
32994 | 2 | } |
32995 | 33.4k | if (p->error_indicator) { |
32996 | 2 | p->level--; |
32997 | 2 | return NULL; |
32998 | 2 | } |
32999 | 33.4k | asdl_seq * _res = NULL; |
33000 | 33.4k | int _mark = p->mark; |
33001 | 33.4k | { // double_starred_kvpair _loop0_83 |
33002 | 33.4k | if (p->error_indicator) { |
33003 | 0 | p->level--; |
33004 | 0 | return NULL; |
33005 | 0 | } |
33006 | 33.4k | D(fprintf(stderr, "%*c> _gather_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_83")); |
33007 | 33.4k | KeyValuePair* elem; |
33008 | 33.4k | asdl_seq * seq; |
33009 | 33.4k | if ( |
33010 | 33.4k | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
33011 | 7.92k | && |
33012 | 7.92k | (seq = _loop0_83_rule(p)) // _loop0_83 |
33013 | 33.4k | ) |
33014 | 7.92k | { |
33015 | 7.92k | D(fprintf(stderr, "%*c+ _gather_84[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_83")); |
33016 | 7.92k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
33017 | 7.92k | goto done; |
33018 | 7.92k | } |
33019 | 25.5k | p->mark = _mark; |
33020 | 25.5k | D(fprintf(stderr, "%*c%s _gather_84[%d-%d]: %s failed!\n", p->level, ' ', |
33021 | 25.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_83")); |
33022 | 25.5k | } |
33023 | 25.5k | _res = NULL; |
33024 | 33.4k | done: |
33025 | 33.4k | p->level--; |
33026 | 33.4k | return _res; |
33027 | 25.5k | } |
33028 | | |
33029 | | // _loop1_85: for_if_clause |
33030 | | static asdl_seq * |
33031 | | _loop1_85_rule(Parser *p) |
33032 | 100k | { |
33033 | 100k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33034 | 0 | _Pypegen_stack_overflow(p); |
33035 | 0 | } |
33036 | 100k | if (p->error_indicator) { |
33037 | 0 | p->level--; |
33038 | 0 | return NULL; |
33039 | 0 | } |
33040 | 100k | void *_res = NULL; |
33041 | 100k | int _mark = p->mark; |
33042 | 100k | void **_children = PyMem_Malloc(sizeof(void *)); |
33043 | 100k | if (!_children) { |
33044 | 0 | p->error_indicator = 1; |
33045 | 0 | PyErr_NoMemory(); |
33046 | 0 | p->level--; |
33047 | 0 | return NULL; |
33048 | 0 | } |
33049 | 100k | Py_ssize_t _children_capacity = 1; |
33050 | 100k | Py_ssize_t _n = 0; |
33051 | 100k | { // for_if_clause |
33052 | 100k | if (p->error_indicator) { |
33053 | 0 | p->level--; |
33054 | 0 | return NULL; |
33055 | 0 | } |
33056 | 100k | D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); |
33057 | 100k | comprehension_ty for_if_clause_var; |
33058 | 100k | while ( |
33059 | 111k | (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause |
33060 | 100k | ) |
33061 | 11.4k | { |
33062 | 11.4k | _res = for_if_clause_var; |
33063 | 11.4k | if (_n == _children_capacity) { |
33064 | 663 | _children_capacity *= 2; |
33065 | 663 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
33066 | 663 | if (!_new_children) { |
33067 | 0 | PyMem_Free(_children); |
33068 | 0 | p->error_indicator = 1; |
33069 | 0 | PyErr_NoMemory(); |
33070 | 0 | p->level--; |
33071 | 0 | return NULL; |
33072 | 0 | } |
33073 | 663 | _children = _new_children; |
33074 | 663 | } |
33075 | 11.4k | _children[_n++] = _res; |
33076 | 11.4k | _mark = p->mark; |
33077 | 11.4k | } |
33078 | 100k | p->mark = _mark; |
33079 | 100k | D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ', |
33080 | 100k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); |
33081 | 100k | } |
33082 | 100k | if (_n == 0 || p->error_indicator) { |
33083 | 89.8k | PyMem_Free(_children); |
33084 | 89.8k | p->level--; |
33085 | 89.8k | return NULL; |
33086 | 89.8k | } |
33087 | 10.4k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
33088 | 10.4k | if (!_seq) { |
33089 | 0 | PyMem_Free(_children); |
33090 | 0 | p->error_indicator = 1; |
33091 | 0 | PyErr_NoMemory(); |
33092 | 0 | p->level--; |
33093 | 0 | return NULL; |
33094 | 0 | } |
33095 | 21.6k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
33096 | 10.4k | PyMem_Free(_children); |
33097 | 10.4k | p->level--; |
33098 | 10.4k | return _seq; |
33099 | 10.4k | } |
33100 | | |
33101 | | // _loop0_86: ('if' disjunction) |
33102 | | static asdl_seq * |
33103 | | _loop0_86_rule(Parser *p) |
33104 | 11.4k | { |
33105 | 11.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33106 | 0 | _Pypegen_stack_overflow(p); |
33107 | 0 | } |
33108 | 11.4k | if (p->error_indicator) { |
33109 | 0 | p->level--; |
33110 | 0 | return NULL; |
33111 | 0 | } |
33112 | 11.4k | void *_res = NULL; |
33113 | 11.4k | int _mark = p->mark; |
33114 | 11.4k | void **_children = PyMem_Malloc(sizeof(void *)); |
33115 | 11.4k | if (!_children) { |
33116 | 0 | p->error_indicator = 1; |
33117 | 0 | PyErr_NoMemory(); |
33118 | 0 | p->level--; |
33119 | 0 | return NULL; |
33120 | 0 | } |
33121 | 11.4k | Py_ssize_t _children_capacity = 1; |
33122 | 11.4k | Py_ssize_t _n = 0; |
33123 | 11.4k | { // ('if' disjunction) |
33124 | 11.4k | if (p->error_indicator) { |
33125 | 0 | p->level--; |
33126 | 0 | return NULL; |
33127 | 0 | } |
33128 | 11.4k | D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); |
33129 | 11.4k | void *_tmp_164_var; |
33130 | 11.4k | while ( |
33131 | 17.0k | (_tmp_164_var = _tmp_164_rule(p)) // 'if' disjunction |
33132 | 11.4k | ) |
33133 | 5.65k | { |
33134 | 5.65k | _res = _tmp_164_var; |
33135 | 5.65k | if (_n == _children_capacity) { |
33136 | 2.19k | _children_capacity *= 2; |
33137 | 2.19k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
33138 | 2.19k | if (!_new_children) { |
33139 | 0 | PyMem_Free(_children); |
33140 | 0 | p->error_indicator = 1; |
33141 | 0 | PyErr_NoMemory(); |
33142 | 0 | p->level--; |
33143 | 0 | return NULL; |
33144 | 0 | } |
33145 | 2.19k | _children = _new_children; |
33146 | 2.19k | } |
33147 | 5.65k | _children[_n++] = _res; |
33148 | 5.65k | _mark = p->mark; |
33149 | 5.65k | } |
33150 | 11.4k | p->mark = _mark; |
33151 | 11.4k | D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ', |
33152 | 11.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); |
33153 | 11.4k | } |
33154 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
33155 | 11.4k | if (!_seq) { |
33156 | 0 | PyMem_Free(_children); |
33157 | 0 | p->error_indicator = 1; |
33158 | 0 | PyErr_NoMemory(); |
33159 | 0 | p->level--; |
33160 | 0 | return NULL; |
33161 | 0 | } |
33162 | 17.0k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
33163 | 11.4k | PyMem_Free(_children); |
33164 | 11.4k | p->level--; |
33165 | 11.4k | return _seq; |
33166 | 11.4k | } |
33167 | | |
33168 | | // _tmp_87: assignment_expression | expression !':=' |
33169 | | static void * |
33170 | | _tmp_87_rule(Parser *p) |
33171 | 188k | { |
33172 | 188k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33173 | 1 | _Pypegen_stack_overflow(p); |
33174 | 1 | } |
33175 | 188k | if (p->error_indicator) { |
33176 | 1 | p->level--; |
33177 | 1 | return NULL; |
33178 | 1 | } |
33179 | 188k | void * _res = NULL; |
33180 | 188k | int _mark = p->mark; |
33181 | 188k | { // assignment_expression |
33182 | 188k | if (p->error_indicator) { |
33183 | 0 | p->level--; |
33184 | 0 | return NULL; |
33185 | 0 | } |
33186 | 188k | D(fprintf(stderr, "%*c> _tmp_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression")); |
33187 | 188k | expr_ty assignment_expression_var; |
33188 | 188k | if ( |
33189 | 188k | (assignment_expression_var = assignment_expression_rule(p)) // assignment_expression |
33190 | 188k | ) |
33191 | 598 | { |
33192 | 598 | D(fprintf(stderr, "%*c+ _tmp_87[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression")); |
33193 | 598 | _res = assignment_expression_var; |
33194 | 598 | goto done; |
33195 | 598 | } |
33196 | 187k | p->mark = _mark; |
33197 | 187k | D(fprintf(stderr, "%*c%s _tmp_87[%d-%d]: %s failed!\n", p->level, ' ', |
33198 | 187k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression")); |
33199 | 187k | } |
33200 | 0 | { // expression !':=' |
33201 | 187k | if (p->error_indicator) { |
33202 | 136 | p->level--; |
33203 | 136 | return NULL; |
33204 | 136 | } |
33205 | 187k | D(fprintf(stderr, "%*c> _tmp_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); |
33206 | 187k | expr_ty expression_var; |
33207 | 187k | if ( |
33208 | 187k | (expression_var = expression_rule(p)) // expression |
33209 | 122k | && |
33210 | 122k | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' |
33211 | 187k | ) |
33212 | 120k | { |
33213 | 120k | D(fprintf(stderr, "%*c+ _tmp_87[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='")); |
33214 | 120k | _res = expression_var; |
33215 | 120k | goto done; |
33216 | 120k | } |
33217 | 67.3k | p->mark = _mark; |
33218 | 67.3k | D(fprintf(stderr, "%*c%s _tmp_87[%d-%d]: %s failed!\n", p->level, ' ', |
33219 | 67.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='")); |
33220 | 67.3k | } |
33221 | 67.3k | _res = NULL; |
33222 | 188k | done: |
33223 | 188k | p->level--; |
33224 | 188k | return _res; |
33225 | 67.3k | } |
33226 | | |
33227 | | // _loop0_88: ',' (starred_expression | (assignment_expression | expression !':=') !'=') |
33228 | | static asdl_seq * |
33229 | | _loop0_88_rule(Parser *p) |
33230 | 41.6k | { |
33231 | 41.6k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33232 | 0 | _Pypegen_stack_overflow(p); |
33233 | 0 | } |
33234 | 41.6k | if (p->error_indicator) { |
33235 | 0 | p->level--; |
33236 | 0 | return NULL; |
33237 | 0 | } |
33238 | 41.6k | void *_res = NULL; |
33239 | 41.6k | int _mark = p->mark; |
33240 | 41.6k | void **_children = PyMem_Malloc(sizeof(void *)); |
33241 | 41.6k | if (!_children) { |
33242 | 0 | p->error_indicator = 1; |
33243 | 0 | PyErr_NoMemory(); |
33244 | 0 | p->level--; |
33245 | 0 | return NULL; |
33246 | 0 | } |
33247 | 41.6k | Py_ssize_t _children_capacity = 1; |
33248 | 41.6k | Py_ssize_t _n = 0; |
33249 | 41.6k | { // ',' (starred_expression | (assignment_expression | expression !':=') !'=') |
33250 | 41.6k | if (p->error_indicator) { |
33251 | 0 | p->level--; |
33252 | 0 | return NULL; |
33253 | 0 | } |
33254 | 41.6k | D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')")); |
33255 | 41.6k | Token * _literal; |
33256 | 41.6k | void *elem; |
33257 | 41.6k | while ( |
33258 | 58.3k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
33259 | 21.4k | && |
33260 | 21.4k | (elem = _tmp_165_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'=' |
33261 | 41.6k | ) |
33262 | 16.7k | { |
33263 | 16.7k | _res = elem; |
33264 | 16.7k | if (_res == NULL && PyErr_Occurred()) { |
33265 | 0 | p->error_indicator = 1; |
33266 | 0 | PyMem_Free(_children); |
33267 | 0 | p->level--; |
33268 | 0 | return NULL; |
33269 | 0 | } |
33270 | 16.7k | if (_n == _children_capacity) { |
33271 | 3.96k | _children_capacity *= 2; |
33272 | 3.96k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
33273 | 3.96k | if (!_new_children) { |
33274 | 0 | PyMem_Free(_children); |
33275 | 0 | p->error_indicator = 1; |
33276 | 0 | PyErr_NoMemory(); |
33277 | 0 | p->level--; |
33278 | 0 | return NULL; |
33279 | 0 | } |
33280 | 3.96k | _children = _new_children; |
33281 | 3.96k | } |
33282 | 16.7k | _children[_n++] = _res; |
33283 | 16.7k | _mark = p->mark; |
33284 | 16.7k | } |
33285 | 41.6k | p->mark = _mark; |
33286 | 41.6k | D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ', |
33287 | 41.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')")); |
33288 | 41.6k | } |
33289 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
33290 | 41.6k | if (!_seq) { |
33291 | 0 | PyMem_Free(_children); |
33292 | 0 | p->error_indicator = 1; |
33293 | 0 | PyErr_NoMemory(); |
33294 | 0 | p->level--; |
33295 | 0 | return NULL; |
33296 | 0 | } |
33297 | 58.3k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
33298 | 41.6k | PyMem_Free(_children); |
33299 | 41.6k | p->level--; |
33300 | 41.6k | return _seq; |
33301 | 41.6k | } |
33302 | | |
33303 | | // _gather_89: |
33304 | | // | (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_88 |
33305 | | static asdl_seq * |
33306 | | _gather_89_rule(Parser *p) |
33307 | 79.5k | { |
33308 | 79.5k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33309 | 0 | _Pypegen_stack_overflow(p); |
33310 | 0 | } |
33311 | 79.5k | if (p->error_indicator) { |
33312 | 0 | p->level--; |
33313 | 0 | return NULL; |
33314 | 0 | } |
33315 | 79.5k | asdl_seq * _res = NULL; |
33316 | 79.5k | int _mark = p->mark; |
33317 | 79.5k | { // (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_88 |
33318 | 79.5k | if (p->error_indicator) { |
33319 | 0 | p->level--; |
33320 | 0 | return NULL; |
33321 | 0 | } |
33322 | 79.5k | D(fprintf(stderr, "%*c> _gather_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_88")); |
33323 | 79.5k | void *elem; |
33324 | 79.5k | asdl_seq * seq; |
33325 | 79.5k | if ( |
33326 | 79.5k | (elem = _tmp_165_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'=' |
33327 | 41.6k | && |
33328 | 41.6k | (seq = _loop0_88_rule(p)) // _loop0_88 |
33329 | 79.5k | ) |
33330 | 41.6k | { |
33331 | 41.6k | D(fprintf(stderr, "%*c+ _gather_89[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_88")); |
33332 | 41.6k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
33333 | 41.6k | goto done; |
33334 | 41.6k | } |
33335 | 37.9k | p->mark = _mark; |
33336 | 37.9k | D(fprintf(stderr, "%*c%s _gather_89[%d-%d]: %s failed!\n", p->level, ' ', |
33337 | 37.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_88")); |
33338 | 37.9k | } |
33339 | 37.9k | _res = NULL; |
33340 | 79.5k | done: |
33341 | 79.5k | p->level--; |
33342 | 79.5k | return _res; |
33343 | 37.9k | } |
33344 | | |
33345 | | // _tmp_90: ',' kwargs |
33346 | | static void * |
33347 | | _tmp_90_rule(Parser *p) |
33348 | 39.0k | { |
33349 | 39.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33350 | 0 | _Pypegen_stack_overflow(p); |
33351 | 0 | } |
33352 | 39.0k | if (p->error_indicator) { |
33353 | 519 | p->level--; |
33354 | 519 | return NULL; |
33355 | 519 | } |
33356 | 38.5k | void * _res = NULL; |
33357 | 38.5k | int _mark = p->mark; |
33358 | 38.5k | { // ',' kwargs |
33359 | 38.5k | if (p->error_indicator) { |
33360 | 0 | p->level--; |
33361 | 0 | return NULL; |
33362 | 0 | } |
33363 | 38.5k | D(fprintf(stderr, "%*c> _tmp_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs")); |
33364 | 38.5k | Token * _literal; |
33365 | 38.5k | asdl_seq* k; |
33366 | 38.5k | if ( |
33367 | 38.5k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
33368 | 3.67k | && |
33369 | 3.67k | (k = kwargs_rule(p)) // kwargs |
33370 | 38.5k | ) |
33371 | 2.77k | { |
33372 | 2.77k | D(fprintf(stderr, "%*c+ _tmp_90[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs")); |
33373 | 2.77k | _res = k; |
33374 | 2.77k | if (_res == NULL && PyErr_Occurred()) { |
33375 | 0 | p->error_indicator = 1; |
33376 | 0 | p->level--; |
33377 | 0 | return NULL; |
33378 | 0 | } |
33379 | 2.77k | goto done; |
33380 | 2.77k | } |
33381 | 35.7k | p->mark = _mark; |
33382 | 35.7k | D(fprintf(stderr, "%*c%s _tmp_90[%d-%d]: %s failed!\n", p->level, ' ', |
33383 | 35.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs")); |
33384 | 35.7k | } |
33385 | 35.7k | _res = NULL; |
33386 | 38.5k | done: |
33387 | 38.5k | p->level--; |
33388 | 38.5k | return _res; |
33389 | 35.7k | } |
33390 | | |
33391 | | // _loop0_91: ',' kwarg_or_starred |
33392 | | static asdl_seq * |
33393 | | _loop0_91_rule(Parser *p) |
33394 | 17.0k | { |
33395 | 17.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33396 | 0 | _Pypegen_stack_overflow(p); |
33397 | 0 | } |
33398 | 17.0k | if (p->error_indicator) { |
33399 | 0 | p->level--; |
33400 | 0 | return NULL; |
33401 | 0 | } |
33402 | 17.0k | void *_res = NULL; |
33403 | 17.0k | int _mark = p->mark; |
33404 | 17.0k | void **_children = PyMem_Malloc(sizeof(void *)); |
33405 | 17.0k | if (!_children) { |
33406 | 0 | p->error_indicator = 1; |
33407 | 0 | PyErr_NoMemory(); |
33408 | 0 | p->level--; |
33409 | 0 | return NULL; |
33410 | 0 | } |
33411 | 17.0k | Py_ssize_t _children_capacity = 1; |
33412 | 17.0k | Py_ssize_t _n = 0; |
33413 | 17.0k | { // ',' kwarg_or_starred |
33414 | 17.0k | if (p->error_indicator) { |
33415 | 0 | p->level--; |
33416 | 0 | return NULL; |
33417 | 0 | } |
33418 | 17.0k | D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); |
33419 | 17.0k | Token * _literal; |
33420 | 17.0k | KeywordOrStarred* elem; |
33421 | 17.0k | while ( |
33422 | 27.1k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
33423 | 15.7k | && |
33424 | 15.7k | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
33425 | 17.0k | ) |
33426 | 10.1k | { |
33427 | 10.1k | _res = elem; |
33428 | 10.1k | if (_res == NULL && PyErr_Occurred()) { |
33429 | 0 | p->error_indicator = 1; |
33430 | 0 | PyMem_Free(_children); |
33431 | 0 | p->level--; |
33432 | 0 | return NULL; |
33433 | 0 | } |
33434 | 10.1k | if (_n == _children_capacity) { |
33435 | 2.68k | _children_capacity *= 2; |
33436 | 2.68k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
33437 | 2.68k | if (!_new_children) { |
33438 | 0 | PyMem_Free(_children); |
33439 | 0 | p->error_indicator = 1; |
33440 | 0 | PyErr_NoMemory(); |
33441 | 0 | p->level--; |
33442 | 0 | return NULL; |
33443 | 0 | } |
33444 | 2.68k | _children = _new_children; |
33445 | 2.68k | } |
33446 | 10.1k | _children[_n++] = _res; |
33447 | 10.1k | _mark = p->mark; |
33448 | 10.1k | } |
33449 | 17.0k | p->mark = _mark; |
33450 | 17.0k | D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n", p->level, ' ', |
33451 | 17.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); |
33452 | 17.0k | } |
33453 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
33454 | 17.0k | if (!_seq) { |
33455 | 0 | PyMem_Free(_children); |
33456 | 0 | p->error_indicator = 1; |
33457 | 0 | PyErr_NoMemory(); |
33458 | 0 | p->level--; |
33459 | 0 | return NULL; |
33460 | 0 | } |
33461 | 27.1k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
33462 | 17.0k | PyMem_Free(_children); |
33463 | 17.0k | p->level--; |
33464 | 17.0k | return _seq; |
33465 | 17.0k | } |
33466 | | |
33467 | | // _gather_92: kwarg_or_starred _loop0_91 |
33468 | | static asdl_seq * |
33469 | | _gather_92_rule(Parser *p) |
33470 | 86.5k | { |
33471 | 86.5k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33472 | 0 | _Pypegen_stack_overflow(p); |
33473 | 0 | } |
33474 | 86.5k | if (p->error_indicator) { |
33475 | 0 | p->level--; |
33476 | 0 | return NULL; |
33477 | 0 | } |
33478 | 86.5k | asdl_seq * _res = NULL; |
33479 | 86.5k | int _mark = p->mark; |
33480 | 86.5k | { // kwarg_or_starred _loop0_91 |
33481 | 86.5k | if (p->error_indicator) { |
33482 | 0 | p->level--; |
33483 | 0 | return NULL; |
33484 | 0 | } |
33485 | 86.5k | D(fprintf(stderr, "%*c> _gather_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_91")); |
33486 | 86.5k | KeywordOrStarred* elem; |
33487 | 86.5k | asdl_seq * seq; |
33488 | 86.5k | if ( |
33489 | 86.5k | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
33490 | 17.0k | && |
33491 | 17.0k | (seq = _loop0_91_rule(p)) // _loop0_91 |
33492 | 86.5k | ) |
33493 | 17.0k | { |
33494 | 17.0k | D(fprintf(stderr, "%*c+ _gather_92[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_91")); |
33495 | 17.0k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
33496 | 17.0k | goto done; |
33497 | 17.0k | } |
33498 | 69.5k | p->mark = _mark; |
33499 | 69.5k | D(fprintf(stderr, "%*c%s _gather_92[%d-%d]: %s failed!\n", p->level, ' ', |
33500 | 69.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_91")); |
33501 | 69.5k | } |
33502 | 69.5k | _res = NULL; |
33503 | 86.5k | done: |
33504 | 86.5k | p->level--; |
33505 | 86.5k | return _res; |
33506 | 69.5k | } |
33507 | | |
33508 | | // _loop0_93: ',' kwarg_or_double_starred |
33509 | | static asdl_seq * |
33510 | | _loop0_93_rule(Parser *p) |
33511 | 4.47k | { |
33512 | 4.47k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33513 | 0 | _Pypegen_stack_overflow(p); |
33514 | 0 | } |
33515 | 4.47k | if (p->error_indicator) { |
33516 | 0 | p->level--; |
33517 | 0 | return NULL; |
33518 | 0 | } |
33519 | 4.47k | void *_res = NULL; |
33520 | 4.47k | int _mark = p->mark; |
33521 | 4.47k | void **_children = PyMem_Malloc(sizeof(void *)); |
33522 | 4.47k | if (!_children) { |
33523 | 0 | p->error_indicator = 1; |
33524 | 0 | PyErr_NoMemory(); |
33525 | 0 | p->level--; |
33526 | 0 | return NULL; |
33527 | 0 | } |
33528 | 4.47k | Py_ssize_t _children_capacity = 1; |
33529 | 4.47k | Py_ssize_t _n = 0; |
33530 | 4.47k | { // ',' kwarg_or_double_starred |
33531 | 4.47k | if (p->error_indicator) { |
33532 | 0 | p->level--; |
33533 | 0 | return NULL; |
33534 | 0 | } |
33535 | 4.47k | D(fprintf(stderr, "%*c> _loop0_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); |
33536 | 4.47k | Token * _literal; |
33537 | 4.47k | KeywordOrStarred* elem; |
33538 | 4.47k | while ( |
33539 | 11.9k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
33540 | 9.65k | && |
33541 | 9.65k | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
33542 | 4.47k | ) |
33543 | 7.47k | { |
33544 | 7.47k | _res = elem; |
33545 | 7.47k | if (_res == NULL && PyErr_Occurred()) { |
33546 | 0 | p->error_indicator = 1; |
33547 | 0 | PyMem_Free(_children); |
33548 | 0 | p->level--; |
33549 | 0 | return NULL; |
33550 | 0 | } |
33551 | 7.47k | if (_n == _children_capacity) { |
33552 | 1.11k | _children_capacity *= 2; |
33553 | 1.11k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
33554 | 1.11k | if (!_new_children) { |
33555 | 0 | PyMem_Free(_children); |
33556 | 0 | p->error_indicator = 1; |
33557 | 0 | PyErr_NoMemory(); |
33558 | 0 | p->level--; |
33559 | 0 | return NULL; |
33560 | 0 | } |
33561 | 1.11k | _children = _new_children; |
33562 | 1.11k | } |
33563 | 7.47k | _children[_n++] = _res; |
33564 | 7.47k | _mark = p->mark; |
33565 | 7.47k | } |
33566 | 4.47k | p->mark = _mark; |
33567 | 4.47k | D(fprintf(stderr, "%*c%s _loop0_93[%d-%d]: %s failed!\n", p->level, ' ', |
33568 | 4.47k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); |
33569 | 4.47k | } |
33570 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
33571 | 4.47k | if (!_seq) { |
33572 | 0 | PyMem_Free(_children); |
33573 | 0 | p->error_indicator = 1; |
33574 | 0 | PyErr_NoMemory(); |
33575 | 0 | p->level--; |
33576 | 0 | return NULL; |
33577 | 0 | } |
33578 | 11.9k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
33579 | 4.47k | PyMem_Free(_children); |
33580 | 4.47k | p->level--; |
33581 | 4.47k | return _seq; |
33582 | 4.47k | } |
33583 | | |
33584 | | // _gather_94: kwarg_or_double_starred _loop0_93 |
33585 | | static asdl_seq * |
33586 | | _gather_94_rule(Parser *p) |
33587 | 37.6k | { |
33588 | 37.6k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33589 | 0 | _Pypegen_stack_overflow(p); |
33590 | 0 | } |
33591 | 37.6k | if (p->error_indicator) { |
33592 | 269 | p->level--; |
33593 | 269 | return NULL; |
33594 | 269 | } |
33595 | 37.3k | asdl_seq * _res = NULL; |
33596 | 37.3k | int _mark = p->mark; |
33597 | 37.3k | { // kwarg_or_double_starred _loop0_93 |
33598 | 37.3k | if (p->error_indicator) { |
33599 | 0 | p->level--; |
33600 | 0 | return NULL; |
33601 | 0 | } |
33602 | 37.3k | D(fprintf(stderr, "%*c> _gather_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_93")); |
33603 | 37.3k | KeywordOrStarred* elem; |
33604 | 37.3k | asdl_seq * seq; |
33605 | 37.3k | if ( |
33606 | 37.3k | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
33607 | 4.47k | && |
33608 | 4.47k | (seq = _loop0_93_rule(p)) // _loop0_93 |
33609 | 37.3k | ) |
33610 | 4.47k | { |
33611 | 4.47k | D(fprintf(stderr, "%*c+ _gather_94[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_93")); |
33612 | 4.47k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
33613 | 4.47k | goto done; |
33614 | 4.47k | } |
33615 | 32.9k | p->mark = _mark; |
33616 | 32.9k | D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ', |
33617 | 32.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_93")); |
33618 | 32.9k | } |
33619 | 32.9k | _res = NULL; |
33620 | 37.3k | done: |
33621 | 37.3k | p->level--; |
33622 | 37.3k | return _res; |
33623 | 32.9k | } |
33624 | | |
33625 | | // _loop0_95: (',' star_target) |
33626 | | static asdl_seq * |
33627 | | _loop0_95_rule(Parser *p) |
33628 | 10.4k | { |
33629 | 10.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33630 | 0 | _Pypegen_stack_overflow(p); |
33631 | 0 | } |
33632 | 10.4k | if (p->error_indicator) { |
33633 | 0 | p->level--; |
33634 | 0 | return NULL; |
33635 | 0 | } |
33636 | 10.4k | void *_res = NULL; |
33637 | 10.4k | int _mark = p->mark; |
33638 | 10.4k | void **_children = PyMem_Malloc(sizeof(void *)); |
33639 | 10.4k | if (!_children) { |
33640 | 0 | p->error_indicator = 1; |
33641 | 0 | PyErr_NoMemory(); |
33642 | 0 | p->level--; |
33643 | 0 | return NULL; |
33644 | 0 | } |
33645 | 10.4k | Py_ssize_t _children_capacity = 1; |
33646 | 10.4k | Py_ssize_t _n = 0; |
33647 | 10.4k | { // (',' star_target) |
33648 | 10.4k | if (p->error_indicator) { |
33649 | 0 | p->level--; |
33650 | 0 | return NULL; |
33651 | 0 | } |
33652 | 10.4k | D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); |
33653 | 10.4k | void *_tmp_166_var; |
33654 | 10.4k | while ( |
33655 | 18.6k | (_tmp_166_var = _tmp_166_rule(p)) // ',' star_target |
33656 | 10.4k | ) |
33657 | 8.29k | { |
33658 | 8.29k | _res = _tmp_166_var; |
33659 | 8.29k | if (_n == _children_capacity) { |
33660 | 1.54k | _children_capacity *= 2; |
33661 | 1.54k | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
33662 | 1.54k | if (!_new_children) { |
33663 | 0 | PyMem_Free(_children); |
33664 | 0 | p->error_indicator = 1; |
33665 | 0 | PyErr_NoMemory(); |
33666 | 0 | p->level--; |
33667 | 0 | return NULL; |
33668 | 0 | } |
33669 | 1.54k | _children = _new_children; |
33670 | 1.54k | } |
33671 | 8.29k | _children[_n++] = _res; |
33672 | 8.29k | _mark = p->mark; |
33673 | 8.29k | } |
33674 | 10.4k | p->mark = _mark; |
33675 | 10.4k | D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ', |
33676 | 10.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); |
33677 | 10.4k | } |
33678 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
33679 | 10.4k | if (!_seq) { |
33680 | 0 | PyMem_Free(_children); |
33681 | 0 | p->error_indicator = 1; |
33682 | 0 | PyErr_NoMemory(); |
33683 | 0 | p->level--; |
33684 | 0 | return NULL; |
33685 | 0 | } |
33686 | 18.6k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
33687 | 10.4k | PyMem_Free(_children); |
33688 | 10.4k | p->level--; |
33689 | 10.4k | return _seq; |
33690 | 10.4k | } |
33691 | | |
33692 | | // _loop0_96: ',' star_target |
33693 | | static asdl_seq * |
33694 | | _loop0_96_rule(Parser *p) |
33695 | 2.25k | { |
33696 | 2.25k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33697 | 0 | _Pypegen_stack_overflow(p); |
33698 | 0 | } |
33699 | 2.25k | if (p->error_indicator) { |
33700 | 0 | p->level--; |
33701 | 0 | return NULL; |
33702 | 0 | } |
33703 | 2.25k | void *_res = NULL; |
33704 | 2.25k | int _mark = p->mark; |
33705 | 2.25k | void **_children = PyMem_Malloc(sizeof(void *)); |
33706 | 2.25k | if (!_children) { |
33707 | 0 | p->error_indicator = 1; |
33708 | 0 | PyErr_NoMemory(); |
33709 | 0 | p->level--; |
33710 | 0 | return NULL; |
33711 | 0 | } |
33712 | 2.25k | Py_ssize_t _children_capacity = 1; |
33713 | 2.25k | Py_ssize_t _n = 0; |
33714 | 2.25k | { // ',' star_target |
33715 | 2.25k | if (p->error_indicator) { |
33716 | 0 | p->level--; |
33717 | 0 | return NULL; |
33718 | 0 | } |
33719 | 2.25k | D(fprintf(stderr, "%*c> _loop0_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
33720 | 2.25k | Token * _literal; |
33721 | 2.25k | expr_ty elem; |
33722 | 2.25k | while ( |
33723 | 3.99k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
33724 | 2.41k | && |
33725 | 2.41k | (elem = star_target_rule(p)) // star_target |
33726 | 2.25k | ) |
33727 | 1.73k | { |
33728 | 1.73k | _res = elem; |
33729 | 1.73k | if (_res == NULL && PyErr_Occurred()) { |
33730 | 0 | p->error_indicator = 1; |
33731 | 0 | PyMem_Free(_children); |
33732 | 0 | p->level--; |
33733 | 0 | return NULL; |
33734 | 0 | } |
33735 | 1.73k | if (_n == _children_capacity) { |
33736 | 490 | _children_capacity *= 2; |
33737 | 490 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
33738 | 490 | if (!_new_children) { |
33739 | 0 | PyMem_Free(_children); |
33740 | 0 | p->error_indicator = 1; |
33741 | 0 | PyErr_NoMemory(); |
33742 | 0 | p->level--; |
33743 | 0 | return NULL; |
33744 | 0 | } |
33745 | 490 | _children = _new_children; |
33746 | 490 | } |
33747 | 1.73k | _children[_n++] = _res; |
33748 | 1.73k | _mark = p->mark; |
33749 | 1.73k | } |
33750 | 2.25k | p->mark = _mark; |
33751 | 2.25k | D(fprintf(stderr, "%*c%s _loop0_96[%d-%d]: %s failed!\n", p->level, ' ', |
33752 | 2.25k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); |
33753 | 2.25k | } |
33754 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
33755 | 2.25k | if (!_seq) { |
33756 | 0 | PyMem_Free(_children); |
33757 | 0 | p->error_indicator = 1; |
33758 | 0 | PyErr_NoMemory(); |
33759 | 0 | p->level--; |
33760 | 0 | return NULL; |
33761 | 0 | } |
33762 | 3.99k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
33763 | 2.25k | PyMem_Free(_children); |
33764 | 2.25k | p->level--; |
33765 | 2.25k | return _seq; |
33766 | 2.25k | } |
33767 | | |
33768 | | // _gather_97: star_target _loop0_96 |
33769 | | static asdl_seq * |
33770 | | _gather_97_rule(Parser *p) |
33771 | 6.05k | { |
33772 | 6.05k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33773 | 0 | _Pypegen_stack_overflow(p); |
33774 | 0 | } |
33775 | 6.05k | if (p->error_indicator) { |
33776 | 0 | p->level--; |
33777 | 0 | return NULL; |
33778 | 0 | } |
33779 | 6.05k | asdl_seq * _res = NULL; |
33780 | 6.05k | int _mark = p->mark; |
33781 | 6.05k | { // star_target _loop0_96 |
33782 | 6.05k | if (p->error_indicator) { |
33783 | 0 | p->level--; |
33784 | 0 | return NULL; |
33785 | 0 | } |
33786 | 6.05k | D(fprintf(stderr, "%*c> _gather_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_96")); |
33787 | 6.05k | expr_ty elem; |
33788 | 6.05k | asdl_seq * seq; |
33789 | 6.05k | if ( |
33790 | 6.05k | (elem = star_target_rule(p)) // star_target |
33791 | 2.25k | && |
33792 | 2.25k | (seq = _loop0_96_rule(p)) // _loop0_96 |
33793 | 6.05k | ) |
33794 | 2.25k | { |
33795 | 2.25k | D(fprintf(stderr, "%*c+ _gather_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_96")); |
33796 | 2.25k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
33797 | 2.25k | goto done; |
33798 | 2.25k | } |
33799 | 3.79k | p->mark = _mark; |
33800 | 3.79k | D(fprintf(stderr, "%*c%s _gather_97[%d-%d]: %s failed!\n", p->level, ' ', |
33801 | 3.79k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_96")); |
33802 | 3.79k | } |
33803 | 3.79k | _res = NULL; |
33804 | 6.05k | done: |
33805 | 6.05k | p->level--; |
33806 | 6.05k | return _res; |
33807 | 3.79k | } |
33808 | | |
33809 | | // _loop1_98: (',' star_target) |
33810 | | static asdl_seq * |
33811 | | _loop1_98_rule(Parser *p) |
33812 | 3.45k | { |
33813 | 3.45k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33814 | 0 | _Pypegen_stack_overflow(p); |
33815 | 0 | } |
33816 | 3.45k | if (p->error_indicator) { |
33817 | 0 | p->level--; |
33818 | 0 | return NULL; |
33819 | 0 | } |
33820 | 3.45k | void *_res = NULL; |
33821 | 3.45k | int _mark = p->mark; |
33822 | 3.45k | void **_children = PyMem_Malloc(sizeof(void *)); |
33823 | 3.45k | if (!_children) { |
33824 | 0 | p->error_indicator = 1; |
33825 | 0 | PyErr_NoMemory(); |
33826 | 0 | p->level--; |
33827 | 0 | return NULL; |
33828 | 0 | } |
33829 | 3.45k | Py_ssize_t _children_capacity = 1; |
33830 | 3.45k | Py_ssize_t _n = 0; |
33831 | 3.45k | { // (',' star_target) |
33832 | 3.45k | if (p->error_indicator) { |
33833 | 0 | p->level--; |
33834 | 0 | return NULL; |
33835 | 0 | } |
33836 | 3.45k | D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); |
33837 | 3.45k | void *_tmp_166_var; |
33838 | 3.45k | while ( |
33839 | 4.78k | (_tmp_166_var = _tmp_166_rule(p)) // ',' star_target |
33840 | 3.45k | ) |
33841 | 1.32k | { |
33842 | 1.32k | _res = _tmp_166_var; |
33843 | 1.32k | if (_n == _children_capacity) { |
33844 | 449 | _children_capacity *= 2; |
33845 | 449 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
33846 | 449 | if (!_new_children) { |
33847 | 0 | PyMem_Free(_children); |
33848 | 0 | p->error_indicator = 1; |
33849 | 0 | PyErr_NoMemory(); |
33850 | 0 | p->level--; |
33851 | 0 | return NULL; |
33852 | 0 | } |
33853 | 449 | _children = _new_children; |
33854 | 449 | } |
33855 | 1.32k | _children[_n++] = _res; |
33856 | 1.32k | _mark = p->mark; |
33857 | 1.32k | } |
33858 | 3.45k | p->mark = _mark; |
33859 | 3.45k | D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ', |
33860 | 3.45k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); |
33861 | 3.45k | } |
33862 | 3.45k | if (_n == 0 || p->error_indicator) { |
33863 | 2.91k | PyMem_Free(_children); |
33864 | 2.91k | p->level--; |
33865 | 2.91k | return NULL; |
33866 | 2.91k | } |
33867 | 539 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
33868 | 539 | if (!_seq) { |
33869 | 0 | PyMem_Free(_children); |
33870 | 0 | p->error_indicator = 1; |
33871 | 0 | PyErr_NoMemory(); |
33872 | 0 | p->level--; |
33873 | 0 | return NULL; |
33874 | 0 | } |
33875 | 1.86k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
33876 | 539 | PyMem_Free(_children); |
33877 | 539 | p->level--; |
33878 | 539 | return _seq; |
33879 | 539 | } |
33880 | | |
33881 | | // _tmp_99: !'*' star_target |
33882 | | static void * |
33883 | | _tmp_99_rule(Parser *p) |
33884 | 2.93k | { |
33885 | 2.93k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33886 | 0 | _Pypegen_stack_overflow(p); |
33887 | 0 | } |
33888 | 2.93k | if (p->error_indicator) { |
33889 | 0 | p->level--; |
33890 | 0 | return NULL; |
33891 | 0 | } |
33892 | 2.93k | void * _res = NULL; |
33893 | 2.93k | int _mark = p->mark; |
33894 | 2.93k | { // !'*' star_target |
33895 | 2.93k | if (p->error_indicator) { |
33896 | 0 | p->level--; |
33897 | 0 | return NULL; |
33898 | 0 | } |
33899 | 2.93k | D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); |
33900 | 2.93k | expr_ty star_target_var; |
33901 | 2.93k | if ( |
33902 | 2.93k | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' |
33903 | 2.92k | && |
33904 | 2.92k | (star_target_var = star_target_rule(p)) // star_target |
33905 | 2.93k | ) |
33906 | 1.74k | { |
33907 | 1.74k | D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); |
33908 | 1.74k | _res = star_target_var; |
33909 | 1.74k | goto done; |
33910 | 1.74k | } |
33911 | 1.18k | p->mark = _mark; |
33912 | 1.18k | D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ', |
33913 | 1.18k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); |
33914 | 1.18k | } |
33915 | 1.18k | _res = NULL; |
33916 | 2.93k | done: |
33917 | 2.93k | p->level--; |
33918 | 2.93k | return _res; |
33919 | 1.18k | } |
33920 | | |
33921 | | // _loop0_100: ',' del_target |
33922 | | static asdl_seq * |
33923 | | _loop0_100_rule(Parser *p) |
33924 | 2.55k | { |
33925 | 2.55k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
33926 | 0 | _Pypegen_stack_overflow(p); |
33927 | 0 | } |
33928 | 2.55k | if (p->error_indicator) { |
33929 | 0 | p->level--; |
33930 | 0 | return NULL; |
33931 | 0 | } |
33932 | 2.55k | void *_res = NULL; |
33933 | 2.55k | int _mark = p->mark; |
33934 | 2.55k | void **_children = PyMem_Malloc(sizeof(void *)); |
33935 | 2.55k | if (!_children) { |
33936 | 0 | p->error_indicator = 1; |
33937 | 0 | PyErr_NoMemory(); |
33938 | 0 | p->level--; |
33939 | 0 | return NULL; |
33940 | 0 | } |
33941 | 2.55k | Py_ssize_t _children_capacity = 1; |
33942 | 2.55k | Py_ssize_t _n = 0; |
33943 | 2.55k | { // ',' del_target |
33944 | 2.55k | if (p->error_indicator) { |
33945 | 0 | p->level--; |
33946 | 0 | return NULL; |
33947 | 0 | } |
33948 | 2.55k | D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); |
33949 | 2.55k | Token * _literal; |
33950 | 2.55k | expr_ty elem; |
33951 | 2.55k | while ( |
33952 | 5.72k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
33953 | 3.84k | && |
33954 | 3.84k | (elem = del_target_rule(p)) // del_target |
33955 | 2.55k | ) |
33956 | 3.17k | { |
33957 | 3.17k | _res = elem; |
33958 | 3.17k | if (_res == NULL && PyErr_Occurred()) { |
33959 | 0 | p->error_indicator = 1; |
33960 | 0 | PyMem_Free(_children); |
33961 | 0 | p->level--; |
33962 | 0 | return NULL; |
33963 | 0 | } |
33964 | 3.17k | if (_n == _children_capacity) { |
33965 | 967 | _children_capacity *= 2; |
33966 | 967 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
33967 | 967 | if (!_new_children) { |
33968 | 0 | PyMem_Free(_children); |
33969 | 0 | p->error_indicator = 1; |
33970 | 0 | PyErr_NoMemory(); |
33971 | 0 | p->level--; |
33972 | 0 | return NULL; |
33973 | 0 | } |
33974 | 967 | _children = _new_children; |
33975 | 967 | } |
33976 | 3.17k | _children[_n++] = _res; |
33977 | 3.17k | _mark = p->mark; |
33978 | 3.17k | } |
33979 | 2.55k | p->mark = _mark; |
33980 | 2.55k | D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', |
33981 | 2.55k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); |
33982 | 2.55k | } |
33983 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
33984 | 2.55k | if (!_seq) { |
33985 | 0 | PyMem_Free(_children); |
33986 | 0 | p->error_indicator = 1; |
33987 | 0 | PyErr_NoMemory(); |
33988 | 0 | p->level--; |
33989 | 0 | return NULL; |
33990 | 0 | } |
33991 | 5.72k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
33992 | 2.55k | PyMem_Free(_children); |
33993 | 2.55k | p->level--; |
33994 | 2.55k | return _seq; |
33995 | 2.55k | } |
33996 | | |
33997 | | // _gather_101: del_target _loop0_100 |
33998 | | static asdl_seq * |
33999 | | _gather_101_rule(Parser *p) |
34000 | 4.97k | { |
34001 | 4.97k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34002 | 0 | _Pypegen_stack_overflow(p); |
34003 | 0 | } |
34004 | 4.97k | if (p->error_indicator) { |
34005 | 0 | p->level--; |
34006 | 0 | return NULL; |
34007 | 0 | } |
34008 | 4.97k | asdl_seq * _res = NULL; |
34009 | 4.97k | int _mark = p->mark; |
34010 | 4.97k | { // del_target _loop0_100 |
34011 | 4.97k | if (p->error_indicator) { |
34012 | 0 | p->level--; |
34013 | 0 | return NULL; |
34014 | 0 | } |
34015 | 4.97k | D(fprintf(stderr, "%*c> _gather_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_100")); |
34016 | 4.97k | expr_ty elem; |
34017 | 4.97k | asdl_seq * seq; |
34018 | 4.97k | if ( |
34019 | 4.97k | (elem = del_target_rule(p)) // del_target |
34020 | 2.55k | && |
34021 | 2.55k | (seq = _loop0_100_rule(p)) // _loop0_100 |
34022 | 4.97k | ) |
34023 | 2.55k | { |
34024 | 2.55k | D(fprintf(stderr, "%*c+ _gather_101[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_100")); |
34025 | 2.55k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
34026 | 2.55k | goto done; |
34027 | 2.55k | } |
34028 | 2.42k | p->mark = _mark; |
34029 | 2.42k | D(fprintf(stderr, "%*c%s _gather_101[%d-%d]: %s failed!\n", p->level, ' ', |
34030 | 2.42k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_100")); |
34031 | 2.42k | } |
34032 | 2.42k | _res = NULL; |
34033 | 4.97k | done: |
34034 | 4.97k | p->level--; |
34035 | 4.97k | return _res; |
34036 | 2.42k | } |
34037 | | |
34038 | | // _loop0_102: ',' expression |
34039 | | static asdl_seq * |
34040 | | _loop0_102_rule(Parser *p) |
34041 | 0 | { |
34042 | 0 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34043 | 0 | _Pypegen_stack_overflow(p); |
34044 | 0 | } |
34045 | 0 | if (p->error_indicator) { |
34046 | 0 | p->level--; |
34047 | 0 | return NULL; |
34048 | 0 | } |
34049 | 0 | void *_res = NULL; |
34050 | 0 | int _mark = p->mark; |
34051 | 0 | void **_children = PyMem_Malloc(sizeof(void *)); |
34052 | 0 | if (!_children) { |
34053 | 0 | p->error_indicator = 1; |
34054 | 0 | PyErr_NoMemory(); |
34055 | 0 | p->level--; |
34056 | 0 | return NULL; |
34057 | 0 | } |
34058 | 0 | Py_ssize_t _children_capacity = 1; |
34059 | 0 | Py_ssize_t _n = 0; |
34060 | 0 | { // ',' expression |
34061 | 0 | if (p->error_indicator) { |
34062 | 0 | p->level--; |
34063 | 0 | return NULL; |
34064 | 0 | } |
34065 | 0 | D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
34066 | 0 | Token * _literal; |
34067 | 0 | expr_ty elem; |
34068 | 0 | while ( |
34069 | 0 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
34070 | 0 | && |
34071 | 0 | (elem = expression_rule(p)) // expression |
34072 | 0 | ) |
34073 | 0 | { |
34074 | 0 | _res = elem; |
34075 | 0 | if (_res == NULL && PyErr_Occurred()) { |
34076 | 0 | p->error_indicator = 1; |
34077 | 0 | PyMem_Free(_children); |
34078 | 0 | p->level--; |
34079 | 0 | return NULL; |
34080 | 0 | } |
34081 | 0 | if (_n == _children_capacity) { |
34082 | 0 | _children_capacity *= 2; |
34083 | 0 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
34084 | 0 | if (!_new_children) { |
34085 | 0 | PyMem_Free(_children); |
34086 | 0 | p->error_indicator = 1; |
34087 | 0 | PyErr_NoMemory(); |
34088 | 0 | p->level--; |
34089 | 0 | return NULL; |
34090 | 0 | } |
34091 | 0 | _children = _new_children; |
34092 | 0 | } |
34093 | 0 | _children[_n++] = _res; |
34094 | 0 | _mark = p->mark; |
34095 | 0 | } |
34096 | 0 | p->mark = _mark; |
34097 | 0 | D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', |
34098 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
34099 | 0 | } |
34100 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
34101 | 0 | if (!_seq) { |
34102 | 0 | PyMem_Free(_children); |
34103 | 0 | p->error_indicator = 1; |
34104 | 0 | PyErr_NoMemory(); |
34105 | 0 | p->level--; |
34106 | 0 | return NULL; |
34107 | 0 | } |
34108 | 0 | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
34109 | 0 | PyMem_Free(_children); |
34110 | 0 | p->level--; |
34111 | 0 | return _seq; |
34112 | 0 | } |
34113 | | |
34114 | | // _gather_103: expression _loop0_102 |
34115 | | static asdl_seq * |
34116 | | _gather_103_rule(Parser *p) |
34117 | 0 | { |
34118 | 0 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34119 | 0 | _Pypegen_stack_overflow(p); |
34120 | 0 | } |
34121 | 0 | if (p->error_indicator) { |
34122 | 0 | p->level--; |
34123 | 0 | return NULL; |
34124 | 0 | } |
34125 | 0 | asdl_seq * _res = NULL; |
34126 | 0 | int _mark = p->mark; |
34127 | 0 | { // expression _loop0_102 |
34128 | 0 | if (p->error_indicator) { |
34129 | 0 | p->level--; |
34130 | 0 | return NULL; |
34131 | 0 | } |
34132 | 0 | D(fprintf(stderr, "%*c> _gather_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_102")); |
34133 | 0 | expr_ty elem; |
34134 | 0 | asdl_seq * seq; |
34135 | 0 | if ( |
34136 | 0 | (elem = expression_rule(p)) // expression |
34137 | 0 | && |
34138 | 0 | (seq = _loop0_102_rule(p)) // _loop0_102 |
34139 | 0 | ) |
34140 | 0 | { |
34141 | 0 | D(fprintf(stderr, "%*c+ _gather_103[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_102")); |
34142 | 0 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
34143 | 0 | goto done; |
34144 | 0 | } |
34145 | 0 | p->mark = _mark; |
34146 | 0 | D(fprintf(stderr, "%*c%s _gather_103[%d-%d]: %s failed!\n", p->level, ' ', |
34147 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_102")); |
34148 | 0 | } |
34149 | 0 | _res = NULL; |
34150 | 0 | done: |
34151 | 0 | p->level--; |
34152 | 0 | return _res; |
34153 | 0 | } |
34154 | | |
34155 | | // _tmp_104: NEWLINE INDENT |
34156 | | static void * |
34157 | | _tmp_104_rule(Parser *p) |
34158 | 0 | { |
34159 | 0 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34160 | 0 | _Pypegen_stack_overflow(p); |
34161 | 0 | } |
34162 | 0 | if (p->error_indicator) { |
34163 | 0 | p->level--; |
34164 | 0 | return NULL; |
34165 | 0 | } |
34166 | 0 | void * _res = NULL; |
34167 | 0 | int _mark = p->mark; |
34168 | 0 | { // NEWLINE INDENT |
34169 | 0 | if (p->error_indicator) { |
34170 | 0 | p->level--; |
34171 | 0 | return NULL; |
34172 | 0 | } |
34173 | 0 | D(fprintf(stderr, "%*c> _tmp_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); |
34174 | 0 | Token * indent_var; |
34175 | 0 | Token * newline_var; |
34176 | 0 | if ( |
34177 | 0 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
34178 | 0 | && |
34179 | 0 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
34180 | 0 | ) |
34181 | 0 | { |
34182 | 0 | D(fprintf(stderr, "%*c+ _tmp_104[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); |
34183 | 0 | _res = _PyPegen_dummy_name(p, newline_var, indent_var); |
34184 | 0 | goto done; |
34185 | 0 | } |
34186 | 0 | p->mark = _mark; |
34187 | 0 | D(fprintf(stderr, "%*c%s _tmp_104[%d-%d]: %s failed!\n", p->level, ' ', |
34188 | 0 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); |
34189 | 0 | } |
34190 | 0 | _res = NULL; |
34191 | 0 | done: |
34192 | 0 | p->level--; |
34193 | 0 | return _res; |
34194 | 0 | } |
34195 | | |
34196 | | // _tmp_105: |
34197 | | // | (','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) |
34198 | | // | kwargs |
34199 | | static void * |
34200 | | _tmp_105_rule(Parser *p) |
34201 | 6.88k | { |
34202 | 6.88k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34203 | 0 | _Pypegen_stack_overflow(p); |
34204 | 0 | } |
34205 | 6.88k | if (p->error_indicator) { |
34206 | 0 | p->level--; |
34207 | 0 | return NULL; |
34208 | 0 | } |
34209 | 6.88k | void * _res = NULL; |
34210 | 6.88k | int _mark = p->mark; |
34211 | 6.88k | { // (','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) |
34212 | 6.88k | if (p->error_indicator) { |
34213 | 0 | p->level--; |
34214 | 0 | return NULL; |
34215 | 0 | } |
34216 | 6.88k | D(fprintf(stderr, "%*c> _tmp_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)")); |
34217 | 6.88k | void *_tmp_167_var; |
34218 | 6.88k | if ( |
34219 | 6.88k | (_tmp_167_var = _tmp_167_rule(p)) // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs |
34220 | 6.88k | ) |
34221 | 333 | { |
34222 | 333 | D(fprintf(stderr, "%*c+ _tmp_105[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)")); |
34223 | 333 | _res = _tmp_167_var; |
34224 | 333 | goto done; |
34225 | 333 | } |
34226 | 6.54k | p->mark = _mark; |
34227 | 6.54k | D(fprintf(stderr, "%*c%s _tmp_105[%d-%d]: %s failed!\n", p->level, ' ', |
34228 | 6.54k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs)")); |
34229 | 6.54k | } |
34230 | 0 | { // kwargs |
34231 | 6.54k | if (p->error_indicator) { |
34232 | 0 | p->level--; |
34233 | 0 | return NULL; |
34234 | 0 | } |
34235 | 6.54k | D(fprintf(stderr, "%*c> _tmp_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs")); |
34236 | 6.54k | asdl_seq* kwargs_var; |
34237 | 6.54k | if ( |
34238 | 6.54k | (kwargs_var = kwargs_rule(p)) // kwargs |
34239 | 6.54k | ) |
34240 | 2.20k | { |
34241 | 2.20k | D(fprintf(stderr, "%*c+ _tmp_105[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs")); |
34242 | 2.20k | _res = kwargs_var; |
34243 | 2.20k | goto done; |
34244 | 2.20k | } |
34245 | 4.34k | p->mark = _mark; |
34246 | 4.34k | D(fprintf(stderr, "%*c%s _tmp_105[%d-%d]: %s failed!\n", p->level, ' ', |
34247 | 4.34k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs")); |
34248 | 4.34k | } |
34249 | 4.34k | _res = NULL; |
34250 | 6.88k | done: |
34251 | 6.88k | p->level--; |
34252 | 6.88k | return _res; |
34253 | 4.34k | } |
34254 | | |
34255 | | // _loop0_106: ',' (starred_expression !'=') |
34256 | | static asdl_seq * |
34257 | | _loop0_106_rule(Parser *p) |
34258 | 497 | { |
34259 | 497 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34260 | 0 | _Pypegen_stack_overflow(p); |
34261 | 0 | } |
34262 | 497 | if (p->error_indicator) { |
34263 | 0 | p->level--; |
34264 | 0 | return NULL; |
34265 | 0 | } |
34266 | 497 | void *_res = NULL; |
34267 | 497 | int _mark = p->mark; |
34268 | 497 | void **_children = PyMem_Malloc(sizeof(void *)); |
34269 | 497 | if (!_children) { |
34270 | 0 | p->error_indicator = 1; |
34271 | 0 | PyErr_NoMemory(); |
34272 | 0 | p->level--; |
34273 | 0 | return NULL; |
34274 | 0 | } |
34275 | 497 | Py_ssize_t _children_capacity = 1; |
34276 | 497 | Py_ssize_t _n = 0; |
34277 | 497 | { // ',' (starred_expression !'=') |
34278 | 497 | if (p->error_indicator) { |
34279 | 0 | p->level--; |
34280 | 0 | return NULL; |
34281 | 0 | } |
34282 | 497 | D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression !'=')")); |
34283 | 497 | Token * _literal; |
34284 | 497 | void *elem; |
34285 | 497 | while ( |
34286 | 1.09k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
34287 | 1.09k | && |
34288 | 1.09k | (elem = _tmp_168_rule(p)) // starred_expression !'=' |
34289 | 497 | ) |
34290 | 598 | { |
34291 | 598 | _res = elem; |
34292 | 598 | if (_res == NULL && PyErr_Occurred()) { |
34293 | 0 | p->error_indicator = 1; |
34294 | 0 | PyMem_Free(_children); |
34295 | 0 | p->level--; |
34296 | 0 | return NULL; |
34297 | 0 | } |
34298 | 598 | if (_n == _children_capacity) { |
34299 | 129 | _children_capacity *= 2; |
34300 | 129 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
34301 | 129 | if (!_new_children) { |
34302 | 0 | PyMem_Free(_children); |
34303 | 0 | p->error_indicator = 1; |
34304 | 0 | PyErr_NoMemory(); |
34305 | 0 | p->level--; |
34306 | 0 | return NULL; |
34307 | 0 | } |
34308 | 129 | _children = _new_children; |
34309 | 129 | } |
34310 | 598 | _children[_n++] = _res; |
34311 | 598 | _mark = p->mark; |
34312 | 598 | } |
34313 | 497 | p->mark = _mark; |
34314 | 497 | D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ', |
34315 | 497 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression !'=')")); |
34316 | 497 | } |
34317 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
34318 | 497 | if (!_seq) { |
34319 | 0 | PyMem_Free(_children); |
34320 | 0 | p->error_indicator = 1; |
34321 | 0 | PyErr_NoMemory(); |
34322 | 0 | p->level--; |
34323 | 0 | return NULL; |
34324 | 0 | } |
34325 | 1.09k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
34326 | 497 | PyMem_Free(_children); |
34327 | 497 | p->level--; |
34328 | 497 | return _seq; |
34329 | 497 | } |
34330 | | |
34331 | | // _gather_107: (starred_expression !'=') _loop0_106 |
34332 | | static asdl_seq * |
34333 | | _gather_107_rule(Parser *p) |
34334 | 1.29k | { |
34335 | 1.29k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34336 | 0 | _Pypegen_stack_overflow(p); |
34337 | 0 | } |
34338 | 1.29k | if (p->error_indicator) { |
34339 | 0 | p->level--; |
34340 | 0 | return NULL; |
34341 | 0 | } |
34342 | 1.29k | asdl_seq * _res = NULL; |
34343 | 1.29k | int _mark = p->mark; |
34344 | 1.29k | { // (starred_expression !'=') _loop0_106 |
34345 | 1.29k | if (p->error_indicator) { |
34346 | 0 | p->level--; |
34347 | 0 | return NULL; |
34348 | 0 | } |
34349 | 1.29k | D(fprintf(stderr, "%*c> _gather_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression !'=') _loop0_106")); |
34350 | 1.29k | void *elem; |
34351 | 1.29k | asdl_seq * seq; |
34352 | 1.29k | if ( |
34353 | 1.29k | (elem = _tmp_168_rule(p)) // starred_expression !'=' |
34354 | 497 | && |
34355 | 497 | (seq = _loop0_106_rule(p)) // _loop0_106 |
34356 | 1.29k | ) |
34357 | 497 | { |
34358 | 497 | D(fprintf(stderr, "%*c+ _gather_107[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression !'=') _loop0_106")); |
34359 | 497 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
34360 | 497 | goto done; |
34361 | 497 | } |
34362 | 794 | p->mark = _mark; |
34363 | 794 | D(fprintf(stderr, "%*c%s _gather_107[%d-%d]: %s failed!\n", p->level, ' ', |
34364 | 794 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression !'=') _loop0_106")); |
34365 | 794 | } |
34366 | 794 | _res = NULL; |
34367 | 1.29k | done: |
34368 | 1.29k | p->level--; |
34369 | 1.29k | return _res; |
34370 | 794 | } |
34371 | | |
34372 | | // _tmp_108: args | expression for_if_clauses |
34373 | | static void * |
34374 | | _tmp_108_rule(Parser *p) |
34375 | 149 | { |
34376 | 149 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34377 | 0 | _Pypegen_stack_overflow(p); |
34378 | 0 | } |
34379 | 149 | if (p->error_indicator) { |
34380 | 0 | p->level--; |
34381 | 0 | return NULL; |
34382 | 0 | } |
34383 | 149 | void * _res = NULL; |
34384 | 149 | int _mark = p->mark; |
34385 | 149 | { // args |
34386 | 149 | if (p->error_indicator) { |
34387 | 0 | p->level--; |
34388 | 0 | return NULL; |
34389 | 0 | } |
34390 | 149 | D(fprintf(stderr, "%*c> _tmp_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); |
34391 | 149 | expr_ty args_var; |
34392 | 149 | if ( |
34393 | 149 | (args_var = args_rule(p)) // args |
34394 | 149 | ) |
34395 | 97 | { |
34396 | 97 | D(fprintf(stderr, "%*c+ _tmp_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); |
34397 | 97 | _res = args_var; |
34398 | 97 | goto done; |
34399 | 97 | } |
34400 | 52 | p->mark = _mark; |
34401 | 52 | D(fprintf(stderr, "%*c%s _tmp_108[%d-%d]: %s failed!\n", p->level, ' ', |
34402 | 52 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); |
34403 | 52 | } |
34404 | 0 | { // expression for_if_clauses |
34405 | 52 | if (p->error_indicator) { |
34406 | 49 | p->level--; |
34407 | 49 | return NULL; |
34408 | 49 | } |
34409 | 3 | D(fprintf(stderr, "%*c> _tmp_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); |
34410 | 3 | expr_ty expression_var; |
34411 | 3 | asdl_comprehension_seq* for_if_clauses_var; |
34412 | 3 | if ( |
34413 | 3 | (expression_var = expression_rule(p)) // expression |
34414 | 1 | && |
34415 | 1 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
34416 | 3 | ) |
34417 | 0 | { |
34418 | 0 | D(fprintf(stderr, "%*c+ _tmp_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); |
34419 | 0 | _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); |
34420 | 0 | goto done; |
34421 | 0 | } |
34422 | 3 | p->mark = _mark; |
34423 | 3 | D(fprintf(stderr, "%*c%s _tmp_108[%d-%d]: %s failed!\n", p->level, ' ', |
34424 | 3 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); |
34425 | 3 | } |
34426 | 3 | _res = NULL; |
34427 | 100 | done: |
34428 | 100 | p->level--; |
34429 | 100 | return _res; |
34430 | 3 | } |
34431 | | |
34432 | | // _tmp_109: args ',' |
34433 | | static void * |
34434 | | _tmp_109_rule(Parser *p) |
34435 | 6.02k | { |
34436 | 6.02k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34437 | 0 | _Pypegen_stack_overflow(p); |
34438 | 0 | } |
34439 | 6.02k | if (p->error_indicator) { |
34440 | 0 | p->level--; |
34441 | 0 | return NULL; |
34442 | 0 | } |
34443 | 6.02k | void * _res = NULL; |
34444 | 6.02k | int _mark = p->mark; |
34445 | 6.02k | { // args ',' |
34446 | 6.02k | if (p->error_indicator) { |
34447 | 0 | p->level--; |
34448 | 0 | return NULL; |
34449 | 0 | } |
34450 | 6.02k | D(fprintf(stderr, "%*c> _tmp_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','")); |
34451 | 6.02k | Token * _literal; |
34452 | 6.02k | expr_ty args_var; |
34453 | 6.02k | if ( |
34454 | 6.02k | (args_var = args_rule(p)) // args |
34455 | 3.35k | && |
34456 | 3.35k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
34457 | 6.02k | ) |
34458 | 539 | { |
34459 | 539 | D(fprintf(stderr, "%*c+ _tmp_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','")); |
34460 | 539 | _res = _PyPegen_dummy_name(p, args_var, _literal); |
34461 | 539 | goto done; |
34462 | 539 | } |
34463 | 5.48k | p->mark = _mark; |
34464 | 5.48k | D(fprintf(stderr, "%*c%s _tmp_109[%d-%d]: %s failed!\n", p->level, ' ', |
34465 | 5.48k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','")); |
34466 | 5.48k | } |
34467 | 5.48k | _res = NULL; |
34468 | 6.02k | done: |
34469 | 6.02k | p->level--; |
34470 | 6.02k | return _res; |
34471 | 5.48k | } |
34472 | | |
34473 | | // _tmp_110: ',' | ')' |
34474 | | static void * |
34475 | | _tmp_110_rule(Parser *p) |
34476 | 545 | { |
34477 | 545 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34478 | 0 | _Pypegen_stack_overflow(p); |
34479 | 0 | } |
34480 | 545 | if (p->error_indicator) { |
34481 | 0 | p->level--; |
34482 | 0 | return NULL; |
34483 | 0 | } |
34484 | 545 | void * _res = NULL; |
34485 | 545 | int _mark = p->mark; |
34486 | 545 | { // ',' |
34487 | 545 | if (p->error_indicator) { |
34488 | 0 | p->level--; |
34489 | 0 | return NULL; |
34490 | 0 | } |
34491 | 545 | D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
34492 | 545 | Token * _literal; |
34493 | 545 | if ( |
34494 | 545 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
34495 | 545 | ) |
34496 | 9 | { |
34497 | 9 | D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
34498 | 9 | _res = _literal; |
34499 | 9 | goto done; |
34500 | 9 | } |
34501 | 536 | p->mark = _mark; |
34502 | 536 | D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ', |
34503 | 536 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
34504 | 536 | } |
34505 | 0 | { // ')' |
34506 | 536 | if (p->error_indicator) { |
34507 | 0 | p->level--; |
34508 | 0 | return NULL; |
34509 | 0 | } |
34510 | 536 | D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
34511 | 536 | Token * _literal; |
34512 | 536 | if ( |
34513 | 536 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
34514 | 536 | ) |
34515 | 4 | { |
34516 | 4 | D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
34517 | 4 | _res = _literal; |
34518 | 4 | goto done; |
34519 | 4 | } |
34520 | 532 | p->mark = _mark; |
34521 | 532 | D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ', |
34522 | 532 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
34523 | 532 | } |
34524 | 532 | _res = NULL; |
34525 | 545 | done: |
34526 | 545 | p->level--; |
34527 | 545 | return _res; |
34528 | 532 | } |
34529 | | |
34530 | | // _tmp_111: 'True' | 'False' | 'None' |
34531 | | static void * |
34532 | | _tmp_111_rule(Parser *p) |
34533 | 99.2k | { |
34534 | 99.2k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34535 | 0 | _Pypegen_stack_overflow(p); |
34536 | 0 | } |
34537 | 99.2k | if (p->error_indicator) { |
34538 | 0 | p->level--; |
34539 | 0 | return NULL; |
34540 | 0 | } |
34541 | 99.2k | void * _res = NULL; |
34542 | 99.2k | int _mark = p->mark; |
34543 | 99.2k | { // 'True' |
34544 | 99.2k | if (p->error_indicator) { |
34545 | 0 | p->level--; |
34546 | 0 | return NULL; |
34547 | 0 | } |
34548 | 99.2k | D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); |
34549 | 99.2k | Token * _keyword; |
34550 | 99.2k | if ( |
34551 | 99.2k | (_keyword = _PyPegen_expect_token(p, 623)) // token='True' |
34552 | 99.2k | ) |
34553 | 219 | { |
34554 | 219 | D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); |
34555 | 219 | _res = _keyword; |
34556 | 219 | goto done; |
34557 | 219 | } |
34558 | 99.0k | p->mark = _mark; |
34559 | 99.0k | D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ', |
34560 | 99.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); |
34561 | 99.0k | } |
34562 | 0 | { // 'False' |
34563 | 99.0k | if (p->error_indicator) { |
34564 | 0 | p->level--; |
34565 | 0 | return NULL; |
34566 | 0 | } |
34567 | 99.0k | D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); |
34568 | 99.0k | Token * _keyword; |
34569 | 99.0k | if ( |
34570 | 99.0k | (_keyword = _PyPegen_expect_token(p, 625)) // token='False' |
34571 | 99.0k | ) |
34572 | 207 | { |
34573 | 207 | D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); |
34574 | 207 | _res = _keyword; |
34575 | 207 | goto done; |
34576 | 207 | } |
34577 | 98.8k | p->mark = _mark; |
34578 | 98.8k | D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ', |
34579 | 98.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); |
34580 | 98.8k | } |
34581 | 0 | { // 'None' |
34582 | 98.8k | if (p->error_indicator) { |
34583 | 0 | p->level--; |
34584 | 0 | return NULL; |
34585 | 0 | } |
34586 | 98.8k | D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); |
34587 | 98.8k | Token * _keyword; |
34588 | 98.8k | if ( |
34589 | 98.8k | (_keyword = _PyPegen_expect_token(p, 624)) // token='None' |
34590 | 98.8k | ) |
34591 | 77 | { |
34592 | 77 | D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); |
34593 | 77 | _res = _keyword; |
34594 | 77 | goto done; |
34595 | 77 | } |
34596 | 98.7k | p->mark = _mark; |
34597 | 98.7k | D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ', |
34598 | 98.7k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); |
34599 | 98.7k | } |
34600 | 98.7k | _res = NULL; |
34601 | 99.2k | done: |
34602 | 99.2k | p->level--; |
34603 | 99.2k | return _res; |
34604 | 98.7k | } |
34605 | | |
34606 | | // _tmp_112: NAME '=' |
34607 | | static void * |
34608 | | _tmp_112_rule(Parser *p) |
34609 | 98.8k | { |
34610 | 98.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34611 | 0 | _Pypegen_stack_overflow(p); |
34612 | 0 | } |
34613 | 98.8k | if (p->error_indicator) { |
34614 | 0 | p->level--; |
34615 | 0 | return NULL; |
34616 | 0 | } |
34617 | 98.8k | void * _res = NULL; |
34618 | 98.8k | int _mark = p->mark; |
34619 | 98.8k | { // NAME '=' |
34620 | 98.8k | if (p->error_indicator) { |
34621 | 0 | p->level--; |
34622 | 0 | return NULL; |
34623 | 0 | } |
34624 | 98.8k | D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '='")); |
34625 | 98.8k | Token * _literal; |
34626 | 98.8k | expr_ty name_var; |
34627 | 98.8k | if ( |
34628 | 98.8k | (name_var = _PyPegen_name_token(p)) // NAME |
34629 | 29.3k | && |
34630 | 29.3k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
34631 | 98.8k | ) |
34632 | 18.9k | { |
34633 | 18.9k | D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '='")); |
34634 | 18.9k | _res = _PyPegen_dummy_name(p, name_var, _literal); |
34635 | 18.9k | goto done; |
34636 | 18.9k | } |
34637 | 79.9k | p->mark = _mark; |
34638 | 79.9k | D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ', |
34639 | 79.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '='")); |
34640 | 79.9k | } |
34641 | 79.9k | _res = NULL; |
34642 | 98.8k | done: |
34643 | 98.8k | p->level--; |
34644 | 98.8k | return _res; |
34645 | 79.9k | } |
34646 | | |
34647 | | // _loop1_113: (!STRING expression_without_invalid) |
34648 | | static asdl_seq * |
34649 | | _loop1_113_rule(Parser *p) |
34650 | 3.38k | { |
34651 | 3.38k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34652 | 1 | _Pypegen_stack_overflow(p); |
34653 | 1 | } |
34654 | 3.38k | if (p->error_indicator) { |
34655 | 1 | p->level--; |
34656 | 1 | return NULL; |
34657 | 1 | } |
34658 | 3.38k | void *_res = NULL; |
34659 | 3.38k | int _mark = p->mark; |
34660 | 3.38k | void **_children = PyMem_Malloc(sizeof(void *)); |
34661 | 3.38k | if (!_children) { |
34662 | 0 | p->error_indicator = 1; |
34663 | 0 | PyErr_NoMemory(); |
34664 | 0 | p->level--; |
34665 | 0 | return NULL; |
34666 | 0 | } |
34667 | 3.38k | Py_ssize_t _children_capacity = 1; |
34668 | 3.38k | Py_ssize_t _n = 0; |
34669 | 3.38k | { // (!STRING expression_without_invalid) |
34670 | 3.38k | if (p->error_indicator) { |
34671 | 0 | p->level--; |
34672 | 0 | return NULL; |
34673 | 0 | } |
34674 | 3.38k | D(fprintf(stderr, "%*c> _loop1_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(!STRING expression_without_invalid)")); |
34675 | 3.38k | void *_tmp_169_var; |
34676 | 3.38k | while ( |
34677 | 5.91k | (_tmp_169_var = _tmp_169_rule(p)) // !STRING expression_without_invalid |
34678 | 3.38k | ) |
34679 | 2.53k | { |
34680 | 2.53k | _res = _tmp_169_var; |
34681 | 2.53k | if (_n == _children_capacity) { |
34682 | 735 | _children_capacity *= 2; |
34683 | 735 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
34684 | 735 | if (!_new_children) { |
34685 | 0 | PyMem_Free(_children); |
34686 | 0 | p->error_indicator = 1; |
34687 | 0 | PyErr_NoMemory(); |
34688 | 0 | p->level--; |
34689 | 0 | return NULL; |
34690 | 0 | } |
34691 | 735 | _children = _new_children; |
34692 | 735 | } |
34693 | 2.53k | _children[_n++] = _res; |
34694 | 2.53k | _mark = p->mark; |
34695 | 2.53k | } |
34696 | 3.38k | p->mark = _mark; |
34697 | 3.38k | D(fprintf(stderr, "%*c%s _loop1_113[%d-%d]: %s failed!\n", p->level, ' ', |
34698 | 3.38k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(!STRING expression_without_invalid)")); |
34699 | 3.38k | } |
34700 | 3.38k | if (_n == 0 || p->error_indicator) { |
34701 | 2.37k | PyMem_Free(_children); |
34702 | 2.37k | p->level--; |
34703 | 2.37k | return NULL; |
34704 | 2.37k | } |
34705 | 1.01k | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
34706 | 1.01k | if (!_seq) { |
34707 | 0 | PyMem_Free(_children); |
34708 | 0 | p->error_indicator = 1; |
34709 | 0 | PyErr_NoMemory(); |
34710 | 0 | p->level--; |
34711 | 0 | return NULL; |
34712 | 0 | } |
34713 | 3.48k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
34714 | 1.01k | PyMem_Free(_children); |
34715 | 1.01k | p->level--; |
34716 | 1.01k | return _seq; |
34717 | 1.01k | } |
34718 | | |
34719 | | // _tmp_114: NAME STRING | SOFT_KEYWORD |
34720 | | static void * |
34721 | | _tmp_114_rule(Parser *p) |
34722 | 211k | { |
34723 | 211k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34724 | 1 | _Pypegen_stack_overflow(p); |
34725 | 1 | } |
34726 | 211k | if (p->error_indicator) { |
34727 | 1 | p->level--; |
34728 | 1 | return NULL; |
34729 | 1 | } |
34730 | 211k | void * _res = NULL; |
34731 | 211k | int _mark = p->mark; |
34732 | 211k | { // NAME STRING |
34733 | 211k | if (p->error_indicator) { |
34734 | 0 | p->level--; |
34735 | 0 | return NULL; |
34736 | 0 | } |
34737 | 211k | D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME STRING")); |
34738 | 211k | expr_ty name_var; |
34739 | 211k | expr_ty string_var; |
34740 | 211k | if ( |
34741 | 211k | (name_var = _PyPegen_name_token(p)) // NAME |
34742 | 67.8k | && |
34743 | 67.8k | (string_var = _PyPegen_string_token(p)) // STRING |
34744 | 211k | ) |
34745 | 513 | { |
34746 | 513 | D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME STRING")); |
34747 | 513 | _res = _PyPegen_dummy_name(p, name_var, string_var); |
34748 | 513 | goto done; |
34749 | 513 | } |
34750 | 211k | p->mark = _mark; |
34751 | 211k | D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', |
34752 | 211k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME STRING")); |
34753 | 211k | } |
34754 | 0 | { // SOFT_KEYWORD |
34755 | 211k | if (p->error_indicator) { |
34756 | 29 | p->level--; |
34757 | 29 | return NULL; |
34758 | 29 | } |
34759 | 211k | D(fprintf(stderr, "%*c> _tmp_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD")); |
34760 | 211k | expr_ty soft_keyword_var; |
34761 | 211k | if ( |
34762 | 211k | (soft_keyword_var = _PyPegen_soft_keyword_token(p)) // SOFT_KEYWORD |
34763 | 211k | ) |
34764 | 4.49k | { |
34765 | 4.49k | D(fprintf(stderr, "%*c+ _tmp_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD")); |
34766 | 4.49k | _res = soft_keyword_var; |
34767 | 4.49k | goto done; |
34768 | 4.49k | } |
34769 | 206k | p->mark = _mark; |
34770 | 206k | D(fprintf(stderr, "%*c%s _tmp_114[%d-%d]: %s failed!\n", p->level, ' ', |
34771 | 206k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "SOFT_KEYWORD")); |
34772 | 206k | } |
34773 | 206k | _res = NULL; |
34774 | 211k | done: |
34775 | 211k | p->level--; |
34776 | 211k | return _res; |
34777 | 206k | } |
34778 | | |
34779 | | // _tmp_115: 'else' | ':' |
34780 | | static void * |
34781 | | _tmp_115_rule(Parser *p) |
34782 | 671 | { |
34783 | 671 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34784 | 0 | _Pypegen_stack_overflow(p); |
34785 | 0 | } |
34786 | 671 | if (p->error_indicator) { |
34787 | 0 | p->level--; |
34788 | 0 | return NULL; |
34789 | 0 | } |
34790 | 671 | void * _res = NULL; |
34791 | 671 | int _mark = p->mark; |
34792 | 671 | { // 'else' |
34793 | 671 | if (p->error_indicator) { |
34794 | 0 | p->level--; |
34795 | 0 | return NULL; |
34796 | 0 | } |
34797 | 671 | D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else'")); |
34798 | 671 | Token * _keyword; |
34799 | 671 | if ( |
34800 | 671 | (_keyword = _PyPegen_expect_token(p, 695)) // token='else' |
34801 | 671 | ) |
34802 | 645 | { |
34803 | 645 | D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else'")); |
34804 | 645 | _res = _keyword; |
34805 | 645 | goto done; |
34806 | 645 | } |
34807 | 26 | p->mark = _mark; |
34808 | 26 | D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', |
34809 | 26 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else'")); |
34810 | 26 | } |
34811 | 0 | { // ':' |
34812 | 26 | if (p->error_indicator) { |
34813 | 0 | p->level--; |
34814 | 0 | return NULL; |
34815 | 0 | } |
34816 | 26 | D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
34817 | 26 | Token * _literal; |
34818 | 26 | if ( |
34819 | 26 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
34820 | 26 | ) |
34821 | 7 | { |
34822 | 7 | D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
34823 | 7 | _res = _literal; |
34824 | 7 | goto done; |
34825 | 7 | } |
34826 | 19 | p->mark = _mark; |
34827 | 19 | D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', |
34828 | 19 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
34829 | 19 | } |
34830 | 19 | _res = NULL; |
34831 | 671 | done: |
34832 | 671 | p->level--; |
34833 | 671 | return _res; |
34834 | 19 | } |
34835 | | |
34836 | | // _tmp_116: pass_stmt | break_stmt | continue_stmt |
34837 | | static void * |
34838 | | _tmp_116_rule(Parser *p) |
34839 | 181k | { |
34840 | 181k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34841 | 0 | _Pypegen_stack_overflow(p); |
34842 | 0 | } |
34843 | 181k | if (p->error_indicator) { |
34844 | 0 | p->level--; |
34845 | 0 | return NULL; |
34846 | 0 | } |
34847 | 181k | void * _res = NULL; |
34848 | 181k | int _mark = p->mark; |
34849 | 181k | { // pass_stmt |
34850 | 181k | if (p->error_indicator) { |
34851 | 0 | p->level--; |
34852 | 0 | return NULL; |
34853 | 0 | } |
34854 | 181k | D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pass_stmt")); |
34855 | 181k | stmt_ty pass_stmt_var; |
34856 | 181k | if ( |
34857 | 181k | (pass_stmt_var = pass_stmt_rule(p)) // pass_stmt |
34858 | 181k | ) |
34859 | 410 | { |
34860 | 410 | D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pass_stmt")); |
34861 | 410 | _res = pass_stmt_var; |
34862 | 410 | goto done; |
34863 | 410 | } |
34864 | 181k | p->mark = _mark; |
34865 | 181k | D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', |
34866 | 181k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pass_stmt")); |
34867 | 181k | } |
34868 | 0 | { // break_stmt |
34869 | 181k | if (p->error_indicator) { |
34870 | 0 | p->level--; |
34871 | 0 | return NULL; |
34872 | 0 | } |
34873 | 181k | D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "break_stmt")); |
34874 | 181k | stmt_ty break_stmt_var; |
34875 | 181k | if ( |
34876 | 181k | (break_stmt_var = break_stmt_rule(p)) // break_stmt |
34877 | 181k | ) |
34878 | 455 | { |
34879 | 455 | D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "break_stmt")); |
34880 | 455 | _res = break_stmt_var; |
34881 | 455 | goto done; |
34882 | 455 | } |
34883 | 181k | p->mark = _mark; |
34884 | 181k | D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', |
34885 | 181k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "break_stmt")); |
34886 | 181k | } |
34887 | 0 | { // continue_stmt |
34888 | 181k | if (p->error_indicator) { |
34889 | 0 | p->level--; |
34890 | 0 | return NULL; |
34891 | 0 | } |
34892 | 181k | D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "continue_stmt")); |
34893 | 181k | stmt_ty continue_stmt_var; |
34894 | 181k | if ( |
34895 | 181k | (continue_stmt_var = continue_stmt_rule(p)) // continue_stmt |
34896 | 181k | ) |
34897 | 1.51k | { |
34898 | 1.51k | D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "continue_stmt")); |
34899 | 1.51k | _res = continue_stmt_var; |
34900 | 1.51k | goto done; |
34901 | 1.51k | } |
34902 | 179k | p->mark = _mark; |
34903 | 179k | D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', |
34904 | 179k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "continue_stmt")); |
34905 | 179k | } |
34906 | 179k | _res = NULL; |
34907 | 181k | done: |
34908 | 181k | p->level--; |
34909 | 181k | return _res; |
34910 | 179k | } |
34911 | | |
34912 | | // _tmp_117: '=' | ':=' |
34913 | | static void * |
34914 | | _tmp_117_rule(Parser *p) |
34915 | 85 | { |
34916 | 85 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34917 | 0 | _Pypegen_stack_overflow(p); |
34918 | 0 | } |
34919 | 85 | if (p->error_indicator) { |
34920 | 0 | p->level--; |
34921 | 0 | return NULL; |
34922 | 0 | } |
34923 | 85 | void * _res = NULL; |
34924 | 85 | int _mark = p->mark; |
34925 | 85 | { // '=' |
34926 | 85 | if (p->error_indicator) { |
34927 | 0 | p->level--; |
34928 | 0 | return NULL; |
34929 | 0 | } |
34930 | 85 | D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); |
34931 | 85 | Token * _literal; |
34932 | 85 | if ( |
34933 | 85 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
34934 | 85 | ) |
34935 | 59 | { |
34936 | 59 | D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); |
34937 | 59 | _res = _literal; |
34938 | 59 | goto done; |
34939 | 59 | } |
34940 | 26 | p->mark = _mark; |
34941 | 26 | D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', |
34942 | 26 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); |
34943 | 26 | } |
34944 | 0 | { // ':=' |
34945 | 26 | if (p->error_indicator) { |
34946 | 0 | p->level--; |
34947 | 0 | return NULL; |
34948 | 0 | } |
34949 | 26 | D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='")); |
34950 | 26 | Token * _literal; |
34951 | 26 | if ( |
34952 | 26 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
34953 | 26 | ) |
34954 | 5 | { |
34955 | 5 | D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='")); |
34956 | 5 | _res = _literal; |
34957 | 5 | goto done; |
34958 | 5 | } |
34959 | 21 | p->mark = _mark; |
34960 | 21 | D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ', |
34961 | 21 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':='")); |
34962 | 21 | } |
34963 | 21 | _res = NULL; |
34964 | 85 | done: |
34965 | 85 | p->level--; |
34966 | 85 | return _res; |
34967 | 21 | } |
34968 | | |
34969 | | // _tmp_118: list | tuple | genexp | 'True' | 'None' | 'False' |
34970 | | static void * |
34971 | | _tmp_118_rule(Parser *p) |
34972 | 81.0k | { |
34973 | 81.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
34974 | 0 | _Pypegen_stack_overflow(p); |
34975 | 0 | } |
34976 | 81.0k | if (p->error_indicator) { |
34977 | 0 | p->level--; |
34978 | 0 | return NULL; |
34979 | 0 | } |
34980 | 81.0k | void * _res = NULL; |
34981 | 81.0k | int _mark = p->mark; |
34982 | 81.0k | { // list |
34983 | 81.0k | if (p->error_indicator) { |
34984 | 0 | p->level--; |
34985 | 0 | return NULL; |
34986 | 0 | } |
34987 | 81.0k | D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); |
34988 | 81.0k | expr_ty list_var; |
34989 | 81.0k | if ( |
34990 | 81.0k | (list_var = list_rule(p)) // list |
34991 | 81.0k | ) |
34992 | 1.16k | { |
34993 | 1.16k | D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); |
34994 | 1.16k | _res = list_var; |
34995 | 1.16k | goto done; |
34996 | 1.16k | } |
34997 | 79.9k | p->mark = _mark; |
34998 | 79.9k | D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', |
34999 | 79.9k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); |
35000 | 79.9k | } |
35001 | 0 | { // tuple |
35002 | 79.9k | if (p->error_indicator) { |
35003 | 199 | p->level--; |
35004 | 199 | return NULL; |
35005 | 199 | } |
35006 | 79.7k | D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); |
35007 | 79.7k | expr_ty tuple_var; |
35008 | 79.7k | if ( |
35009 | 79.7k | (tuple_var = tuple_rule(p)) // tuple |
35010 | 79.7k | ) |
35011 | 3.70k | { |
35012 | 3.70k | D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); |
35013 | 3.70k | _res = tuple_var; |
35014 | 3.70k | goto done; |
35015 | 3.70k | } |
35016 | 76.0k | p->mark = _mark; |
35017 | 76.0k | D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', |
35018 | 76.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); |
35019 | 76.0k | } |
35020 | 0 | { // genexp |
35021 | 76.0k | if (p->error_indicator) { |
35022 | 194 | p->level--; |
35023 | 194 | return NULL; |
35024 | 194 | } |
35025 | 75.8k | D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); |
35026 | 75.8k | expr_ty genexp_var; |
35027 | 75.8k | if ( |
35028 | 75.8k | (genexp_var = genexp_rule(p)) // genexp |
35029 | 75.8k | ) |
35030 | 318 | { |
35031 | 318 | D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); |
35032 | 318 | _res = genexp_var; |
35033 | 318 | goto done; |
35034 | 318 | } |
35035 | 75.4k | p->mark = _mark; |
35036 | 75.4k | D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', |
35037 | 75.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); |
35038 | 75.4k | } |
35039 | 0 | { // 'True' |
35040 | 75.4k | if (p->error_indicator) { |
35041 | 209 | p->level--; |
35042 | 209 | return NULL; |
35043 | 209 | } |
35044 | 75.2k | D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); |
35045 | 75.2k | Token * _keyword; |
35046 | 75.2k | if ( |
35047 | 75.2k | (_keyword = _PyPegen_expect_token(p, 623)) // token='True' |
35048 | 75.2k | ) |
35049 | 223 | { |
35050 | 223 | D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); |
35051 | 223 | _res = _keyword; |
35052 | 223 | goto done; |
35053 | 223 | } |
35054 | 75.0k | p->mark = _mark; |
35055 | 75.0k | D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', |
35056 | 75.0k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); |
35057 | 75.0k | } |
35058 | 0 | { // 'None' |
35059 | 75.0k | if (p->error_indicator) { |
35060 | 0 | p->level--; |
35061 | 0 | return NULL; |
35062 | 0 | } |
35063 | 75.0k | D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); |
35064 | 75.0k | Token * _keyword; |
35065 | 75.0k | if ( |
35066 | 75.0k | (_keyword = _PyPegen_expect_token(p, 624)) // token='None' |
35067 | 75.0k | ) |
35068 | 202 | { |
35069 | 202 | D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); |
35070 | 202 | _res = _keyword; |
35071 | 202 | goto done; |
35072 | 202 | } |
35073 | 74.8k | p->mark = _mark; |
35074 | 74.8k | D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', |
35075 | 74.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); |
35076 | 74.8k | } |
35077 | 0 | { // 'False' |
35078 | 74.8k | if (p->error_indicator) { |
35079 | 0 | p->level--; |
35080 | 0 | return NULL; |
35081 | 0 | } |
35082 | 74.8k | D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); |
35083 | 74.8k | Token * _keyword; |
35084 | 74.8k | if ( |
35085 | 74.8k | (_keyword = _PyPegen_expect_token(p, 625)) // token='False' |
35086 | 74.8k | ) |
35087 | 196 | { |
35088 | 196 | D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); |
35089 | 196 | _res = _keyword; |
35090 | 196 | goto done; |
35091 | 196 | } |
35092 | 74.6k | p->mark = _mark; |
35093 | 74.6k | D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', |
35094 | 74.6k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); |
35095 | 74.6k | } |
35096 | 74.6k | _res = NULL; |
35097 | 80.4k | done: |
35098 | 80.4k | p->level--; |
35099 | 80.4k | return _res; |
35100 | 74.6k | } |
35101 | | |
35102 | | // _loop0_119: star_named_expressions |
35103 | | static asdl_seq * |
35104 | | _loop0_119_rule(Parser *p) |
35105 | 1.49k | { |
35106 | 1.49k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35107 | 0 | _Pypegen_stack_overflow(p); |
35108 | 0 | } |
35109 | 1.49k | if (p->error_indicator) { |
35110 | 0 | p->level--; |
35111 | 0 | return NULL; |
35112 | 0 | } |
35113 | 1.49k | void *_res = NULL; |
35114 | 1.49k | int _mark = p->mark; |
35115 | 1.49k | void **_children = PyMem_Malloc(sizeof(void *)); |
35116 | 1.49k | if (!_children) { |
35117 | 0 | p->error_indicator = 1; |
35118 | 0 | PyErr_NoMemory(); |
35119 | 0 | p->level--; |
35120 | 0 | return NULL; |
35121 | 0 | } |
35122 | 1.49k | Py_ssize_t _children_capacity = 1; |
35123 | 1.49k | Py_ssize_t _n = 0; |
35124 | 1.49k | { // star_named_expressions |
35125 | 1.49k | if (p->error_indicator) { |
35126 | 0 | p->level--; |
35127 | 0 | return NULL; |
35128 | 0 | } |
35129 | 1.49k | D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); |
35130 | 1.49k | asdl_expr_seq* star_named_expressions_var; |
35131 | 1.49k | while ( |
35132 | 4.68k | (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions |
35133 | 1.49k | ) |
35134 | 3.18k | { |
35135 | 3.18k | _res = star_named_expressions_var; |
35136 | 3.18k | if (_n == _children_capacity) { |
35137 | 278 | _children_capacity *= 2; |
35138 | 278 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
35139 | 278 | if (!_new_children) { |
35140 | 0 | PyMem_Free(_children); |
35141 | 0 | p->error_indicator = 1; |
35142 | 0 | PyErr_NoMemory(); |
35143 | 0 | p->level--; |
35144 | 0 | return NULL; |
35145 | 0 | } |
35146 | 278 | _children = _new_children; |
35147 | 278 | } |
35148 | 3.18k | _children[_n++] = _res; |
35149 | 3.18k | _mark = p->mark; |
35150 | 3.18k | } |
35151 | 1.49k | p->mark = _mark; |
35152 | 1.49k | D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ', |
35153 | 1.49k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); |
35154 | 1.49k | } |
35155 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
35156 | 1.49k | if (!_seq) { |
35157 | 0 | PyMem_Free(_children); |
35158 | 0 | p->error_indicator = 1; |
35159 | 0 | PyErr_NoMemory(); |
35160 | 0 | p->level--; |
35161 | 0 | return NULL; |
35162 | 0 | } |
35163 | 4.68k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
35164 | 1.49k | PyMem_Free(_children); |
35165 | 1.49k | p->level--; |
35166 | 1.49k | return _seq; |
35167 | 1.49k | } |
35168 | | |
35169 | | // _loop0_120: (star_targets '=') |
35170 | | static asdl_seq * |
35171 | | _loop0_120_rule(Parser *p) |
35172 | 74.8k | { |
35173 | 74.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35174 | 0 | _Pypegen_stack_overflow(p); |
35175 | 0 | } |
35176 | 74.8k | if (p->error_indicator) { |
35177 | 0 | p->level--; |
35178 | 0 | return NULL; |
35179 | 0 | } |
35180 | 74.8k | void *_res = NULL; |
35181 | 74.8k | int _mark = p->mark; |
35182 | 74.8k | void **_children = PyMem_Malloc(sizeof(void *)); |
35183 | 74.8k | if (!_children) { |
35184 | 0 | p->error_indicator = 1; |
35185 | 0 | PyErr_NoMemory(); |
35186 | 0 | p->level--; |
35187 | 0 | return NULL; |
35188 | 0 | } |
35189 | 74.8k | Py_ssize_t _children_capacity = 1; |
35190 | 74.8k | Py_ssize_t _n = 0; |
35191 | 74.8k | { // (star_targets '=') |
35192 | 74.8k | if (p->error_indicator) { |
35193 | 0 | p->level--; |
35194 | 0 | return NULL; |
35195 | 0 | } |
35196 | 74.8k | D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); |
35197 | 74.8k | void *_tmp_157_var; |
35198 | 74.8k | while ( |
35199 | 75.7k | (_tmp_157_var = _tmp_157_rule(p)) // star_targets '=' |
35200 | 74.8k | ) |
35201 | 903 | { |
35202 | 903 | _res = _tmp_157_var; |
35203 | 903 | if (_n == _children_capacity) { |
35204 | 130 | _children_capacity *= 2; |
35205 | 130 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
35206 | 130 | if (!_new_children) { |
35207 | 0 | PyMem_Free(_children); |
35208 | 0 | p->error_indicator = 1; |
35209 | 0 | PyErr_NoMemory(); |
35210 | 0 | p->level--; |
35211 | 0 | return NULL; |
35212 | 0 | } |
35213 | 130 | _children = _new_children; |
35214 | 130 | } |
35215 | 903 | _children[_n++] = _res; |
35216 | 903 | _mark = p->mark; |
35217 | 903 | } |
35218 | 74.8k | p->mark = _mark; |
35219 | 74.8k | D(fprintf(stderr, "%*c%s _loop0_120[%d-%d]: %s failed!\n", p->level, ' ', |
35220 | 74.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); |
35221 | 74.8k | } |
35222 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
35223 | 74.8k | if (!_seq) { |
35224 | 0 | PyMem_Free(_children); |
35225 | 0 | p->error_indicator = 1; |
35226 | 0 | PyErr_NoMemory(); |
35227 | 0 | p->level--; |
35228 | 0 | return NULL; |
35229 | 0 | } |
35230 | 75.7k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
35231 | 74.8k | PyMem_Free(_children); |
35232 | 74.8k | p->level--; |
35233 | 74.8k | return _seq; |
35234 | 74.8k | } |
35235 | | |
35236 | | // _tmp_121: '[' | '(' | '{' |
35237 | | static void * |
35238 | | _tmp_121_rule(Parser *p) |
35239 | 209k | { |
35240 | 209k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35241 | 1 | _Pypegen_stack_overflow(p); |
35242 | 1 | } |
35243 | 209k | if (p->error_indicator) { |
35244 | 1 | p->level--; |
35245 | 1 | return NULL; |
35246 | 1 | } |
35247 | 209k | void * _res = NULL; |
35248 | 209k | int _mark = p->mark; |
35249 | 209k | { // '[' |
35250 | 209k | if (p->error_indicator) { |
35251 | 0 | p->level--; |
35252 | 0 | return NULL; |
35253 | 0 | } |
35254 | 209k | D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); |
35255 | 209k | Token * _literal; |
35256 | 209k | if ( |
35257 | 209k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
35258 | 209k | ) |
35259 | 9.17k | { |
35260 | 9.17k | D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); |
35261 | 9.17k | _res = _literal; |
35262 | 9.17k | goto done; |
35263 | 9.17k | } |
35264 | 200k | p->mark = _mark; |
35265 | 200k | D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', |
35266 | 200k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
35267 | 200k | } |
35268 | 0 | { // '(' |
35269 | 200k | if (p->error_indicator) { |
35270 | 0 | p->level--; |
35271 | 0 | return NULL; |
35272 | 0 | } |
35273 | 200k | D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
35274 | 200k | Token * _literal; |
35275 | 200k | if ( |
35276 | 200k | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
35277 | 200k | ) |
35278 | 18.9k | { |
35279 | 18.9k | D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
35280 | 18.9k | _res = _literal; |
35281 | 18.9k | goto done; |
35282 | 18.9k | } |
35283 | 181k | p->mark = _mark; |
35284 | 181k | D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', |
35285 | 181k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
35286 | 181k | } |
35287 | 0 | { // '{' |
35288 | 181k | if (p->error_indicator) { |
35289 | 0 | p->level--; |
35290 | 0 | return NULL; |
35291 | 0 | } |
35292 | 181k | D(fprintf(stderr, "%*c> _tmp_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); |
35293 | 181k | Token * _literal; |
35294 | 181k | if ( |
35295 | 181k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
35296 | 181k | ) |
35297 | 4.89k | { |
35298 | 4.89k | D(fprintf(stderr, "%*c+ _tmp_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); |
35299 | 4.89k | _res = _literal; |
35300 | 4.89k | goto done; |
35301 | 4.89k | } |
35302 | 176k | p->mark = _mark; |
35303 | 176k | D(fprintf(stderr, "%*c%s _tmp_121[%d-%d]: %s failed!\n", p->level, ' ', |
35304 | 176k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); |
35305 | 176k | } |
35306 | 176k | _res = NULL; |
35307 | 209k | done: |
35308 | 209k | p->level--; |
35309 | 209k | return _res; |
35310 | 176k | } |
35311 | | |
35312 | | // _tmp_122: '[' | '{' |
35313 | | static void * |
35314 | | _tmp_122_rule(Parser *p) |
35315 | 416k | { |
35316 | 416k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35317 | 0 | _Pypegen_stack_overflow(p); |
35318 | 0 | } |
35319 | 416k | if (p->error_indicator) { |
35320 | 0 | p->level--; |
35321 | 0 | return NULL; |
35322 | 0 | } |
35323 | 416k | void * _res = NULL; |
35324 | 416k | int _mark = p->mark; |
35325 | 416k | { // '[' |
35326 | 416k | if (p->error_indicator) { |
35327 | 0 | p->level--; |
35328 | 0 | return NULL; |
35329 | 0 | } |
35330 | 416k | D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); |
35331 | 416k | Token * _literal; |
35332 | 416k | if ( |
35333 | 416k | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
35334 | 416k | ) |
35335 | 17.4k | { |
35336 | 17.4k | D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); |
35337 | 17.4k | _res = _literal; |
35338 | 17.4k | goto done; |
35339 | 17.4k | } |
35340 | 398k | p->mark = _mark; |
35341 | 398k | D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', |
35342 | 398k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
35343 | 398k | } |
35344 | 0 | { // '{' |
35345 | 398k | if (p->error_indicator) { |
35346 | 0 | p->level--; |
35347 | 0 | return NULL; |
35348 | 0 | } |
35349 | 398k | D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); |
35350 | 398k | Token * _literal; |
35351 | 398k | if ( |
35352 | 398k | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
35353 | 398k | ) |
35354 | 8.69k | { |
35355 | 8.69k | D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); |
35356 | 8.69k | _res = _literal; |
35357 | 8.69k | goto done; |
35358 | 8.69k | } |
35359 | 390k | p->mark = _mark; |
35360 | 390k | D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ', |
35361 | 390k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); |
35362 | 390k | } |
35363 | 390k | _res = NULL; |
35364 | 416k | done: |
35365 | 416k | p->level--; |
35366 | 416k | return _res; |
35367 | 390k | } |
35368 | | |
35369 | | // _tmp_123: slash_no_default | slash_with_default |
35370 | | static void * |
35371 | | _tmp_123_rule(Parser *p) |
35372 | 10.5k | { |
35373 | 10.5k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35374 | 0 | _Pypegen_stack_overflow(p); |
35375 | 0 | } |
35376 | 10.5k | if (p->error_indicator) { |
35377 | 0 | p->level--; |
35378 | 0 | return NULL; |
35379 | 0 | } |
35380 | 10.5k | void * _res = NULL; |
35381 | 10.5k | int _mark = p->mark; |
35382 | 10.5k | { // slash_no_default |
35383 | 10.5k | if (p->error_indicator) { |
35384 | 0 | p->level--; |
35385 | 0 | return NULL; |
35386 | 0 | } |
35387 | 10.5k | D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default")); |
35388 | 10.5k | asdl_arg_seq* slash_no_default_var; |
35389 | 10.5k | if ( |
35390 | 10.5k | (slash_no_default_var = slash_no_default_rule(p)) // slash_no_default |
35391 | 10.5k | ) |
35392 | 800 | { |
35393 | 800 | D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default")); |
35394 | 800 | _res = slash_no_default_var; |
35395 | 800 | goto done; |
35396 | 800 | } |
35397 | 9.74k | p->mark = _mark; |
35398 | 9.74k | D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', |
35399 | 9.74k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default")); |
35400 | 9.74k | } |
35401 | 0 | { // slash_with_default |
35402 | 9.74k | if (p->error_indicator) { |
35403 | 1 | p->level--; |
35404 | 1 | return NULL; |
35405 | 1 | } |
35406 | 9.73k | D(fprintf(stderr, "%*c> _tmp_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); |
35407 | 9.73k | SlashWithDefault* slash_with_default_var; |
35408 | 9.73k | if ( |
35409 | 9.73k | (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default |
35410 | 9.73k | ) |
35411 | 965 | { |
35412 | 965 | D(fprintf(stderr, "%*c+ _tmp_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default")); |
35413 | 965 | _res = slash_with_default_var; |
35414 | 965 | goto done; |
35415 | 965 | } |
35416 | 8.77k | p->mark = _mark; |
35417 | 8.77k | D(fprintf(stderr, "%*c%s _tmp_123[%d-%d]: %s failed!\n", p->level, ' ', |
35418 | 8.77k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); |
35419 | 8.77k | } |
35420 | 8.77k | _res = NULL; |
35421 | 10.5k | done: |
35422 | 10.5k | p->level--; |
35423 | 10.5k | return _res; |
35424 | 8.77k | } |
35425 | | |
35426 | | // _tmp_124: ',' | param_no_default |
35427 | | static void * |
35428 | | _tmp_124_rule(Parser *p) |
35429 | 1.75k | { |
35430 | 1.75k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35431 | 0 | _Pypegen_stack_overflow(p); |
35432 | 0 | } |
35433 | 1.75k | if (p->error_indicator) { |
35434 | 0 | p->level--; |
35435 | 0 | return NULL; |
35436 | 0 | } |
35437 | 1.75k | void * _res = NULL; |
35438 | 1.75k | int _mark = p->mark; |
35439 | 1.75k | { // ',' |
35440 | 1.75k | if (p->error_indicator) { |
35441 | 0 | p->level--; |
35442 | 0 | return NULL; |
35443 | 0 | } |
35444 | 1.75k | D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
35445 | 1.75k | Token * _literal; |
35446 | 1.75k | if ( |
35447 | 1.75k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
35448 | 1.75k | ) |
35449 | 707 | { |
35450 | 707 | D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
35451 | 707 | _res = _literal; |
35452 | 707 | goto done; |
35453 | 707 | } |
35454 | 1.04k | p->mark = _mark; |
35455 | 1.04k | D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', |
35456 | 1.04k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
35457 | 1.04k | } |
35458 | 0 | { // param_no_default |
35459 | 1.04k | if (p->error_indicator) { |
35460 | 0 | p->level--; |
35461 | 0 | return NULL; |
35462 | 0 | } |
35463 | 1.04k | D(fprintf(stderr, "%*c> _tmp_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
35464 | 1.04k | arg_ty param_no_default_var; |
35465 | 1.04k | if ( |
35466 | 1.04k | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
35467 | 1.04k | ) |
35468 | 534 | { |
35469 | 534 | D(fprintf(stderr, "%*c+ _tmp_124[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
35470 | 534 | _res = param_no_default_var; |
35471 | 534 | goto done; |
35472 | 534 | } |
35473 | 513 | p->mark = _mark; |
35474 | 513 | D(fprintf(stderr, "%*c%s _tmp_124[%d-%d]: %s failed!\n", p->level, ' ', |
35475 | 513 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
35476 | 513 | } |
35477 | 513 | _res = NULL; |
35478 | 1.75k | done: |
35479 | 1.75k | p->level--; |
35480 | 1.75k | return _res; |
35481 | 513 | } |
35482 | | |
35483 | | // _tmp_125: ')' | ',' |
35484 | | static void * |
35485 | | _tmp_125_rule(Parser *p) |
35486 | 14.3k | { |
35487 | 14.3k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35488 | 0 | _Pypegen_stack_overflow(p); |
35489 | 0 | } |
35490 | 14.3k | if (p->error_indicator) { |
35491 | 0 | p->level--; |
35492 | 0 | return NULL; |
35493 | 0 | } |
35494 | 14.3k | void * _res = NULL; |
35495 | 14.3k | int _mark = p->mark; |
35496 | 14.3k | { // ')' |
35497 | 14.3k | if (p->error_indicator) { |
35498 | 0 | p->level--; |
35499 | 0 | return NULL; |
35500 | 0 | } |
35501 | 14.3k | D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
35502 | 14.3k | Token * _literal; |
35503 | 14.3k | if ( |
35504 | 14.3k | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
35505 | 14.3k | ) |
35506 | 2 | { |
35507 | 2 | D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
35508 | 2 | _res = _literal; |
35509 | 2 | goto done; |
35510 | 2 | } |
35511 | 14.3k | p->mark = _mark; |
35512 | 14.3k | D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', |
35513 | 14.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
35514 | 14.3k | } |
35515 | 0 | { // ',' |
35516 | 14.3k | if (p->error_indicator) { |
35517 | 0 | p->level--; |
35518 | 0 | return NULL; |
35519 | 0 | } |
35520 | 14.3k | D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
35521 | 14.3k | Token * _literal; |
35522 | 14.3k | if ( |
35523 | 14.3k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
35524 | 14.3k | ) |
35525 | 14 | { |
35526 | 14 | D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
35527 | 14 | _res = _literal; |
35528 | 14 | goto done; |
35529 | 14 | } |
35530 | 14.3k | p->mark = _mark; |
35531 | 14.3k | D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', |
35532 | 14.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
35533 | 14.3k | } |
35534 | 14.3k | _res = NULL; |
35535 | 14.3k | done: |
35536 | 14.3k | p->level--; |
35537 | 14.3k | return _res; |
35538 | 14.3k | } |
35539 | | |
35540 | | // _tmp_126: ')' | ',' (')' | '**') |
35541 | | static void * |
35542 | | _tmp_126_rule(Parser *p) |
35543 | 1.74k | { |
35544 | 1.74k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35545 | 0 | _Pypegen_stack_overflow(p); |
35546 | 0 | } |
35547 | 1.74k | if (p->error_indicator) { |
35548 | 0 | p->level--; |
35549 | 0 | return NULL; |
35550 | 0 | } |
35551 | 1.74k | void * _res = NULL; |
35552 | 1.74k | int _mark = p->mark; |
35553 | 1.74k | { // ')' |
35554 | 1.74k | if (p->error_indicator) { |
35555 | 0 | p->level--; |
35556 | 0 | return NULL; |
35557 | 0 | } |
35558 | 1.74k | D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
35559 | 1.74k | Token * _literal; |
35560 | 1.74k | if ( |
35561 | 1.74k | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
35562 | 1.74k | ) |
35563 | 1 | { |
35564 | 1 | D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
35565 | 1 | _res = _literal; |
35566 | 1 | goto done; |
35567 | 1 | } |
35568 | 1.74k | p->mark = _mark; |
35569 | 1.74k | D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', |
35570 | 1.74k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
35571 | 1.74k | } |
35572 | 0 | { // ',' (')' | '**') |
35573 | 1.74k | if (p->error_indicator) { |
35574 | 0 | p->level--; |
35575 | 0 | return NULL; |
35576 | 0 | } |
35577 | 1.74k | D(fprintf(stderr, "%*c> _tmp_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); |
35578 | 1.74k | Token * _literal; |
35579 | 1.74k | void *_tmp_170_var; |
35580 | 1.74k | if ( |
35581 | 1.74k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
35582 | 705 | && |
35583 | 705 | (_tmp_170_var = _tmp_170_rule(p)) // ')' | '**' |
35584 | 1.74k | ) |
35585 | 2 | { |
35586 | 2 | D(fprintf(stderr, "%*c+ _tmp_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); |
35587 | 2 | _res = _PyPegen_dummy_name(p, _literal, _tmp_170_var); |
35588 | 2 | goto done; |
35589 | 2 | } |
35590 | 1.74k | p->mark = _mark; |
35591 | 1.74k | D(fprintf(stderr, "%*c%s _tmp_126[%d-%d]: %s failed!\n", p->level, ' ', |
35592 | 1.74k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); |
35593 | 1.74k | } |
35594 | 1.74k | _res = NULL; |
35595 | 1.74k | done: |
35596 | 1.74k | p->level--; |
35597 | 1.74k | return _res; |
35598 | 1.74k | } |
35599 | | |
35600 | | // _tmp_127: param_no_default | ',' |
35601 | | static void * |
35602 | | _tmp_127_rule(Parser *p) |
35603 | 1.75k | { |
35604 | 1.75k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35605 | 0 | _Pypegen_stack_overflow(p); |
35606 | 0 | } |
35607 | 1.75k | if (p->error_indicator) { |
35608 | 0 | p->level--; |
35609 | 0 | return NULL; |
35610 | 0 | } |
35611 | 1.75k | void * _res = NULL; |
35612 | 1.75k | int _mark = p->mark; |
35613 | 1.75k | { // param_no_default |
35614 | 1.75k | if (p->error_indicator) { |
35615 | 0 | p->level--; |
35616 | 0 | return NULL; |
35617 | 0 | } |
35618 | 1.75k | D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
35619 | 1.75k | arg_ty param_no_default_var; |
35620 | 1.75k | if ( |
35621 | 1.75k | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
35622 | 1.75k | ) |
35623 | 534 | { |
35624 | 534 | D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default")); |
35625 | 534 | _res = param_no_default_var; |
35626 | 534 | goto done; |
35627 | 534 | } |
35628 | 1.22k | p->mark = _mark; |
35629 | 1.22k | D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ', |
35630 | 1.22k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
35631 | 1.22k | } |
35632 | 0 | { // ',' |
35633 | 1.22k | if (p->error_indicator) { |
35634 | 2 | p->level--; |
35635 | 2 | return NULL; |
35636 | 2 | } |
35637 | 1.21k | D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
35638 | 1.21k | Token * _literal; |
35639 | 1.21k | if ( |
35640 | 1.21k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
35641 | 1.21k | ) |
35642 | 705 | { |
35643 | 705 | D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
35644 | 705 | _res = _literal; |
35645 | 705 | goto done; |
35646 | 705 | } |
35647 | 514 | p->mark = _mark; |
35648 | 514 | D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ', |
35649 | 514 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
35650 | 514 | } |
35651 | 514 | _res = NULL; |
35652 | 1.75k | done: |
35653 | 1.75k | p->level--; |
35654 | 1.75k | return _res; |
35655 | 514 | } |
35656 | | |
35657 | | // _tmp_128: '*' | '**' | '/' |
35658 | | static void * |
35659 | | _tmp_128_rule(Parser *p) |
35660 | 35 | { |
35661 | 35 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35662 | 0 | _Pypegen_stack_overflow(p); |
35663 | 0 | } |
35664 | 35 | if (p->error_indicator) { |
35665 | 0 | p->level--; |
35666 | 0 | return NULL; |
35667 | 0 | } |
35668 | 35 | void * _res = NULL; |
35669 | 35 | int _mark = p->mark; |
35670 | 35 | { // '*' |
35671 | 35 | if (p->error_indicator) { |
35672 | 0 | p->level--; |
35673 | 0 | return NULL; |
35674 | 0 | } |
35675 | 35 | D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); |
35676 | 35 | Token * _literal; |
35677 | 35 | if ( |
35678 | 35 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
35679 | 35 | ) |
35680 | 1 | { |
35681 | 1 | D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); |
35682 | 1 | _res = _literal; |
35683 | 1 | goto done; |
35684 | 1 | } |
35685 | 34 | p->mark = _mark; |
35686 | 34 | D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', |
35687 | 34 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); |
35688 | 34 | } |
35689 | 0 | { // '**' |
35690 | 34 | if (p->error_indicator) { |
35691 | 0 | p->level--; |
35692 | 0 | return NULL; |
35693 | 0 | } |
35694 | 34 | D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); |
35695 | 34 | Token * _literal; |
35696 | 34 | if ( |
35697 | 34 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
35698 | 34 | ) |
35699 | 1 | { |
35700 | 1 | D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); |
35701 | 1 | _res = _literal; |
35702 | 1 | goto done; |
35703 | 1 | } |
35704 | 33 | p->mark = _mark; |
35705 | 33 | D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', |
35706 | 33 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); |
35707 | 33 | } |
35708 | 0 | { // '/' |
35709 | 33 | if (p->error_indicator) { |
35710 | 0 | p->level--; |
35711 | 0 | return NULL; |
35712 | 0 | } |
35713 | 33 | D(fprintf(stderr, "%*c> _tmp_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/'")); |
35714 | 33 | Token * _literal; |
35715 | 33 | if ( |
35716 | 33 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
35717 | 33 | ) |
35718 | 1 | { |
35719 | 1 | D(fprintf(stderr, "%*c+ _tmp_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/'")); |
35720 | 1 | _res = _literal; |
35721 | 1 | goto done; |
35722 | 1 | } |
35723 | 32 | p->mark = _mark; |
35724 | 32 | D(fprintf(stderr, "%*c%s _tmp_128[%d-%d]: %s failed!\n", p->level, ' ', |
35725 | 32 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/'")); |
35726 | 32 | } |
35727 | 32 | _res = NULL; |
35728 | 35 | done: |
35729 | 35 | p->level--; |
35730 | 35 | return _res; |
35731 | 32 | } |
35732 | | |
35733 | | // _tmp_129: lambda_slash_no_default | lambda_slash_with_default |
35734 | | static void * |
35735 | | _tmp_129_rule(Parser *p) |
35736 | 13.8k | { |
35737 | 13.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35738 | 0 | _Pypegen_stack_overflow(p); |
35739 | 0 | } |
35740 | 13.8k | if (p->error_indicator) { |
35741 | 0 | p->level--; |
35742 | 0 | return NULL; |
35743 | 0 | } |
35744 | 13.8k | void * _res = NULL; |
35745 | 13.8k | int _mark = p->mark; |
35746 | 13.8k | { // lambda_slash_no_default |
35747 | 13.8k | if (p->error_indicator) { |
35748 | 0 | p->level--; |
35749 | 0 | return NULL; |
35750 | 0 | } |
35751 | 13.8k | D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default")); |
35752 | 13.8k | asdl_arg_seq* lambda_slash_no_default_var; |
35753 | 13.8k | if ( |
35754 | 13.8k | (lambda_slash_no_default_var = lambda_slash_no_default_rule(p)) // lambda_slash_no_default |
35755 | 13.8k | ) |
35756 | 757 | { |
35757 | 757 | D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default")); |
35758 | 757 | _res = lambda_slash_no_default_var; |
35759 | 757 | goto done; |
35760 | 757 | } |
35761 | 13.1k | p->mark = _mark; |
35762 | 13.1k | D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ', |
35763 | 13.1k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default")); |
35764 | 13.1k | } |
35765 | 0 | { // lambda_slash_with_default |
35766 | 13.1k | if (p->error_indicator) { |
35767 | 2 | p->level--; |
35768 | 2 | return NULL; |
35769 | 2 | } |
35770 | 13.1k | D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); |
35771 | 13.1k | SlashWithDefault* lambda_slash_with_default_var; |
35772 | 13.1k | if ( |
35773 | 13.1k | (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default |
35774 | 13.1k | ) |
35775 | 1.62k | { |
35776 | 1.62k | D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); |
35777 | 1.62k | _res = lambda_slash_with_default_var; |
35778 | 1.62k | goto done; |
35779 | 1.62k | } |
35780 | 11.5k | p->mark = _mark; |
35781 | 11.5k | D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ', |
35782 | 11.5k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default")); |
35783 | 11.5k | } |
35784 | 11.5k | _res = NULL; |
35785 | 13.8k | done: |
35786 | 13.8k | p->level--; |
35787 | 13.8k | return _res; |
35788 | 11.5k | } |
35789 | | |
35790 | | // _loop0_130: ',' lambda_param |
35791 | | static asdl_seq * |
35792 | | _loop0_130_rule(Parser *p) |
35793 | 55 | { |
35794 | 55 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35795 | 0 | _Pypegen_stack_overflow(p); |
35796 | 0 | } |
35797 | 55 | if (p->error_indicator) { |
35798 | 0 | p->level--; |
35799 | 0 | return NULL; |
35800 | 0 | } |
35801 | 55 | void *_res = NULL; |
35802 | 55 | int _mark = p->mark; |
35803 | 55 | void **_children = PyMem_Malloc(sizeof(void *)); |
35804 | 55 | if (!_children) { |
35805 | 0 | p->error_indicator = 1; |
35806 | 0 | PyErr_NoMemory(); |
35807 | 0 | p->level--; |
35808 | 0 | return NULL; |
35809 | 0 | } |
35810 | 55 | Py_ssize_t _children_capacity = 1; |
35811 | 55 | Py_ssize_t _n = 0; |
35812 | 55 | { // ',' lambda_param |
35813 | 55 | if (p->error_indicator) { |
35814 | 0 | p->level--; |
35815 | 0 | return NULL; |
35816 | 0 | } |
35817 | 55 | D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' lambda_param")); |
35818 | 55 | Token * _literal; |
35819 | 55 | arg_ty elem; |
35820 | 55 | while ( |
35821 | 3.66k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
35822 | 3.62k | && |
35823 | 3.62k | (elem = lambda_param_rule(p)) // lambda_param |
35824 | 55 | ) |
35825 | 3.61k | { |
35826 | 3.61k | _res = elem; |
35827 | 3.61k | if (_res == NULL && PyErr_Occurred()) { |
35828 | 0 | p->error_indicator = 1; |
35829 | 0 | PyMem_Free(_children); |
35830 | 0 | p->level--; |
35831 | 0 | return NULL; |
35832 | 0 | } |
35833 | 3.61k | if (_n == _children_capacity) { |
35834 | 152 | _children_capacity *= 2; |
35835 | 152 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
35836 | 152 | if (!_new_children) { |
35837 | 0 | PyMem_Free(_children); |
35838 | 0 | p->error_indicator = 1; |
35839 | 0 | PyErr_NoMemory(); |
35840 | 0 | p->level--; |
35841 | 0 | return NULL; |
35842 | 0 | } |
35843 | 152 | _children = _new_children; |
35844 | 152 | } |
35845 | 3.61k | _children[_n++] = _res; |
35846 | 3.61k | _mark = p->mark; |
35847 | 3.61k | } |
35848 | 55 | p->mark = _mark; |
35849 | 55 | D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ', |
35850 | 55 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' lambda_param")); |
35851 | 55 | } |
35852 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
35853 | 55 | if (!_seq) { |
35854 | 0 | PyMem_Free(_children); |
35855 | 0 | p->error_indicator = 1; |
35856 | 0 | PyErr_NoMemory(); |
35857 | 0 | p->level--; |
35858 | 0 | return NULL; |
35859 | 0 | } |
35860 | 3.66k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
35861 | 55 | PyMem_Free(_children); |
35862 | 55 | p->level--; |
35863 | 55 | return _seq; |
35864 | 55 | } |
35865 | | |
35866 | | // _gather_131: lambda_param _loop0_130 |
35867 | | static asdl_seq * |
35868 | | _gather_131_rule(Parser *p) |
35869 | 61 | { |
35870 | 61 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35871 | 0 | _Pypegen_stack_overflow(p); |
35872 | 0 | } |
35873 | 61 | if (p->error_indicator) { |
35874 | 0 | p->level--; |
35875 | 0 | return NULL; |
35876 | 0 | } |
35877 | 61 | asdl_seq * _res = NULL; |
35878 | 61 | int _mark = p->mark; |
35879 | 61 | { // lambda_param _loop0_130 |
35880 | 61 | if (p->error_indicator) { |
35881 | 0 | p->level--; |
35882 | 0 | return NULL; |
35883 | 0 | } |
35884 | 61 | D(fprintf(stderr, "%*c> _gather_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param _loop0_130")); |
35885 | 61 | arg_ty elem; |
35886 | 61 | asdl_seq * seq; |
35887 | 61 | if ( |
35888 | 61 | (elem = lambda_param_rule(p)) // lambda_param |
35889 | 55 | && |
35890 | 55 | (seq = _loop0_130_rule(p)) // _loop0_130 |
35891 | 61 | ) |
35892 | 55 | { |
35893 | 55 | D(fprintf(stderr, "%*c+ _gather_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param _loop0_130")); |
35894 | 55 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
35895 | 55 | goto done; |
35896 | 55 | } |
35897 | 6 | p->mark = _mark; |
35898 | 6 | D(fprintf(stderr, "%*c%s _gather_131[%d-%d]: %s failed!\n", p->level, ' ', |
35899 | 6 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param _loop0_130")); |
35900 | 6 | } |
35901 | 6 | _res = NULL; |
35902 | 61 | done: |
35903 | 61 | p->level--; |
35904 | 61 | return _res; |
35905 | 6 | } |
35906 | | |
35907 | | // _tmp_132: ',' | lambda_param_no_default |
35908 | | static void * |
35909 | | _tmp_132_rule(Parser *p) |
35910 | 2.77k | { |
35911 | 2.77k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35912 | 0 | _Pypegen_stack_overflow(p); |
35913 | 0 | } |
35914 | 2.77k | if (p->error_indicator) { |
35915 | 0 | p->level--; |
35916 | 0 | return NULL; |
35917 | 0 | } |
35918 | 2.77k | void * _res = NULL; |
35919 | 2.77k | int _mark = p->mark; |
35920 | 2.77k | { // ',' |
35921 | 2.77k | if (p->error_indicator) { |
35922 | 0 | p->level--; |
35923 | 0 | return NULL; |
35924 | 0 | } |
35925 | 2.77k | D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
35926 | 2.77k | Token * _literal; |
35927 | 2.77k | if ( |
35928 | 2.77k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
35929 | 2.77k | ) |
35930 | 1.45k | { |
35931 | 1.45k | D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
35932 | 1.45k | _res = _literal; |
35933 | 1.45k | goto done; |
35934 | 1.45k | } |
35935 | 1.31k | p->mark = _mark; |
35936 | 1.31k | D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ', |
35937 | 1.31k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
35938 | 1.31k | } |
35939 | 0 | { // lambda_param_no_default |
35940 | 1.31k | if (p->error_indicator) { |
35941 | 1 | p->level--; |
35942 | 1 | return NULL; |
35943 | 1 | } |
35944 | 1.31k | D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
35945 | 1.31k | arg_ty lambda_param_no_default_var; |
35946 | 1.31k | if ( |
35947 | 1.31k | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
35948 | 1.31k | ) |
35949 | 1.23k | { |
35950 | 1.23k | D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
35951 | 1.23k | _res = lambda_param_no_default_var; |
35952 | 1.23k | goto done; |
35953 | 1.23k | } |
35954 | 78 | p->mark = _mark; |
35955 | 78 | D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ', |
35956 | 78 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
35957 | 78 | } |
35958 | 78 | _res = NULL; |
35959 | 2.76k | done: |
35960 | 2.76k | p->level--; |
35961 | 2.76k | return _res; |
35962 | 78 | } |
35963 | | |
35964 | | // _tmp_133: ':' | ',' (':' | '**') |
35965 | | static void * |
35966 | | _tmp_133_rule(Parser *p) |
35967 | 2.55k | { |
35968 | 2.55k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
35969 | 0 | _Pypegen_stack_overflow(p); |
35970 | 0 | } |
35971 | 2.55k | if (p->error_indicator) { |
35972 | 0 | p->level--; |
35973 | 0 | return NULL; |
35974 | 0 | } |
35975 | 2.55k | void * _res = NULL; |
35976 | 2.55k | int _mark = p->mark; |
35977 | 2.55k | { // ':' |
35978 | 2.55k | if (p->error_indicator) { |
35979 | 0 | p->level--; |
35980 | 0 | return NULL; |
35981 | 0 | } |
35982 | 2.55k | D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
35983 | 2.55k | Token * _literal; |
35984 | 2.55k | if ( |
35985 | 2.55k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
35986 | 2.55k | ) |
35987 | 3 | { |
35988 | 3 | D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
35989 | 3 | _res = _literal; |
35990 | 3 | goto done; |
35991 | 3 | } |
35992 | 2.55k | p->mark = _mark; |
35993 | 2.55k | D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ', |
35994 | 2.55k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
35995 | 2.55k | } |
35996 | 0 | { // ',' (':' | '**') |
35997 | 2.55k | if (p->error_indicator) { |
35998 | 0 | p->level--; |
35999 | 0 | return NULL; |
36000 | 0 | } |
36001 | 2.55k | D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); |
36002 | 2.55k | Token * _literal; |
36003 | 2.55k | void *_tmp_171_var; |
36004 | 2.55k | if ( |
36005 | 2.55k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
36006 | 1.23k | && |
36007 | 1.23k | (_tmp_171_var = _tmp_171_rule(p)) // ':' | '**' |
36008 | 2.55k | ) |
36009 | 3 | { |
36010 | 3 | D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); |
36011 | 3 | _res = _PyPegen_dummy_name(p, _literal, _tmp_171_var); |
36012 | 3 | goto done; |
36013 | 3 | } |
36014 | 2.54k | p->mark = _mark; |
36015 | 2.54k | D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ', |
36016 | 2.54k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); |
36017 | 2.54k | } |
36018 | 2.54k | _res = NULL; |
36019 | 2.55k | done: |
36020 | 2.55k | p->level--; |
36021 | 2.55k | return _res; |
36022 | 2.54k | } |
36023 | | |
36024 | | // _tmp_134: lambda_param_no_default | ',' |
36025 | | static void * |
36026 | | _tmp_134_rule(Parser *p) |
36027 | 2.61k | { |
36028 | 2.61k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36029 | 0 | _Pypegen_stack_overflow(p); |
36030 | 0 | } |
36031 | 2.61k | if (p->error_indicator) { |
36032 | 0 | p->level--; |
36033 | 0 | return NULL; |
36034 | 0 | } |
36035 | 2.61k | void * _res = NULL; |
36036 | 2.61k | int _mark = p->mark; |
36037 | 2.61k | { // lambda_param_no_default |
36038 | 2.61k | if (p->error_indicator) { |
36039 | 0 | p->level--; |
36040 | 0 | return NULL; |
36041 | 0 | } |
36042 | 2.61k | D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
36043 | 2.61k | arg_ty lambda_param_no_default_var; |
36044 | 2.61k | if ( |
36045 | 2.61k | (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default |
36046 | 2.61k | ) |
36047 | 1.23k | { |
36048 | 1.23k | D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); |
36049 | 1.23k | _res = lambda_param_no_default_var; |
36050 | 1.23k | goto done; |
36051 | 1.23k | } |
36052 | 1.37k | p->mark = _mark; |
36053 | 1.37k | D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ', |
36054 | 1.37k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
36055 | 1.37k | } |
36056 | 0 | { // ',' |
36057 | 1.37k | if (p->error_indicator) { |
36058 | 1 | p->level--; |
36059 | 1 | return NULL; |
36060 | 1 | } |
36061 | 1.37k | D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
36062 | 1.37k | Token * _literal; |
36063 | 1.37k | if ( |
36064 | 1.37k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
36065 | 1.37k | ) |
36066 | 1.23k | { |
36067 | 1.23k | D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
36068 | 1.23k | _res = _literal; |
36069 | 1.23k | goto done; |
36070 | 1.23k | } |
36071 | 141 | p->mark = _mark; |
36072 | 141 | D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ', |
36073 | 141 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
36074 | 141 | } |
36075 | 141 | _res = NULL; |
36076 | 2.61k | done: |
36077 | 2.61k | p->level--; |
36078 | 2.61k | return _res; |
36079 | 141 | } |
36080 | | |
36081 | | // _tmp_135: bitwise_or ((',' bitwise_or))* ','? |
36082 | | static void * |
36083 | | _tmp_135_rule(Parser *p) |
36084 | 2.96k | { |
36085 | 2.96k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36086 | 0 | _Pypegen_stack_overflow(p); |
36087 | 0 | } |
36088 | 2.96k | if (p->error_indicator) { |
36089 | 0 | p->level--; |
36090 | 0 | return NULL; |
36091 | 0 | } |
36092 | 2.96k | void * _res = NULL; |
36093 | 2.96k | int _mark = p->mark; |
36094 | 2.96k | { // bitwise_or ((',' bitwise_or))* ','? |
36095 | 2.96k | if (p->error_indicator) { |
36096 | 0 | p->level--; |
36097 | 0 | return NULL; |
36098 | 0 | } |
36099 | 2.96k | D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or ((',' bitwise_or))* ','?")); |
36100 | 2.96k | asdl_seq * _loop0_172_var; |
36101 | 2.96k | void *_opt_var; |
36102 | 2.96k | UNUSED(_opt_var); // Silence compiler warnings |
36103 | 2.96k | expr_ty bitwise_or_var; |
36104 | 2.96k | if ( |
36105 | 2.96k | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
36106 | 632 | && |
36107 | 632 | (_loop0_172_var = _loop0_172_rule(p)) // ((',' bitwise_or))* |
36108 | 632 | && |
36109 | 632 | (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? |
36110 | 2.96k | ) |
36111 | 109 | { |
36112 | 109 | D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or ((',' bitwise_or))* ','?")); |
36113 | 109 | _res = _PyPegen_dummy_name(p, bitwise_or_var, _loop0_172_var, _opt_var); |
36114 | 109 | goto done; |
36115 | 109 | } |
36116 | 2.85k | p->mark = _mark; |
36117 | 2.85k | D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ', |
36118 | 2.85k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or ((',' bitwise_or))* ','?")); |
36119 | 2.85k | } |
36120 | 2.85k | _res = NULL; |
36121 | 2.96k | done: |
36122 | 2.96k | p->level--; |
36123 | 2.96k | return _res; |
36124 | 2.85k | } |
36125 | | |
36126 | | // _loop0_136: ',' dotted_name |
36127 | | static asdl_seq * |
36128 | | _loop0_136_rule(Parser *p) |
36129 | 733 | { |
36130 | 733 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36131 | 0 | _Pypegen_stack_overflow(p); |
36132 | 0 | } |
36133 | 733 | if (p->error_indicator) { |
36134 | 0 | p->level--; |
36135 | 0 | return NULL; |
36136 | 0 | } |
36137 | 733 | void *_res = NULL; |
36138 | 733 | int _mark = p->mark; |
36139 | 733 | void **_children = PyMem_Malloc(sizeof(void *)); |
36140 | 733 | if (!_children) { |
36141 | 0 | p->error_indicator = 1; |
36142 | 0 | PyErr_NoMemory(); |
36143 | 0 | p->level--; |
36144 | 0 | return NULL; |
36145 | 0 | } |
36146 | 733 | Py_ssize_t _children_capacity = 1; |
36147 | 733 | Py_ssize_t _n = 0; |
36148 | 733 | { // ',' dotted_name |
36149 | 733 | if (p->error_indicator) { |
36150 | 0 | p->level--; |
36151 | 0 | return NULL; |
36152 | 0 | } |
36153 | 733 | D(fprintf(stderr, "%*c> _loop0_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_name")); |
36154 | 733 | Token * _literal; |
36155 | 733 | expr_ty elem; |
36156 | 733 | while ( |
36157 | 2.60k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
36158 | 1.89k | && |
36159 | 1.89k | (elem = dotted_name_rule(p)) // dotted_name |
36160 | 733 | ) |
36161 | 1.87k | { |
36162 | 1.87k | _res = elem; |
36163 | 1.87k | if (_res == NULL && PyErr_Occurred()) { |
36164 | 0 | p->error_indicator = 1; |
36165 | 0 | PyMem_Free(_children); |
36166 | 0 | p->level--; |
36167 | 0 | return NULL; |
36168 | 0 | } |
36169 | 1.87k | if (_n == _children_capacity) { |
36170 | 552 | _children_capacity *= 2; |
36171 | 552 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
36172 | 552 | if (!_new_children) { |
36173 | 0 | PyMem_Free(_children); |
36174 | 0 | p->error_indicator = 1; |
36175 | 0 | PyErr_NoMemory(); |
36176 | 0 | p->level--; |
36177 | 0 | return NULL; |
36178 | 0 | } |
36179 | 552 | _children = _new_children; |
36180 | 552 | } |
36181 | 1.87k | _children[_n++] = _res; |
36182 | 1.87k | _mark = p->mark; |
36183 | 1.87k | } |
36184 | 733 | p->mark = _mark; |
36185 | 733 | D(fprintf(stderr, "%*c%s _loop0_136[%d-%d]: %s failed!\n", p->level, ' ', |
36186 | 733 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_name")); |
36187 | 733 | } |
36188 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
36189 | 733 | if (!_seq) { |
36190 | 0 | PyMem_Free(_children); |
36191 | 0 | p->error_indicator = 1; |
36192 | 0 | PyErr_NoMemory(); |
36193 | 0 | p->level--; |
36194 | 0 | return NULL; |
36195 | 0 | } |
36196 | 2.60k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
36197 | 733 | PyMem_Free(_children); |
36198 | 733 | p->level--; |
36199 | 733 | return _seq; |
36200 | 733 | } |
36201 | | |
36202 | | // _gather_137: dotted_name _loop0_136 |
36203 | | static asdl_seq * |
36204 | | _gather_137_rule(Parser *p) |
36205 | 740 | { |
36206 | 740 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36207 | 0 | _Pypegen_stack_overflow(p); |
36208 | 0 | } |
36209 | 740 | if (p->error_indicator) { |
36210 | 0 | p->level--; |
36211 | 0 | return NULL; |
36212 | 0 | } |
36213 | 740 | asdl_seq * _res = NULL; |
36214 | 740 | int _mark = p->mark; |
36215 | 740 | { // dotted_name _loop0_136 |
36216 | 740 | if (p->error_indicator) { |
36217 | 0 | p->level--; |
36218 | 0 | return NULL; |
36219 | 0 | } |
36220 | 740 | D(fprintf(stderr, "%*c> _gather_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name _loop0_136")); |
36221 | 740 | expr_ty elem; |
36222 | 740 | asdl_seq * seq; |
36223 | 740 | if ( |
36224 | 740 | (elem = dotted_name_rule(p)) // dotted_name |
36225 | 733 | && |
36226 | 733 | (seq = _loop0_136_rule(p)) // _loop0_136 |
36227 | 740 | ) |
36228 | 733 | { |
36229 | 733 | D(fprintf(stderr, "%*c+ _gather_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name _loop0_136")); |
36230 | 733 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
36231 | 733 | goto done; |
36232 | 733 | } |
36233 | 7 | p->mark = _mark; |
36234 | 7 | D(fprintf(stderr, "%*c%s _gather_137[%d-%d]: %s failed!\n", p->level, ' ', |
36235 | 7 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name _loop0_136")); |
36236 | 7 | } |
36237 | 7 | _res = NULL; |
36238 | 740 | done: |
36239 | 740 | p->level--; |
36240 | 740 | return _res; |
36241 | 7 | } |
36242 | | |
36243 | | // _tmp_138: NAME (',' | ')' | ';' | NEWLINE) |
36244 | | static void * |
36245 | | _tmp_138_rule(Parser *p) |
36246 | 598 | { |
36247 | 598 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36248 | 0 | _Pypegen_stack_overflow(p); |
36249 | 0 | } |
36250 | 598 | if (p->error_indicator) { |
36251 | 0 | p->level--; |
36252 | 0 | return NULL; |
36253 | 0 | } |
36254 | 598 | void * _res = NULL; |
36255 | 598 | int _mark = p->mark; |
36256 | 598 | { // NAME (',' | ')' | ';' | NEWLINE) |
36257 | 598 | if (p->error_indicator) { |
36258 | 0 | p->level--; |
36259 | 0 | return NULL; |
36260 | 0 | } |
36261 | 598 | D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME (',' | ')' | ';' | NEWLINE)")); |
36262 | 598 | void *_tmp_173_var; |
36263 | 598 | expr_ty name_var; |
36264 | 598 | if ( |
36265 | 598 | (name_var = _PyPegen_name_token(p)) // NAME |
36266 | 571 | && |
36267 | 571 | (_tmp_173_var = _tmp_173_rule(p)) // ',' | ')' | ';' | NEWLINE |
36268 | 598 | ) |
36269 | 562 | { |
36270 | 562 | D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME (',' | ')' | ';' | NEWLINE)")); |
36271 | 562 | _res = _PyPegen_dummy_name(p, name_var, _tmp_173_var); |
36272 | 562 | goto done; |
36273 | 562 | } |
36274 | 36 | p->mark = _mark; |
36275 | 36 | D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ', |
36276 | 36 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME (',' | ')' | ';' | NEWLINE)")); |
36277 | 36 | } |
36278 | 36 | _res = NULL; |
36279 | 598 | done: |
36280 | 598 | p->level--; |
36281 | 598 | return _res; |
36282 | 36 | } |
36283 | | |
36284 | | // _loop0_139: ',' (expression ['as' star_target]) |
36285 | | static asdl_seq * |
36286 | | _loop0_139_rule(Parser *p) |
36287 | 1.54k | { |
36288 | 1.54k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36289 | 0 | _Pypegen_stack_overflow(p); |
36290 | 0 | } |
36291 | 1.54k | if (p->error_indicator) { |
36292 | 0 | p->level--; |
36293 | 0 | return NULL; |
36294 | 0 | } |
36295 | 1.54k | void *_res = NULL; |
36296 | 1.54k | int _mark = p->mark; |
36297 | 1.54k | void **_children = PyMem_Malloc(sizeof(void *)); |
36298 | 1.54k | if (!_children) { |
36299 | 0 | p->error_indicator = 1; |
36300 | 0 | PyErr_NoMemory(); |
36301 | 0 | p->level--; |
36302 | 0 | return NULL; |
36303 | 0 | } |
36304 | 1.54k | Py_ssize_t _children_capacity = 1; |
36305 | 1.54k | Py_ssize_t _n = 0; |
36306 | 1.54k | { // ',' (expression ['as' star_target]) |
36307 | 1.54k | if (p->error_indicator) { |
36308 | 0 | p->level--; |
36309 | 0 | return NULL; |
36310 | 0 | } |
36311 | 1.54k | D(fprintf(stderr, "%*c> _loop0_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])")); |
36312 | 1.54k | Token * _literal; |
36313 | 1.54k | void *elem; |
36314 | 1.54k | while ( |
36315 | 2.99k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
36316 | 1.47k | && |
36317 | 1.47k | (elem = _tmp_174_rule(p)) // expression ['as' star_target] |
36318 | 1.54k | ) |
36319 | 1.45k | { |
36320 | 1.45k | _res = elem; |
36321 | 1.45k | if (_res == NULL && PyErr_Occurred()) { |
36322 | 0 | p->error_indicator = 1; |
36323 | 0 | PyMem_Free(_children); |
36324 | 0 | p->level--; |
36325 | 0 | return NULL; |
36326 | 0 | } |
36327 | 1.45k | if (_n == _children_capacity) { |
36328 | 242 | _children_capacity *= 2; |
36329 | 242 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
36330 | 242 | if (!_new_children) { |
36331 | 0 | PyMem_Free(_children); |
36332 | 0 | p->error_indicator = 1; |
36333 | 0 | PyErr_NoMemory(); |
36334 | 0 | p->level--; |
36335 | 0 | return NULL; |
36336 | 0 | } |
36337 | 242 | _children = _new_children; |
36338 | 242 | } |
36339 | 1.45k | _children[_n++] = _res; |
36340 | 1.45k | _mark = p->mark; |
36341 | 1.45k | } |
36342 | 1.54k | p->mark = _mark; |
36343 | 1.54k | D(fprintf(stderr, "%*c%s _loop0_139[%d-%d]: %s failed!\n", p->level, ' ', |
36344 | 1.54k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expression ['as' star_target])")); |
36345 | 1.54k | } |
36346 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
36347 | 1.54k | if (!_seq) { |
36348 | 0 | PyMem_Free(_children); |
36349 | 0 | p->error_indicator = 1; |
36350 | 0 | PyErr_NoMemory(); |
36351 | 0 | p->level--; |
36352 | 0 | return NULL; |
36353 | 0 | } |
36354 | 2.99k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
36355 | 1.54k | PyMem_Free(_children); |
36356 | 1.54k | p->level--; |
36357 | 1.54k | return _seq; |
36358 | 1.54k | } |
36359 | | |
36360 | | // _gather_140: (expression ['as' star_target]) _loop0_139 |
36361 | | static asdl_seq * |
36362 | | _gather_140_rule(Parser *p) |
36363 | 1.74k | { |
36364 | 1.74k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36365 | 0 | _Pypegen_stack_overflow(p); |
36366 | 0 | } |
36367 | 1.74k | if (p->error_indicator) { |
36368 | 0 | p->level--; |
36369 | 0 | return NULL; |
36370 | 0 | } |
36371 | 1.74k | asdl_seq * _res = NULL; |
36372 | 1.74k | int _mark = p->mark; |
36373 | 1.74k | { // (expression ['as' star_target]) _loop0_139 |
36374 | 1.74k | if (p->error_indicator) { |
36375 | 0 | p->level--; |
36376 | 0 | return NULL; |
36377 | 0 | } |
36378 | 1.74k | D(fprintf(stderr, "%*c> _gather_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_139")); |
36379 | 1.74k | void *elem; |
36380 | 1.74k | asdl_seq * seq; |
36381 | 1.74k | if ( |
36382 | 1.74k | (elem = _tmp_174_rule(p)) // expression ['as' star_target] |
36383 | 1.54k | && |
36384 | 1.54k | (seq = _loop0_139_rule(p)) // _loop0_139 |
36385 | 1.74k | ) |
36386 | 1.54k | { |
36387 | 1.54k | D(fprintf(stderr, "%*c+ _gather_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_139")); |
36388 | 1.54k | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
36389 | 1.54k | goto done; |
36390 | 1.54k | } |
36391 | 203 | p->mark = _mark; |
36392 | 203 | D(fprintf(stderr, "%*c%s _gather_140[%d-%d]: %s failed!\n", p->level, ' ', |
36393 | 203 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_139")); |
36394 | 203 | } |
36395 | 203 | _res = NULL; |
36396 | 1.74k | done: |
36397 | 1.74k | p->level--; |
36398 | 1.74k | return _res; |
36399 | 203 | } |
36400 | | |
36401 | | // _loop0_141: ',' (expressions ['as' star_target]) |
36402 | | static asdl_seq * |
36403 | | _loop0_141_rule(Parser *p) |
36404 | 909 | { |
36405 | 909 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36406 | 0 | _Pypegen_stack_overflow(p); |
36407 | 0 | } |
36408 | 909 | if (p->error_indicator) { |
36409 | 0 | p->level--; |
36410 | 0 | return NULL; |
36411 | 0 | } |
36412 | 909 | void *_res = NULL; |
36413 | 909 | int _mark = p->mark; |
36414 | 909 | void **_children = PyMem_Malloc(sizeof(void *)); |
36415 | 909 | if (!_children) { |
36416 | 0 | p->error_indicator = 1; |
36417 | 0 | PyErr_NoMemory(); |
36418 | 0 | p->level--; |
36419 | 0 | return NULL; |
36420 | 0 | } |
36421 | 909 | Py_ssize_t _children_capacity = 1; |
36422 | 909 | Py_ssize_t _n = 0; |
36423 | 909 | { // ',' (expressions ['as' star_target]) |
36424 | 909 | if (p->error_indicator) { |
36425 | 0 | p->level--; |
36426 | 0 | return NULL; |
36427 | 0 | } |
36428 | 909 | D(fprintf(stderr, "%*c> _loop0_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])")); |
36429 | 909 | Token * _literal; |
36430 | 909 | void *elem; |
36431 | 909 | while ( |
36432 | 2.37k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
36433 | 1.50k | && |
36434 | 1.50k | (elem = _tmp_175_rule(p)) // expressions ['as' star_target] |
36435 | 909 | ) |
36436 | 1.46k | { |
36437 | 1.46k | _res = elem; |
36438 | 1.46k | if (_res == NULL && PyErr_Occurred()) { |
36439 | 0 | p->error_indicator = 1; |
36440 | 0 | PyMem_Free(_children); |
36441 | 0 | p->level--; |
36442 | 0 | return NULL; |
36443 | 0 | } |
36444 | 1.46k | if (_n == _children_capacity) { |
36445 | 224 | _children_capacity *= 2; |
36446 | 224 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
36447 | 224 | if (!_new_children) { |
36448 | 0 | PyMem_Free(_children); |
36449 | 0 | p->error_indicator = 1; |
36450 | 0 | PyErr_NoMemory(); |
36451 | 0 | p->level--; |
36452 | 0 | return NULL; |
36453 | 0 | } |
36454 | 224 | _children = _new_children; |
36455 | 224 | } |
36456 | 1.46k | _children[_n++] = _res; |
36457 | 1.46k | _mark = p->mark; |
36458 | 1.46k | } |
36459 | 909 | p->mark = _mark; |
36460 | 909 | D(fprintf(stderr, "%*c%s _loop0_141[%d-%d]: %s failed!\n", p->level, ' ', |
36461 | 909 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expressions ['as' star_target])")); |
36462 | 909 | } |
36463 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
36464 | 909 | if (!_seq) { |
36465 | 0 | PyMem_Free(_children); |
36466 | 0 | p->error_indicator = 1; |
36467 | 0 | PyErr_NoMemory(); |
36468 | 0 | p->level--; |
36469 | 0 | return NULL; |
36470 | 0 | } |
36471 | 2.37k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
36472 | 909 | PyMem_Free(_children); |
36473 | 909 | p->level--; |
36474 | 909 | return _seq; |
36475 | 909 | } |
36476 | | |
36477 | | // _gather_142: (expressions ['as' star_target]) _loop0_141 |
36478 | | static asdl_seq * |
36479 | | _gather_142_rule(Parser *p) |
36480 | 1.16k | { |
36481 | 1.16k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36482 | 0 | _Pypegen_stack_overflow(p); |
36483 | 0 | } |
36484 | 1.16k | if (p->error_indicator) { |
36485 | 0 | p->level--; |
36486 | 0 | return NULL; |
36487 | 0 | } |
36488 | 1.16k | asdl_seq * _res = NULL; |
36489 | 1.16k | int _mark = p->mark; |
36490 | 1.16k | { // (expressions ['as' star_target]) _loop0_141 |
36491 | 1.16k | if (p->error_indicator) { |
36492 | 0 | p->level--; |
36493 | 0 | return NULL; |
36494 | 0 | } |
36495 | 1.16k | D(fprintf(stderr, "%*c> _gather_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_141")); |
36496 | 1.16k | void *elem; |
36497 | 1.16k | asdl_seq * seq; |
36498 | 1.16k | if ( |
36499 | 1.16k | (elem = _tmp_175_rule(p)) // expressions ['as' star_target] |
36500 | 909 | && |
36501 | 909 | (seq = _loop0_141_rule(p)) // _loop0_141 |
36502 | 1.16k | ) |
36503 | 909 | { |
36504 | 909 | D(fprintf(stderr, "%*c+ _gather_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_141")); |
36505 | 909 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
36506 | 909 | goto done; |
36507 | 909 | } |
36508 | 253 | p->mark = _mark; |
36509 | 253 | D(fprintf(stderr, "%*c%s _gather_142[%d-%d]: %s failed!\n", p->level, ' ', |
36510 | 253 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_141")); |
36511 | 253 | } |
36512 | 253 | _res = NULL; |
36513 | 1.16k | done: |
36514 | 1.16k | p->level--; |
36515 | 1.16k | return _res; |
36516 | 253 | } |
36517 | | |
36518 | | // _tmp_143: 'except' | 'finally' |
36519 | | static void * |
36520 | | _tmp_143_rule(Parser *p) |
36521 | 1.90k | { |
36522 | 1.90k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36523 | 0 | _Pypegen_stack_overflow(p); |
36524 | 0 | } |
36525 | 1.90k | if (p->error_indicator) { |
36526 | 0 | p->level--; |
36527 | 0 | return NULL; |
36528 | 0 | } |
36529 | 1.90k | void * _res = NULL; |
36530 | 1.90k | int _mark = p->mark; |
36531 | 1.90k | { // 'except' |
36532 | 1.90k | if (p->error_indicator) { |
36533 | 0 | p->level--; |
36534 | 0 | return NULL; |
36535 | 0 | } |
36536 | 1.90k | D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except'")); |
36537 | 1.90k | Token * _keyword; |
36538 | 1.90k | if ( |
36539 | 1.90k | (_keyword = _PyPegen_expect_token(p, 686)) // token='except' |
36540 | 1.90k | ) |
36541 | 1.40k | { |
36542 | 1.40k | D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except'")); |
36543 | 1.40k | _res = _keyword; |
36544 | 1.40k | goto done; |
36545 | 1.40k | } |
36546 | 495 | p->mark = _mark; |
36547 | 495 | D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', |
36548 | 495 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except'")); |
36549 | 495 | } |
36550 | 0 | { // 'finally' |
36551 | 495 | if (p->error_indicator) { |
36552 | 1 | p->level--; |
36553 | 1 | return NULL; |
36554 | 1 | } |
36555 | 494 | D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally'")); |
36556 | 494 | Token * _keyword; |
36557 | 494 | if ( |
36558 | 494 | (_keyword = _PyPegen_expect_token(p, 682)) // token='finally' |
36559 | 494 | ) |
36560 | 456 | { |
36561 | 456 | D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally'")); |
36562 | 456 | _res = _keyword; |
36563 | 456 | goto done; |
36564 | 456 | } |
36565 | 38 | p->mark = _mark; |
36566 | 38 | D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', |
36567 | 38 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally'")); |
36568 | 38 | } |
36569 | 38 | _res = NULL; |
36570 | 1.90k | done: |
36571 | 1.90k | p->level--; |
36572 | 1.90k | return _res; |
36573 | 38 | } |
36574 | | |
36575 | | // _loop0_144: block |
36576 | | static asdl_seq * |
36577 | | _loop0_144_rule(Parser *p) |
36578 | 3.85k | { |
36579 | 3.85k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36580 | 0 | _Pypegen_stack_overflow(p); |
36581 | 0 | } |
36582 | 3.85k | if (p->error_indicator) { |
36583 | 0 | p->level--; |
36584 | 0 | return NULL; |
36585 | 0 | } |
36586 | 3.85k | void *_res = NULL; |
36587 | 3.85k | int _mark = p->mark; |
36588 | 3.85k | void **_children = PyMem_Malloc(sizeof(void *)); |
36589 | 3.85k | if (!_children) { |
36590 | 0 | p->error_indicator = 1; |
36591 | 0 | PyErr_NoMemory(); |
36592 | 0 | p->level--; |
36593 | 0 | return NULL; |
36594 | 0 | } |
36595 | 3.85k | Py_ssize_t _children_capacity = 1; |
36596 | 3.85k | Py_ssize_t _n = 0; |
36597 | 3.85k | { // block |
36598 | 3.85k | if (p->error_indicator) { |
36599 | 0 | p->level--; |
36600 | 0 | return NULL; |
36601 | 0 | } |
36602 | 3.85k | D(fprintf(stderr, "%*c> _loop0_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "block")); |
36603 | 3.85k | asdl_stmt_seq* block_var; |
36604 | 3.85k | while ( |
36605 | 7.56k | (block_var = block_rule(p)) // block |
36606 | 3.85k | ) |
36607 | 3.70k | { |
36608 | 3.70k | _res = block_var; |
36609 | 3.70k | if (_n == _children_capacity) { |
36610 | 0 | _children_capacity *= 2; |
36611 | 0 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
36612 | 0 | if (!_new_children) { |
36613 | 0 | PyMem_Free(_children); |
36614 | 0 | p->error_indicator = 1; |
36615 | 0 | PyErr_NoMemory(); |
36616 | 0 | p->level--; |
36617 | 0 | return NULL; |
36618 | 0 | } |
36619 | 0 | _children = _new_children; |
36620 | 0 | } |
36621 | 3.70k | _children[_n++] = _res; |
36622 | 3.70k | _mark = p->mark; |
36623 | 3.70k | } |
36624 | 3.85k | p->mark = _mark; |
36625 | 3.85k | D(fprintf(stderr, "%*c%s _loop0_144[%d-%d]: %s failed!\n", p->level, ' ', |
36626 | 3.85k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "block")); |
36627 | 3.85k | } |
36628 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
36629 | 3.85k | if (!_seq) { |
36630 | 0 | PyMem_Free(_children); |
36631 | 0 | p->error_indicator = 1; |
36632 | 0 | PyErr_NoMemory(); |
36633 | 0 | p->level--; |
36634 | 0 | return NULL; |
36635 | 0 | } |
36636 | 7.56k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
36637 | 3.85k | PyMem_Free(_children); |
36638 | 3.85k | p->level--; |
36639 | 3.85k | return _seq; |
36640 | 3.85k | } |
36641 | | |
36642 | | // _tmp_145: expression ['as' NAME] |
36643 | | static void * |
36644 | | _tmp_145_rule(Parser *p) |
36645 | 15 | { |
36646 | 15 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36647 | 0 | _Pypegen_stack_overflow(p); |
36648 | 0 | } |
36649 | 15 | if (p->error_indicator) { |
36650 | 0 | p->level--; |
36651 | 0 | return NULL; |
36652 | 0 | } |
36653 | 15 | void * _res = NULL; |
36654 | 15 | int _mark = p->mark; |
36655 | 15 | { // expression ['as' NAME] |
36656 | 15 | if (p->error_indicator) { |
36657 | 0 | p->level--; |
36658 | 0 | return NULL; |
36659 | 0 | } |
36660 | 15 | D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' NAME]")); |
36661 | 15 | void *_opt_var; |
36662 | 15 | UNUSED(_opt_var); // Silence compiler warnings |
36663 | 15 | expr_ty expression_var; |
36664 | 15 | if ( |
36665 | 15 | (expression_var = expression_rule(p)) // expression |
36666 | 3 | && |
36667 | 3 | (_opt_var = _tmp_21_rule(p), !p->error_indicator) // ['as' NAME] |
36668 | 15 | ) |
36669 | 2 | { |
36670 | 2 | D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' NAME]")); |
36671 | 2 | _res = _PyPegen_dummy_name(p, expression_var, _opt_var); |
36672 | 2 | goto done; |
36673 | 2 | } |
36674 | 13 | p->mark = _mark; |
36675 | 13 | D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', |
36676 | 13 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' NAME]")); |
36677 | 13 | } |
36678 | 13 | _res = NULL; |
36679 | 15 | done: |
36680 | 15 | p->level--; |
36681 | 15 | return _res; |
36682 | 13 | } |
36683 | | |
36684 | | // _tmp_146: NEWLINE | ':' |
36685 | | static void * |
36686 | | _tmp_146_rule(Parser *p) |
36687 | 81 | { |
36688 | 81 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36689 | 0 | _Pypegen_stack_overflow(p); |
36690 | 0 | } |
36691 | 81 | if (p->error_indicator) { |
36692 | 0 | p->level--; |
36693 | 0 | return NULL; |
36694 | 0 | } |
36695 | 81 | void * _res = NULL; |
36696 | 81 | int _mark = p->mark; |
36697 | 81 | { // NEWLINE |
36698 | 81 | if (p->error_indicator) { |
36699 | 0 | p->level--; |
36700 | 0 | return NULL; |
36701 | 0 | } |
36702 | 81 | D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
36703 | 81 | Token * newline_var; |
36704 | 81 | if ( |
36705 | 81 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
36706 | 81 | ) |
36707 | 3 | { |
36708 | 3 | D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
36709 | 3 | _res = newline_var; |
36710 | 3 | goto done; |
36711 | 3 | } |
36712 | 78 | p->mark = _mark; |
36713 | 78 | D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', |
36714 | 78 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
36715 | 78 | } |
36716 | 0 | { // ':' |
36717 | 78 | if (p->error_indicator) { |
36718 | 0 | p->level--; |
36719 | 0 | return NULL; |
36720 | 0 | } |
36721 | 78 | D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
36722 | 78 | Token * _literal; |
36723 | 78 | if ( |
36724 | 78 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
36725 | 78 | ) |
36726 | 2 | { |
36727 | 2 | D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
36728 | 2 | _res = _literal; |
36729 | 2 | goto done; |
36730 | 2 | } |
36731 | 76 | p->mark = _mark; |
36732 | 76 | D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', |
36733 | 76 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
36734 | 76 | } |
36735 | 76 | _res = NULL; |
36736 | 81 | done: |
36737 | 81 | p->level--; |
36738 | 81 | return _res; |
36739 | 76 | } |
36740 | | |
36741 | | // _tmp_147: items_pattern ',' |
36742 | | static void * |
36743 | | _tmp_147_rule(Parser *p) |
36744 | 242 | { |
36745 | 242 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36746 | 0 | _Pypegen_stack_overflow(p); |
36747 | 0 | } |
36748 | 242 | if (p->error_indicator) { |
36749 | 0 | p->level--; |
36750 | 0 | return NULL; |
36751 | 0 | } |
36752 | 242 | void * _res = NULL; |
36753 | 242 | int _mark = p->mark; |
36754 | 242 | { // items_pattern ',' |
36755 | 242 | if (p->error_indicator) { |
36756 | 0 | p->level--; |
36757 | 0 | return NULL; |
36758 | 0 | } |
36759 | 242 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "items_pattern ','")); |
36760 | 242 | Token * _literal; |
36761 | 242 | asdl_seq* items_pattern_var; |
36762 | 242 | if ( |
36763 | 242 | (items_pattern_var = items_pattern_rule(p)) // items_pattern |
36764 | 27 | && |
36765 | 27 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
36766 | 242 | ) |
36767 | 16 | { |
36768 | 16 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "items_pattern ','")); |
36769 | 16 | _res = _PyPegen_dummy_name(p, items_pattern_var, _literal); |
36770 | 16 | goto done; |
36771 | 16 | } |
36772 | 226 | p->mark = _mark; |
36773 | 226 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', |
36774 | 226 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "items_pattern ','")); |
36775 | 226 | } |
36776 | 226 | _res = NULL; |
36777 | 242 | done: |
36778 | 242 | p->level--; |
36779 | 242 | return _res; |
36780 | 226 | } |
36781 | | |
36782 | | // _tmp_148: positional_patterns ',' |
36783 | | static void * |
36784 | | _tmp_148_rule(Parser *p) |
36785 | 2.64k | { |
36786 | 2.64k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36787 | 0 | _Pypegen_stack_overflow(p); |
36788 | 0 | } |
36789 | 2.64k | if (p->error_indicator) { |
36790 | 0 | p->level--; |
36791 | 0 | return NULL; |
36792 | 0 | } |
36793 | 2.64k | void * _res = NULL; |
36794 | 2.64k | int _mark = p->mark; |
36795 | 2.64k | { // positional_patterns ',' |
36796 | 2.64k | if (p->error_indicator) { |
36797 | 0 | p->level--; |
36798 | 0 | return NULL; |
36799 | 0 | } |
36800 | 2.64k | D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "positional_patterns ','")); |
36801 | 2.64k | Token * _literal; |
36802 | 2.64k | asdl_pattern_seq* positional_patterns_var; |
36803 | 2.64k | if ( |
36804 | 2.64k | (positional_patterns_var = positional_patterns_rule(p)) // positional_patterns |
36805 | 1.34k | && |
36806 | 1.34k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
36807 | 2.64k | ) |
36808 | 562 | { |
36809 | 562 | D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "positional_patterns ','")); |
36810 | 562 | _res = _PyPegen_dummy_name(p, positional_patterns_var, _literal); |
36811 | 562 | goto done; |
36812 | 562 | } |
36813 | 2.08k | p->mark = _mark; |
36814 | 2.08k | D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', |
36815 | 2.08k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "positional_patterns ','")); |
36816 | 2.08k | } |
36817 | 2.08k | _res = NULL; |
36818 | 2.64k | done: |
36819 | 2.64k | p->level--; |
36820 | 2.64k | return _res; |
36821 | 2.08k | } |
36822 | | |
36823 | | // _tmp_149: '}' | ',' |
36824 | | static void * |
36825 | | _tmp_149_rule(Parser *p) |
36826 | 3.23k | { |
36827 | 3.23k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36828 | 0 | _Pypegen_stack_overflow(p); |
36829 | 0 | } |
36830 | 3.23k | if (p->error_indicator) { |
36831 | 0 | p->level--; |
36832 | 0 | return NULL; |
36833 | 0 | } |
36834 | 3.23k | void * _res = NULL; |
36835 | 3.23k | int _mark = p->mark; |
36836 | 3.23k | { // '}' |
36837 | 3.23k | if (p->error_indicator) { |
36838 | 0 | p->level--; |
36839 | 0 | return NULL; |
36840 | 0 | } |
36841 | 3.23k | D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'")); |
36842 | 3.23k | Token * _literal; |
36843 | 3.23k | if ( |
36844 | 3.23k | (_literal = _PyPegen_expect_token(p, 26)) // token='}' |
36845 | 3.23k | ) |
36846 | 1 | { |
36847 | 1 | D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'")); |
36848 | 1 | _res = _literal; |
36849 | 1 | goto done; |
36850 | 1 | } |
36851 | 3.23k | p->mark = _mark; |
36852 | 3.23k | D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', |
36853 | 3.23k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'")); |
36854 | 3.23k | } |
36855 | 0 | { // ',' |
36856 | 3.23k | if (p->error_indicator) { |
36857 | 0 | p->level--; |
36858 | 0 | return NULL; |
36859 | 0 | } |
36860 | 3.23k | D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
36861 | 3.23k | Token * _literal; |
36862 | 3.23k | if ( |
36863 | 3.23k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
36864 | 3.23k | ) |
36865 | 3 | { |
36866 | 3 | D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
36867 | 3 | _res = _literal; |
36868 | 3 | goto done; |
36869 | 3 | } |
36870 | 3.23k | p->mark = _mark; |
36871 | 3.23k | D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', |
36872 | 3.23k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
36873 | 3.23k | } |
36874 | 3.23k | _res = NULL; |
36875 | 3.23k | done: |
36876 | 3.23k | p->level--; |
36877 | 3.23k | return _res; |
36878 | 3.23k | } |
36879 | | |
36880 | | // _tmp_150: '=' | '!' | ':' | '}' |
36881 | | static void * |
36882 | | _tmp_150_rule(Parser *p) |
36883 | 231 | { |
36884 | 231 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36885 | 0 | _Pypegen_stack_overflow(p); |
36886 | 0 | } |
36887 | 231 | if (p->error_indicator) { |
36888 | 0 | p->level--; |
36889 | 0 | return NULL; |
36890 | 0 | } |
36891 | 231 | void * _res = NULL; |
36892 | 231 | int _mark = p->mark; |
36893 | 231 | { // '=' |
36894 | 231 | if (p->error_indicator) { |
36895 | 0 | p->level--; |
36896 | 0 | return NULL; |
36897 | 0 | } |
36898 | 231 | D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); |
36899 | 231 | Token * _literal; |
36900 | 231 | if ( |
36901 | 231 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
36902 | 231 | ) |
36903 | 22 | { |
36904 | 22 | D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); |
36905 | 22 | _res = _literal; |
36906 | 22 | goto done; |
36907 | 22 | } |
36908 | 209 | p->mark = _mark; |
36909 | 209 | D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', |
36910 | 209 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); |
36911 | 209 | } |
36912 | 0 | { // '!' |
36913 | 209 | if (p->error_indicator) { |
36914 | 0 | p->level--; |
36915 | 0 | return NULL; |
36916 | 0 | } |
36917 | 209 | D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!'")); |
36918 | 209 | Token * _literal; |
36919 | 209 | if ( |
36920 | 209 | (_literal = _PyPegen_expect_token(p, 54)) // token='!' |
36921 | 209 | ) |
36922 | 26 | { |
36923 | 26 | D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!'")); |
36924 | 26 | _res = _literal; |
36925 | 26 | goto done; |
36926 | 26 | } |
36927 | 183 | p->mark = _mark; |
36928 | 183 | D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', |
36929 | 183 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!'")); |
36930 | 183 | } |
36931 | 0 | { // ':' |
36932 | 183 | if (p->error_indicator) { |
36933 | 0 | p->level--; |
36934 | 0 | return NULL; |
36935 | 0 | } |
36936 | 183 | D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
36937 | 183 | Token * _literal; |
36938 | 183 | if ( |
36939 | 183 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
36940 | 183 | ) |
36941 | 146 | { |
36942 | 146 | D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
36943 | 146 | _res = _literal; |
36944 | 146 | goto done; |
36945 | 146 | } |
36946 | 37 | p->mark = _mark; |
36947 | 37 | D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', |
36948 | 37 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
36949 | 37 | } |
36950 | 0 | { // '}' |
36951 | 37 | if (p->error_indicator) { |
36952 | 0 | p->level--; |
36953 | 0 | return NULL; |
36954 | 0 | } |
36955 | 37 | D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'")); |
36956 | 37 | Token * _literal; |
36957 | 37 | if ( |
36958 | 37 | (_literal = _PyPegen_expect_token(p, 26)) // token='}' |
36959 | 37 | ) |
36960 | 0 | { |
36961 | 0 | D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'")); |
36962 | 0 | _res = _literal; |
36963 | 0 | goto done; |
36964 | 0 | } |
36965 | 37 | p->mark = _mark; |
36966 | 37 | D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', |
36967 | 37 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'")); |
36968 | 37 | } |
36969 | 37 | _res = NULL; |
36970 | 231 | done: |
36971 | 231 | p->level--; |
36972 | 231 | return _res; |
36973 | 37 | } |
36974 | | |
36975 | | // _tmp_151: '!' | ':' | '}' |
36976 | | static void * |
36977 | | _tmp_151_rule(Parser *p) |
36978 | 22 | { |
36979 | 22 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
36980 | 0 | _Pypegen_stack_overflow(p); |
36981 | 0 | } |
36982 | 22 | if (p->error_indicator) { |
36983 | 0 | p->level--; |
36984 | 0 | return NULL; |
36985 | 0 | } |
36986 | 22 | void * _res = NULL; |
36987 | 22 | int _mark = p->mark; |
36988 | 22 | { // '!' |
36989 | 22 | if (p->error_indicator) { |
36990 | 0 | p->level--; |
36991 | 0 | return NULL; |
36992 | 0 | } |
36993 | 22 | D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!'")); |
36994 | 22 | Token * _literal; |
36995 | 22 | if ( |
36996 | 22 | (_literal = _PyPegen_expect_token(p, 54)) // token='!' |
36997 | 22 | ) |
36998 | 4 | { |
36999 | 4 | D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!'")); |
37000 | 4 | _res = _literal; |
37001 | 4 | goto done; |
37002 | 4 | } |
37003 | 18 | p->mark = _mark; |
37004 | 18 | D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', |
37005 | 18 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!'")); |
37006 | 18 | } |
37007 | 0 | { // ':' |
37008 | 18 | if (p->error_indicator) { |
37009 | 0 | p->level--; |
37010 | 0 | return NULL; |
37011 | 0 | } |
37012 | 18 | D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
37013 | 18 | Token * _literal; |
37014 | 18 | if ( |
37015 | 18 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
37016 | 18 | ) |
37017 | 3 | { |
37018 | 3 | D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
37019 | 3 | _res = _literal; |
37020 | 3 | goto done; |
37021 | 3 | } |
37022 | 15 | p->mark = _mark; |
37023 | 15 | D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', |
37024 | 15 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
37025 | 15 | } |
37026 | 0 | { // '}' |
37027 | 15 | if (p->error_indicator) { |
37028 | 0 | p->level--; |
37029 | 0 | return NULL; |
37030 | 0 | } |
37031 | 15 | D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'")); |
37032 | 15 | Token * _literal; |
37033 | 15 | if ( |
37034 | 15 | (_literal = _PyPegen_expect_token(p, 26)) // token='}' |
37035 | 15 | ) |
37036 | 0 | { |
37037 | 0 | D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'")); |
37038 | 0 | _res = _literal; |
37039 | 0 | goto done; |
37040 | 0 | } |
37041 | 15 | p->mark = _mark; |
37042 | 15 | D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', |
37043 | 15 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'")); |
37044 | 15 | } |
37045 | 15 | _res = NULL; |
37046 | 22 | done: |
37047 | 22 | p->level--; |
37048 | 22 | return _res; |
37049 | 15 | } |
37050 | | |
37051 | | // _tmp_152: '!' NAME |
37052 | | static void * |
37053 | | _tmp_152_rule(Parser *p) |
37054 | 307 | { |
37055 | 307 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37056 | 0 | _Pypegen_stack_overflow(p); |
37057 | 0 | } |
37058 | 307 | if (p->error_indicator) { |
37059 | 0 | p->level--; |
37060 | 0 | return NULL; |
37061 | 0 | } |
37062 | 307 | void * _res = NULL; |
37063 | 307 | int _mark = p->mark; |
37064 | 307 | { // '!' NAME |
37065 | 307 | if (p->error_indicator) { |
37066 | 0 | p->level--; |
37067 | 0 | return NULL; |
37068 | 0 | } |
37069 | 307 | D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!' NAME")); |
37070 | 307 | Token * _literal; |
37071 | 307 | expr_ty name_var; |
37072 | 307 | if ( |
37073 | 307 | (_literal = _PyPegen_expect_token(p, 54)) // token='!' |
37074 | 9 | && |
37075 | 9 | (name_var = _PyPegen_name_token(p)) // NAME |
37076 | 307 | ) |
37077 | 9 | { |
37078 | 9 | D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' NAME")); |
37079 | 9 | _res = _PyPegen_dummy_name(p, _literal, name_var); |
37080 | 9 | goto done; |
37081 | 9 | } |
37082 | 298 | p->mark = _mark; |
37083 | 298 | D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', |
37084 | 298 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!' NAME")); |
37085 | 298 | } |
37086 | 298 | _res = NULL; |
37087 | 307 | done: |
37088 | 307 | p->level--; |
37089 | 307 | return _res; |
37090 | 298 | } |
37091 | | |
37092 | | // _tmp_153: ':' | '}' |
37093 | | static void * |
37094 | | _tmp_153_rule(Parser *p) |
37095 | 187 | { |
37096 | 187 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37097 | 0 | _Pypegen_stack_overflow(p); |
37098 | 0 | } |
37099 | 187 | if (p->error_indicator) { |
37100 | 0 | p->level--; |
37101 | 0 | return NULL; |
37102 | 0 | } |
37103 | 187 | void * _res = NULL; |
37104 | 187 | int _mark = p->mark; |
37105 | 187 | { // ':' |
37106 | 187 | if (p->error_indicator) { |
37107 | 0 | p->level--; |
37108 | 0 | return NULL; |
37109 | 0 | } |
37110 | 187 | D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
37111 | 187 | Token * _literal; |
37112 | 187 | if ( |
37113 | 187 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
37114 | 187 | ) |
37115 | 154 | { |
37116 | 154 | D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
37117 | 154 | _res = _literal; |
37118 | 154 | goto done; |
37119 | 154 | } |
37120 | 33 | p->mark = _mark; |
37121 | 33 | D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', |
37122 | 33 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
37123 | 33 | } |
37124 | 0 | { // '}' |
37125 | 33 | if (p->error_indicator) { |
37126 | 0 | p->level--; |
37127 | 0 | return NULL; |
37128 | 0 | } |
37129 | 33 | D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'")); |
37130 | 33 | Token * _literal; |
37131 | 33 | if ( |
37132 | 33 | (_literal = _PyPegen_expect_token(p, 26)) // token='}' |
37133 | 33 | ) |
37134 | 3 | { |
37135 | 3 | D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'")); |
37136 | 3 | _res = _literal; |
37137 | 3 | goto done; |
37138 | 3 | } |
37139 | 30 | p->mark = _mark; |
37140 | 30 | D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', |
37141 | 30 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'")); |
37142 | 30 | } |
37143 | 30 | _res = NULL; |
37144 | 187 | done: |
37145 | 187 | p->level--; |
37146 | 187 | return _res; |
37147 | 30 | } |
37148 | | |
37149 | | // _tmp_154: fstring | string |
37150 | | static void * |
37151 | | _tmp_154_rule(Parser *p) |
37152 | 203k | { |
37153 | 203k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37154 | 1 | _Pypegen_stack_overflow(p); |
37155 | 1 | } |
37156 | 203k | if (p->error_indicator) { |
37157 | 5 | p->level--; |
37158 | 5 | return NULL; |
37159 | 5 | } |
37160 | 203k | void * _res = NULL; |
37161 | 203k | int _mark = p->mark; |
37162 | 203k | { // fstring |
37163 | 203k | if (p->error_indicator) { |
37164 | 0 | p->level--; |
37165 | 0 | return NULL; |
37166 | 0 | } |
37167 | 203k | D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "fstring")); |
37168 | 203k | expr_ty fstring_var; |
37169 | 203k | if ( |
37170 | 203k | (fstring_var = fstring_rule(p)) // fstring |
37171 | 203k | ) |
37172 | 12.6k | { |
37173 | 12.6k | D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "fstring")); |
37174 | 12.6k | _res = fstring_var; |
37175 | 12.6k | goto done; |
37176 | 12.6k | } |
37177 | 190k | p->mark = _mark; |
37178 | 190k | D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', |
37179 | 190k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "fstring")); |
37180 | 190k | } |
37181 | 0 | { // string |
37182 | 190k | if (p->error_indicator) { |
37183 | 2.49k | p->level--; |
37184 | 2.49k | return NULL; |
37185 | 2.49k | } |
37186 | 187k | D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "string")); |
37187 | 187k | expr_ty string_var; |
37188 | 187k | if ( |
37189 | 187k | (string_var = string_rule(p)) // string |
37190 | 187k | ) |
37191 | 68.5k | { |
37192 | 68.5k | D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "string")); |
37193 | 68.5k | _res = string_var; |
37194 | 68.5k | goto done; |
37195 | 68.5k | } |
37196 | 119k | p->mark = _mark; |
37197 | 119k | D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', |
37198 | 119k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "string")); |
37199 | 119k | } |
37200 | 119k | _res = NULL; |
37201 | 200k | done: |
37202 | 200k | p->level--; |
37203 | 200k | return _res; |
37204 | 119k | } |
37205 | | |
37206 | | // _tmp_155: '+' | '-' | '*' | '/' | '%' | '//' | '@' |
37207 | | static void * |
37208 | | _tmp_155_rule(Parser *p) |
37209 | 204k | { |
37210 | 204k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37211 | 0 | _Pypegen_stack_overflow(p); |
37212 | 0 | } |
37213 | 204k | if (p->error_indicator) { |
37214 | 0 | p->level--; |
37215 | 0 | return NULL; |
37216 | 0 | } |
37217 | 204k | void * _res = NULL; |
37218 | 204k | int _mark = p->mark; |
37219 | 204k | { // '+' |
37220 | 204k | if (p->error_indicator) { |
37221 | 0 | p->level--; |
37222 | 0 | return NULL; |
37223 | 0 | } |
37224 | 204k | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'")); |
37225 | 204k | Token * _literal; |
37226 | 204k | if ( |
37227 | 204k | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
37228 | 204k | ) |
37229 | 1.18k | { |
37230 | 1.18k | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'")); |
37231 | 1.18k | _res = _literal; |
37232 | 1.18k | goto done; |
37233 | 1.18k | } |
37234 | 203k | p->mark = _mark; |
37235 | 203k | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
37236 | 203k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'")); |
37237 | 203k | } |
37238 | 0 | { // '-' |
37239 | 203k | if (p->error_indicator) { |
37240 | 0 | p->level--; |
37241 | 0 | return NULL; |
37242 | 0 | } |
37243 | 203k | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'")); |
37244 | 203k | Token * _literal; |
37245 | 203k | if ( |
37246 | 203k | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
37247 | 203k | ) |
37248 | 514 | { |
37249 | 514 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'")); |
37250 | 514 | _res = _literal; |
37251 | 514 | goto done; |
37252 | 514 | } |
37253 | 202k | p->mark = _mark; |
37254 | 202k | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
37255 | 202k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'")); |
37256 | 202k | } |
37257 | 0 | { // '*' |
37258 | 202k | if (p->error_indicator) { |
37259 | 0 | p->level--; |
37260 | 0 | return NULL; |
37261 | 0 | } |
37262 | 202k | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'")); |
37263 | 202k | Token * _literal; |
37264 | 202k | if ( |
37265 | 202k | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
37266 | 202k | ) |
37267 | 696 | { |
37268 | 696 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'")); |
37269 | 696 | _res = _literal; |
37270 | 696 | goto done; |
37271 | 696 | } |
37272 | 202k | p->mark = _mark; |
37273 | 202k | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
37274 | 202k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); |
37275 | 202k | } |
37276 | 0 | { // '/' |
37277 | 202k | if (p->error_indicator) { |
37278 | 0 | p->level--; |
37279 | 0 | return NULL; |
37280 | 0 | } |
37281 | 202k | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/'")); |
37282 | 202k | Token * _literal; |
37283 | 202k | if ( |
37284 | 202k | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
37285 | 202k | ) |
37286 | 442 | { |
37287 | 442 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/'")); |
37288 | 442 | _res = _literal; |
37289 | 442 | goto done; |
37290 | 442 | } |
37291 | 201k | p->mark = _mark; |
37292 | 201k | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
37293 | 201k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/'")); |
37294 | 201k | } |
37295 | 0 | { // '%' |
37296 | 201k | if (p->error_indicator) { |
37297 | 0 | p->level--; |
37298 | 0 | return NULL; |
37299 | 0 | } |
37300 | 201k | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%'")); |
37301 | 201k | Token * _literal; |
37302 | 201k | if ( |
37303 | 201k | (_literal = _PyPegen_expect_token(p, 24)) // token='%' |
37304 | 201k | ) |
37305 | 342 | { |
37306 | 342 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%'")); |
37307 | 342 | _res = _literal; |
37308 | 342 | goto done; |
37309 | 342 | } |
37310 | 201k | p->mark = _mark; |
37311 | 201k | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
37312 | 201k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%'")); |
37313 | 201k | } |
37314 | 0 | { // '//' |
37315 | 201k | if (p->error_indicator) { |
37316 | 0 | p->level--; |
37317 | 0 | return NULL; |
37318 | 0 | } |
37319 | 201k | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//'")); |
37320 | 201k | Token * _literal; |
37321 | 201k | if ( |
37322 | 201k | (_literal = _PyPegen_expect_token(p, 47)) // token='//' |
37323 | 201k | ) |
37324 | 212 | { |
37325 | 212 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//'")); |
37326 | 212 | _res = _literal; |
37327 | 212 | goto done; |
37328 | 212 | } |
37329 | 201k | p->mark = _mark; |
37330 | 201k | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
37331 | 201k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//'")); |
37332 | 201k | } |
37333 | 0 | { // '@' |
37334 | 201k | if (p->error_indicator) { |
37335 | 0 | p->level--; |
37336 | 0 | return NULL; |
37337 | 0 | } |
37338 | 201k | D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'")); |
37339 | 201k | Token * _literal; |
37340 | 201k | if ( |
37341 | 201k | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
37342 | 201k | ) |
37343 | 356 | { |
37344 | 356 | D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'")); |
37345 | 356 | _res = _literal; |
37346 | 356 | goto done; |
37347 | 356 | } |
37348 | 200k | p->mark = _mark; |
37349 | 200k | D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', |
37350 | 200k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); |
37351 | 200k | } |
37352 | 200k | _res = NULL; |
37353 | 204k | done: |
37354 | 204k | p->level--; |
37355 | 204k | return _res; |
37356 | 200k | } |
37357 | | |
37358 | | // _tmp_156: '+' | '-' | '~' |
37359 | | static void * |
37360 | | _tmp_156_rule(Parser *p) |
37361 | 292k | { |
37362 | 292k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37363 | 1 | _Pypegen_stack_overflow(p); |
37364 | 1 | } |
37365 | 292k | if (p->error_indicator) { |
37366 | 1 | p->level--; |
37367 | 1 | return NULL; |
37368 | 1 | } |
37369 | 292k | void * _res = NULL; |
37370 | 292k | int _mark = p->mark; |
37371 | 292k | { // '+' |
37372 | 292k | if (p->error_indicator) { |
37373 | 0 | p->level--; |
37374 | 0 | return NULL; |
37375 | 0 | } |
37376 | 292k | D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'")); |
37377 | 292k | Token * _literal; |
37378 | 292k | if ( |
37379 | 292k | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
37380 | 292k | ) |
37381 | 4.95k | { |
37382 | 4.95k | D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'")); |
37383 | 4.95k | _res = _literal; |
37384 | 4.95k | goto done; |
37385 | 4.95k | } |
37386 | 287k | p->mark = _mark; |
37387 | 287k | D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', |
37388 | 287k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'")); |
37389 | 287k | } |
37390 | 0 | { // '-' |
37391 | 287k | if (p->error_indicator) { |
37392 | 0 | p->level--; |
37393 | 0 | return NULL; |
37394 | 0 | } |
37395 | 287k | D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'")); |
37396 | 287k | Token * _literal; |
37397 | 287k | if ( |
37398 | 287k | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
37399 | 287k | ) |
37400 | 4.04k | { |
37401 | 4.04k | D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'")); |
37402 | 4.04k | _res = _literal; |
37403 | 4.04k | goto done; |
37404 | 4.04k | } |
37405 | 283k | p->mark = _mark; |
37406 | 283k | D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', |
37407 | 283k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'")); |
37408 | 283k | } |
37409 | 0 | { // '~' |
37410 | 283k | if (p->error_indicator) { |
37411 | 0 | p->level--; |
37412 | 0 | return NULL; |
37413 | 0 | } |
37414 | 283k | D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~'")); |
37415 | 283k | Token * _literal; |
37416 | 283k | if ( |
37417 | 283k | (_literal = _PyPegen_expect_token(p, 31)) // token='~' |
37418 | 283k | ) |
37419 | 1.38k | { |
37420 | 1.38k | D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~'")); |
37421 | 1.38k | _res = _literal; |
37422 | 1.38k | goto done; |
37423 | 1.38k | } |
37424 | 281k | p->mark = _mark; |
37425 | 281k | D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', |
37426 | 281k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~'")); |
37427 | 281k | } |
37428 | 281k | _res = NULL; |
37429 | 292k | done: |
37430 | 292k | p->level--; |
37431 | 292k | return _res; |
37432 | 281k | } |
37433 | | |
37434 | | // _tmp_157: star_targets '=' |
37435 | | static void * |
37436 | | _tmp_157_rule(Parser *p) |
37437 | 282k | { |
37438 | 282k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37439 | 0 | _Pypegen_stack_overflow(p); |
37440 | 0 | } |
37441 | 282k | if (p->error_indicator) { |
37442 | 0 | p->level--; |
37443 | 0 | return NULL; |
37444 | 0 | } |
37445 | 282k | void * _res = NULL; |
37446 | 282k | int _mark = p->mark; |
37447 | 282k | { // star_targets '=' |
37448 | 282k | if (p->error_indicator) { |
37449 | 0 | p->level--; |
37450 | 0 | return NULL; |
37451 | 0 | } |
37452 | 282k | D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
37453 | 282k | Token * _literal; |
37454 | 282k | expr_ty z; |
37455 | 282k | if ( |
37456 | 282k | (z = star_targets_rule(p)) // star_targets |
37457 | 142k | && |
37458 | 142k | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
37459 | 282k | ) |
37460 | 20.8k | { |
37461 | 20.8k | D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
37462 | 20.8k | _res = z; |
37463 | 20.8k | if (_res == NULL && PyErr_Occurred()) { |
37464 | 0 | p->error_indicator = 1; |
37465 | 0 | p->level--; |
37466 | 0 | return NULL; |
37467 | 0 | } |
37468 | 20.8k | goto done; |
37469 | 20.8k | } |
37470 | 261k | p->mark = _mark; |
37471 | 261k | D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', |
37472 | 261k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); |
37473 | 261k | } |
37474 | 261k | _res = NULL; |
37475 | 282k | done: |
37476 | 282k | p->level--; |
37477 | 282k | return _res; |
37478 | 261k | } |
37479 | | |
37480 | | // _tmp_158: '.' | '...' |
37481 | | static void * |
37482 | | _tmp_158_rule(Parser *p) |
37483 | 10.4k | { |
37484 | 10.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37485 | 0 | _Pypegen_stack_overflow(p); |
37486 | 0 | } |
37487 | 10.4k | if (p->error_indicator) { |
37488 | 0 | p->level--; |
37489 | 0 | return NULL; |
37490 | 0 | } |
37491 | 10.4k | void * _res = NULL; |
37492 | 10.4k | int _mark = p->mark; |
37493 | 10.4k | { // '.' |
37494 | 10.4k | if (p->error_indicator) { |
37495 | 0 | p->level--; |
37496 | 0 | return NULL; |
37497 | 0 | } |
37498 | 10.4k | D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
37499 | 10.4k | Token * _literal; |
37500 | 10.4k | if ( |
37501 | 10.4k | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
37502 | 10.4k | ) |
37503 | 4.53k | { |
37504 | 4.53k | D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
37505 | 4.53k | _res = _literal; |
37506 | 4.53k | goto done; |
37507 | 4.53k | } |
37508 | 5.92k | p->mark = _mark; |
37509 | 5.92k | D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', |
37510 | 5.92k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
37511 | 5.92k | } |
37512 | 0 | { // '...' |
37513 | 5.92k | if (p->error_indicator) { |
37514 | 7 | p->level--; |
37515 | 7 | return NULL; |
37516 | 7 | } |
37517 | 5.91k | D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); |
37518 | 5.91k | Token * _literal; |
37519 | 5.91k | if ( |
37520 | 5.91k | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
37521 | 5.91k | ) |
37522 | 1.29k | { |
37523 | 1.29k | D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); |
37524 | 1.29k | _res = _literal; |
37525 | 1.29k | goto done; |
37526 | 1.29k | } |
37527 | 4.62k | p->mark = _mark; |
37528 | 4.62k | D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', |
37529 | 4.62k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
37530 | 4.62k | } |
37531 | 4.62k | _res = NULL; |
37532 | 10.4k | done: |
37533 | 10.4k | p->level--; |
37534 | 10.4k | return _res; |
37535 | 4.62k | } |
37536 | | |
37537 | | // _tmp_159: '@' named_expression NEWLINE |
37538 | | static void * |
37539 | | _tmp_159_rule(Parser *p) |
37540 | 23.8k | { |
37541 | 23.8k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37542 | 0 | _Pypegen_stack_overflow(p); |
37543 | 0 | } |
37544 | 23.8k | if (p->error_indicator) { |
37545 | 0 | p->level--; |
37546 | 0 | return NULL; |
37547 | 0 | } |
37548 | 23.8k | void * _res = NULL; |
37549 | 23.8k | int _mark = p->mark; |
37550 | 23.8k | { // '@' named_expression NEWLINE |
37551 | 23.8k | if (p->error_indicator) { |
37552 | 0 | p->level--; |
37553 | 0 | return NULL; |
37554 | 0 | } |
37555 | 23.8k | D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); |
37556 | 23.8k | Token * _literal; |
37557 | 23.8k | expr_ty f; |
37558 | 23.8k | Token * newline_var; |
37559 | 23.8k | if ( |
37560 | 23.8k | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
37561 | 4.71k | && |
37562 | 4.71k | (f = named_expression_rule(p)) // named_expression |
37563 | 4.58k | && |
37564 | 4.58k | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
37565 | 23.8k | ) |
37566 | 4.53k | { |
37567 | 4.53k | D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); |
37568 | 4.53k | _res = f; |
37569 | 4.53k | if (_res == NULL && PyErr_Occurred()) { |
37570 | 0 | p->error_indicator = 1; |
37571 | 0 | p->level--; |
37572 | 0 | return NULL; |
37573 | 0 | } |
37574 | 4.53k | goto done; |
37575 | 4.53k | } |
37576 | 19.3k | p->mark = _mark; |
37577 | 19.3k | D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', |
37578 | 19.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); |
37579 | 19.3k | } |
37580 | 19.3k | _res = NULL; |
37581 | 23.8k | done: |
37582 | 23.8k | p->level--; |
37583 | 23.8k | return _res; |
37584 | 19.3k | } |
37585 | | |
37586 | | // _tmp_160: ',' star_expression |
37587 | | static void * |
37588 | | _tmp_160_rule(Parser *p) |
37589 | 230k | { |
37590 | 230k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37591 | 0 | _Pypegen_stack_overflow(p); |
37592 | 0 | } |
37593 | 230k | if (p->error_indicator) { |
37594 | 0 | p->level--; |
37595 | 0 | return NULL; |
37596 | 0 | } |
37597 | 230k | void * _res = NULL; |
37598 | 230k | int _mark = p->mark; |
37599 | 230k | { // ',' star_expression |
37600 | 230k | if (p->error_indicator) { |
37601 | 0 | p->level--; |
37602 | 0 | return NULL; |
37603 | 0 | } |
37604 | 230k | D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); |
37605 | 230k | Token * _literal; |
37606 | 230k | expr_ty c; |
37607 | 230k | if ( |
37608 | 230k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
37609 | 24.0k | && |
37610 | 24.0k | (c = star_expression_rule(p)) // star_expression |
37611 | 230k | ) |
37612 | 15.9k | { |
37613 | 15.9k | D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); |
37614 | 15.9k | _res = c; |
37615 | 15.9k | if (_res == NULL && PyErr_Occurred()) { |
37616 | 0 | p->error_indicator = 1; |
37617 | 0 | p->level--; |
37618 | 0 | return NULL; |
37619 | 0 | } |
37620 | 15.9k | goto done; |
37621 | 15.9k | } |
37622 | 214k | p->mark = _mark; |
37623 | 214k | D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', |
37624 | 214k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); |
37625 | 214k | } |
37626 | 214k | _res = NULL; |
37627 | 230k | done: |
37628 | 230k | p->level--; |
37629 | 230k | return _res; |
37630 | 214k | } |
37631 | | |
37632 | | // _tmp_161: 'or' conjunction |
37633 | | static void * |
37634 | | _tmp_161_rule(Parser *p) |
37635 | 403k | { |
37636 | 403k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37637 | 0 | _Pypegen_stack_overflow(p); |
37638 | 0 | } |
37639 | 403k | if (p->error_indicator) { |
37640 | 0 | p->level--; |
37641 | 0 | return NULL; |
37642 | 0 | } |
37643 | 403k | void * _res = NULL; |
37644 | 403k | int _mark = p->mark; |
37645 | 403k | { // 'or' conjunction |
37646 | 403k | if (p->error_indicator) { |
37647 | 0 | p->level--; |
37648 | 0 | return NULL; |
37649 | 0 | } |
37650 | 403k | D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); |
37651 | 403k | Token * _keyword; |
37652 | 403k | expr_ty c; |
37653 | 403k | if ( |
37654 | 403k | (_keyword = _PyPegen_expect_token(p, 589)) // token='or' |
37655 | 5.52k | && |
37656 | 5.52k | (c = conjunction_rule(p)) // conjunction |
37657 | 403k | ) |
37658 | 5.24k | { |
37659 | 5.24k | D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); |
37660 | 5.24k | _res = c; |
37661 | 5.24k | if (_res == NULL && PyErr_Occurred()) { |
37662 | 0 | p->error_indicator = 1; |
37663 | 0 | p->level--; |
37664 | 0 | return NULL; |
37665 | 0 | } |
37666 | 5.24k | goto done; |
37667 | 5.24k | } |
37668 | 398k | p->mark = _mark; |
37669 | 398k | D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', |
37670 | 398k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); |
37671 | 398k | } |
37672 | 398k | _res = NULL; |
37673 | 403k | done: |
37674 | 403k | p->level--; |
37675 | 403k | return _res; |
37676 | 398k | } |
37677 | | |
37678 | | // _tmp_162: 'and' inversion |
37679 | | static void * |
37680 | | _tmp_162_rule(Parser *p) |
37681 | 407k | { |
37682 | 407k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37683 | 0 | _Pypegen_stack_overflow(p); |
37684 | 0 | } |
37685 | 407k | if (p->error_indicator) { |
37686 | 0 | p->level--; |
37687 | 0 | return NULL; |
37688 | 0 | } |
37689 | 407k | void * _res = NULL; |
37690 | 407k | int _mark = p->mark; |
37691 | 407k | { // 'and' inversion |
37692 | 407k | if (p->error_indicator) { |
37693 | 0 | p->level--; |
37694 | 0 | return NULL; |
37695 | 0 | } |
37696 | 407k | D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); |
37697 | 407k | Token * _keyword; |
37698 | 407k | expr_ty c; |
37699 | 407k | if ( |
37700 | 407k | (_keyword = _PyPegen_expect_token(p, 590)) // token='and' |
37701 | 4.21k | && |
37702 | 4.21k | (c = inversion_rule(p)) // inversion |
37703 | 407k | ) |
37704 | 3.77k | { |
37705 | 3.77k | D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); |
37706 | 3.77k | _res = c; |
37707 | 3.77k | if (_res == NULL && PyErr_Occurred()) { |
37708 | 0 | p->error_indicator = 1; |
37709 | 0 | p->level--; |
37710 | 0 | return NULL; |
37711 | 0 | } |
37712 | 3.77k | goto done; |
37713 | 3.77k | } |
37714 | 403k | p->mark = _mark; |
37715 | 403k | D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', |
37716 | 403k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); |
37717 | 403k | } |
37718 | 403k | _res = NULL; |
37719 | 407k | done: |
37720 | 407k | p->level--; |
37721 | 407k | return _res; |
37722 | 403k | } |
37723 | | |
37724 | | // _tmp_163: slice | starred_expression |
37725 | | static void * |
37726 | | _tmp_163_rule(Parser *p) |
37727 | 20.0k | { |
37728 | 20.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37729 | 0 | _Pypegen_stack_overflow(p); |
37730 | 0 | } |
37731 | 20.0k | if (p->error_indicator) { |
37732 | 0 | p->level--; |
37733 | 0 | return NULL; |
37734 | 0 | } |
37735 | 20.0k | void * _res = NULL; |
37736 | 20.0k | int _mark = p->mark; |
37737 | 20.0k | { // slice |
37738 | 20.0k | if (p->error_indicator) { |
37739 | 0 | p->level--; |
37740 | 0 | return NULL; |
37741 | 0 | } |
37742 | 20.0k | D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice")); |
37743 | 20.0k | expr_ty slice_var; |
37744 | 20.0k | if ( |
37745 | 20.0k | (slice_var = slice_rule(p)) // slice |
37746 | 20.0k | ) |
37747 | 16.6k | { |
37748 | 16.6k | D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice")); |
37749 | 16.6k | _res = slice_var; |
37750 | 16.6k | goto done; |
37751 | 16.6k | } |
37752 | 3.40k | p->mark = _mark; |
37753 | 3.40k | D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', |
37754 | 3.40k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice")); |
37755 | 3.40k | } |
37756 | 0 | { // starred_expression |
37757 | 3.40k | if (p->error_indicator) { |
37758 | 206 | p->level--; |
37759 | 206 | return NULL; |
37760 | 206 | } |
37761 | 3.20k | D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
37762 | 3.20k | expr_ty starred_expression_var; |
37763 | 3.20k | if ( |
37764 | 3.20k | (starred_expression_var = starred_expression_rule(p)) // starred_expression |
37765 | 3.20k | ) |
37766 | 531 | { |
37767 | 531 | D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
37768 | 531 | _res = starred_expression_var; |
37769 | 531 | goto done; |
37770 | 531 | } |
37771 | 2.67k | p->mark = _mark; |
37772 | 2.67k | D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', |
37773 | 2.67k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); |
37774 | 2.67k | } |
37775 | 2.67k | _res = NULL; |
37776 | 19.8k | done: |
37777 | 19.8k | p->level--; |
37778 | 19.8k | return _res; |
37779 | 2.67k | } |
37780 | | |
37781 | | // _tmp_164: 'if' disjunction |
37782 | | static void * |
37783 | | _tmp_164_rule(Parser *p) |
37784 | 17.0k | { |
37785 | 17.0k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37786 | 0 | _Pypegen_stack_overflow(p); |
37787 | 0 | } |
37788 | 17.0k | if (p->error_indicator) { |
37789 | 0 | p->level--; |
37790 | 0 | return NULL; |
37791 | 0 | } |
37792 | 17.0k | void * _res = NULL; |
37793 | 17.0k | int _mark = p->mark; |
37794 | 17.0k | { // 'if' disjunction |
37795 | 17.0k | if (p->error_indicator) { |
37796 | 0 | p->level--; |
37797 | 0 | return NULL; |
37798 | 0 | } |
37799 | 17.0k | D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); |
37800 | 17.0k | Token * _keyword; |
37801 | 17.0k | expr_ty z; |
37802 | 17.0k | if ( |
37803 | 17.0k | (_keyword = _PyPegen_expect_token(p, 691)) // token='if' |
37804 | 6.77k | && |
37805 | 6.77k | (z = disjunction_rule(p)) // disjunction |
37806 | 17.0k | ) |
37807 | 5.65k | { |
37808 | 5.65k | D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); |
37809 | 5.65k | _res = z; |
37810 | 5.65k | if (_res == NULL && PyErr_Occurred()) { |
37811 | 0 | p->error_indicator = 1; |
37812 | 0 | p->level--; |
37813 | 0 | return NULL; |
37814 | 0 | } |
37815 | 5.65k | goto done; |
37816 | 5.65k | } |
37817 | 11.4k | p->mark = _mark; |
37818 | 11.4k | D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', |
37819 | 11.4k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); |
37820 | 11.4k | } |
37821 | 11.4k | _res = NULL; |
37822 | 17.0k | done: |
37823 | 17.0k | p->level--; |
37824 | 17.0k | return _res; |
37825 | 11.4k | } |
37826 | | |
37827 | | // _tmp_165: starred_expression | (assignment_expression | expression !':=') !'=' |
37828 | | static void * |
37829 | | _tmp_165_rule(Parser *p) |
37830 | 100k | { |
37831 | 100k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37832 | 0 | _Pypegen_stack_overflow(p); |
37833 | 0 | } |
37834 | 100k | if (p->error_indicator) { |
37835 | 0 | p->level--; |
37836 | 0 | return NULL; |
37837 | 0 | } |
37838 | 100k | void * _res = NULL; |
37839 | 100k | int _mark = p->mark; |
37840 | 100k | { // starred_expression |
37841 | 100k | if (p->error_indicator) { |
37842 | 0 | p->level--; |
37843 | 0 | return NULL; |
37844 | 0 | } |
37845 | 100k | D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
37846 | 100k | expr_ty starred_expression_var; |
37847 | 100k | if ( |
37848 | 100k | (starred_expression_var = starred_expression_rule(p)) // starred_expression |
37849 | 100k | ) |
37850 | 4.64k | { |
37851 | 4.64k | D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); |
37852 | 4.64k | _res = starred_expression_var; |
37853 | 4.64k | goto done; |
37854 | 4.64k | } |
37855 | 96.3k | p->mark = _mark; |
37856 | 96.3k | D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', |
37857 | 96.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); |
37858 | 96.3k | } |
37859 | 0 | { // (assignment_expression | expression !':=') !'=' |
37860 | 96.3k | if (p->error_indicator) { |
37861 | 286 | p->level--; |
37862 | 286 | return NULL; |
37863 | 286 | } |
37864 | 96.0k | D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='")); |
37865 | 96.0k | void *_tmp_87_var; |
37866 | 96.0k | if ( |
37867 | 96.0k | (_tmp_87_var = _tmp_87_rule(p)) // assignment_expression | expression !':=' |
37868 | 63.5k | && |
37869 | 63.5k | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' |
37870 | 96.0k | ) |
37871 | 53.7k | { |
37872 | 53.7k | D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='")); |
37873 | 53.7k | _res = _tmp_87_var; |
37874 | 53.7k | goto done; |
37875 | 53.7k | } |
37876 | 42.3k | p->mark = _mark; |
37877 | 42.3k | D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', |
37878 | 42.3k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(assignment_expression | expression !':=') !'='")); |
37879 | 42.3k | } |
37880 | 42.3k | _res = NULL; |
37881 | 100k | done: |
37882 | 100k | p->level--; |
37883 | 100k | return _res; |
37884 | 42.3k | } |
37885 | | |
37886 | | // _tmp_166: ',' star_target |
37887 | | static void * |
37888 | | _tmp_166_rule(Parser *p) |
37889 | 23.4k | { |
37890 | 23.4k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37891 | 0 | _Pypegen_stack_overflow(p); |
37892 | 0 | } |
37893 | 23.4k | if (p->error_indicator) { |
37894 | 0 | p->level--; |
37895 | 0 | return NULL; |
37896 | 0 | } |
37897 | 23.4k | void * _res = NULL; |
37898 | 23.4k | int _mark = p->mark; |
37899 | 23.4k | { // ',' star_target |
37900 | 23.4k | if (p->error_indicator) { |
37901 | 0 | p->level--; |
37902 | 0 | return NULL; |
37903 | 0 | } |
37904 | 23.4k | D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
37905 | 23.4k | Token * _literal; |
37906 | 23.4k | expr_ty c; |
37907 | 23.4k | if ( |
37908 | 23.4k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
37909 | 16.9k | && |
37910 | 16.9k | (c = star_target_rule(p)) // star_target |
37911 | 23.4k | ) |
37912 | 9.61k | { |
37913 | 9.61k | D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
37914 | 9.61k | _res = c; |
37915 | 9.61k | if (_res == NULL && PyErr_Occurred()) { |
37916 | 0 | p->error_indicator = 1; |
37917 | 0 | p->level--; |
37918 | 0 | return NULL; |
37919 | 0 | } |
37920 | 9.61k | goto done; |
37921 | 9.61k | } |
37922 | 13.8k | p->mark = _mark; |
37923 | 13.8k | D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', |
37924 | 13.8k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); |
37925 | 13.8k | } |
37926 | 13.8k | _res = NULL; |
37927 | 23.4k | done: |
37928 | 23.4k | p->level--; |
37929 | 23.4k | return _res; |
37930 | 13.8k | } |
37931 | | |
37932 | | // _tmp_167: |
37933 | | // | ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs |
37934 | | static void * |
37935 | | _tmp_167_rule(Parser *p) |
37936 | 6.88k | { |
37937 | 6.88k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37938 | 0 | _Pypegen_stack_overflow(p); |
37939 | 0 | } |
37940 | 6.88k | if (p->error_indicator) { |
37941 | 0 | p->level--; |
37942 | 0 | return NULL; |
37943 | 0 | } |
37944 | 6.88k | void * _res = NULL; |
37945 | 6.88k | int _mark = p->mark; |
37946 | 6.88k | { // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs |
37947 | 6.88k | if (p->error_indicator) { |
37948 | 0 | p->level--; |
37949 | 0 | return NULL; |
37950 | 0 | } |
37951 | 6.88k | D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs")); |
37952 | 6.88k | asdl_seq * _gather_89_var; |
37953 | 6.88k | Token * _literal; |
37954 | 6.88k | asdl_seq* kwargs_var; |
37955 | 6.88k | if ( |
37956 | 6.88k | (_gather_89_var = _gather_89_rule(p)) // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ |
37957 | 2.56k | && |
37958 | 2.56k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
37959 | 471 | && |
37960 | 471 | (kwargs_var = kwargs_rule(p)) // kwargs |
37961 | 6.88k | ) |
37962 | 333 | { |
37963 | 333 | D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs")); |
37964 | 333 | _res = _PyPegen_dummy_name(p, _gather_89_var, _literal, kwargs_var); |
37965 | 333 | goto done; |
37966 | 333 | } |
37967 | 6.54k | p->mark = _mark; |
37968 | 6.54k | D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', |
37969 | 6.54k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs")); |
37970 | 6.54k | } |
37971 | 6.54k | _res = NULL; |
37972 | 6.88k | done: |
37973 | 6.88k | p->level--; |
37974 | 6.88k | return _res; |
37975 | 6.54k | } |
37976 | | |
37977 | | // _tmp_168: starred_expression !'=' |
37978 | | static void * |
37979 | | _tmp_168_rule(Parser *p) |
37980 | 2.38k | { |
37981 | 2.38k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
37982 | 0 | _Pypegen_stack_overflow(p); |
37983 | 0 | } |
37984 | 2.38k | if (p->error_indicator) { |
37985 | 0 | p->level--; |
37986 | 0 | return NULL; |
37987 | 0 | } |
37988 | 2.38k | void * _res = NULL; |
37989 | 2.38k | int _mark = p->mark; |
37990 | 2.38k | { // starred_expression !'=' |
37991 | 2.38k | if (p->error_indicator) { |
37992 | 0 | p->level--; |
37993 | 0 | return NULL; |
37994 | 0 | } |
37995 | 2.38k | D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression !'='")); |
37996 | 2.38k | expr_ty starred_expression_var; |
37997 | 2.38k | if ( |
37998 | 2.38k | (starred_expression_var = starred_expression_rule(p)) // starred_expression |
37999 | 1.09k | && |
38000 | 1.09k | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' |
38001 | 2.38k | ) |
38002 | 1.09k | { |
38003 | 1.09k | D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression !'='")); |
38004 | 1.09k | _res = starred_expression_var; |
38005 | 1.09k | goto done; |
38006 | 1.09k | } |
38007 | 1.29k | p->mark = _mark; |
38008 | 1.29k | D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ', |
38009 | 1.29k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression !'='")); |
38010 | 1.29k | } |
38011 | 1.29k | _res = NULL; |
38012 | 2.38k | done: |
38013 | 2.38k | p->level--; |
38014 | 2.38k | return _res; |
38015 | 1.29k | } |
38016 | | |
38017 | | // _tmp_169: !STRING expression_without_invalid |
38018 | | static void * |
38019 | | _tmp_169_rule(Parser *p) |
38020 | 5.91k | { |
38021 | 5.91k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
38022 | 1 | _Pypegen_stack_overflow(p); |
38023 | 1 | } |
38024 | 5.91k | if (p->error_indicator) { |
38025 | 1 | p->level--; |
38026 | 1 | return NULL; |
38027 | 1 | } |
38028 | 5.91k | void * _res = NULL; |
38029 | 5.91k | int _mark = p->mark; |
38030 | 5.91k | { // !STRING expression_without_invalid |
38031 | 5.91k | if (p->error_indicator) { |
38032 | 0 | p->level--; |
38033 | 0 | return NULL; |
38034 | 0 | } |
38035 | 5.91k | D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!STRING expression_without_invalid")); |
38036 | 5.91k | expr_ty expression_without_invalid_var; |
38037 | 5.91k | if ( |
38038 | 5.91k | _PyPegen_lookahead(0, _PyPegen_string_token, p) |
38039 | 5.32k | && |
38040 | 5.32k | (expression_without_invalid_var = expression_without_invalid_rule(p)) // expression_without_invalid |
38041 | 5.91k | ) |
38042 | 2.53k | { |
38043 | 2.53k | D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!STRING expression_without_invalid")); |
38044 | 2.53k | _res = expression_without_invalid_var; |
38045 | 2.53k | goto done; |
38046 | 2.53k | } |
38047 | 3.38k | p->mark = _mark; |
38048 | 3.38k | D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ', |
38049 | 3.38k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!STRING expression_without_invalid")); |
38050 | 3.38k | } |
38051 | 3.38k | _res = NULL; |
38052 | 5.91k | done: |
38053 | 5.91k | p->level--; |
38054 | 5.91k | return _res; |
38055 | 3.38k | } |
38056 | | |
38057 | | // _tmp_170: ')' | '**' |
38058 | | static void * |
38059 | | _tmp_170_rule(Parser *p) |
38060 | 705 | { |
38061 | 705 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
38062 | 0 | _Pypegen_stack_overflow(p); |
38063 | 0 | } |
38064 | 705 | if (p->error_indicator) { |
38065 | 0 | p->level--; |
38066 | 0 | return NULL; |
38067 | 0 | } |
38068 | 705 | void * _res = NULL; |
38069 | 705 | int _mark = p->mark; |
38070 | 705 | { // ')' |
38071 | 705 | if (p->error_indicator) { |
38072 | 0 | p->level--; |
38073 | 0 | return NULL; |
38074 | 0 | } |
38075 | 705 | D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
38076 | 705 | Token * _literal; |
38077 | 705 | if ( |
38078 | 705 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
38079 | 705 | ) |
38080 | 1 | { |
38081 | 1 | D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
38082 | 1 | _res = _literal; |
38083 | 1 | goto done; |
38084 | 1 | } |
38085 | 704 | p->mark = _mark; |
38086 | 704 | D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', |
38087 | 704 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
38088 | 704 | } |
38089 | 0 | { // '**' |
38090 | 704 | if (p->error_indicator) { |
38091 | 0 | p->level--; |
38092 | 0 | return NULL; |
38093 | 0 | } |
38094 | 704 | D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); |
38095 | 704 | Token * _literal; |
38096 | 704 | if ( |
38097 | 704 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
38098 | 704 | ) |
38099 | 1 | { |
38100 | 1 | D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); |
38101 | 1 | _res = _literal; |
38102 | 1 | goto done; |
38103 | 1 | } |
38104 | 703 | p->mark = _mark; |
38105 | 703 | D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', |
38106 | 703 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); |
38107 | 703 | } |
38108 | 703 | _res = NULL; |
38109 | 705 | done: |
38110 | 705 | p->level--; |
38111 | 705 | return _res; |
38112 | 703 | } |
38113 | | |
38114 | | // _tmp_171: ':' | '**' |
38115 | | static void * |
38116 | | _tmp_171_rule(Parser *p) |
38117 | 1.23k | { |
38118 | 1.23k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
38119 | 0 | _Pypegen_stack_overflow(p); |
38120 | 0 | } |
38121 | 1.23k | if (p->error_indicator) { |
38122 | 0 | p->level--; |
38123 | 0 | return NULL; |
38124 | 0 | } |
38125 | 1.23k | void * _res = NULL; |
38126 | 1.23k | int _mark = p->mark; |
38127 | 1.23k | { // ':' |
38128 | 1.23k | if (p->error_indicator) { |
38129 | 0 | p->level--; |
38130 | 0 | return NULL; |
38131 | 0 | } |
38132 | 1.23k | D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
38133 | 1.23k | Token * _literal; |
38134 | 1.23k | if ( |
38135 | 1.23k | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
38136 | 1.23k | ) |
38137 | 2 | { |
38138 | 2 | D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
38139 | 2 | _res = _literal; |
38140 | 2 | goto done; |
38141 | 2 | } |
38142 | 1.23k | p->mark = _mark; |
38143 | 1.23k | D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', |
38144 | 1.23k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
38145 | 1.23k | } |
38146 | 0 | { // '**' |
38147 | 1.23k | if (p->error_indicator) { |
38148 | 0 | p->level--; |
38149 | 0 | return NULL; |
38150 | 0 | } |
38151 | 1.23k | D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); |
38152 | 1.23k | Token * _literal; |
38153 | 1.23k | if ( |
38154 | 1.23k | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
38155 | 1.23k | ) |
38156 | 1 | { |
38157 | 1 | D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); |
38158 | 1 | _res = _literal; |
38159 | 1 | goto done; |
38160 | 1 | } |
38161 | 1.23k | p->mark = _mark; |
38162 | 1.23k | D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', |
38163 | 1.23k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); |
38164 | 1.23k | } |
38165 | 1.23k | _res = NULL; |
38166 | 1.23k | done: |
38167 | 1.23k | p->level--; |
38168 | 1.23k | return _res; |
38169 | 1.23k | } |
38170 | | |
38171 | | // _loop0_172: (',' bitwise_or) |
38172 | | static asdl_seq * |
38173 | | _loop0_172_rule(Parser *p) |
38174 | 632 | { |
38175 | 632 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
38176 | 0 | _Pypegen_stack_overflow(p); |
38177 | 0 | } |
38178 | 632 | if (p->error_indicator) { |
38179 | 0 | p->level--; |
38180 | 0 | return NULL; |
38181 | 0 | } |
38182 | 632 | void *_res = NULL; |
38183 | 632 | int _mark = p->mark; |
38184 | 632 | void **_children = PyMem_Malloc(sizeof(void *)); |
38185 | 632 | if (!_children) { |
38186 | 0 | p->error_indicator = 1; |
38187 | 0 | PyErr_NoMemory(); |
38188 | 0 | p->level--; |
38189 | 0 | return NULL; |
38190 | 0 | } |
38191 | 632 | Py_ssize_t _children_capacity = 1; |
38192 | 632 | Py_ssize_t _n = 0; |
38193 | 632 | { // (',' bitwise_or) |
38194 | 632 | if (p->error_indicator) { |
38195 | 0 | p->level--; |
38196 | 0 | return NULL; |
38197 | 0 | } |
38198 | 632 | D(fprintf(stderr, "%*c> _loop0_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' bitwise_or)")); |
38199 | 632 | void *_tmp_176_var; |
38200 | 632 | while ( |
38201 | 1.99k | (_tmp_176_var = _tmp_176_rule(p)) // ',' bitwise_or |
38202 | 632 | ) |
38203 | 1.35k | { |
38204 | 1.35k | _res = _tmp_176_var; |
38205 | 1.35k | if (_n == _children_capacity) { |
38206 | 532 | _children_capacity *= 2; |
38207 | 532 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
38208 | 532 | if (!_new_children) { |
38209 | 0 | PyMem_Free(_children); |
38210 | 0 | p->error_indicator = 1; |
38211 | 0 | PyErr_NoMemory(); |
38212 | 0 | p->level--; |
38213 | 0 | return NULL; |
38214 | 0 | } |
38215 | 532 | _children = _new_children; |
38216 | 532 | } |
38217 | 1.35k | _children[_n++] = _res; |
38218 | 1.35k | _mark = p->mark; |
38219 | 1.35k | } |
38220 | 632 | p->mark = _mark; |
38221 | 632 | D(fprintf(stderr, "%*c%s _loop0_172[%d-%d]: %s failed!\n", p->level, ' ', |
38222 | 632 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' bitwise_or)")); |
38223 | 632 | } |
38224 | 0 | asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); |
38225 | 632 | if (!_seq) { |
38226 | 0 | PyMem_Free(_children); |
38227 | 0 | p->error_indicator = 1; |
38228 | 0 | PyErr_NoMemory(); |
38229 | 0 | p->level--; |
38230 | 0 | return NULL; |
38231 | 0 | } |
38232 | 1.99k | for (Py_ssize_t i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); |
38233 | 632 | PyMem_Free(_children); |
38234 | 632 | p->level--; |
38235 | 632 | return _seq; |
38236 | 632 | } |
38237 | | |
38238 | | // _tmp_173: ',' | ')' | ';' | NEWLINE |
38239 | | static void * |
38240 | | _tmp_173_rule(Parser *p) |
38241 | 571 | { |
38242 | 571 | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
38243 | 0 | _Pypegen_stack_overflow(p); |
38244 | 0 | } |
38245 | 571 | if (p->error_indicator) { |
38246 | 0 | p->level--; |
38247 | 0 | return NULL; |
38248 | 0 | } |
38249 | 571 | void * _res = NULL; |
38250 | 571 | int _mark = p->mark; |
38251 | 571 | { // ',' |
38252 | 571 | if (p->error_indicator) { |
38253 | 0 | p->level--; |
38254 | 0 | return NULL; |
38255 | 0 | } |
38256 | 571 | D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); |
38257 | 571 | Token * _literal; |
38258 | 571 | if ( |
38259 | 571 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
38260 | 571 | ) |
38261 | 306 | { |
38262 | 306 | D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); |
38263 | 306 | _res = _literal; |
38264 | 306 | goto done; |
38265 | 306 | } |
38266 | 265 | p->mark = _mark; |
38267 | 265 | D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', |
38268 | 265 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
38269 | 265 | } |
38270 | 0 | { // ')' |
38271 | 265 | if (p->error_indicator) { |
38272 | 1 | p->level--; |
38273 | 1 | return NULL; |
38274 | 1 | } |
38275 | 264 | D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
38276 | 264 | Token * _literal; |
38277 | 264 | if ( |
38278 | 264 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
38279 | 264 | ) |
38280 | 18 | { |
38281 | 18 | D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
38282 | 18 | _res = _literal; |
38283 | 18 | goto done; |
38284 | 18 | } |
38285 | 246 | p->mark = _mark; |
38286 | 246 | D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', |
38287 | 246 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
38288 | 246 | } |
38289 | 0 | { // ';' |
38290 | 246 | if (p->error_indicator) { |
38291 | 0 | p->level--; |
38292 | 0 | return NULL; |
38293 | 0 | } |
38294 | 246 | D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'")); |
38295 | 246 | Token * _literal; |
38296 | 246 | if ( |
38297 | 246 | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
38298 | 246 | ) |
38299 | 0 | { |
38300 | 0 | D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'")); |
38301 | 0 | _res = _literal; |
38302 | 0 | goto done; |
38303 | 0 | } |
38304 | 246 | p->mark = _mark; |
38305 | 246 | D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', |
38306 | 246 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'")); |
38307 | 246 | } |
38308 | 0 | { // NEWLINE |
38309 | 246 | if (p->error_indicator) { |
38310 | 0 | p->level--; |
38311 | 0 | return NULL; |
38312 | 0 | } |
38313 | 246 | D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
38314 | 246 | Token * newline_var; |
38315 | 246 | if ( |
38316 | 246 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
38317 | 246 | ) |
38318 | 238 | { |
38319 | 238 | D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE")); |
38320 | 238 | _res = newline_var; |
38321 | 238 | goto done; |
38322 | 238 | } |
38323 | 8 | p->mark = _mark; |
38324 | 8 | D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', |
38325 | 8 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
38326 | 8 | } |
38327 | 8 | _res = NULL; |
38328 | 570 | done: |
38329 | 570 | p->level--; |
38330 | 570 | return _res; |
38331 | 8 | } |
38332 | | |
38333 | | // _tmp_174: expression ['as' star_target] |
38334 | | static void * |
38335 | | _tmp_174_rule(Parser *p) |
38336 | 3.22k | { |
38337 | 3.22k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
38338 | 0 | _Pypegen_stack_overflow(p); |
38339 | 0 | } |
38340 | 3.22k | if (p->error_indicator) { |
38341 | 0 | p->level--; |
38342 | 0 | return NULL; |
38343 | 0 | } |
38344 | 3.22k | void * _res = NULL; |
38345 | 3.22k | int _mark = p->mark; |
38346 | 3.22k | { // expression ['as' star_target] |
38347 | 3.22k | if (p->error_indicator) { |
38348 | 0 | p->level--; |
38349 | 0 | return NULL; |
38350 | 0 | } |
38351 | 3.22k | D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); |
38352 | 3.22k | void *_opt_var; |
38353 | 3.22k | UNUSED(_opt_var); // Silence compiler warnings |
38354 | 3.22k | expr_ty expression_var; |
38355 | 3.22k | if ( |
38356 | 3.22k | (expression_var = expression_rule(p)) // expression |
38357 | 2.99k | && |
38358 | 2.99k | (_opt_var = _tmp_177_rule(p), !p->error_indicator) // ['as' star_target] |
38359 | 3.22k | ) |
38360 | 2.99k | { |
38361 | 2.99k | D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); |
38362 | 2.99k | _res = _PyPegen_dummy_name(p, expression_var, _opt_var); |
38363 | 2.99k | goto done; |
38364 | 2.99k | } |
38365 | 226 | p->mark = _mark; |
38366 | 226 | D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', |
38367 | 226 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]")); |
38368 | 226 | } |
38369 | 226 | _res = NULL; |
38370 | 3.22k | done: |
38371 | 3.22k | p->level--; |
38372 | 3.22k | return _res; |
38373 | 226 | } |
38374 | | |
38375 | | // _tmp_175: expressions ['as' star_target] |
38376 | | static void * |
38377 | | _tmp_175_rule(Parser *p) |
38378 | 2.67k | { |
38379 | 2.67k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
38380 | 0 | _Pypegen_stack_overflow(p); |
38381 | 0 | } |
38382 | 2.67k | if (p->error_indicator) { |
38383 | 0 | p->level--; |
38384 | 0 | return NULL; |
38385 | 0 | } |
38386 | 2.67k | void * _res = NULL; |
38387 | 2.67k | int _mark = p->mark; |
38388 | 2.67k | { // expressions ['as' star_target] |
38389 | 2.67k | if (p->error_indicator) { |
38390 | 0 | p->level--; |
38391 | 0 | return NULL; |
38392 | 0 | } |
38393 | 2.67k | D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); |
38394 | 2.67k | void *_opt_var; |
38395 | 2.67k | UNUSED(_opt_var); // Silence compiler warnings |
38396 | 2.67k | expr_ty expressions_var; |
38397 | 2.67k | if ( |
38398 | 2.67k | (expressions_var = expressions_rule(p)) // expressions |
38399 | 2.37k | && |
38400 | 2.37k | (_opt_var = _tmp_177_rule(p), !p->error_indicator) // ['as' star_target] |
38401 | 2.67k | ) |
38402 | 2.37k | { |
38403 | 2.37k | D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); |
38404 | 2.37k | _res = _PyPegen_dummy_name(p, expressions_var, _opt_var); |
38405 | 2.37k | goto done; |
38406 | 2.37k | } |
38407 | 300 | p->mark = _mark; |
38408 | 300 | D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', |
38409 | 300 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]")); |
38410 | 300 | } |
38411 | 300 | _res = NULL; |
38412 | 2.67k | done: |
38413 | 2.67k | p->level--; |
38414 | 2.67k | return _res; |
38415 | 300 | } |
38416 | | |
38417 | | // _tmp_176: ',' bitwise_or |
38418 | | static void * |
38419 | | _tmp_176_rule(Parser *p) |
38420 | 1.99k | { |
38421 | 1.99k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
38422 | 0 | _Pypegen_stack_overflow(p); |
38423 | 0 | } |
38424 | 1.99k | if (p->error_indicator) { |
38425 | 0 | p->level--; |
38426 | 0 | return NULL; |
38427 | 0 | } |
38428 | 1.99k | void * _res = NULL; |
38429 | 1.99k | int _mark = p->mark; |
38430 | 1.99k | { // ',' bitwise_or |
38431 | 1.99k | if (p->error_indicator) { |
38432 | 0 | p->level--; |
38433 | 0 | return NULL; |
38434 | 0 | } |
38435 | 1.99k | D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' bitwise_or")); |
38436 | 1.99k | Token * _literal; |
38437 | 1.99k | expr_ty bitwise_or_var; |
38438 | 1.99k | if ( |
38439 | 1.99k | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
38440 | 1.88k | && |
38441 | 1.88k | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
38442 | 1.99k | ) |
38443 | 1.35k | { |
38444 | 1.35k | D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' bitwise_or")); |
38445 | 1.35k | _res = _PyPegen_dummy_name(p, _literal, bitwise_or_var); |
38446 | 1.35k | goto done; |
38447 | 1.35k | } |
38448 | 632 | p->mark = _mark; |
38449 | 632 | D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', |
38450 | 632 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' bitwise_or")); |
38451 | 632 | } |
38452 | 632 | _res = NULL; |
38453 | 1.99k | done: |
38454 | 1.99k | p->level--; |
38455 | 1.99k | return _res; |
38456 | 632 | } |
38457 | | |
38458 | | // _tmp_177: 'as' star_target |
38459 | | static void * |
38460 | | _tmp_177_rule(Parser *p) |
38461 | 5.37k | { |
38462 | 5.37k | if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) { |
38463 | 0 | _Pypegen_stack_overflow(p); |
38464 | 0 | } |
38465 | 5.37k | if (p->error_indicator) { |
38466 | 0 | p->level--; |
38467 | 0 | return NULL; |
38468 | 0 | } |
38469 | 5.37k | void * _res = NULL; |
38470 | 5.37k | int _mark = p->mark; |
38471 | 5.37k | { // 'as' star_target |
38472 | 5.37k | if (p->error_indicator) { |
38473 | 0 | p->level--; |
38474 | 0 | return NULL; |
38475 | 0 | } |
38476 | 5.37k | D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); |
38477 | 5.37k | Token * _keyword; |
38478 | 5.37k | expr_ty star_target_var; |
38479 | 5.37k | if ( |
38480 | 5.37k | (_keyword = _PyPegen_expect_token(p, 689)) // token='as' |
38481 | 671 | && |
38482 | 671 | (star_target_var = star_target_rule(p)) // star_target |
38483 | 5.37k | ) |
38484 | 657 | { |
38485 | 657 | D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); |
38486 | 657 | _res = _PyPegen_dummy_name(p, _keyword, star_target_var); |
38487 | 657 | goto done; |
38488 | 657 | } |
38489 | 4.71k | p->mark = _mark; |
38490 | 4.71k | D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', |
38491 | 4.71k | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); |
38492 | 4.71k | } |
38493 | 4.71k | _res = NULL; |
38494 | 5.37k | done: |
38495 | 5.37k | p->level--; |
38496 | 5.37k | return _res; |
38497 | 4.71k | } |
38498 | | |
38499 | | void * |
38500 | | _PyPegen_parse(Parser *p) |
38501 | 31.2k | { |
38502 | | // Initialize keywords |
38503 | 31.2k | p->keywords = reserved_keywords; |
38504 | 31.2k | p->n_keyword_lists = n_keyword_lists; |
38505 | 31.2k | p->soft_keywords = soft_keywords; |
38506 | | |
38507 | | // Run parser |
38508 | 31.2k | void *result = NULL; |
38509 | 31.2k | if (p->start_rule == Py_file_input) { |
38510 | 31.2k | result = file_rule(p); |
38511 | 31.2k | } else if (p->start_rule == Py_single_input) { |
38512 | 0 | result = interactive_rule(p); |
38513 | 75 | } else if (p->start_rule == Py_eval_input) { |
38514 | 75 | result = eval_rule(p); |
38515 | 75 | } else if (p->start_rule == Py_func_type_input) { |
38516 | 0 | result = func_type_rule(p); |
38517 | 0 | } |
38518 | | |
38519 | 31.2k | return result; |
38520 | 31.2k | } |