blob: 3e724a260d90a93df1c7670fb3f301e817199134 [file] [log] [blame]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001// @generated by pegen.py from ./Grammar/python.gram
2#include "pegen.h"
Guido van Rossumf70e43a1991-02-19 12:39:46 +00003
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004#if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
Guido van Rossum86bea461997-04-29 21:03:06 +00005extern int Py_DebugFlag;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006#define D(x) if (Py_DebugFlag) x;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00007#else
8#define D(x)
9#endif
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010static const int n_keyword_lists = 9;
11static KeywordToken *reserved_keywords[] = {
Pablo Galindo1ac0cbc2020-07-06 20:31:16 +010012 (KeywordToken[]) {{NULL, -1}},
13 (KeywordToken[]) {{NULL, -1}},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014 (KeywordToken[]) {
15 {"if", 510},
16 {"in", 518},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017 {"as", 520},
18 {"is", 527},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019 {"or", 531},
20 {NULL, -1},
21 },
22 (KeywordToken[]) {
23 {"del", 503},
24 {"try", 511},
25 {"for", 517},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030026 {"def", 523},
27 {"not", 526},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010028 {"and", 532},
29 {NULL, -1},
30 },
31 (KeywordToken[]) {
32 {"pass", 502},
33 {"from", 514},
34 {"elif", 515},
35 {"else", 516},
36 {"with", 519},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030037 {"True", 528},
38 {"None", 530},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010039 {NULL, -1},
40 },
41 (KeywordToken[]) {
42 {"raise", 501},
43 {"yield", 504},
44 {"break", 506},
45 {"while", 512},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030046 {"class", 524},
47 {"False", 529},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010048 {NULL, -1},
49 },
50 (KeywordToken[]) {
51 {"return", 500},
52 {"assert", 505},
53 {"global", 508},
54 {"import", 513},
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030055 {"except", 521},
56 {"lambda", 525},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010057 {NULL, -1},
58 },
59 (KeywordToken[]) {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030060 {"finally", 522},
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010061 {NULL, -1},
62 },
63 (KeywordToken[]) {
64 {"continue", 507},
65 {"nonlocal", 509},
66 {NULL, -1},
67 },
68};
69#define file_type 1000
70#define interactive_type 1001
71#define eval_type 1002
72#define func_type_type 1003
73#define fstring_type 1004
74#define type_expressions_type 1005
75#define statements_type 1006
76#define statement_type 1007
77#define statement_newline_type 1008
78#define simple_stmt_type 1009
79#define small_stmt_type 1010
80#define compound_stmt_type 1011
81#define assignment_type 1012
82#define augassign_type 1013
83#define global_stmt_type 1014
84#define nonlocal_stmt_type 1015
85#define yield_stmt_type 1016
86#define assert_stmt_type 1017
87#define del_stmt_type 1018
88#define import_stmt_type 1019
89#define import_name_type 1020
90#define import_from_type 1021
91#define import_from_targets_type 1022
92#define import_from_as_names_type 1023
93#define import_from_as_name_type 1024
94#define dotted_as_names_type 1025
95#define dotted_as_name_type 1026
96#define dotted_name_type 1027 // Left-recursive
97#define if_stmt_type 1028
98#define elif_stmt_type 1029
99#define else_block_type 1030
100#define while_stmt_type 1031
101#define for_stmt_type 1032
102#define with_stmt_type 1033
103#define with_item_type 1034
104#define try_stmt_type 1035
105#define except_block_type 1036
106#define finally_block_type 1037
107#define return_stmt_type 1038
108#define raise_stmt_type 1039
109#define function_def_type 1040
110#define function_def_raw_type 1041
111#define func_type_comment_type 1042
112#define params_type 1043
113#define parameters_type 1044
114#define slash_no_default_type 1045
115#define slash_with_default_type 1046
116#define star_etc_type 1047
117#define kwds_type 1048
118#define param_no_default_type 1049
119#define param_with_default_type 1050
120#define param_maybe_default_type 1051
121#define param_type 1052
122#define annotation_type 1053
123#define default_type 1054
124#define decorators_type 1055
125#define class_def_type 1056
126#define class_def_raw_type 1057
127#define block_type 1058
128#define expressions_list_type 1059
129#define star_expressions_type 1060
130#define star_expression_type 1061
131#define star_named_expressions_type 1062
132#define star_named_expression_type 1063
133#define named_expression_type 1064
134#define annotated_rhs_type 1065
135#define expressions_type 1066
136#define expression_type 1067
137#define lambdef_type 1068
138#define lambda_params_type 1069
139#define lambda_parameters_type 1070
140#define lambda_slash_no_default_type 1071
141#define lambda_slash_with_default_type 1072
142#define lambda_star_etc_type 1073
143#define lambda_kwds_type 1074
144#define lambda_param_no_default_type 1075
145#define lambda_param_with_default_type 1076
146#define lambda_param_maybe_default_type 1077
147#define lambda_param_type 1078
148#define disjunction_type 1079
149#define conjunction_type 1080
150#define inversion_type 1081
151#define comparison_type 1082
152#define compare_op_bitwise_or_pair_type 1083
153#define eq_bitwise_or_type 1084
154#define noteq_bitwise_or_type 1085
155#define lte_bitwise_or_type 1086
156#define lt_bitwise_or_type 1087
157#define gte_bitwise_or_type 1088
158#define gt_bitwise_or_type 1089
159#define notin_bitwise_or_type 1090
160#define in_bitwise_or_type 1091
161#define isnot_bitwise_or_type 1092
162#define is_bitwise_or_type 1093
163#define bitwise_or_type 1094 // Left-recursive
164#define bitwise_xor_type 1095 // Left-recursive
165#define bitwise_and_type 1096 // Left-recursive
166#define shift_expr_type 1097 // Left-recursive
167#define sum_type 1098 // Left-recursive
168#define term_type 1099 // Left-recursive
169#define factor_type 1100
170#define power_type 1101
171#define await_primary_type 1102
172#define primary_type 1103 // Left-recursive
173#define slices_type 1104
174#define slice_type 1105
175#define atom_type 1106
176#define strings_type 1107
177#define list_type 1108
178#define listcomp_type 1109
179#define tuple_type 1110
180#define group_type 1111
181#define genexp_type 1112
182#define set_type 1113
183#define setcomp_type 1114
184#define dict_type 1115
185#define dictcomp_type 1116
186#define double_starred_kvpairs_type 1117
187#define double_starred_kvpair_type 1118
188#define kvpair_type 1119
189#define for_if_clauses_type 1120
190#define for_if_clause_type 1121
191#define yield_expr_type 1122
192#define arguments_type 1123
193#define args_type 1124
194#define kwargs_type 1125
195#define starred_expression_type 1126
196#define kwarg_or_starred_type 1127
197#define kwarg_or_double_starred_type 1128
198#define star_targets_type 1129
199#define star_targets_seq_type 1130
200#define star_target_type 1131
201#define star_atom_type 1132
202#define single_target_type 1133
203#define single_subscript_attribute_target_type 1134
204#define del_targets_type 1135
205#define del_target_type 1136
206#define del_t_atom_type 1137
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300207#define targets_type 1138
208#define target_type 1139
209#define t_primary_type 1140 // Left-recursive
210#define t_lookahead_type 1141
211#define t_atom_type 1142
212#define incorrect_arguments_type 1143
213#define invalid_kwarg_type 1144
214#define invalid_named_expression_type 1145
215#define invalid_assignment_type 1146
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300216#define invalid_ann_assign_target_type 1147
217#define invalid_del_stmt_type 1148
218#define invalid_block_type 1149
219#define invalid_comprehension_type 1150
220#define invalid_dict_comprehension_type 1151
221#define invalid_parameters_type 1152
222#define invalid_lambda_parameters_type 1153
223#define invalid_star_etc_type 1154
224#define invalid_lambda_star_etc_type 1155
225#define invalid_double_type_comments_type 1156
226#define invalid_with_item_type 1157
227#define invalid_for_target_type 1158
228#define invalid_group_type 1159
229#define invalid_import_from_targets_type 1160
230#define _loop0_1_type 1161
231#define _loop0_2_type 1162
232#define _loop0_4_type 1163
233#define _gather_3_type 1164
234#define _loop0_6_type 1165
235#define _gather_5_type 1166
236#define _loop0_8_type 1167
237#define _gather_7_type 1168
238#define _loop0_10_type 1169
239#define _gather_9_type 1170
240#define _loop1_11_type 1171
241#define _loop0_13_type 1172
242#define _gather_12_type 1173
243#define _tmp_14_type 1174
244#define _tmp_15_type 1175
245#define _tmp_16_type 1176
246#define _tmp_17_type 1177
247#define _tmp_18_type 1178
248#define _tmp_19_type 1179
249#define _tmp_20_type 1180
250#define _tmp_21_type 1181
251#define _loop1_22_type 1182
252#define _tmp_23_type 1183
253#define _tmp_24_type 1184
254#define _loop0_26_type 1185
255#define _gather_25_type 1186
256#define _loop0_28_type 1187
257#define _gather_27_type 1188
258#define _tmp_29_type 1189
259#define _tmp_30_type 1190
260#define _loop0_31_type 1191
261#define _loop1_32_type 1192
262#define _loop0_34_type 1193
263#define _gather_33_type 1194
264#define _tmp_35_type 1195
265#define _loop0_37_type 1196
266#define _gather_36_type 1197
267#define _tmp_38_type 1198
268#define _loop0_40_type 1199
269#define _gather_39_type 1200
270#define _loop0_42_type 1201
271#define _gather_41_type 1202
272#define _loop0_44_type 1203
273#define _gather_43_type 1204
274#define _loop0_46_type 1205
275#define _gather_45_type 1206
276#define _tmp_47_type 1207
277#define _loop1_48_type 1208
278#define _tmp_49_type 1209
279#define _tmp_50_type 1210
280#define _tmp_51_type 1211
281#define _tmp_52_type 1212
282#define _tmp_53_type 1213
283#define _loop0_54_type 1214
284#define _loop0_55_type 1215
285#define _loop0_56_type 1216
286#define _loop1_57_type 1217
287#define _loop0_58_type 1218
288#define _loop1_59_type 1219
289#define _loop1_60_type 1220
290#define _loop1_61_type 1221
291#define _loop0_62_type 1222
292#define _loop1_63_type 1223
293#define _loop0_64_type 1224
294#define _loop1_65_type 1225
295#define _loop0_66_type 1226
296#define _loop1_67_type 1227
297#define _loop1_68_type 1228
298#define _tmp_69_type 1229
299#define _loop0_71_type 1230
300#define _gather_70_type 1231
301#define _loop1_72_type 1232
302#define _loop0_74_type 1233
303#define _gather_73_type 1234
304#define _loop1_75_type 1235
305#define _loop0_76_type 1236
306#define _loop0_77_type 1237
307#define _loop0_78_type 1238
308#define _loop1_79_type 1239
309#define _loop0_80_type 1240
310#define _loop1_81_type 1241
311#define _loop1_82_type 1242
312#define _loop1_83_type 1243
313#define _loop0_84_type 1244
314#define _loop1_85_type 1245
315#define _loop0_86_type 1246
316#define _loop1_87_type 1247
317#define _loop0_88_type 1248
318#define _loop1_89_type 1249
319#define _loop1_90_type 1250
320#define _loop1_91_type 1251
321#define _loop1_92_type 1252
322#define _tmp_93_type 1253
323#define _loop0_95_type 1254
324#define _gather_94_type 1255
325#define _tmp_96_type 1256
326#define _tmp_97_type 1257
327#define _tmp_98_type 1258
328#define _tmp_99_type 1259
329#define _loop1_100_type 1260
330#define _tmp_101_type 1261
331#define _tmp_102_type 1262
332#define _loop0_104_type 1263
333#define _gather_103_type 1264
334#define _loop1_105_type 1265
335#define _loop0_106_type 1266
336#define _loop0_107_type 1267
Pablo Galindo4a97b152020-09-02 17:44:19 +0100337#define _loop0_109_type 1268
338#define _gather_108_type 1269
339#define _tmp_110_type 1270
340#define _loop0_112_type 1271
341#define _gather_111_type 1272
342#define _loop0_114_type 1273
343#define _gather_113_type 1274
344#define _loop0_116_type 1275
345#define _gather_115_type 1276
346#define _loop0_118_type 1277
347#define _gather_117_type 1278
348#define _loop0_119_type 1279
349#define _loop0_121_type 1280
350#define _gather_120_type 1281
351#define _tmp_122_type 1282
352#define _loop0_124_type 1283
353#define _gather_123_type 1284
354#define _loop0_126_type 1285
355#define _gather_125_type 1286
356#define _tmp_127_type 1287
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300357#define _loop0_128_type 1288
358#define _loop0_129_type 1289
Pablo Galindo4a97b152020-09-02 17:44:19 +0100359#define _loop0_130_type 1290
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300360#define _tmp_131_type 1291
Pablo Galindo4a97b152020-09-02 17:44:19 +0100361#define _tmp_132_type 1292
362#define _loop0_133_type 1293
363#define _tmp_134_type 1294
364#define _loop0_135_type 1295
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300365#define _tmp_136_type 1296
366#define _tmp_137_type 1297
367#define _tmp_138_type 1298
368#define _tmp_139_type 1299
369#define _tmp_140_type 1300
370#define _tmp_141_type 1301
371#define _tmp_142_type 1302
372#define _tmp_143_type 1303
373#define _tmp_144_type 1304
374#define _tmp_145_type 1305
375#define _tmp_146_type 1306
376#define _tmp_147_type 1307
377#define _tmp_148_type 1308
378#define _tmp_149_type 1309
379#define _tmp_150_type 1310
Pablo Galindo4a97b152020-09-02 17:44:19 +0100380#define _tmp_151_type 1311
381#define _tmp_152_type 1312
382#define _loop1_153_type 1313
383#define _loop1_154_type 1314
384#define _tmp_155_type 1315
385#define _tmp_156_type 1316
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100386
387static mod_ty file_rule(Parser *p);
388static mod_ty interactive_rule(Parser *p);
389static mod_ty eval_rule(Parser *p);
390static mod_ty func_type_rule(Parser *p);
391static expr_ty fstring_rule(Parser *p);
392static asdl_seq* type_expressions_rule(Parser *p);
393static asdl_seq* statements_rule(Parser *p);
394static asdl_seq* statement_rule(Parser *p);
395static asdl_seq* statement_newline_rule(Parser *p);
396static asdl_seq* simple_stmt_rule(Parser *p);
397static stmt_ty small_stmt_rule(Parser *p);
398static stmt_ty compound_stmt_rule(Parser *p);
399static stmt_ty assignment_rule(Parser *p);
400static AugOperator* augassign_rule(Parser *p);
401static stmt_ty global_stmt_rule(Parser *p);
402static stmt_ty nonlocal_stmt_rule(Parser *p);
403static stmt_ty yield_stmt_rule(Parser *p);
404static stmt_ty assert_stmt_rule(Parser *p);
405static stmt_ty del_stmt_rule(Parser *p);
406static stmt_ty import_stmt_rule(Parser *p);
407static stmt_ty import_name_rule(Parser *p);
408static stmt_ty import_from_rule(Parser *p);
409static asdl_seq* import_from_targets_rule(Parser *p);
410static asdl_seq* import_from_as_names_rule(Parser *p);
411static alias_ty import_from_as_name_rule(Parser *p);
412static asdl_seq* dotted_as_names_rule(Parser *p);
413static alias_ty dotted_as_name_rule(Parser *p);
414static expr_ty dotted_name_rule(Parser *p);
415static stmt_ty if_stmt_rule(Parser *p);
416static stmt_ty elif_stmt_rule(Parser *p);
417static asdl_seq* else_block_rule(Parser *p);
418static stmt_ty while_stmt_rule(Parser *p);
419static stmt_ty for_stmt_rule(Parser *p);
420static stmt_ty with_stmt_rule(Parser *p);
421static withitem_ty with_item_rule(Parser *p);
422static stmt_ty try_stmt_rule(Parser *p);
423static excepthandler_ty except_block_rule(Parser *p);
424static asdl_seq* finally_block_rule(Parser *p);
425static stmt_ty return_stmt_rule(Parser *p);
426static stmt_ty raise_stmt_rule(Parser *p);
427static stmt_ty function_def_rule(Parser *p);
428static stmt_ty function_def_raw_rule(Parser *p);
429static Token* func_type_comment_rule(Parser *p);
430static arguments_ty params_rule(Parser *p);
431static arguments_ty parameters_rule(Parser *p);
432static asdl_seq* slash_no_default_rule(Parser *p);
433static SlashWithDefault* slash_with_default_rule(Parser *p);
434static StarEtc* star_etc_rule(Parser *p);
435static arg_ty kwds_rule(Parser *p);
436static arg_ty param_no_default_rule(Parser *p);
437static NameDefaultPair* param_with_default_rule(Parser *p);
438static NameDefaultPair* param_maybe_default_rule(Parser *p);
439static arg_ty param_rule(Parser *p);
440static expr_ty annotation_rule(Parser *p);
441static expr_ty default_rule(Parser *p);
442static asdl_seq* decorators_rule(Parser *p);
443static stmt_ty class_def_rule(Parser *p);
444static stmt_ty class_def_raw_rule(Parser *p);
445static asdl_seq* block_rule(Parser *p);
446static asdl_seq* expressions_list_rule(Parser *p);
447static expr_ty star_expressions_rule(Parser *p);
448static expr_ty star_expression_rule(Parser *p);
449static asdl_seq* star_named_expressions_rule(Parser *p);
450static expr_ty star_named_expression_rule(Parser *p);
451static expr_ty named_expression_rule(Parser *p);
452static expr_ty annotated_rhs_rule(Parser *p);
453static expr_ty expressions_rule(Parser *p);
454static expr_ty expression_rule(Parser *p);
455static expr_ty lambdef_rule(Parser *p);
456static arguments_ty lambda_params_rule(Parser *p);
457static arguments_ty lambda_parameters_rule(Parser *p);
458static asdl_seq* lambda_slash_no_default_rule(Parser *p);
459static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
460static StarEtc* lambda_star_etc_rule(Parser *p);
461static arg_ty lambda_kwds_rule(Parser *p);
462static arg_ty lambda_param_no_default_rule(Parser *p);
463static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
464static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
465static arg_ty lambda_param_rule(Parser *p);
466static expr_ty disjunction_rule(Parser *p);
467static expr_ty conjunction_rule(Parser *p);
468static expr_ty inversion_rule(Parser *p);
469static expr_ty comparison_rule(Parser *p);
470static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
471static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
472static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
473static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
474static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
475static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
476static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
477static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
478static CmpopExprPair* in_bitwise_or_rule(Parser *p);
479static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
480static CmpopExprPair* is_bitwise_or_rule(Parser *p);
481static expr_ty bitwise_or_rule(Parser *p);
482static expr_ty bitwise_xor_rule(Parser *p);
483static expr_ty bitwise_and_rule(Parser *p);
484static expr_ty shift_expr_rule(Parser *p);
485static expr_ty sum_rule(Parser *p);
486static expr_ty term_rule(Parser *p);
487static expr_ty factor_rule(Parser *p);
488static expr_ty power_rule(Parser *p);
489static expr_ty await_primary_rule(Parser *p);
490static expr_ty primary_rule(Parser *p);
491static expr_ty slices_rule(Parser *p);
492static expr_ty slice_rule(Parser *p);
493static expr_ty atom_rule(Parser *p);
494static expr_ty strings_rule(Parser *p);
495static expr_ty list_rule(Parser *p);
496static expr_ty listcomp_rule(Parser *p);
497static expr_ty tuple_rule(Parser *p);
498static expr_ty group_rule(Parser *p);
499static expr_ty genexp_rule(Parser *p);
500static expr_ty set_rule(Parser *p);
501static expr_ty setcomp_rule(Parser *p);
502static expr_ty dict_rule(Parser *p);
503static expr_ty dictcomp_rule(Parser *p);
504static asdl_seq* double_starred_kvpairs_rule(Parser *p);
505static KeyValuePair* double_starred_kvpair_rule(Parser *p);
506static KeyValuePair* kvpair_rule(Parser *p);
507static asdl_seq* for_if_clauses_rule(Parser *p);
508static comprehension_ty for_if_clause_rule(Parser *p);
509static expr_ty yield_expr_rule(Parser *p);
510static expr_ty arguments_rule(Parser *p);
511static expr_ty args_rule(Parser *p);
512static asdl_seq* kwargs_rule(Parser *p);
513static expr_ty starred_expression_rule(Parser *p);
514static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
515static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
516static expr_ty star_targets_rule(Parser *p);
517static asdl_seq* star_targets_seq_rule(Parser *p);
518static expr_ty star_target_rule(Parser *p);
519static expr_ty star_atom_rule(Parser *p);
520static expr_ty single_target_rule(Parser *p);
521static expr_ty single_subscript_attribute_target_rule(Parser *p);
522static asdl_seq* del_targets_rule(Parser *p);
523static expr_ty del_target_rule(Parser *p);
524static expr_ty del_t_atom_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100525static asdl_seq* targets_rule(Parser *p);
526static expr_ty target_rule(Parser *p);
527static expr_ty t_primary_rule(Parser *p);
528static void *t_lookahead_rule(Parser *p);
529static expr_ty t_atom_rule(Parser *p);
530static void *incorrect_arguments_rule(Parser *p);
531static void *invalid_kwarg_rule(Parser *p);
532static void *invalid_named_expression_rule(Parser *p);
533static void *invalid_assignment_rule(Parser *p);
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +0300534static expr_ty invalid_ann_assign_target_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300535static void *invalid_del_stmt_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100536static void *invalid_block_rule(Parser *p);
537static void *invalid_comprehension_rule(Parser *p);
538static void *invalid_dict_comprehension_rule(Parser *p);
539static void *invalid_parameters_rule(Parser *p);
540static void *invalid_lambda_parameters_rule(Parser *p);
541static void *invalid_star_etc_rule(Parser *p);
542static void *invalid_lambda_star_etc_rule(Parser *p);
543static void *invalid_double_type_comments_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300544static void *invalid_with_item_rule(Parser *p);
545static void *invalid_for_target_rule(Parser *p);
546static void *invalid_group_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100547static void *invalid_import_from_targets_rule(Parser *p);
548static asdl_seq *_loop0_1_rule(Parser *p);
549static asdl_seq *_loop0_2_rule(Parser *p);
550static asdl_seq *_loop0_4_rule(Parser *p);
551static asdl_seq *_gather_3_rule(Parser *p);
552static asdl_seq *_loop0_6_rule(Parser *p);
553static asdl_seq *_gather_5_rule(Parser *p);
554static asdl_seq *_loop0_8_rule(Parser *p);
555static asdl_seq *_gather_7_rule(Parser *p);
556static asdl_seq *_loop0_10_rule(Parser *p);
557static asdl_seq *_gather_9_rule(Parser *p);
558static asdl_seq *_loop1_11_rule(Parser *p);
559static asdl_seq *_loop0_13_rule(Parser *p);
560static asdl_seq *_gather_12_rule(Parser *p);
561static void *_tmp_14_rule(Parser *p);
562static void *_tmp_15_rule(Parser *p);
563static void *_tmp_16_rule(Parser *p);
564static void *_tmp_17_rule(Parser *p);
565static void *_tmp_18_rule(Parser *p);
566static void *_tmp_19_rule(Parser *p);
567static void *_tmp_20_rule(Parser *p);
568static void *_tmp_21_rule(Parser *p);
569static asdl_seq *_loop1_22_rule(Parser *p);
570static void *_tmp_23_rule(Parser *p);
571static void *_tmp_24_rule(Parser *p);
572static asdl_seq *_loop0_26_rule(Parser *p);
573static asdl_seq *_gather_25_rule(Parser *p);
574static asdl_seq *_loop0_28_rule(Parser *p);
575static asdl_seq *_gather_27_rule(Parser *p);
576static void *_tmp_29_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300577static void *_tmp_30_rule(Parser *p);
578static asdl_seq *_loop0_31_rule(Parser *p);
579static asdl_seq *_loop1_32_rule(Parser *p);
580static asdl_seq *_loop0_34_rule(Parser *p);
581static asdl_seq *_gather_33_rule(Parser *p);
582static void *_tmp_35_rule(Parser *p);
583static asdl_seq *_loop0_37_rule(Parser *p);
584static asdl_seq *_gather_36_rule(Parser *p);
585static void *_tmp_38_rule(Parser *p);
586static asdl_seq *_loop0_40_rule(Parser *p);
587static asdl_seq *_gather_39_rule(Parser *p);
588static asdl_seq *_loop0_42_rule(Parser *p);
589static asdl_seq *_gather_41_rule(Parser *p);
590static asdl_seq *_loop0_44_rule(Parser *p);
591static asdl_seq *_gather_43_rule(Parser *p);
592static asdl_seq *_loop0_46_rule(Parser *p);
593static asdl_seq *_gather_45_rule(Parser *p);
594static void *_tmp_47_rule(Parser *p);
595static asdl_seq *_loop1_48_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100596static void *_tmp_49_rule(Parser *p);
597static void *_tmp_50_rule(Parser *p);
598static void *_tmp_51_rule(Parser *p);
599static void *_tmp_52_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300600static void *_tmp_53_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100601static asdl_seq *_loop0_54_rule(Parser *p);
602static asdl_seq *_loop0_55_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300603static asdl_seq *_loop0_56_rule(Parser *p);
604static asdl_seq *_loop1_57_rule(Parser *p);
605static asdl_seq *_loop0_58_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100606static asdl_seq *_loop1_59_rule(Parser *p);
607static asdl_seq *_loop1_60_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300608static asdl_seq *_loop1_61_rule(Parser *p);
609static asdl_seq *_loop0_62_rule(Parser *p);
610static asdl_seq *_loop1_63_rule(Parser *p);
611static asdl_seq *_loop0_64_rule(Parser *p);
612static asdl_seq *_loop1_65_rule(Parser *p);
613static asdl_seq *_loop0_66_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100614static asdl_seq *_loop1_67_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300615static asdl_seq *_loop1_68_rule(Parser *p);
616static void *_tmp_69_rule(Parser *p);
617static asdl_seq *_loop0_71_rule(Parser *p);
618static asdl_seq *_gather_70_rule(Parser *p);
619static asdl_seq *_loop1_72_rule(Parser *p);
620static asdl_seq *_loop0_74_rule(Parser *p);
621static asdl_seq *_gather_73_rule(Parser *p);
622static asdl_seq *_loop1_75_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100623static asdl_seq *_loop0_76_rule(Parser *p);
624static asdl_seq *_loop0_77_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300625static asdl_seq *_loop0_78_rule(Parser *p);
626static asdl_seq *_loop1_79_rule(Parser *p);
627static asdl_seq *_loop0_80_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100628static asdl_seq *_loop1_81_rule(Parser *p);
629static asdl_seq *_loop1_82_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300630static asdl_seq *_loop1_83_rule(Parser *p);
631static asdl_seq *_loop0_84_rule(Parser *p);
632static asdl_seq *_loop1_85_rule(Parser *p);
633static asdl_seq *_loop0_86_rule(Parser *p);
634static asdl_seq *_loop1_87_rule(Parser *p);
635static asdl_seq *_loop0_88_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100636static asdl_seq *_loop1_89_rule(Parser *p);
637static asdl_seq *_loop1_90_rule(Parser *p);
638static asdl_seq *_loop1_91_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300639static asdl_seq *_loop1_92_rule(Parser *p);
640static void *_tmp_93_rule(Parser *p);
641static asdl_seq *_loop0_95_rule(Parser *p);
642static asdl_seq *_gather_94_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100643static void *_tmp_96_rule(Parser *p);
644static void *_tmp_97_rule(Parser *p);
645static void *_tmp_98_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300646static void *_tmp_99_rule(Parser *p);
647static asdl_seq *_loop1_100_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100648static void *_tmp_101_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300649static void *_tmp_102_rule(Parser *p);
650static asdl_seq *_loop0_104_rule(Parser *p);
651static asdl_seq *_gather_103_rule(Parser *p);
652static asdl_seq *_loop1_105_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100653static asdl_seq *_loop0_106_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300654static asdl_seq *_loop0_107_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100655static asdl_seq *_loop0_109_rule(Parser *p);
656static asdl_seq *_gather_108_rule(Parser *p);
657static void *_tmp_110_rule(Parser *p);
658static asdl_seq *_loop0_112_rule(Parser *p);
659static asdl_seq *_gather_111_rule(Parser *p);
660static asdl_seq *_loop0_114_rule(Parser *p);
661static asdl_seq *_gather_113_rule(Parser *p);
662static asdl_seq *_loop0_116_rule(Parser *p);
663static asdl_seq *_gather_115_rule(Parser *p);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300664static asdl_seq *_loop0_118_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100665static asdl_seq *_gather_117_rule(Parser *p);
666static asdl_seq *_loop0_119_rule(Parser *p);
667static asdl_seq *_loop0_121_rule(Parser *p);
668static asdl_seq *_gather_120_rule(Parser *p);
669static void *_tmp_122_rule(Parser *p);
670static asdl_seq *_loop0_124_rule(Parser *p);
671static asdl_seq *_gather_123_rule(Parser *p);
672static asdl_seq *_loop0_126_rule(Parser *p);
673static asdl_seq *_gather_125_rule(Parser *p);
674static void *_tmp_127_rule(Parser *p);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +0300675static asdl_seq *_loop0_128_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100676static asdl_seq *_loop0_129_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100677static asdl_seq *_loop0_130_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100678static void *_tmp_131_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100679static void *_tmp_132_rule(Parser *p);
680static asdl_seq *_loop0_133_rule(Parser *p);
681static void *_tmp_134_rule(Parser *p);
682static asdl_seq *_loop0_135_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100683static void *_tmp_136_rule(Parser *p);
684static void *_tmp_137_rule(Parser *p);
685static void *_tmp_138_rule(Parser *p);
686static void *_tmp_139_rule(Parser *p);
687static void *_tmp_140_rule(Parser *p);
688static void *_tmp_141_rule(Parser *p);
689static void *_tmp_142_rule(Parser *p);
690static void *_tmp_143_rule(Parser *p);
691static void *_tmp_144_rule(Parser *p);
692static void *_tmp_145_rule(Parser *p);
693static void *_tmp_146_rule(Parser *p);
694static void *_tmp_147_rule(Parser *p);
695static void *_tmp_148_rule(Parser *p);
696static void *_tmp_149_rule(Parser *p);
697static void *_tmp_150_rule(Parser *p);
Pablo Galindo4a97b152020-09-02 17:44:19 +0100698static void *_tmp_151_rule(Parser *p);
699static void *_tmp_152_rule(Parser *p);
700static asdl_seq *_loop1_153_rule(Parser *p);
701static asdl_seq *_loop1_154_rule(Parser *p);
702static void *_tmp_155_rule(Parser *p);
703static void *_tmp_156_rule(Parser *p);
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000704
705
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100706// file: statements? $
707static mod_ty
708file_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000709{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100710 D(p->level++);
711 if (p->error_indicator) {
712 D(p->level--);
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000713 return NULL;
714 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100715 mod_ty _res = NULL;
716 int _mark = p->mark;
717 { // statements? $
718 if (p->error_indicator) {
719 D(p->level--);
720 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000721 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100722 D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $"));
723 void *a;
724 Token * endmarker_var;
725 if (
726 (a = statements_rule(p), 1) // statements?
727 &&
728 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
729 )
730 {
731 D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $"));
732 _res = _PyPegen_make_module ( p , a );
733 if (_res == NULL && PyErr_Occurred()) {
734 p->error_indicator = 1;
735 D(p->level--);
736 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000737 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100738 goto done;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000739 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100740 p->mark = _mark;
741 D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ',
742 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000743 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100744 _res = NULL;
745 done:
746 D(p->level--);
747 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000748}
749
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100750// interactive: statement_newline
751static mod_ty
752interactive_rule(Parser *p)
Guido van Rossumb09f7ed2001-07-15 21:08:29 +0000753{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100754 D(p->level++);
755 if (p->error_indicator) {
756 D(p->level--);
757 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000758 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100759 mod_ty _res = NULL;
760 int _mark = p->mark;
761 { // statement_newline
762 if (p->error_indicator) {
763 D(p->level--);
764 return NULL;
765 }
766 D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline"));
767 asdl_seq* a;
768 if (
769 (a = statement_newline_rule(p)) // statement_newline
770 )
771 {
772 D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline"));
773 _res = Interactive ( a , p -> arena );
774 if (_res == NULL && PyErr_Occurred()) {
775 p->error_indicator = 1;
776 D(p->level--);
777 return NULL;
778 }
779 goto done;
780 }
781 p->mark = _mark;
782 D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ',
783 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline"));
784 }
785 _res = NULL;
786 done:
787 D(p->level--);
788 return _res;
Guido van Rossumb09f7ed2001-07-15 21:08:29 +0000789}
790
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100791// eval: expressions NEWLINE* $
792static mod_ty
793eval_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +0000794{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100795 D(p->level++);
796 if (p->error_indicator) {
797 D(p->level--);
798 return NULL;
799 }
800 mod_ty _res = NULL;
801 int _mark = p->mark;
802 { // expressions NEWLINE* $
803 if (p->error_indicator) {
804 D(p->level--);
805 return NULL;
806 }
807 D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
808 asdl_seq * _loop0_1_var;
809 expr_ty a;
810 Token * endmarker_var;
811 if (
812 (a = expressions_rule(p)) // expressions
813 &&
814 (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE*
815 &&
816 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
817 )
818 {
819 D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
820 _res = Expression ( a , p -> arena );
821 if (_res == NULL && PyErr_Occurred()) {
822 p->error_indicator = 1;
823 D(p->level--);
824 return NULL;
825 }
826 goto done;
827 }
828 p->mark = _mark;
829 D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ',
830 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $"));
831 }
832 _res = NULL;
833 done:
834 D(p->level--);
835 return _res;
836}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000837
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100838// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
839static mod_ty
840func_type_rule(Parser *p)
841{
842 D(p->level++);
843 if (p->error_indicator) {
844 D(p->level--);
845 return NULL;
846 }
847 mod_ty _res = NULL;
848 int _mark = p->mark;
849 { // '(' type_expressions? ')' '->' expression NEWLINE* $
850 if (p->error_indicator) {
851 D(p->level--);
852 return NULL;
853 }
854 D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
855 Token * _literal;
856 Token * _literal_1;
857 Token * _literal_2;
858 asdl_seq * _loop0_2_var;
859 void *a;
860 expr_ty b;
861 Token * endmarker_var;
862 if (
863 (_literal = _PyPegen_expect_token(p, 7)) // token='('
864 &&
865 (a = type_expressions_rule(p), 1) // type_expressions?
866 &&
867 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
868 &&
869 (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->'
870 &&
871 (b = expression_rule(p)) // expression
872 &&
873 (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE*
874 &&
875 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
876 )
877 {
878 D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
879 _res = FunctionType ( a , b , p -> arena );
880 if (_res == NULL && PyErr_Occurred()) {
881 p->error_indicator = 1;
882 D(p->level--);
883 return NULL;
884 }
885 goto done;
886 }
887 p->mark = _mark;
888 D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ',
889 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
890 }
891 _res = NULL;
892 done:
893 D(p->level--);
894 return _res;
895}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000896
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100897// fstring: star_expressions
898static expr_ty
899fstring_rule(Parser *p)
900{
901 D(p->level++);
902 if (p->error_indicator) {
903 D(p->level--);
904 return NULL;
905 }
906 expr_ty _res = NULL;
907 int _mark = p->mark;
908 { // star_expressions
909 if (p->error_indicator) {
910 D(p->level--);
911 return NULL;
912 }
913 D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
914 expr_ty star_expressions_var;
915 if (
916 (star_expressions_var = star_expressions_rule(p)) // star_expressions
917 )
918 {
919 D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
920 _res = star_expressions_var;
921 goto done;
922 }
923 p->mark = _mark;
924 D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ',
925 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
926 }
927 _res = NULL;
928 done:
929 D(p->level--);
930 return _res;
931}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +0000932
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100933// type_expressions:
934// | ','.expression+ ',' '*' expression ',' '**' expression
935// | ','.expression+ ',' '*' expression
936// | ','.expression+ ',' '**' expression
937// | '*' expression ',' '**' expression
938// | '*' expression
939// | '**' expression
940// | ','.expression+
941static asdl_seq*
942type_expressions_rule(Parser *p)
943{
944 D(p->level++);
945 if (p->error_indicator) {
946 D(p->level--);
947 return NULL;
948 }
949 asdl_seq* _res = NULL;
950 int _mark = p->mark;
951 { // ','.expression+ ',' '*' expression ',' '**' expression
952 if (p->error_indicator) {
953 D(p->level--);
954 return NULL;
955 }
956 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
957 Token * _literal;
958 Token * _literal_1;
959 Token * _literal_2;
960 Token * _literal_3;
961 asdl_seq * a;
962 expr_ty b;
963 expr_ty c;
964 if (
965 (a = _gather_3_rule(p)) // ','.expression+
966 &&
967 (_literal = _PyPegen_expect_token(p, 12)) // token=','
968 &&
969 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
970 &&
971 (b = expression_rule(p)) // expression
972 &&
973 (_literal_2 = _PyPegen_expect_token(p, 12)) // token=','
974 &&
975 (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**'
976 &&
977 (c = expression_rule(p)) // expression
978 )
979 {
980 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
981 _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
982 if (_res == NULL && PyErr_Occurred()) {
983 p->error_indicator = 1;
984 D(p->level--);
985 return NULL;
986 }
987 goto done;
988 }
989 p->mark = _mark;
990 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
991 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
992 }
993 { // ','.expression+ ',' '*' expression
994 if (p->error_indicator) {
995 D(p->level--);
996 return NULL;
997 }
998 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
999 Token * _literal;
1000 Token * _literal_1;
1001 asdl_seq * a;
1002 expr_ty b;
1003 if (
1004 (a = _gather_5_rule(p)) // ','.expression+
1005 &&
1006 (_literal = _PyPegen_expect_token(p, 12)) // token=','
1007 &&
1008 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
1009 &&
1010 (b = expression_rule(p)) // expression
1011 )
1012 {
1013 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
1014 _res = _PyPegen_seq_append_to_end ( p , a , b );
1015 if (_res == NULL && PyErr_Occurred()) {
1016 p->error_indicator = 1;
1017 D(p->level--);
1018 return NULL;
1019 }
1020 goto done;
1021 }
1022 p->mark = _mark;
1023 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1024 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression"));
1025 }
1026 { // ','.expression+ ',' '**' expression
1027 if (p->error_indicator) {
1028 D(p->level--);
1029 return NULL;
1030 }
1031 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
1032 Token * _literal;
1033 Token * _literal_1;
1034 asdl_seq * a;
1035 expr_ty b;
1036 if (
1037 (a = _gather_7_rule(p)) // ','.expression+
1038 &&
1039 (_literal = _PyPegen_expect_token(p, 12)) // token=','
1040 &&
1041 (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**'
1042 &&
1043 (b = expression_rule(p)) // expression
1044 )
1045 {
1046 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
1047 _res = _PyPegen_seq_append_to_end ( p , a , b );
1048 if (_res == NULL && PyErr_Occurred()) {
1049 p->error_indicator = 1;
1050 D(p->level--);
1051 return NULL;
1052 }
1053 goto done;
1054 }
1055 p->mark = _mark;
1056 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1057 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression"));
1058 }
1059 { // '*' expression ',' '**' expression
1060 if (p->error_indicator) {
1061 D(p->level--);
1062 return NULL;
1063 }
1064 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
1065 Token * _literal;
1066 Token * _literal_1;
1067 Token * _literal_2;
1068 expr_ty a;
1069 expr_ty b;
1070 if (
1071 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
1072 &&
1073 (a = expression_rule(p)) // expression
1074 &&
1075 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
1076 &&
1077 (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**'
1078 &&
1079 (b = expression_rule(p)) // expression
1080 )
1081 {
1082 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
1083 _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b );
1084 if (_res == NULL && PyErr_Occurred()) {
1085 p->error_indicator = 1;
1086 D(p->level--);
1087 return NULL;
1088 }
1089 goto done;
1090 }
1091 p->mark = _mark;
1092 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1093 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression"));
1094 }
1095 { // '*' expression
1096 if (p->error_indicator) {
1097 D(p->level--);
1098 return NULL;
1099 }
1100 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
1101 Token * _literal;
1102 expr_ty a;
1103 if (
1104 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
1105 &&
1106 (a = expression_rule(p)) // expression
1107 )
1108 {
1109 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
1110 _res = _PyPegen_singleton_seq ( p , a );
1111 if (_res == NULL && PyErr_Occurred()) {
1112 p->error_indicator = 1;
1113 D(p->level--);
1114 return NULL;
1115 }
1116 goto done;
1117 }
1118 p->mark = _mark;
1119 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1120 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
1121 }
1122 { // '**' expression
1123 if (p->error_indicator) {
1124 D(p->level--);
1125 return NULL;
1126 }
1127 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
1128 Token * _literal;
1129 expr_ty a;
1130 if (
1131 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
1132 &&
1133 (a = expression_rule(p)) // expression
1134 )
1135 {
1136 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
1137 _res = _PyPegen_singleton_seq ( p , a );
1138 if (_res == NULL && PyErr_Occurred()) {
1139 p->error_indicator = 1;
1140 D(p->level--);
1141 return NULL;
1142 }
1143 goto done;
1144 }
1145 p->mark = _mark;
1146 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1147 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
1148 }
1149 { // ','.expression+
1150 if (p->error_indicator) {
1151 D(p->level--);
1152 return NULL;
1153 }
1154 D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
1155 asdl_seq * _gather_9_var;
1156 if (
1157 (_gather_9_var = _gather_9_rule(p)) // ','.expression+
1158 )
1159 {
1160 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
1161 _res = _gather_9_var;
1162 goto done;
1163 }
1164 p->mark = _mark;
1165 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1166 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
1167 }
1168 _res = NULL;
1169 done:
1170 D(p->level--);
1171 return _res;
1172}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001173
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001174// statements: statement+
1175static asdl_seq*
1176statements_rule(Parser *p)
1177{
1178 D(p->level++);
1179 if (p->error_indicator) {
1180 D(p->level--);
1181 return NULL;
1182 }
1183 asdl_seq* _res = NULL;
1184 int _mark = p->mark;
1185 { // statement+
1186 if (p->error_indicator) {
1187 D(p->level--);
1188 return NULL;
1189 }
1190 D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+"));
1191 asdl_seq * a;
1192 if (
1193 (a = _loop1_11_rule(p)) // statement+
1194 )
1195 {
1196 D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
1197 _res = _PyPegen_seq_flatten ( p , a );
1198 if (_res == NULL && PyErr_Occurred()) {
1199 p->error_indicator = 1;
1200 D(p->level--);
1201 return NULL;
1202 }
1203 goto done;
1204 }
1205 p->mark = _mark;
1206 D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ',
1207 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+"));
1208 }
1209 _res = NULL;
1210 done:
1211 D(p->level--);
1212 return _res;
1213}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001214
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001215// statement: compound_stmt | simple_stmt
1216static asdl_seq*
1217statement_rule(Parser *p)
1218{
1219 D(p->level++);
1220 if (p->error_indicator) {
1221 D(p->level--);
1222 return NULL;
1223 }
1224 asdl_seq* _res = NULL;
1225 int _mark = p->mark;
1226 { // compound_stmt
1227 if (p->error_indicator) {
1228 D(p->level--);
1229 return NULL;
1230 }
1231 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
1232 stmt_ty a;
1233 if (
1234 (a = compound_stmt_rule(p)) // compound_stmt
1235 )
1236 {
1237 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
1238 _res = _PyPegen_singleton_seq ( p , a );
1239 if (_res == NULL && PyErr_Occurred()) {
1240 p->error_indicator = 1;
1241 D(p->level--);
1242 return NULL;
1243 }
1244 goto done;
1245 }
1246 p->mark = _mark;
1247 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1248 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt"));
1249 }
1250 { // simple_stmt
1251 if (p->error_indicator) {
1252 D(p->level--);
1253 return NULL;
1254 }
1255 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1256 asdl_seq* simple_stmt_var;
1257 if (
1258 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
1259 )
1260 {
1261 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1262 _res = simple_stmt_var;
1263 goto done;
1264 }
1265 p->mark = _mark;
1266 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1267 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1268 }
1269 _res = NULL;
1270 done:
1271 D(p->level--);
1272 return _res;
1273}
1274
1275// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
1276static asdl_seq*
1277statement_newline_rule(Parser *p)
1278{
1279 D(p->level++);
1280 if (p->error_indicator) {
1281 D(p->level--);
1282 return NULL;
1283 }
1284 asdl_seq* _res = NULL;
1285 int _mark = p->mark;
1286 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1287 p->error_indicator = 1;
1288 D(p->level--);
1289 return NULL;
1290 }
1291 int _start_lineno = p->tokens[_mark]->lineno;
1292 UNUSED(_start_lineno); // Only used by EXTRA macro
1293 int _start_col_offset = p->tokens[_mark]->col_offset;
1294 UNUSED(_start_col_offset); // Only used by EXTRA macro
1295 { // compound_stmt NEWLINE
1296 if (p->error_indicator) {
1297 D(p->level--);
1298 return NULL;
1299 }
1300 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
1301 stmt_ty a;
1302 Token * newline_var;
1303 if (
1304 (a = compound_stmt_rule(p)) // compound_stmt
1305 &&
1306 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1307 )
1308 {
1309 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
1310 _res = _PyPegen_singleton_seq ( p , a );
1311 if (_res == NULL && PyErr_Occurred()) {
1312 p->error_indicator = 1;
1313 D(p->level--);
1314 return NULL;
1315 }
1316 goto done;
1317 }
1318 p->mark = _mark;
1319 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1320 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE"));
1321 }
1322 { // simple_stmt
1323 if (p->error_indicator) {
1324 D(p->level--);
1325 return NULL;
1326 }
1327 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1328 asdl_seq* simple_stmt_var;
1329 if (
1330 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
1331 )
1332 {
1333 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1334 _res = simple_stmt_var;
1335 goto done;
1336 }
1337 p->mark = _mark;
1338 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1339 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1340 }
1341 { // NEWLINE
1342 if (p->error_indicator) {
1343 D(p->level--);
1344 return NULL;
1345 }
1346 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1347 Token * newline_var;
1348 if (
1349 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1350 )
1351 {
1352 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1353 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1354 if (_token == NULL) {
1355 D(p->level--);
1356 return NULL;
1357 }
1358 int _end_lineno = _token->end_lineno;
1359 UNUSED(_end_lineno); // Only used by EXTRA macro
1360 int _end_col_offset = _token->end_col_offset;
1361 UNUSED(_end_col_offset); // Only used by EXTRA macro
1362 _res = _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) );
1363 if (_res == NULL && PyErr_Occurred()) {
1364 p->error_indicator = 1;
1365 D(p->level--);
1366 return NULL;
1367 }
1368 goto done;
1369 }
1370 p->mark = _mark;
1371 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1372 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
1373 }
1374 { // $
1375 if (p->error_indicator) {
1376 D(p->level--);
1377 return NULL;
1378 }
1379 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$"));
1380 Token * endmarker_var;
1381 if (
1382 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
1383 )
1384 {
1385 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$"));
1386 _res = _PyPegen_interactive_exit ( p );
1387 if (_res == NULL && PyErr_Occurred()) {
1388 p->error_indicator = 1;
1389 D(p->level--);
1390 return NULL;
1391 }
1392 goto done;
1393 }
1394 p->mark = _mark;
1395 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1396 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$"));
1397 }
1398 _res = NULL;
1399 done:
1400 D(p->level--);
1401 return _res;
1402}
1403
1404// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
1405static asdl_seq*
1406simple_stmt_rule(Parser *p)
1407{
1408 D(p->level++);
1409 if (p->error_indicator) {
1410 D(p->level--);
1411 return NULL;
1412 }
1413 asdl_seq* _res = NULL;
1414 int _mark = p->mark;
1415 { // small_stmt !';' NEWLINE
1416 if (p->error_indicator) {
1417 D(p->level--);
1418 return NULL;
1419 }
1420 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
1421 stmt_ty a;
1422 Token * newline_var;
1423 if (
1424 (a = small_stmt_rule(p)) // small_stmt
1425 &&
1426 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';'
1427 &&
1428 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1429 )
1430 {
1431 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
1432 _res = _PyPegen_singleton_seq ( p , a );
1433 if (_res == NULL && PyErr_Occurred()) {
1434 p->error_indicator = 1;
1435 D(p->level--);
1436 return NULL;
1437 }
1438 goto done;
1439 }
1440 p->mark = _mark;
1441 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1442 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt !';' NEWLINE"));
1443 }
1444 { // ';'.small_stmt+ ';'? NEWLINE
1445 if (p->error_indicator) {
1446 D(p->level--);
1447 return NULL;
1448 }
1449 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1450 void *_opt_var;
1451 UNUSED(_opt_var); // Silence compiler warnings
1452 asdl_seq * a;
1453 Token * newline_var;
1454 if (
1455 (a = _gather_12_rule(p)) // ';'.small_stmt+
1456 &&
1457 (_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'?
1458 &&
1459 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1460 )
1461 {
1462 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1463 _res = a;
1464 if (_res == NULL && PyErr_Occurred()) {
1465 p->error_indicator = 1;
1466 D(p->level--);
1467 return NULL;
1468 }
1469 goto done;
1470 }
1471 p->mark = _mark;
1472 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1473 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1474 }
1475 _res = NULL;
1476 done:
1477 D(p->level--);
1478 return _res;
1479}
1480
1481// small_stmt:
1482// | assignment
1483// | star_expressions
1484// | &'return' return_stmt
1485// | &('import' | 'from') import_stmt
1486// | &'raise' raise_stmt
1487// | 'pass'
1488// | &'del' del_stmt
1489// | &'yield' yield_stmt
1490// | &'assert' assert_stmt
1491// | 'break'
1492// | 'continue'
1493// | &'global' global_stmt
1494// | &'nonlocal' nonlocal_stmt
1495static stmt_ty
1496small_stmt_rule(Parser *p)
1497{
1498 D(p->level++);
1499 if (p->error_indicator) {
1500 D(p->level--);
1501 return NULL;
1502 }
1503 stmt_ty _res = NULL;
1504 if (_PyPegen_is_memoized(p, small_stmt_type, &_res)) {
1505 D(p->level--);
1506 return _res;
1507 }
1508 int _mark = p->mark;
1509 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1510 p->error_indicator = 1;
1511 D(p->level--);
1512 return NULL;
1513 }
1514 int _start_lineno = p->tokens[_mark]->lineno;
1515 UNUSED(_start_lineno); // Only used by EXTRA macro
1516 int _start_col_offset = p->tokens[_mark]->col_offset;
1517 UNUSED(_start_col_offset); // Only used by EXTRA macro
1518 { // assignment
1519 if (p->error_indicator) {
1520 D(p->level--);
1521 return NULL;
1522 }
1523 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment"));
1524 stmt_ty assignment_var;
1525 if (
1526 (assignment_var = assignment_rule(p)) // assignment
1527 )
1528 {
1529 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment"));
1530 _res = assignment_var;
1531 goto done;
1532 }
1533 p->mark = _mark;
1534 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1535 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment"));
1536 }
1537 { // star_expressions
1538 if (p->error_indicator) {
1539 D(p->level--);
1540 return NULL;
1541 }
1542 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1543 expr_ty e;
1544 if (
1545 (e = star_expressions_rule(p)) // star_expressions
1546 )
1547 {
1548 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1549 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1550 if (_token == NULL) {
1551 D(p->level--);
1552 return NULL;
1553 }
1554 int _end_lineno = _token->end_lineno;
1555 UNUSED(_end_lineno); // Only used by EXTRA macro
1556 int _end_col_offset = _token->end_col_offset;
1557 UNUSED(_end_col_offset); // Only used by EXTRA macro
1558 _res = _Py_Expr ( e , EXTRA );
1559 if (_res == NULL && PyErr_Occurred()) {
1560 p->error_indicator = 1;
1561 D(p->level--);
1562 return NULL;
1563 }
1564 goto done;
1565 }
1566 p->mark = _mark;
1567 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1568 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
1569 }
1570 { // &'return' return_stmt
1571 if (p->error_indicator) {
1572 D(p->level--);
1573 return NULL;
1574 }
1575 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1576 stmt_ty return_stmt_var;
1577 if (
1578 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return'
1579 &&
1580 (return_stmt_var = return_stmt_rule(p)) // return_stmt
1581 )
1582 {
1583 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1584 _res = return_stmt_var;
1585 goto done;
1586 }
1587 p->mark = _mark;
1588 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1589 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt"));
1590 }
1591 { // &('import' | 'from') import_stmt
1592 if (p->error_indicator) {
1593 D(p->level--);
1594 return NULL;
1595 }
1596 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1597 stmt_ty import_stmt_var;
1598 if (
1599 _PyPegen_lookahead(1, _tmp_14_rule, p)
1600 &&
1601 (import_stmt_var = import_stmt_rule(p)) // import_stmt
1602 )
1603 {
1604 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1605 _res = import_stmt_var;
1606 goto done;
1607 }
1608 p->mark = _mark;
1609 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1610 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt"));
1611 }
1612 { // &'raise' raise_stmt
1613 if (p->error_indicator) {
1614 D(p->level--);
1615 return NULL;
1616 }
1617 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1618 stmt_ty raise_stmt_var;
1619 if (
1620 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise'
1621 &&
1622 (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt
1623 )
1624 {
1625 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1626 _res = raise_stmt_var;
1627 goto done;
1628 }
1629 p->mark = _mark;
1630 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1631 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt"));
1632 }
1633 { // 'pass'
1634 if (p->error_indicator) {
1635 D(p->level--);
1636 return NULL;
1637 }
1638 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'"));
1639 Token * _keyword;
1640 if (
1641 (_keyword = _PyPegen_expect_token(p, 502)) // token='pass'
1642 )
1643 {
1644 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'"));
1645 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1646 if (_token == NULL) {
1647 D(p->level--);
1648 return NULL;
1649 }
1650 int _end_lineno = _token->end_lineno;
1651 UNUSED(_end_lineno); // Only used by EXTRA macro
1652 int _end_col_offset = _token->end_col_offset;
1653 UNUSED(_end_col_offset); // Only used by EXTRA macro
1654 _res = _Py_Pass ( EXTRA );
1655 if (_res == NULL && PyErr_Occurred()) {
1656 p->error_indicator = 1;
1657 D(p->level--);
1658 return NULL;
1659 }
1660 goto done;
1661 }
1662 p->mark = _mark;
1663 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1664 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'"));
1665 }
1666 { // &'del' del_stmt
1667 if (p->error_indicator) {
1668 D(p->level--);
1669 return NULL;
1670 }
1671 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1672 stmt_ty del_stmt_var;
1673 if (
1674 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del'
1675 &&
1676 (del_stmt_var = del_stmt_rule(p)) // del_stmt
1677 )
1678 {
1679 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1680 _res = del_stmt_var;
1681 goto done;
1682 }
1683 p->mark = _mark;
1684 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1685 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt"));
1686 }
1687 { // &'yield' yield_stmt
1688 if (p->error_indicator) {
1689 D(p->level--);
1690 return NULL;
1691 }
1692 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1693 stmt_ty yield_stmt_var;
1694 if (
1695 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield'
1696 &&
1697 (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt
1698 )
1699 {
1700 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1701 _res = yield_stmt_var;
1702 goto done;
1703 }
1704 p->mark = _mark;
1705 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1706 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt"));
1707 }
1708 { // &'assert' assert_stmt
1709 if (p->error_indicator) {
1710 D(p->level--);
1711 return NULL;
1712 }
1713 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1714 stmt_ty assert_stmt_var;
1715 if (
1716 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert'
1717 &&
1718 (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt
1719 )
1720 {
1721 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1722 _res = assert_stmt_var;
1723 goto done;
1724 }
1725 p->mark = _mark;
1726 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1727 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt"));
1728 }
1729 { // 'break'
1730 if (p->error_indicator) {
1731 D(p->level--);
1732 return NULL;
1733 }
1734 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'"));
1735 Token * _keyword;
1736 if (
1737 (_keyword = _PyPegen_expect_token(p, 506)) // token='break'
1738 )
1739 {
1740 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'"));
1741 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1742 if (_token == NULL) {
1743 D(p->level--);
1744 return NULL;
1745 }
1746 int _end_lineno = _token->end_lineno;
1747 UNUSED(_end_lineno); // Only used by EXTRA macro
1748 int _end_col_offset = _token->end_col_offset;
1749 UNUSED(_end_col_offset); // Only used by EXTRA macro
1750 _res = _Py_Break ( EXTRA );
1751 if (_res == NULL && PyErr_Occurred()) {
1752 p->error_indicator = 1;
1753 D(p->level--);
1754 return NULL;
1755 }
1756 goto done;
1757 }
1758 p->mark = _mark;
1759 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1760 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'"));
1761 }
1762 { // 'continue'
1763 if (p->error_indicator) {
1764 D(p->level--);
1765 return NULL;
1766 }
1767 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'"));
1768 Token * _keyword;
1769 if (
1770 (_keyword = _PyPegen_expect_token(p, 507)) // token='continue'
1771 )
1772 {
1773 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'"));
1774 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1775 if (_token == NULL) {
1776 D(p->level--);
1777 return NULL;
1778 }
1779 int _end_lineno = _token->end_lineno;
1780 UNUSED(_end_lineno); // Only used by EXTRA macro
1781 int _end_col_offset = _token->end_col_offset;
1782 UNUSED(_end_col_offset); // Only used by EXTRA macro
1783 _res = _Py_Continue ( EXTRA );
1784 if (_res == NULL && PyErr_Occurred()) {
1785 p->error_indicator = 1;
1786 D(p->level--);
1787 return NULL;
1788 }
1789 goto done;
1790 }
1791 p->mark = _mark;
1792 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1793 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'"));
1794 }
1795 { // &'global' global_stmt
1796 if (p->error_indicator) {
1797 D(p->level--);
1798 return NULL;
1799 }
1800 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1801 stmt_ty global_stmt_var;
1802 if (
1803 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global'
1804 &&
1805 (global_stmt_var = global_stmt_rule(p)) // global_stmt
1806 )
1807 {
1808 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1809 _res = global_stmt_var;
1810 goto done;
1811 }
1812 p->mark = _mark;
1813 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1814 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt"));
1815 }
1816 { // &'nonlocal' nonlocal_stmt
1817 if (p->error_indicator) {
1818 D(p->level--);
1819 return NULL;
1820 }
1821 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1822 stmt_ty nonlocal_stmt_var;
1823 if (
1824 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal'
1825 &&
1826 (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt
1827 )
1828 {
1829 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1830 _res = nonlocal_stmt_var;
1831 goto done;
1832 }
1833 p->mark = _mark;
1834 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1835 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1836 }
1837 _res = NULL;
1838 done:
1839 _PyPegen_insert_memo(p, _mark, small_stmt_type, _res);
1840 D(p->level--);
1841 return _res;
1842}
1843
1844// compound_stmt:
1845// | &('def' | '@' | ASYNC) function_def
1846// | &'if' if_stmt
1847// | &('class' | '@') class_def
1848// | &('with' | ASYNC) with_stmt
1849// | &('for' | ASYNC) for_stmt
1850// | &'try' try_stmt
1851// | &'while' while_stmt
1852static stmt_ty
1853compound_stmt_rule(Parser *p)
1854{
1855 D(p->level++);
1856 if (p->error_indicator) {
1857 D(p->level--);
1858 return NULL;
1859 }
1860 stmt_ty _res = NULL;
1861 int _mark = p->mark;
1862 { // &('def' | '@' | ASYNC) function_def
1863 if (p->error_indicator) {
1864 D(p->level--);
1865 return NULL;
1866 }
1867 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1868 stmt_ty function_def_var;
1869 if (
1870 _PyPegen_lookahead(1, _tmp_15_rule, p)
1871 &&
1872 (function_def_var = function_def_rule(p)) // function_def
1873 )
1874 {
1875 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1876 _res = function_def_var;
1877 goto done;
1878 }
1879 p->mark = _mark;
1880 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1881 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1882 }
1883 { // &'if' if_stmt
1884 if (p->error_indicator) {
1885 D(p->level--);
1886 return NULL;
1887 }
1888 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1889 stmt_ty if_stmt_var;
1890 if (
1891 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if'
1892 &&
1893 (if_stmt_var = if_stmt_rule(p)) // if_stmt
1894 )
1895 {
1896 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1897 _res = if_stmt_var;
1898 goto done;
1899 }
1900 p->mark = _mark;
1901 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1902 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt"));
1903 }
1904 { // &('class' | '@') class_def
1905 if (p->error_indicator) {
1906 D(p->level--);
1907 return NULL;
1908 }
1909 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1910 stmt_ty class_def_var;
1911 if (
1912 _PyPegen_lookahead(1, _tmp_16_rule, p)
1913 &&
1914 (class_def_var = class_def_rule(p)) // class_def
1915 )
1916 {
1917 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1918 _res = class_def_var;
1919 goto done;
1920 }
1921 p->mark = _mark;
1922 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1923 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def"));
1924 }
1925 { // &('with' | ASYNC) with_stmt
1926 if (p->error_indicator) {
1927 D(p->level--);
1928 return NULL;
1929 }
1930 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1931 stmt_ty with_stmt_var;
1932 if (
1933 _PyPegen_lookahead(1, _tmp_17_rule, p)
1934 &&
1935 (with_stmt_var = with_stmt_rule(p)) // with_stmt
1936 )
1937 {
1938 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1939 _res = with_stmt_var;
1940 goto done;
1941 }
1942 p->mark = _mark;
1943 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1944 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1945 }
1946 { // &('for' | ASYNC) for_stmt
1947 if (p->error_indicator) {
1948 D(p->level--);
1949 return NULL;
1950 }
1951 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1952 stmt_ty for_stmt_var;
1953 if (
1954 _PyPegen_lookahead(1, _tmp_18_rule, p)
1955 &&
1956 (for_stmt_var = for_stmt_rule(p)) // for_stmt
1957 )
1958 {
1959 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1960 _res = for_stmt_var;
1961 goto done;
1962 }
1963 p->mark = _mark;
1964 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1965 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1966 }
1967 { // &'try' try_stmt
1968 if (p->error_indicator) {
1969 D(p->level--);
1970 return NULL;
1971 }
1972 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1973 stmt_ty try_stmt_var;
1974 if (
1975 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try'
1976 &&
1977 (try_stmt_var = try_stmt_rule(p)) // try_stmt
1978 )
1979 {
1980 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1981 _res = try_stmt_var;
1982 goto done;
1983 }
1984 p->mark = _mark;
1985 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1986 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt"));
1987 }
1988 { // &'while' while_stmt
1989 if (p->error_indicator) {
1990 D(p->level--);
1991 return NULL;
1992 }
1993 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
1994 stmt_ty while_stmt_var;
1995 if (
1996 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while'
1997 &&
1998 (while_stmt_var = while_stmt_rule(p)) // while_stmt
1999 )
2000 {
2001 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
2002 _res = while_stmt_var;
2003 goto done;
2004 }
2005 p->mark = _mark;
2006 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2007 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt"));
2008 }
2009 _res = NULL;
2010 done:
2011 D(p->level--);
2012 return _res;
2013}
2014
2015// assignment:
2016// | NAME ':' expression ['=' annotated_rhs]
2017// | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2018// | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002019// | single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002020// | invalid_assignment
2021static stmt_ty
2022assignment_rule(Parser *p)
2023{
2024 D(p->level++);
2025 if (p->error_indicator) {
2026 D(p->level--);
2027 return NULL;
2028 }
2029 stmt_ty _res = NULL;
2030 int _mark = p->mark;
2031 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2032 p->error_indicator = 1;
2033 D(p->level--);
2034 return NULL;
2035 }
2036 int _start_lineno = p->tokens[_mark]->lineno;
2037 UNUSED(_start_lineno); // Only used by EXTRA macro
2038 int _start_col_offset = p->tokens[_mark]->col_offset;
2039 UNUSED(_start_col_offset); // Only used by EXTRA macro
2040 { // NAME ':' expression ['=' annotated_rhs]
2041 if (p->error_indicator) {
2042 D(p->level--);
2043 return NULL;
2044 }
2045 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2046 Token * _literal;
2047 expr_ty a;
2048 expr_ty b;
2049 void *c;
2050 if (
2051 (a = _PyPegen_name_token(p)) // NAME
2052 &&
2053 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2054 &&
2055 (b = expression_rule(p)) // expression
2056 &&
2057 (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs]
2058 )
2059 {
2060 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2061 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2062 if (_token == NULL) {
2063 D(p->level--);
2064 return NULL;
2065 }
2066 int _end_lineno = _token->end_lineno;
2067 UNUSED(_end_lineno); // Only used by EXTRA macro
2068 int _end_col_offset = _token->end_col_offset;
2069 UNUSED(_end_col_offset); // Only used by EXTRA macro
2070 _res = CHECK_VERSION ( 6 , "Variable annotation syntax is" , _Py_AnnAssign ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
2071 if (_res == NULL && PyErr_Occurred()) {
2072 p->error_indicator = 1;
2073 D(p->level--);
2074 return NULL;
2075 }
2076 goto done;
2077 }
2078 p->mark = _mark;
2079 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2080 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2081 }
2082 { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2083 if (p->error_indicator) {
2084 D(p->level--);
2085 return NULL;
2086 }
2087 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2088 Token * _literal;
2089 void *a;
2090 expr_ty b;
2091 void *c;
2092 if (
2093 (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target
2094 &&
2095 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2096 &&
2097 (b = expression_rule(p)) // expression
2098 &&
2099 (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs]
2100 )
2101 {
2102 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2103 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2104 if (_token == NULL) {
2105 D(p->level--);
2106 return NULL;
2107 }
2108 int _end_lineno = _token->end_lineno;
2109 UNUSED(_end_lineno); // Only used by EXTRA macro
2110 int _end_col_offset = _token->end_col_offset;
2111 UNUSED(_end_col_offset); // Only used by EXTRA macro
2112 _res = CHECK_VERSION ( 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) );
2113 if (_res == NULL && PyErr_Occurred()) {
2114 p->error_indicator = 1;
2115 D(p->level--);
2116 return NULL;
2117 }
2118 goto done;
2119 }
2120 p->mark = _mark;
2121 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2122 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2123 }
2124 { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
2125 if (p->error_indicator) {
2126 D(p->level--);
2127 return NULL;
2128 }
2129 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2130 asdl_seq * a;
2131 void *b;
2132 void *tc;
2133 if (
2134 (a = _loop1_22_rule(p)) // ((star_targets '='))+
2135 &&
2136 (b = _tmp_23_rule(p)) // yield_expr | star_expressions
2137 &&
2138 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
2139 &&
2140 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
2141 )
2142 {
2143 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2144 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2145 if (_token == NULL) {
2146 D(p->level--);
2147 return NULL;
2148 }
2149 int _end_lineno = _token->end_lineno;
2150 UNUSED(_end_lineno); // Only used by EXTRA macro
2151 int _end_col_offset = _token->end_col_offset;
2152 UNUSED(_end_col_offset); // Only used by EXTRA macro
2153 _res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
2154 if (_res == NULL && PyErr_Occurred()) {
2155 p->error_indicator = 1;
2156 D(p->level--);
2157 return NULL;
2158 }
2159 goto done;
2160 }
2161 p->mark = _mark;
2162 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2163 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2164 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002165 { // single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002166 if (p->error_indicator) {
2167 D(p->level--);
2168 return NULL;
2169 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002170 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2171 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002172 expr_ty a;
2173 AugOperator* b;
2174 void *c;
2175 if (
2176 (a = single_target_rule(p)) // single_target
2177 &&
2178 (b = augassign_rule(p)) // augassign
2179 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002180 (_cut_var = 1)
2181 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002182 (c = _tmp_24_rule(p)) // yield_expr | star_expressions
2183 )
2184 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002185 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002186 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2187 if (_token == NULL) {
2188 D(p->level--);
2189 return NULL;
2190 }
2191 int _end_lineno = _token->end_lineno;
2192 UNUSED(_end_lineno); // Only used by EXTRA macro
2193 int _end_col_offset = _token->end_col_offset;
2194 UNUSED(_end_col_offset); // Only used by EXTRA macro
2195 _res = _Py_AugAssign ( a , b -> kind , c , EXTRA );
2196 if (_res == NULL && PyErr_Occurred()) {
2197 p->error_indicator = 1;
2198 D(p->level--);
2199 return NULL;
2200 }
2201 goto done;
2202 }
2203 p->mark = _mark;
2204 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002205 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2206 if (_cut_var) {
2207 D(p->level--);
2208 return NULL;
2209 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002210 }
2211 { // invalid_assignment
2212 if (p->error_indicator) {
2213 D(p->level--);
2214 return NULL;
2215 }
2216 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2217 void *invalid_assignment_var;
2218 if (
2219 (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment
2220 )
2221 {
2222 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2223 _res = invalid_assignment_var;
2224 goto done;
2225 }
2226 p->mark = _mark;
2227 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2228 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment"));
2229 }
2230 _res = NULL;
2231 done:
2232 D(p->level--);
2233 return _res;
2234}
2235
2236// augassign:
2237// | '+='
2238// | '-='
2239// | '*='
2240// | '@='
2241// | '/='
2242// | '%='
2243// | '&='
2244// | '|='
2245// | '^='
2246// | '<<='
2247// | '>>='
2248// | '**='
2249// | '//='
2250static AugOperator*
2251augassign_rule(Parser *p)
2252{
2253 D(p->level++);
2254 if (p->error_indicator) {
2255 D(p->level--);
2256 return NULL;
2257 }
2258 AugOperator* _res = NULL;
2259 int _mark = p->mark;
2260 { // '+='
2261 if (p->error_indicator) {
2262 D(p->level--);
2263 return NULL;
2264 }
2265 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='"));
2266 Token * _literal;
2267 if (
2268 (_literal = _PyPegen_expect_token(p, 36)) // token='+='
2269 )
2270 {
2271 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='"));
2272 _res = _PyPegen_augoperator ( p , Add );
2273 if (_res == NULL && PyErr_Occurred()) {
2274 p->error_indicator = 1;
2275 D(p->level--);
2276 return NULL;
2277 }
2278 goto done;
2279 }
2280 p->mark = _mark;
2281 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2282 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='"));
2283 }
2284 { // '-='
2285 if (p->error_indicator) {
2286 D(p->level--);
2287 return NULL;
2288 }
2289 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='"));
2290 Token * _literal;
2291 if (
2292 (_literal = _PyPegen_expect_token(p, 37)) // token='-='
2293 )
2294 {
2295 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='"));
2296 _res = _PyPegen_augoperator ( p , Sub );
2297 if (_res == NULL && PyErr_Occurred()) {
2298 p->error_indicator = 1;
2299 D(p->level--);
2300 return NULL;
2301 }
2302 goto done;
2303 }
2304 p->mark = _mark;
2305 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2306 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='"));
2307 }
2308 { // '*='
2309 if (p->error_indicator) {
2310 D(p->level--);
2311 return NULL;
2312 }
2313 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='"));
2314 Token * _literal;
2315 if (
2316 (_literal = _PyPegen_expect_token(p, 38)) // token='*='
2317 )
2318 {
2319 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='"));
2320 _res = _PyPegen_augoperator ( p , Mult );
2321 if (_res == NULL && PyErr_Occurred()) {
2322 p->error_indicator = 1;
2323 D(p->level--);
2324 return NULL;
2325 }
2326 goto done;
2327 }
2328 p->mark = _mark;
2329 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2330 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='"));
2331 }
2332 { // '@='
2333 if (p->error_indicator) {
2334 D(p->level--);
2335 return NULL;
2336 }
2337 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='"));
2338 Token * _literal;
2339 if (
2340 (_literal = _PyPegen_expect_token(p, 50)) // token='@='
2341 )
2342 {
2343 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='"));
2344 _res = CHECK_VERSION ( 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
2345 if (_res == NULL && PyErr_Occurred()) {
2346 p->error_indicator = 1;
2347 D(p->level--);
2348 return NULL;
2349 }
2350 goto done;
2351 }
2352 p->mark = _mark;
2353 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2354 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='"));
2355 }
2356 { // '/='
2357 if (p->error_indicator) {
2358 D(p->level--);
2359 return NULL;
2360 }
2361 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='"));
2362 Token * _literal;
2363 if (
2364 (_literal = _PyPegen_expect_token(p, 39)) // token='/='
2365 )
2366 {
2367 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='"));
2368 _res = _PyPegen_augoperator ( p , Div );
2369 if (_res == NULL && PyErr_Occurred()) {
2370 p->error_indicator = 1;
2371 D(p->level--);
2372 return NULL;
2373 }
2374 goto done;
2375 }
2376 p->mark = _mark;
2377 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2378 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='"));
2379 }
2380 { // '%='
2381 if (p->error_indicator) {
2382 D(p->level--);
2383 return NULL;
2384 }
2385 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='"));
2386 Token * _literal;
2387 if (
2388 (_literal = _PyPegen_expect_token(p, 40)) // token='%='
2389 )
2390 {
2391 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='"));
2392 _res = _PyPegen_augoperator ( p , Mod );
2393 if (_res == NULL && PyErr_Occurred()) {
2394 p->error_indicator = 1;
2395 D(p->level--);
2396 return NULL;
2397 }
2398 goto done;
2399 }
2400 p->mark = _mark;
2401 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2402 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='"));
2403 }
2404 { // '&='
2405 if (p->error_indicator) {
2406 D(p->level--);
2407 return NULL;
2408 }
2409 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='"));
2410 Token * _literal;
2411 if (
2412 (_literal = _PyPegen_expect_token(p, 41)) // token='&='
2413 )
2414 {
2415 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='"));
2416 _res = _PyPegen_augoperator ( p , BitAnd );
2417 if (_res == NULL && PyErr_Occurred()) {
2418 p->error_indicator = 1;
2419 D(p->level--);
2420 return NULL;
2421 }
2422 goto done;
2423 }
2424 p->mark = _mark;
2425 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2426 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='"));
2427 }
2428 { // '|='
2429 if (p->error_indicator) {
2430 D(p->level--);
2431 return NULL;
2432 }
2433 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='"));
2434 Token * _literal;
2435 if (
2436 (_literal = _PyPegen_expect_token(p, 42)) // token='|='
2437 )
2438 {
2439 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='"));
2440 _res = _PyPegen_augoperator ( p , BitOr );
2441 if (_res == NULL && PyErr_Occurred()) {
2442 p->error_indicator = 1;
2443 D(p->level--);
2444 return NULL;
2445 }
2446 goto done;
2447 }
2448 p->mark = _mark;
2449 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2450 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='"));
2451 }
2452 { // '^='
2453 if (p->error_indicator) {
2454 D(p->level--);
2455 return NULL;
2456 }
2457 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='"));
2458 Token * _literal;
2459 if (
2460 (_literal = _PyPegen_expect_token(p, 43)) // token='^='
2461 )
2462 {
2463 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='"));
2464 _res = _PyPegen_augoperator ( p , BitXor );
2465 if (_res == NULL && PyErr_Occurred()) {
2466 p->error_indicator = 1;
2467 D(p->level--);
2468 return NULL;
2469 }
2470 goto done;
2471 }
2472 p->mark = _mark;
2473 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2474 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='"));
2475 }
2476 { // '<<='
2477 if (p->error_indicator) {
2478 D(p->level--);
2479 return NULL;
2480 }
2481 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='"));
2482 Token * _literal;
2483 if (
2484 (_literal = _PyPegen_expect_token(p, 44)) // token='<<='
2485 )
2486 {
2487 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='"));
2488 _res = _PyPegen_augoperator ( p , LShift );
2489 if (_res == NULL && PyErr_Occurred()) {
2490 p->error_indicator = 1;
2491 D(p->level--);
2492 return NULL;
2493 }
2494 goto done;
2495 }
2496 p->mark = _mark;
2497 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2498 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='"));
2499 }
2500 { // '>>='
2501 if (p->error_indicator) {
2502 D(p->level--);
2503 return NULL;
2504 }
2505 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='"));
2506 Token * _literal;
2507 if (
2508 (_literal = _PyPegen_expect_token(p, 45)) // token='>>='
2509 )
2510 {
2511 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='"));
2512 _res = _PyPegen_augoperator ( p , RShift );
2513 if (_res == NULL && PyErr_Occurred()) {
2514 p->error_indicator = 1;
2515 D(p->level--);
2516 return NULL;
2517 }
2518 goto done;
2519 }
2520 p->mark = _mark;
2521 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2522 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='"));
2523 }
2524 { // '**='
2525 if (p->error_indicator) {
2526 D(p->level--);
2527 return NULL;
2528 }
2529 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='"));
2530 Token * _literal;
2531 if (
2532 (_literal = _PyPegen_expect_token(p, 46)) // token='**='
2533 )
2534 {
2535 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='"));
2536 _res = _PyPegen_augoperator ( p , Pow );
2537 if (_res == NULL && PyErr_Occurred()) {
2538 p->error_indicator = 1;
2539 D(p->level--);
2540 return NULL;
2541 }
2542 goto done;
2543 }
2544 p->mark = _mark;
2545 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2546 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='"));
2547 }
2548 { // '//='
2549 if (p->error_indicator) {
2550 D(p->level--);
2551 return NULL;
2552 }
2553 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='"));
2554 Token * _literal;
2555 if (
2556 (_literal = _PyPegen_expect_token(p, 48)) // token='//='
2557 )
2558 {
2559 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='"));
2560 _res = _PyPegen_augoperator ( p , FloorDiv );
2561 if (_res == NULL && PyErr_Occurred()) {
2562 p->error_indicator = 1;
2563 D(p->level--);
2564 return NULL;
2565 }
2566 goto done;
2567 }
2568 p->mark = _mark;
2569 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2570 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='"));
2571 }
2572 _res = NULL;
2573 done:
2574 D(p->level--);
2575 return _res;
2576}
2577
2578// global_stmt: 'global' ','.NAME+
2579static stmt_ty
2580global_stmt_rule(Parser *p)
2581{
2582 D(p->level++);
2583 if (p->error_indicator) {
2584 D(p->level--);
2585 return NULL;
2586 }
2587 stmt_ty _res = NULL;
2588 int _mark = p->mark;
2589 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2590 p->error_indicator = 1;
2591 D(p->level--);
2592 return NULL;
2593 }
2594 int _start_lineno = p->tokens[_mark]->lineno;
2595 UNUSED(_start_lineno); // Only used by EXTRA macro
2596 int _start_col_offset = p->tokens[_mark]->col_offset;
2597 UNUSED(_start_col_offset); // Only used by EXTRA macro
2598 { // 'global' ','.NAME+
2599 if (p->error_indicator) {
2600 D(p->level--);
2601 return NULL;
2602 }
2603 D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2604 Token * _keyword;
2605 asdl_seq * a;
2606 if (
2607 (_keyword = _PyPegen_expect_token(p, 508)) // token='global'
2608 &&
2609 (a = _gather_25_rule(p)) // ','.NAME+
2610 )
2611 {
2612 D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2613 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2614 if (_token == NULL) {
2615 D(p->level--);
2616 return NULL;
2617 }
2618 int _end_lineno = _token->end_lineno;
2619 UNUSED(_end_lineno); // Only used by EXTRA macro
2620 int _end_col_offset = _token->end_col_offset;
2621 UNUSED(_end_col_offset); // Only used by EXTRA macro
2622 _res = _Py_Global ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
2623 if (_res == NULL && PyErr_Occurred()) {
2624 p->error_indicator = 1;
2625 D(p->level--);
2626 return NULL;
2627 }
2628 goto done;
2629 }
2630 p->mark = _mark;
2631 D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2632 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
2633 }
2634 _res = NULL;
2635 done:
2636 D(p->level--);
2637 return _res;
2638}
2639
2640// nonlocal_stmt: 'nonlocal' ','.NAME+
2641static stmt_ty
2642nonlocal_stmt_rule(Parser *p)
2643{
2644 D(p->level++);
2645 if (p->error_indicator) {
2646 D(p->level--);
2647 return NULL;
2648 }
2649 stmt_ty _res = NULL;
2650 int _mark = p->mark;
2651 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2652 p->error_indicator = 1;
2653 D(p->level--);
2654 return NULL;
2655 }
2656 int _start_lineno = p->tokens[_mark]->lineno;
2657 UNUSED(_start_lineno); // Only used by EXTRA macro
2658 int _start_col_offset = p->tokens[_mark]->col_offset;
2659 UNUSED(_start_col_offset); // Only used by EXTRA macro
2660 { // 'nonlocal' ','.NAME+
2661 if (p->error_indicator) {
2662 D(p->level--);
2663 return NULL;
2664 }
2665 D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2666 Token * _keyword;
2667 asdl_seq * a;
2668 if (
2669 (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal'
2670 &&
2671 (a = _gather_27_rule(p)) // ','.NAME+
2672 )
2673 {
2674 D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2675 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2676 if (_token == NULL) {
2677 D(p->level--);
2678 return NULL;
2679 }
2680 int _end_lineno = _token->end_lineno;
2681 UNUSED(_end_lineno); // Only used by EXTRA macro
2682 int _end_col_offset = _token->end_col_offset;
2683 UNUSED(_end_col_offset); // Only used by EXTRA macro
2684 _res = _Py_Nonlocal ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
2685 if (_res == NULL && PyErr_Occurred()) {
2686 p->error_indicator = 1;
2687 D(p->level--);
2688 return NULL;
2689 }
2690 goto done;
2691 }
2692 p->mark = _mark;
2693 D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2694 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
2695 }
2696 _res = NULL;
2697 done:
2698 D(p->level--);
2699 return _res;
2700}
2701
2702// yield_stmt: yield_expr
2703static stmt_ty
2704yield_stmt_rule(Parser *p)
2705{
2706 D(p->level++);
2707 if (p->error_indicator) {
2708 D(p->level--);
2709 return NULL;
2710 }
2711 stmt_ty _res = NULL;
2712 int _mark = p->mark;
2713 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2714 p->error_indicator = 1;
2715 D(p->level--);
2716 return NULL;
2717 }
2718 int _start_lineno = p->tokens[_mark]->lineno;
2719 UNUSED(_start_lineno); // Only used by EXTRA macro
2720 int _start_col_offset = p->tokens[_mark]->col_offset;
2721 UNUSED(_start_col_offset); // Only used by EXTRA macro
2722 { // yield_expr
2723 if (p->error_indicator) {
2724 D(p->level--);
2725 return NULL;
2726 }
2727 D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2728 expr_ty y;
2729 if (
2730 (y = yield_expr_rule(p)) // yield_expr
2731 )
2732 {
2733 D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2734 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2735 if (_token == NULL) {
2736 D(p->level--);
2737 return NULL;
2738 }
2739 int _end_lineno = _token->end_lineno;
2740 UNUSED(_end_lineno); // Only used by EXTRA macro
2741 int _end_col_offset = _token->end_col_offset;
2742 UNUSED(_end_col_offset); // Only used by EXTRA macro
2743 _res = _Py_Expr ( y , EXTRA );
2744 if (_res == NULL && PyErr_Occurred()) {
2745 p->error_indicator = 1;
2746 D(p->level--);
2747 return NULL;
2748 }
2749 goto done;
2750 }
2751 p->mark = _mark;
2752 D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2753 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
2754 }
2755 _res = NULL;
2756 done:
2757 D(p->level--);
2758 return _res;
2759}
2760
2761// assert_stmt: 'assert' expression [',' expression]
2762static stmt_ty
2763assert_stmt_rule(Parser *p)
2764{
2765 D(p->level++);
2766 if (p->error_indicator) {
2767 D(p->level--);
2768 return NULL;
2769 }
2770 stmt_ty _res = NULL;
2771 int _mark = p->mark;
2772 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2773 p->error_indicator = 1;
2774 D(p->level--);
2775 return NULL;
2776 }
2777 int _start_lineno = p->tokens[_mark]->lineno;
2778 UNUSED(_start_lineno); // Only used by EXTRA macro
2779 int _start_col_offset = p->tokens[_mark]->col_offset;
2780 UNUSED(_start_col_offset); // Only used by EXTRA macro
2781 { // 'assert' expression [',' expression]
2782 if (p->error_indicator) {
2783 D(p->level--);
2784 return NULL;
2785 }
2786 D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2787 Token * _keyword;
2788 expr_ty a;
2789 void *b;
2790 if (
2791 (_keyword = _PyPegen_expect_token(p, 505)) // token='assert'
2792 &&
2793 (a = expression_rule(p)) // expression
2794 &&
2795 (b = _tmp_29_rule(p), 1) // [',' expression]
2796 )
2797 {
2798 D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2799 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2800 if (_token == NULL) {
2801 D(p->level--);
2802 return NULL;
2803 }
2804 int _end_lineno = _token->end_lineno;
2805 UNUSED(_end_lineno); // Only used by EXTRA macro
2806 int _end_col_offset = _token->end_col_offset;
2807 UNUSED(_end_col_offset); // Only used by EXTRA macro
2808 _res = _Py_Assert ( a , b , EXTRA );
2809 if (_res == NULL && PyErr_Occurred()) {
2810 p->error_indicator = 1;
2811 D(p->level--);
2812 return NULL;
2813 }
2814 goto done;
2815 }
2816 p->mark = _mark;
2817 D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2818 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
2819 }
2820 _res = NULL;
2821 done:
2822 D(p->level--);
2823 return _res;
2824}
2825
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002826// del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002827static stmt_ty
2828del_stmt_rule(Parser *p)
2829{
2830 D(p->level++);
2831 if (p->error_indicator) {
2832 D(p->level--);
2833 return NULL;
2834 }
2835 stmt_ty _res = NULL;
2836 int _mark = p->mark;
2837 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2838 p->error_indicator = 1;
2839 D(p->level--);
2840 return NULL;
2841 }
2842 int _start_lineno = p->tokens[_mark]->lineno;
2843 UNUSED(_start_lineno); // Only used by EXTRA macro
2844 int _start_col_offset = p->tokens[_mark]->col_offset;
2845 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002846 { // 'del' del_targets &(';' | NEWLINE)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002847 if (p->error_indicator) {
2848 D(p->level--);
2849 return NULL;
2850 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002851 D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002852 Token * _keyword;
2853 asdl_seq* a;
2854 if (
2855 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
2856 &&
2857 (a = del_targets_rule(p)) // del_targets
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002858 &&
2859 _PyPegen_lookahead(1, _tmp_30_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002860 )
2861 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002862 D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002863 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2864 if (_token == NULL) {
2865 D(p->level--);
2866 return NULL;
2867 }
2868 int _end_lineno = _token->end_lineno;
2869 UNUSED(_end_lineno); // Only used by EXTRA macro
2870 int _end_col_offset = _token->end_col_offset;
2871 UNUSED(_end_col_offset); // Only used by EXTRA macro
2872 _res = _Py_Delete ( a , EXTRA );
2873 if (_res == NULL && PyErr_Occurred()) {
2874 p->error_indicator = 1;
2875 D(p->level--);
2876 return NULL;
2877 }
2878 goto done;
2879 }
2880 p->mark = _mark;
2881 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002882 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
2883 }
2884 { // invalid_del_stmt
2885 if (p->error_indicator) {
2886 D(p->level--);
2887 return NULL;
2888 }
2889 D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2890 void *invalid_del_stmt_var;
2891 if (
2892 (invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt
2893 )
2894 {
2895 D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2896 _res = invalid_del_stmt_var;
2897 goto done;
2898 }
2899 p->mark = _mark;
2900 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2901 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002902 }
2903 _res = NULL;
2904 done:
2905 D(p->level--);
2906 return _res;
2907}
2908
2909// import_stmt: import_name | import_from
2910static stmt_ty
2911import_stmt_rule(Parser *p)
2912{
2913 D(p->level++);
2914 if (p->error_indicator) {
2915 D(p->level--);
2916 return NULL;
2917 }
2918 stmt_ty _res = NULL;
2919 int _mark = p->mark;
2920 { // import_name
2921 if (p->error_indicator) {
2922 D(p->level--);
2923 return NULL;
2924 }
2925 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name"));
2926 stmt_ty import_name_var;
2927 if (
2928 (import_name_var = import_name_rule(p)) // import_name
2929 )
2930 {
2931 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name"));
2932 _res = import_name_var;
2933 goto done;
2934 }
2935 p->mark = _mark;
2936 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2937 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name"));
2938 }
2939 { // import_from
2940 if (p->error_indicator) {
2941 D(p->level--);
2942 return NULL;
2943 }
2944 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from"));
2945 stmt_ty import_from_var;
2946 if (
2947 (import_from_var = import_from_rule(p)) // import_from
2948 )
2949 {
2950 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from"));
2951 _res = import_from_var;
2952 goto done;
2953 }
2954 p->mark = _mark;
2955 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2956 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from"));
2957 }
2958 _res = NULL;
2959 done:
2960 D(p->level--);
2961 return _res;
2962}
2963
2964// import_name: 'import' dotted_as_names
2965static stmt_ty
2966import_name_rule(Parser *p)
2967{
2968 D(p->level++);
2969 if (p->error_indicator) {
2970 D(p->level--);
2971 return NULL;
2972 }
2973 stmt_ty _res = NULL;
2974 int _mark = p->mark;
2975 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2976 p->error_indicator = 1;
2977 D(p->level--);
2978 return NULL;
2979 }
2980 int _start_lineno = p->tokens[_mark]->lineno;
2981 UNUSED(_start_lineno); // Only used by EXTRA macro
2982 int _start_col_offset = p->tokens[_mark]->col_offset;
2983 UNUSED(_start_col_offset); // Only used by EXTRA macro
2984 { // 'import' dotted_as_names
2985 if (p->error_indicator) {
2986 D(p->level--);
2987 return NULL;
2988 }
2989 D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
2990 Token * _keyword;
2991 asdl_seq* a;
2992 if (
2993 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
2994 &&
2995 (a = dotted_as_names_rule(p)) // dotted_as_names
2996 )
2997 {
2998 D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
2999 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3000 if (_token == NULL) {
3001 D(p->level--);
3002 return NULL;
3003 }
3004 int _end_lineno = _token->end_lineno;
3005 UNUSED(_end_lineno); // Only used by EXTRA macro
3006 int _end_col_offset = _token->end_col_offset;
3007 UNUSED(_end_col_offset); // Only used by EXTRA macro
3008 _res = _Py_Import ( a , EXTRA );
3009 if (_res == NULL && PyErr_Occurred()) {
3010 p->error_indicator = 1;
3011 D(p->level--);
3012 return NULL;
3013 }
3014 goto done;
3015 }
3016 p->mark = _mark;
3017 D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ',
3018 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names"));
3019 }
3020 _res = NULL;
3021 done:
3022 D(p->level--);
3023 return _res;
3024}
3025
3026// import_from:
3027// | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3028// | 'from' (('.' | '...'))+ 'import' import_from_targets
3029static stmt_ty
3030import_from_rule(Parser *p)
3031{
3032 D(p->level++);
3033 if (p->error_indicator) {
3034 D(p->level--);
3035 return NULL;
3036 }
3037 stmt_ty _res = NULL;
3038 int _mark = p->mark;
3039 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3040 p->error_indicator = 1;
3041 D(p->level--);
3042 return NULL;
3043 }
3044 int _start_lineno = p->tokens[_mark]->lineno;
3045 UNUSED(_start_lineno); // Only used by EXTRA macro
3046 int _start_col_offset = p->tokens[_mark]->col_offset;
3047 UNUSED(_start_col_offset); // Only used by EXTRA macro
3048 { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3049 if (p->error_indicator) {
3050 D(p->level--);
3051 return NULL;
3052 }
3053 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3054 Token * _keyword;
3055 Token * _keyword_1;
3056 asdl_seq * a;
3057 expr_ty b;
3058 asdl_seq* c;
3059 if (
3060 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3061 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003062 (a = _loop0_31_rule(p)) // (('.' | '...'))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003063 &&
3064 (b = dotted_name_rule(p)) // dotted_name
3065 &&
3066 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3067 &&
3068 (c = import_from_targets_rule(p)) // import_from_targets
3069 )
3070 {
3071 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3072 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3073 if (_token == NULL) {
3074 D(p->level--);
3075 return NULL;
3076 }
3077 int _end_lineno = _token->end_lineno;
3078 UNUSED(_end_lineno); // Only used by EXTRA macro
3079 int _end_col_offset = _token->end_col_offset;
3080 UNUSED(_end_col_offset); // Only used by EXTRA macro
3081 _res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
3082 if (_res == NULL && PyErr_Occurred()) {
3083 p->error_indicator = 1;
3084 D(p->level--);
3085 return NULL;
3086 }
3087 goto done;
3088 }
3089 p->mark = _mark;
3090 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3091 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3092 }
3093 { // 'from' (('.' | '...'))+ 'import' import_from_targets
3094 if (p->error_indicator) {
3095 D(p->level--);
3096 return NULL;
3097 }
3098 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3099 Token * _keyword;
3100 Token * _keyword_1;
3101 asdl_seq * a;
3102 asdl_seq* b;
3103 if (
3104 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3105 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003106 (a = _loop1_32_rule(p)) // (('.' | '...'))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003107 &&
3108 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3109 &&
3110 (b = import_from_targets_rule(p)) // import_from_targets
3111 )
3112 {
3113 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3114 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3115 if (_token == NULL) {
3116 D(p->level--);
3117 return NULL;
3118 }
3119 int _end_lineno = _token->end_lineno;
3120 UNUSED(_end_lineno); // Only used by EXTRA macro
3121 int _end_col_offset = _token->end_col_offset;
3122 UNUSED(_end_col_offset); // Only used by EXTRA macro
3123 _res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
3124 if (_res == NULL && PyErr_Occurred()) {
3125 p->error_indicator = 1;
3126 D(p->level--);
3127 return NULL;
3128 }
3129 goto done;
3130 }
3131 p->mark = _mark;
3132 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3133 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3134 }
3135 _res = NULL;
3136 done:
3137 D(p->level--);
3138 return _res;
3139}
3140
3141// import_from_targets:
3142// | '(' import_from_as_names ','? ')'
3143// | import_from_as_names !','
3144// | '*'
3145// | invalid_import_from_targets
3146static asdl_seq*
3147import_from_targets_rule(Parser *p)
3148{
3149 D(p->level++);
3150 if (p->error_indicator) {
3151 D(p->level--);
3152 return NULL;
3153 }
3154 asdl_seq* _res = NULL;
3155 int _mark = p->mark;
3156 { // '(' import_from_as_names ','? ')'
3157 if (p->error_indicator) {
3158 D(p->level--);
3159 return NULL;
3160 }
3161 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3162 Token * _literal;
3163 Token * _literal_1;
3164 void *_opt_var;
3165 UNUSED(_opt_var); // Silence compiler warnings
3166 asdl_seq* a;
3167 if (
3168 (_literal = _PyPegen_expect_token(p, 7)) // token='('
3169 &&
3170 (a = import_from_as_names_rule(p)) // import_from_as_names
3171 &&
3172 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
3173 &&
3174 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
3175 )
3176 {
3177 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3178 _res = a;
3179 if (_res == NULL && PyErr_Occurred()) {
3180 p->error_indicator = 1;
3181 D(p->level--);
3182 return NULL;
3183 }
3184 goto done;
3185 }
3186 p->mark = _mark;
3187 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3188 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3189 }
3190 { // import_from_as_names !','
3191 if (p->error_indicator) {
3192 D(p->level--);
3193 return NULL;
3194 }
3195 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
3196 asdl_seq* import_from_as_names_var;
3197 if (
3198 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
3199 &&
3200 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
3201 )
3202 {
3203 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
3204 _res = import_from_as_names_var;
3205 goto done;
3206 }
3207 p->mark = _mark;
3208 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3209 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','"));
3210 }
3211 { // '*'
3212 if (p->error_indicator) {
3213 D(p->level--);
3214 return NULL;
3215 }
3216 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
3217 Token * _literal;
3218 if (
3219 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
3220 )
3221 {
3222 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
3223 _res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) );
3224 if (_res == NULL && PyErr_Occurred()) {
3225 p->error_indicator = 1;
3226 D(p->level--);
3227 return NULL;
3228 }
3229 goto done;
3230 }
3231 p->mark = _mark;
3232 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3233 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
3234 }
3235 { // invalid_import_from_targets
3236 if (p->error_indicator) {
3237 D(p->level--);
3238 return NULL;
3239 }
3240 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3241 void *invalid_import_from_targets_var;
3242 if (
3243 (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets
3244 )
3245 {
3246 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3247 _res = invalid_import_from_targets_var;
3248 goto done;
3249 }
3250 p->mark = _mark;
3251 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3252 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets"));
3253 }
3254 _res = NULL;
3255 done:
3256 D(p->level--);
3257 return _res;
3258}
3259
3260// import_from_as_names: ','.import_from_as_name+
3261static asdl_seq*
3262import_from_as_names_rule(Parser *p)
3263{
3264 D(p->level++);
3265 if (p->error_indicator) {
3266 D(p->level--);
3267 return NULL;
3268 }
3269 asdl_seq* _res = NULL;
3270 int _mark = p->mark;
3271 { // ','.import_from_as_name+
3272 if (p->error_indicator) {
3273 D(p->level--);
3274 return NULL;
3275 }
3276 D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
3277 asdl_seq * a;
3278 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003279 (a = _gather_33_rule(p)) // ','.import_from_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003280 )
3281 {
3282 D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
3283 _res = a;
3284 if (_res == NULL && PyErr_Occurred()) {
3285 p->error_indicator = 1;
3286 D(p->level--);
3287 return NULL;
3288 }
3289 goto done;
3290 }
3291 p->mark = _mark;
3292 D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3293 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+"));
3294 }
3295 _res = NULL;
3296 done:
3297 D(p->level--);
3298 return _res;
3299}
3300
3301// import_from_as_name: NAME ['as' NAME]
3302static alias_ty
3303import_from_as_name_rule(Parser *p)
3304{
3305 D(p->level++);
3306 if (p->error_indicator) {
3307 D(p->level--);
3308 return NULL;
3309 }
3310 alias_ty _res = NULL;
3311 int _mark = p->mark;
3312 { // NAME ['as' NAME]
3313 if (p->error_indicator) {
3314 D(p->level--);
3315 return NULL;
3316 }
3317 D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3318 expr_ty a;
3319 void *b;
3320 if (
3321 (a = _PyPegen_name_token(p)) // NAME
3322 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003323 (b = _tmp_35_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003324 )
3325 {
3326 D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3327 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3328 if (_res == NULL && PyErr_Occurred()) {
3329 p->error_indicator = 1;
3330 D(p->level--);
3331 return NULL;
3332 }
3333 goto done;
3334 }
3335 p->mark = _mark;
3336 D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3337 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]"));
3338 }
3339 _res = NULL;
3340 done:
3341 D(p->level--);
3342 return _res;
3343}
3344
3345// dotted_as_names: ','.dotted_as_name+
3346static asdl_seq*
3347dotted_as_names_rule(Parser *p)
3348{
3349 D(p->level++);
3350 if (p->error_indicator) {
3351 D(p->level--);
3352 return NULL;
3353 }
3354 asdl_seq* _res = NULL;
3355 int _mark = p->mark;
3356 { // ','.dotted_as_name+
3357 if (p->error_indicator) {
3358 D(p->level--);
3359 return NULL;
3360 }
3361 D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
3362 asdl_seq * a;
3363 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003364 (a = _gather_36_rule(p)) // ','.dotted_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003365 )
3366 {
3367 D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
3368 _res = a;
3369 if (_res == NULL && PyErr_Occurred()) {
3370 p->error_indicator = 1;
3371 D(p->level--);
3372 return NULL;
3373 }
3374 goto done;
3375 }
3376 p->mark = _mark;
3377 D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3378 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+"));
3379 }
3380 _res = NULL;
3381 done:
3382 D(p->level--);
3383 return _res;
3384}
3385
3386// dotted_as_name: dotted_name ['as' NAME]
3387static alias_ty
3388dotted_as_name_rule(Parser *p)
3389{
3390 D(p->level++);
3391 if (p->error_indicator) {
3392 D(p->level--);
3393 return NULL;
3394 }
3395 alias_ty _res = NULL;
3396 int _mark = p->mark;
3397 { // dotted_name ['as' NAME]
3398 if (p->error_indicator) {
3399 D(p->level--);
3400 return NULL;
3401 }
3402 D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3403 expr_ty a;
3404 void *b;
3405 if (
3406 (a = dotted_name_rule(p)) // dotted_name
3407 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003408 (b = _tmp_38_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003409 )
3410 {
3411 D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3412 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3413 if (_res == NULL && PyErr_Occurred()) {
3414 p->error_indicator = 1;
3415 D(p->level--);
3416 return NULL;
3417 }
3418 goto done;
3419 }
3420 p->mark = _mark;
3421 D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3422 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]"));
3423 }
3424 _res = NULL;
3425 done:
3426 D(p->level--);
3427 return _res;
3428}
3429
3430// Left-recursive
3431// dotted_name: dotted_name '.' NAME | NAME
3432static expr_ty dotted_name_raw(Parser *);
3433static expr_ty
3434dotted_name_rule(Parser *p)
3435{
3436 D(p->level++);
3437 expr_ty _res = NULL;
3438 if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) {
3439 D(p->level--);
3440 return _res;
3441 }
3442 int _mark = p->mark;
3443 int _resmark = p->mark;
3444 while (1) {
3445 int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res);
3446 if (tmpvar_0) {
3447 D(p->level--);
3448 return _res;
3449 }
3450 p->mark = _mark;
3451 void *_raw = dotted_name_raw(p);
3452 if (_raw == NULL || p->mark <= _resmark)
3453 break;
3454 _resmark = p->mark;
3455 _res = _raw;
3456 }
3457 p->mark = _resmark;
3458 D(p->level--);
3459 return _res;
3460}
3461static expr_ty
3462dotted_name_raw(Parser *p)
3463{
3464 D(p->level++);
3465 if (p->error_indicator) {
3466 D(p->level--);
3467 return NULL;
3468 }
3469 expr_ty _res = NULL;
3470 int _mark = p->mark;
3471 { // dotted_name '.' NAME
3472 if (p->error_indicator) {
3473 D(p->level--);
3474 return NULL;
3475 }
3476 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3477 Token * _literal;
3478 expr_ty a;
3479 expr_ty b;
3480 if (
3481 (a = dotted_name_rule(p)) // dotted_name
3482 &&
3483 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
3484 &&
3485 (b = _PyPegen_name_token(p)) // NAME
3486 )
3487 {
3488 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3489 _res = _PyPegen_join_names_with_dot ( p , a , b );
3490 if (_res == NULL && PyErr_Occurred()) {
3491 p->error_indicator = 1;
3492 D(p->level--);
3493 return NULL;
3494 }
3495 goto done;
3496 }
3497 p->mark = _mark;
3498 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3499 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME"));
3500 }
3501 { // NAME
3502 if (p->error_indicator) {
3503 D(p->level--);
3504 return NULL;
3505 }
3506 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
3507 expr_ty name_var;
3508 if (
3509 (name_var = _PyPegen_name_token(p)) // NAME
3510 )
3511 {
3512 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
3513 _res = name_var;
3514 goto done;
3515 }
3516 p->mark = _mark;
3517 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3518 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
3519 }
3520 _res = NULL;
3521 done:
3522 D(p->level--);
3523 return _res;
3524}
3525
3526// if_stmt:
3527// | 'if' named_expression ':' block elif_stmt
3528// | 'if' named_expression ':' block else_block?
3529static stmt_ty
3530if_stmt_rule(Parser *p)
3531{
3532 D(p->level++);
3533 if (p->error_indicator) {
3534 D(p->level--);
3535 return NULL;
3536 }
3537 stmt_ty _res = NULL;
3538 int _mark = p->mark;
3539 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3540 p->error_indicator = 1;
3541 D(p->level--);
3542 return NULL;
3543 }
3544 int _start_lineno = p->tokens[_mark]->lineno;
3545 UNUSED(_start_lineno); // Only used by EXTRA macro
3546 int _start_col_offset = p->tokens[_mark]->col_offset;
3547 UNUSED(_start_col_offset); // Only used by EXTRA macro
3548 { // 'if' named_expression ':' block elif_stmt
3549 if (p->error_indicator) {
3550 D(p->level--);
3551 return NULL;
3552 }
3553 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3554 Token * _keyword;
3555 Token * _literal;
3556 expr_ty a;
3557 asdl_seq* b;
3558 stmt_ty c;
3559 if (
3560 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3561 &&
3562 (a = named_expression_rule(p)) // named_expression
3563 &&
3564 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3565 &&
3566 (b = block_rule(p)) // block
3567 &&
3568 (c = elif_stmt_rule(p)) // elif_stmt
3569 )
3570 {
3571 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3572 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3573 if (_token == NULL) {
3574 D(p->level--);
3575 return NULL;
3576 }
3577 int _end_lineno = _token->end_lineno;
3578 UNUSED(_end_lineno); // Only used by EXTRA macro
3579 int _end_col_offset = _token->end_col_offset;
3580 UNUSED(_end_col_offset); // Only used by EXTRA macro
3581 _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
3582 if (_res == NULL && PyErr_Occurred()) {
3583 p->error_indicator = 1;
3584 D(p->level--);
3585 return NULL;
3586 }
3587 goto done;
3588 }
3589 p->mark = _mark;
3590 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3591 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3592 }
3593 { // 'if' named_expression ':' block else_block?
3594 if (p->error_indicator) {
3595 D(p->level--);
3596 return NULL;
3597 }
3598 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3599 Token * _keyword;
3600 Token * _literal;
3601 expr_ty a;
3602 asdl_seq* b;
3603 void *c;
3604 if (
3605 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3606 &&
3607 (a = named_expression_rule(p)) // named_expression
3608 &&
3609 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3610 &&
3611 (b = block_rule(p)) // block
3612 &&
3613 (c = else_block_rule(p), 1) // else_block?
3614 )
3615 {
3616 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3617 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3618 if (_token == NULL) {
3619 D(p->level--);
3620 return NULL;
3621 }
3622 int _end_lineno = _token->end_lineno;
3623 UNUSED(_end_lineno); // Only used by EXTRA macro
3624 int _end_col_offset = _token->end_col_offset;
3625 UNUSED(_end_col_offset); // Only used by EXTRA macro
3626 _res = _Py_If ( a , b , c , EXTRA );
3627 if (_res == NULL && PyErr_Occurred()) {
3628 p->error_indicator = 1;
3629 D(p->level--);
3630 return NULL;
3631 }
3632 goto done;
3633 }
3634 p->mark = _mark;
3635 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3636 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?"));
3637 }
3638 _res = NULL;
3639 done:
3640 D(p->level--);
3641 return _res;
3642}
3643
3644// elif_stmt:
3645// | 'elif' named_expression ':' block elif_stmt
3646// | 'elif' named_expression ':' block else_block?
3647static stmt_ty
3648elif_stmt_rule(Parser *p)
3649{
3650 D(p->level++);
3651 if (p->error_indicator) {
3652 D(p->level--);
3653 return NULL;
3654 }
3655 stmt_ty _res = NULL;
3656 int _mark = p->mark;
3657 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3658 p->error_indicator = 1;
3659 D(p->level--);
3660 return NULL;
3661 }
3662 int _start_lineno = p->tokens[_mark]->lineno;
3663 UNUSED(_start_lineno); // Only used by EXTRA macro
3664 int _start_col_offset = p->tokens[_mark]->col_offset;
3665 UNUSED(_start_col_offset); // Only used by EXTRA macro
3666 { // 'elif' named_expression ':' block elif_stmt
3667 if (p->error_indicator) {
3668 D(p->level--);
3669 return NULL;
3670 }
3671 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3672 Token * _keyword;
3673 Token * _literal;
3674 expr_ty a;
3675 asdl_seq* b;
3676 stmt_ty c;
3677 if (
3678 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3679 &&
3680 (a = named_expression_rule(p)) // named_expression
3681 &&
3682 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3683 &&
3684 (b = block_rule(p)) // block
3685 &&
3686 (c = elif_stmt_rule(p)) // elif_stmt
3687 )
3688 {
3689 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3690 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3691 if (_token == NULL) {
3692 D(p->level--);
3693 return NULL;
3694 }
3695 int _end_lineno = _token->end_lineno;
3696 UNUSED(_end_lineno); // Only used by EXTRA macro
3697 int _end_col_offset = _token->end_col_offset;
3698 UNUSED(_end_col_offset); // Only used by EXTRA macro
3699 _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
3700 if (_res == NULL && PyErr_Occurred()) {
3701 p->error_indicator = 1;
3702 D(p->level--);
3703 return NULL;
3704 }
3705 goto done;
3706 }
3707 p->mark = _mark;
3708 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3709 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3710 }
3711 { // 'elif' named_expression ':' block else_block?
3712 if (p->error_indicator) {
3713 D(p->level--);
3714 return NULL;
3715 }
3716 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3717 Token * _keyword;
3718 Token * _literal;
3719 expr_ty a;
3720 asdl_seq* b;
3721 void *c;
3722 if (
3723 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3724 &&
3725 (a = named_expression_rule(p)) // named_expression
3726 &&
3727 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3728 &&
3729 (b = block_rule(p)) // block
3730 &&
3731 (c = else_block_rule(p), 1) // else_block?
3732 )
3733 {
3734 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3735 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3736 if (_token == NULL) {
3737 D(p->level--);
3738 return NULL;
3739 }
3740 int _end_lineno = _token->end_lineno;
3741 UNUSED(_end_lineno); // Only used by EXTRA macro
3742 int _end_col_offset = _token->end_col_offset;
3743 UNUSED(_end_col_offset); // Only used by EXTRA macro
3744 _res = _Py_If ( a , b , c , EXTRA );
3745 if (_res == NULL && PyErr_Occurred()) {
3746 p->error_indicator = 1;
3747 D(p->level--);
3748 return NULL;
3749 }
3750 goto done;
3751 }
3752 p->mark = _mark;
3753 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3754 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3755 }
3756 _res = NULL;
3757 done:
3758 D(p->level--);
3759 return _res;
3760}
3761
3762// else_block: 'else' ':' block
3763static asdl_seq*
3764else_block_rule(Parser *p)
3765{
3766 D(p->level++);
3767 if (p->error_indicator) {
3768 D(p->level--);
3769 return NULL;
3770 }
3771 asdl_seq* _res = NULL;
3772 int _mark = p->mark;
3773 { // 'else' ':' block
3774 if (p->error_indicator) {
3775 D(p->level--);
3776 return NULL;
3777 }
3778 D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3779 Token * _keyword;
3780 Token * _literal;
3781 asdl_seq* b;
3782 if (
3783 (_keyword = _PyPegen_expect_token(p, 516)) // token='else'
3784 &&
3785 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3786 &&
3787 (b = block_rule(p)) // block
3788 )
3789 {
3790 D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3791 _res = b;
3792 if (_res == NULL && PyErr_Occurred()) {
3793 p->error_indicator = 1;
3794 D(p->level--);
3795 return NULL;
3796 }
3797 goto done;
3798 }
3799 p->mark = _mark;
3800 D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
3801 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' block"));
3802 }
3803 _res = NULL;
3804 done:
3805 D(p->level--);
3806 return _res;
3807}
3808
3809// while_stmt: 'while' named_expression ':' block else_block?
3810static stmt_ty
3811while_stmt_rule(Parser *p)
3812{
3813 D(p->level++);
3814 if (p->error_indicator) {
3815 D(p->level--);
3816 return NULL;
3817 }
3818 stmt_ty _res = NULL;
3819 int _mark = p->mark;
3820 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3821 p->error_indicator = 1;
3822 D(p->level--);
3823 return NULL;
3824 }
3825 int _start_lineno = p->tokens[_mark]->lineno;
3826 UNUSED(_start_lineno); // Only used by EXTRA macro
3827 int _start_col_offset = p->tokens[_mark]->col_offset;
3828 UNUSED(_start_col_offset); // Only used by EXTRA macro
3829 { // 'while' named_expression ':' block else_block?
3830 if (p->error_indicator) {
3831 D(p->level--);
3832 return NULL;
3833 }
3834 D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3835 Token * _keyword;
3836 Token * _literal;
3837 expr_ty a;
3838 asdl_seq* b;
3839 void *c;
3840 if (
3841 (_keyword = _PyPegen_expect_token(p, 512)) // token='while'
3842 &&
3843 (a = named_expression_rule(p)) // named_expression
3844 &&
3845 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3846 &&
3847 (b = block_rule(p)) // block
3848 &&
3849 (c = else_block_rule(p), 1) // else_block?
3850 )
3851 {
3852 D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3853 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3854 if (_token == NULL) {
3855 D(p->level--);
3856 return NULL;
3857 }
3858 int _end_lineno = _token->end_lineno;
3859 UNUSED(_end_lineno); // Only used by EXTRA macro
3860 int _end_col_offset = _token->end_col_offset;
3861 UNUSED(_end_col_offset); // Only used by EXTRA macro
3862 _res = _Py_While ( a , b , c , EXTRA );
3863 if (_res == NULL && PyErr_Occurred()) {
3864 p->error_indicator = 1;
3865 D(p->level--);
3866 return NULL;
3867 }
3868 goto done;
3869 }
3870 p->mark = _mark;
3871 D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3872 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?"));
3873 }
3874 _res = NULL;
3875 done:
3876 D(p->level--);
3877 return _res;
3878}
3879
3880// for_stmt:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003881// | 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3882// | ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3883// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003884static stmt_ty
3885for_stmt_rule(Parser *p)
3886{
3887 D(p->level++);
3888 if (p->error_indicator) {
3889 D(p->level--);
3890 return NULL;
3891 }
3892 stmt_ty _res = NULL;
3893 int _mark = p->mark;
3894 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3895 p->error_indicator = 1;
3896 D(p->level--);
3897 return NULL;
3898 }
3899 int _start_lineno = p->tokens[_mark]->lineno;
3900 UNUSED(_start_lineno); // Only used by EXTRA macro
3901 int _start_col_offset = p->tokens[_mark]->col_offset;
3902 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003903 { // 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003904 if (p->error_indicator) {
3905 D(p->level--);
3906 return NULL;
3907 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003908 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?"));
3909 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003910 Token * _keyword;
3911 Token * _keyword_1;
3912 Token * _literal;
3913 asdl_seq* b;
3914 void *el;
3915 expr_ty ex;
3916 expr_ty t;
3917 void *tc;
3918 if (
3919 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3920 &&
3921 (t = star_targets_rule(p)) // star_targets
3922 &&
3923 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
3924 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003925 (_cut_var = 1)
3926 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003927 (ex = star_expressions_rule(p)) // star_expressions
3928 &&
3929 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3930 &&
3931 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
3932 &&
3933 (b = block_rule(p)) // block
3934 &&
3935 (el = else_block_rule(p), 1) // else_block?
3936 )
3937 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003938 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?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003939 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3940 if (_token == NULL) {
3941 D(p->level--);
3942 return NULL;
3943 }
3944 int _end_lineno = _token->end_lineno;
3945 UNUSED(_end_lineno); // Only used by EXTRA macro
3946 int _end_col_offset = _token->end_col_offset;
3947 UNUSED(_end_col_offset); // Only used by EXTRA macro
3948 _res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
3949 if (_res == NULL && PyErr_Occurred()) {
3950 p->error_indicator = 1;
3951 D(p->level--);
3952 return NULL;
3953 }
3954 goto done;
3955 }
3956 p->mark = _mark;
3957 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003958 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
3959 if (_cut_var) {
3960 D(p->level--);
3961 return NULL;
3962 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003963 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003964 { // ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003965 if (p->error_indicator) {
3966 D(p->level--);
3967 return NULL;
3968 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003969 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?"));
3970 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003971 Token * _keyword;
3972 Token * _keyword_1;
3973 Token * _literal;
3974 Token * async_var;
3975 asdl_seq* b;
3976 void *el;
3977 expr_ty ex;
3978 expr_ty t;
3979 void *tc;
3980 if (
3981 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
3982 &&
3983 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3984 &&
3985 (t = star_targets_rule(p)) // star_targets
3986 &&
3987 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
3988 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003989 (_cut_var = 1)
3990 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003991 (ex = star_expressions_rule(p)) // star_expressions
3992 &&
3993 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3994 &&
3995 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
3996 &&
3997 (b = block_rule(p)) // block
3998 &&
3999 (el = else_block_rule(p), 1) // else_block?
4000 )
4001 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004002 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?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004003 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4004 if (_token == NULL) {
4005 D(p->level--);
4006 return NULL;
4007 }
4008 int _end_lineno = _token->end_lineno;
4009 UNUSED(_end_lineno); // Only used by EXTRA macro
4010 int _end_col_offset = _token->end_col_offset;
4011 UNUSED(_end_col_offset); // Only used by EXTRA macro
4012 _res = CHECK_VERSION ( 5 , "Async for loops are" , _Py_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
4013 if (_res == NULL && PyErr_Occurred()) {
4014 p->error_indicator = 1;
4015 D(p->level--);
4016 return NULL;
4017 }
4018 goto done;
4019 }
4020 p->mark = _mark;
4021 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004022 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
4023 if (_cut_var) {
4024 D(p->level--);
4025 return NULL;
4026 }
4027 }
4028 { // invalid_for_target
4029 if (p->error_indicator) {
4030 D(p->level--);
4031 return NULL;
4032 }
4033 D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4034 void *invalid_for_target_var;
4035 if (
4036 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
4037 )
4038 {
4039 D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4040 _res = invalid_for_target_var;
4041 goto done;
4042 }
4043 p->mark = _mark;
4044 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4045 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004046 }
4047 _res = NULL;
4048 done:
4049 D(p->level--);
4050 return _res;
4051}
4052
4053// with_stmt:
4054// | 'with' '(' ','.with_item+ ','? ')' ':' block
4055// | 'with' ','.with_item+ ':' TYPE_COMMENT? block
4056// | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4057// | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4058static stmt_ty
4059with_stmt_rule(Parser *p)
4060{
4061 D(p->level++);
4062 if (p->error_indicator) {
4063 D(p->level--);
4064 return NULL;
4065 }
4066 stmt_ty _res = NULL;
4067 int _mark = p->mark;
4068 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4069 p->error_indicator = 1;
4070 D(p->level--);
4071 return NULL;
4072 }
4073 int _start_lineno = p->tokens[_mark]->lineno;
4074 UNUSED(_start_lineno); // Only used by EXTRA macro
4075 int _start_col_offset = p->tokens[_mark]->col_offset;
4076 UNUSED(_start_col_offset); // Only used by EXTRA macro
4077 { // 'with' '(' ','.with_item+ ','? ')' ':' block
4078 if (p->error_indicator) {
4079 D(p->level--);
4080 return NULL;
4081 }
4082 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4083 Token * _keyword;
4084 Token * _literal;
4085 Token * _literal_1;
4086 Token * _literal_2;
4087 void *_opt_var;
4088 UNUSED(_opt_var); // Silence compiler warnings
4089 asdl_seq * a;
4090 asdl_seq* b;
4091 if (
4092 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4093 &&
4094 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4095 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004096 (a = _gather_39_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004097 &&
4098 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4099 &&
4100 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4101 &&
4102 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4103 &&
4104 (b = block_rule(p)) // block
4105 )
4106 {
4107 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4108 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4109 if (_token == NULL) {
4110 D(p->level--);
4111 return NULL;
4112 }
4113 int _end_lineno = _token->end_lineno;
4114 UNUSED(_end_lineno); // Only used by EXTRA macro
4115 int _end_col_offset = _token->end_col_offset;
4116 UNUSED(_end_col_offset); // Only used by EXTRA macro
4117 _res = _Py_With ( a , b , NULL , EXTRA );
4118 if (_res == NULL && PyErr_Occurred()) {
4119 p->error_indicator = 1;
4120 D(p->level--);
4121 return NULL;
4122 }
4123 goto done;
4124 }
4125 p->mark = _mark;
4126 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4127 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4128 }
4129 { // 'with' ','.with_item+ ':' TYPE_COMMENT? block
4130 if (p->error_indicator) {
4131 D(p->level--);
4132 return NULL;
4133 }
4134 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4135 Token * _keyword;
4136 Token * _literal;
4137 asdl_seq * a;
4138 asdl_seq* b;
4139 void *tc;
4140 if (
4141 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4142 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004143 (a = _gather_41_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004144 &&
4145 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4146 &&
4147 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4148 &&
4149 (b = block_rule(p)) // block
4150 )
4151 {
4152 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4153 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4154 if (_token == NULL) {
4155 D(p->level--);
4156 return NULL;
4157 }
4158 int _end_lineno = _token->end_lineno;
4159 UNUSED(_end_lineno); // Only used by EXTRA macro
4160 int _end_col_offset = _token->end_col_offset;
4161 UNUSED(_end_col_offset); // Only used by EXTRA macro
4162 _res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
4163 if (_res == NULL && PyErr_Occurred()) {
4164 p->error_indicator = 1;
4165 D(p->level--);
4166 return NULL;
4167 }
4168 goto done;
4169 }
4170 p->mark = _mark;
4171 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4172 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4173 }
4174 { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4175 if (p->error_indicator) {
4176 D(p->level--);
4177 return NULL;
4178 }
4179 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4180 Token * _keyword;
4181 Token * _literal;
4182 Token * _literal_1;
4183 Token * _literal_2;
4184 void *_opt_var;
4185 UNUSED(_opt_var); // Silence compiler warnings
4186 asdl_seq * a;
4187 Token * async_var;
4188 asdl_seq* b;
4189 if (
4190 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4191 &&
4192 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4193 &&
4194 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4195 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004196 (a = _gather_43_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004197 &&
4198 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4199 &&
4200 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4201 &&
4202 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4203 &&
4204 (b = block_rule(p)) // block
4205 )
4206 {
4207 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4208 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4209 if (_token == NULL) {
4210 D(p->level--);
4211 return NULL;
4212 }
4213 int _end_lineno = _token->end_lineno;
4214 UNUSED(_end_lineno); // Only used by EXTRA macro
4215 int _end_col_offset = _token->end_col_offset;
4216 UNUSED(_end_col_offset); // Only used by EXTRA macro
4217 _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) );
4218 if (_res == NULL && PyErr_Occurred()) {
4219 p->error_indicator = 1;
4220 D(p->level--);
4221 return NULL;
4222 }
4223 goto done;
4224 }
4225 p->mark = _mark;
4226 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4227 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4228 }
4229 { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4230 if (p->error_indicator) {
4231 D(p->level--);
4232 return NULL;
4233 }
4234 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4235 Token * _keyword;
4236 Token * _literal;
4237 asdl_seq * a;
4238 Token * async_var;
4239 asdl_seq* b;
4240 void *tc;
4241 if (
4242 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4243 &&
4244 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4245 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004246 (a = _gather_45_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004247 &&
4248 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4249 &&
4250 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4251 &&
4252 (b = block_rule(p)) // block
4253 )
4254 {
4255 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4256 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4257 if (_token == NULL) {
4258 D(p->level--);
4259 return NULL;
4260 }
4261 int _end_lineno = _token->end_lineno;
4262 UNUSED(_end_lineno); // Only used by EXTRA macro
4263 int _end_col_offset = _token->end_col_offset;
4264 UNUSED(_end_col_offset); // Only used by EXTRA macro
4265 _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
4266 if (_res == NULL && PyErr_Occurred()) {
4267 p->error_indicator = 1;
4268 D(p->level--);
4269 return NULL;
4270 }
4271 goto done;
4272 }
4273 p->mark = _mark;
4274 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4275 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4276 }
4277 _res = NULL;
4278 done:
4279 D(p->level--);
4280 return _res;
4281}
4282
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004283// with_item: expression 'as' target &(',' | ')' | ':') | invalid_with_item | expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004284static withitem_ty
4285with_item_rule(Parser *p)
4286{
4287 D(p->level++);
4288 if (p->error_indicator) {
4289 D(p->level--);
4290 return NULL;
4291 }
4292 withitem_ty _res = NULL;
4293 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004294 { // expression 'as' target &(',' | ')' | ':')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004295 if (p->error_indicator) {
4296 D(p->level--);
4297 return NULL;
4298 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004299 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4300 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004301 expr_ty e;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004302 expr_ty t;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004303 if (
4304 (e = expression_rule(p)) // expression
4305 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004306 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
4307 &&
4308 (t = target_rule(p)) // target
4309 &&
4310 _PyPegen_lookahead(1, _tmp_47_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004311 )
4312 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004313 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4314 _res = _Py_withitem ( e , t , p -> arena );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004315 if (_res == NULL && PyErr_Occurred()) {
4316 p->error_indicator = 1;
4317 D(p->level--);
4318 return NULL;
4319 }
4320 goto done;
4321 }
4322 p->mark = _mark;
4323 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004324 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4325 }
4326 { // invalid_with_item
4327 if (p->error_indicator) {
4328 D(p->level--);
4329 return NULL;
4330 }
4331 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4332 void *invalid_with_item_var;
4333 if (
4334 (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item
4335 )
4336 {
4337 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4338 _res = invalid_with_item_var;
4339 goto done;
4340 }
4341 p->mark = _mark;
4342 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4343 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item"));
4344 }
4345 { // expression
4346 if (p->error_indicator) {
4347 D(p->level--);
4348 return NULL;
4349 }
4350 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
4351 expr_ty e;
4352 if (
4353 (e = expression_rule(p)) // expression
4354 )
4355 {
4356 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
4357 _res = _Py_withitem ( e , NULL , p -> arena );
4358 if (_res == NULL && PyErr_Occurred()) {
4359 p->error_indicator = 1;
4360 D(p->level--);
4361 return NULL;
4362 }
4363 goto done;
4364 }
4365 p->mark = _mark;
4366 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4367 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004368 }
4369 _res = NULL;
4370 done:
4371 D(p->level--);
4372 return _res;
4373}
4374
4375// try_stmt:
4376// | 'try' ':' block finally_block
4377// | 'try' ':' block except_block+ else_block? finally_block?
4378static stmt_ty
4379try_stmt_rule(Parser *p)
4380{
4381 D(p->level++);
4382 if (p->error_indicator) {
4383 D(p->level--);
4384 return NULL;
4385 }
4386 stmt_ty _res = NULL;
4387 int _mark = p->mark;
4388 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4389 p->error_indicator = 1;
4390 D(p->level--);
4391 return NULL;
4392 }
4393 int _start_lineno = p->tokens[_mark]->lineno;
4394 UNUSED(_start_lineno); // Only used by EXTRA macro
4395 int _start_col_offset = p->tokens[_mark]->col_offset;
4396 UNUSED(_start_col_offset); // Only used by EXTRA macro
4397 { // 'try' ':' block finally_block
4398 if (p->error_indicator) {
4399 D(p->level--);
4400 return NULL;
4401 }
4402 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4403 Token * _keyword;
4404 Token * _literal;
4405 asdl_seq* b;
4406 asdl_seq* f;
4407 if (
4408 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4409 &&
4410 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4411 &&
4412 (b = block_rule(p)) // block
4413 &&
4414 (f = finally_block_rule(p)) // finally_block
4415 )
4416 {
4417 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4418 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4419 if (_token == NULL) {
4420 D(p->level--);
4421 return NULL;
4422 }
4423 int _end_lineno = _token->end_lineno;
4424 UNUSED(_end_lineno); // Only used by EXTRA macro
4425 int _end_col_offset = _token->end_col_offset;
4426 UNUSED(_end_col_offset); // Only used by EXTRA macro
4427 _res = _Py_Try ( b , NULL , NULL , f , EXTRA );
4428 if (_res == NULL && PyErr_Occurred()) {
4429 p->error_indicator = 1;
4430 D(p->level--);
4431 return NULL;
4432 }
4433 goto done;
4434 }
4435 p->mark = _mark;
4436 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4437 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block finally_block"));
4438 }
4439 { // 'try' ':' block except_block+ else_block? finally_block?
4440 if (p->error_indicator) {
4441 D(p->level--);
4442 return NULL;
4443 }
4444 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4445 Token * _keyword;
4446 Token * _literal;
4447 asdl_seq* b;
4448 void *el;
4449 asdl_seq * ex;
4450 void *f;
4451 if (
4452 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4453 &&
4454 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4455 &&
4456 (b = block_rule(p)) // block
4457 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004458 (ex = _loop1_48_rule(p)) // except_block+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004459 &&
4460 (el = else_block_rule(p), 1) // else_block?
4461 &&
4462 (f = finally_block_rule(p), 1) // finally_block?
4463 )
4464 {
4465 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4466 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4467 if (_token == NULL) {
4468 D(p->level--);
4469 return NULL;
4470 }
4471 int _end_lineno = _token->end_lineno;
4472 UNUSED(_end_lineno); // Only used by EXTRA macro
4473 int _end_col_offset = _token->end_col_offset;
4474 UNUSED(_end_col_offset); // Only used by EXTRA macro
4475 _res = _Py_Try ( b , ex , el , f , EXTRA );
4476 if (_res == NULL && PyErr_Occurred()) {
4477 p->error_indicator = 1;
4478 D(p->level--);
4479 return NULL;
4480 }
4481 goto done;
4482 }
4483 p->mark = _mark;
4484 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4485 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4486 }
4487 _res = NULL;
4488 done:
4489 D(p->level--);
4490 return _res;
4491}
4492
4493// except_block: 'except' expression ['as' NAME] ':' block | 'except' ':' block
4494static excepthandler_ty
4495except_block_rule(Parser *p)
4496{
4497 D(p->level++);
4498 if (p->error_indicator) {
4499 D(p->level--);
4500 return NULL;
4501 }
4502 excepthandler_ty _res = NULL;
4503 int _mark = p->mark;
4504 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4505 p->error_indicator = 1;
4506 D(p->level--);
4507 return NULL;
4508 }
4509 int _start_lineno = p->tokens[_mark]->lineno;
4510 UNUSED(_start_lineno); // Only used by EXTRA macro
4511 int _start_col_offset = p->tokens[_mark]->col_offset;
4512 UNUSED(_start_col_offset); // Only used by EXTRA macro
4513 { // 'except' expression ['as' NAME] ':' block
4514 if (p->error_indicator) {
4515 D(p->level--);
4516 return NULL;
4517 }
4518 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4519 Token * _keyword;
4520 Token * _literal;
4521 asdl_seq* b;
4522 expr_ty e;
4523 void *t;
4524 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004525 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004526 &&
4527 (e = expression_rule(p)) // expression
4528 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004529 (t = _tmp_49_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004530 &&
4531 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4532 &&
4533 (b = block_rule(p)) // block
4534 )
4535 {
4536 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4537 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4538 if (_token == NULL) {
4539 D(p->level--);
4540 return NULL;
4541 }
4542 int _end_lineno = _token->end_lineno;
4543 UNUSED(_end_lineno); // Only used by EXTRA macro
4544 int _end_col_offset = _token->end_col_offset;
4545 UNUSED(_end_col_offset); // Only used by EXTRA macro
4546 _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
4547 if (_res == NULL && PyErr_Occurred()) {
4548 p->error_indicator = 1;
4549 D(p->level--);
4550 return NULL;
4551 }
4552 goto done;
4553 }
4554 p->mark = _mark;
4555 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4556 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4557 }
4558 { // 'except' ':' block
4559 if (p->error_indicator) {
4560 D(p->level--);
4561 return NULL;
4562 }
4563 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4564 Token * _keyword;
4565 Token * _literal;
4566 asdl_seq* b;
4567 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004568 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004569 &&
4570 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4571 &&
4572 (b = block_rule(p)) // block
4573 )
4574 {
4575 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4576 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4577 if (_token == NULL) {
4578 D(p->level--);
4579 return NULL;
4580 }
4581 int _end_lineno = _token->end_lineno;
4582 UNUSED(_end_lineno); // Only used by EXTRA macro
4583 int _end_col_offset = _token->end_col_offset;
4584 UNUSED(_end_col_offset); // Only used by EXTRA macro
4585 _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
4586 if (_res == NULL && PyErr_Occurred()) {
4587 p->error_indicator = 1;
4588 D(p->level--);
4589 return NULL;
4590 }
4591 goto done;
4592 }
4593 p->mark = _mark;
4594 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4595 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block"));
4596 }
4597 _res = NULL;
4598 done:
4599 D(p->level--);
4600 return _res;
4601}
4602
4603// finally_block: 'finally' ':' block
4604static asdl_seq*
4605finally_block_rule(Parser *p)
4606{
4607 D(p->level++);
4608 if (p->error_indicator) {
4609 D(p->level--);
4610 return NULL;
4611 }
4612 asdl_seq* _res = NULL;
4613 int _mark = p->mark;
4614 { // 'finally' ':' block
4615 if (p->error_indicator) {
4616 D(p->level--);
4617 return NULL;
4618 }
4619 D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4620 Token * _keyword;
4621 Token * _literal;
4622 asdl_seq* a;
4623 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004624 (_keyword = _PyPegen_expect_token(p, 522)) // token='finally'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004625 &&
4626 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4627 &&
4628 (a = block_rule(p)) // block
4629 )
4630 {
4631 D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4632 _res = a;
4633 if (_res == NULL && PyErr_Occurred()) {
4634 p->error_indicator = 1;
4635 D(p->level--);
4636 return NULL;
4637 }
4638 goto done;
4639 }
4640 p->mark = _mark;
4641 D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
4642 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block"));
4643 }
4644 _res = NULL;
4645 done:
4646 D(p->level--);
4647 return _res;
4648}
4649
4650// return_stmt: 'return' star_expressions?
4651static stmt_ty
4652return_stmt_rule(Parser *p)
4653{
4654 D(p->level++);
4655 if (p->error_indicator) {
4656 D(p->level--);
4657 return NULL;
4658 }
4659 stmt_ty _res = NULL;
4660 int _mark = p->mark;
4661 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4662 p->error_indicator = 1;
4663 D(p->level--);
4664 return NULL;
4665 }
4666 int _start_lineno = p->tokens[_mark]->lineno;
4667 UNUSED(_start_lineno); // Only used by EXTRA macro
4668 int _start_col_offset = p->tokens[_mark]->col_offset;
4669 UNUSED(_start_col_offset); // Only used by EXTRA macro
4670 { // 'return' star_expressions?
4671 if (p->error_indicator) {
4672 D(p->level--);
4673 return NULL;
4674 }
4675 D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4676 Token * _keyword;
4677 void *a;
4678 if (
4679 (_keyword = _PyPegen_expect_token(p, 500)) // token='return'
4680 &&
4681 (a = star_expressions_rule(p), 1) // star_expressions?
4682 )
4683 {
4684 D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4685 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4686 if (_token == NULL) {
4687 D(p->level--);
4688 return NULL;
4689 }
4690 int _end_lineno = _token->end_lineno;
4691 UNUSED(_end_lineno); // Only used by EXTRA macro
4692 int _end_col_offset = _token->end_col_offset;
4693 UNUSED(_end_col_offset); // Only used by EXTRA macro
4694 _res = _Py_Return ( a , EXTRA );
4695 if (_res == NULL && PyErr_Occurred()) {
4696 p->error_indicator = 1;
4697 D(p->level--);
4698 return NULL;
4699 }
4700 goto done;
4701 }
4702 p->mark = _mark;
4703 D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4704 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
4705 }
4706 _res = NULL;
4707 done:
4708 D(p->level--);
4709 return _res;
4710}
4711
4712// raise_stmt: 'raise' expression ['from' expression] | 'raise'
4713static stmt_ty
4714raise_stmt_rule(Parser *p)
4715{
4716 D(p->level++);
4717 if (p->error_indicator) {
4718 D(p->level--);
4719 return NULL;
4720 }
4721 stmt_ty _res = NULL;
4722 int _mark = p->mark;
4723 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4724 p->error_indicator = 1;
4725 D(p->level--);
4726 return NULL;
4727 }
4728 int _start_lineno = p->tokens[_mark]->lineno;
4729 UNUSED(_start_lineno); // Only used by EXTRA macro
4730 int _start_col_offset = p->tokens[_mark]->col_offset;
4731 UNUSED(_start_col_offset); // Only used by EXTRA macro
4732 { // 'raise' expression ['from' expression]
4733 if (p->error_indicator) {
4734 D(p->level--);
4735 return NULL;
4736 }
4737 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4738 Token * _keyword;
4739 expr_ty a;
4740 void *b;
4741 if (
4742 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4743 &&
4744 (a = expression_rule(p)) // expression
4745 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004746 (b = _tmp_50_rule(p), 1) // ['from' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004747 )
4748 {
4749 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4750 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4751 if (_token == NULL) {
4752 D(p->level--);
4753 return NULL;
4754 }
4755 int _end_lineno = _token->end_lineno;
4756 UNUSED(_end_lineno); // Only used by EXTRA macro
4757 int _end_col_offset = _token->end_col_offset;
4758 UNUSED(_end_col_offset); // Only used by EXTRA macro
4759 _res = _Py_Raise ( a , b , EXTRA );
4760 if (_res == NULL && PyErr_Occurred()) {
4761 p->error_indicator = 1;
4762 D(p->level--);
4763 return NULL;
4764 }
4765 goto done;
4766 }
4767 p->mark = _mark;
4768 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4769 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
4770 }
4771 { // 'raise'
4772 if (p->error_indicator) {
4773 D(p->level--);
4774 return NULL;
4775 }
4776 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
4777 Token * _keyword;
4778 if (
4779 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4780 )
4781 {
4782 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
4783 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4784 if (_token == NULL) {
4785 D(p->level--);
4786 return NULL;
4787 }
4788 int _end_lineno = _token->end_lineno;
4789 UNUSED(_end_lineno); // Only used by EXTRA macro
4790 int _end_col_offset = _token->end_col_offset;
4791 UNUSED(_end_col_offset); // Only used by EXTRA macro
4792 _res = _Py_Raise ( NULL , NULL , EXTRA );
4793 if (_res == NULL && PyErr_Occurred()) {
4794 p->error_indicator = 1;
4795 D(p->level--);
4796 return NULL;
4797 }
4798 goto done;
4799 }
4800 p->mark = _mark;
4801 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4802 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
4803 }
4804 _res = NULL;
4805 done:
4806 D(p->level--);
4807 return _res;
4808}
4809
4810// function_def: decorators function_def_raw | function_def_raw
4811static stmt_ty
4812function_def_rule(Parser *p)
4813{
4814 D(p->level++);
4815 if (p->error_indicator) {
4816 D(p->level--);
4817 return NULL;
4818 }
4819 stmt_ty _res = NULL;
4820 int _mark = p->mark;
4821 { // decorators function_def_raw
4822 if (p->error_indicator) {
4823 D(p->level--);
4824 return NULL;
4825 }
4826 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
4827 asdl_seq* d;
4828 stmt_ty f;
4829 if (
4830 (d = decorators_rule(p)) // decorators
4831 &&
4832 (f = function_def_raw_rule(p)) // function_def_raw
4833 )
4834 {
4835 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
4836 _res = _PyPegen_function_def_decorators ( p , d , f );
4837 if (_res == NULL && PyErr_Occurred()) {
4838 p->error_indicator = 1;
4839 D(p->level--);
4840 return NULL;
4841 }
4842 goto done;
4843 }
4844 p->mark = _mark;
4845 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4846 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
4847 }
4848 { // function_def_raw
4849 if (p->error_indicator) {
4850 D(p->level--);
4851 return NULL;
4852 }
4853 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4854 stmt_ty function_def_raw_var;
4855 if (
4856 (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw
4857 )
4858 {
4859 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4860 _res = function_def_raw_var;
4861 goto done;
4862 }
4863 p->mark = _mark;
4864 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4865 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
4866 }
4867 _res = NULL;
4868 done:
4869 D(p->level--);
4870 return _res;
4871}
4872
4873// function_def_raw:
4874// | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4875// | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4876static stmt_ty
4877function_def_raw_rule(Parser *p)
4878{
4879 D(p->level++);
4880 if (p->error_indicator) {
4881 D(p->level--);
4882 return NULL;
4883 }
4884 stmt_ty _res = NULL;
4885 int _mark = p->mark;
4886 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4887 p->error_indicator = 1;
4888 D(p->level--);
4889 return NULL;
4890 }
4891 int _start_lineno = p->tokens[_mark]->lineno;
4892 UNUSED(_start_lineno); // Only used by EXTRA macro
4893 int _start_col_offset = p->tokens[_mark]->col_offset;
4894 UNUSED(_start_col_offset); // Only used by EXTRA macro
4895 { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4896 if (p->error_indicator) {
4897 D(p->level--);
4898 return NULL;
4899 }
4900 D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4901 Token * _keyword;
4902 Token * _literal;
4903 Token * _literal_1;
4904 Token * _literal_2;
4905 void *a;
4906 asdl_seq* b;
4907 expr_ty n;
4908 void *params;
4909 void *tc;
4910 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004911 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004912 &&
4913 (n = _PyPegen_name_token(p)) // NAME
4914 &&
4915 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4916 &&
4917 (params = params_rule(p), 1) // params?
4918 &&
4919 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4920 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004921 (a = _tmp_51_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004922 &&
4923 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4924 &&
4925 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4926 &&
4927 (b = block_rule(p)) // block
4928 )
4929 {
4930 D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4931 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4932 if (_token == NULL) {
4933 D(p->level--);
4934 return NULL;
4935 }
4936 int _end_lineno = _token->end_lineno;
4937 UNUSED(_end_lineno); // Only used by EXTRA macro
4938 int _end_col_offset = _token->end_col_offset;
4939 UNUSED(_end_col_offset); // Only used by EXTRA macro
4940 _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
4941 if (_res == NULL && PyErr_Occurred()) {
4942 p->error_indicator = 1;
4943 D(p->level--);
4944 return NULL;
4945 }
4946 goto done;
4947 }
4948 p->mark = _mark;
4949 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
4950 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4951 }
4952 { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4953 if (p->error_indicator) {
4954 D(p->level--);
4955 return NULL;
4956 }
4957 D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4958 Token * _keyword;
4959 Token * _literal;
4960 Token * _literal_1;
4961 Token * _literal_2;
4962 void *a;
4963 Token * async_var;
4964 asdl_seq* b;
4965 expr_ty n;
4966 void *params;
4967 void *tc;
4968 if (
4969 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4970 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004971 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004972 &&
4973 (n = _PyPegen_name_token(p)) // NAME
4974 &&
4975 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4976 &&
4977 (params = params_rule(p), 1) // params?
4978 &&
4979 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4980 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004981 (a = _tmp_52_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004982 &&
4983 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4984 &&
4985 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4986 &&
4987 (b = block_rule(p)) // block
4988 )
4989 {
4990 D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4991 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4992 if (_token == NULL) {
4993 D(p->level--);
4994 return NULL;
4995 }
4996 int _end_lineno = _token->end_lineno;
4997 UNUSED(_end_lineno); // Only used by EXTRA macro
4998 int _end_col_offset = _token->end_col_offset;
4999 UNUSED(_end_col_offset); // Only used by EXTRA macro
5000 _res = CHECK_VERSION ( 5 , "Async functions are" , _Py_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
5001 if (_res == NULL && PyErr_Occurred()) {
5002 p->error_indicator = 1;
5003 D(p->level--);
5004 return NULL;
5005 }
5006 goto done;
5007 }
5008 p->mark = _mark;
5009 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
5010 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
5011 }
5012 _res = NULL;
5013 done:
5014 D(p->level--);
5015 return _res;
5016}
5017
5018// func_type_comment:
5019// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5020// | invalid_double_type_comments
5021// | TYPE_COMMENT
5022static Token*
5023func_type_comment_rule(Parser *p)
5024{
5025 D(p->level++);
5026 if (p->error_indicator) {
5027 D(p->level--);
5028 return NULL;
5029 }
5030 Token* _res = NULL;
5031 int _mark = p->mark;
5032 { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5033 if (p->error_indicator) {
5034 D(p->level--);
5035 return NULL;
5036 }
5037 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5038 Token * newline_var;
5039 Token * t;
5040 if (
5041 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
5042 &&
5043 (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5044 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005045 _PyPegen_lookahead(1, _tmp_53_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005046 )
5047 {
5048 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5049 _res = t;
5050 if (_res == NULL && PyErr_Occurred()) {
5051 p->error_indicator = 1;
5052 D(p->level--);
5053 return NULL;
5054 }
5055 goto done;
5056 }
5057 p->mark = _mark;
5058 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5059 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5060 }
5061 { // invalid_double_type_comments
5062 if (p->error_indicator) {
5063 D(p->level--);
5064 return NULL;
5065 }
5066 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5067 void *invalid_double_type_comments_var;
5068 if (
5069 (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments
5070 )
5071 {
5072 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5073 _res = invalid_double_type_comments_var;
5074 goto done;
5075 }
5076 p->mark = _mark;
5077 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5078 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
5079 }
5080 { // TYPE_COMMENT
5081 if (p->error_indicator) {
5082 D(p->level--);
5083 return NULL;
5084 }
5085 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5086 Token * type_comment_var;
5087 if (
5088 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5089 )
5090 {
5091 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5092 _res = type_comment_var;
5093 goto done;
5094 }
5095 p->mark = _mark;
5096 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5097 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
5098 }
5099 _res = NULL;
5100 done:
5101 D(p->level--);
5102 return _res;
5103}
5104
5105// params: invalid_parameters | parameters
5106static arguments_ty
5107params_rule(Parser *p)
5108{
5109 D(p->level++);
5110 if (p->error_indicator) {
5111 D(p->level--);
5112 return NULL;
5113 }
5114 arguments_ty _res = NULL;
5115 int _mark = p->mark;
5116 { // invalid_parameters
5117 if (p->error_indicator) {
5118 D(p->level--);
5119 return NULL;
5120 }
5121 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5122 void *invalid_parameters_var;
5123 if (
5124 (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters
5125 )
5126 {
5127 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5128 _res = invalid_parameters_var;
5129 goto done;
5130 }
5131 p->mark = _mark;
5132 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5133 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
5134 }
5135 { // parameters
5136 if (p->error_indicator) {
5137 D(p->level--);
5138 return NULL;
5139 }
5140 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
5141 arguments_ty parameters_var;
5142 if (
5143 (parameters_var = parameters_rule(p)) // parameters
5144 )
5145 {
5146 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
5147 _res = parameters_var;
5148 goto done;
5149 }
5150 p->mark = _mark;
5151 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5152 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
5153 }
5154 _res = NULL;
5155 done:
5156 D(p->level--);
5157 return _res;
5158}
5159
5160// parameters:
5161// | slash_no_default param_no_default* param_with_default* star_etc?
5162// | slash_with_default param_with_default* star_etc?
5163// | param_no_default+ param_with_default* star_etc?
5164// | param_with_default+ star_etc?
5165// | star_etc
5166static arguments_ty
5167parameters_rule(Parser *p)
5168{
5169 D(p->level++);
5170 if (p->error_indicator) {
5171 D(p->level--);
5172 return NULL;
5173 }
5174 arguments_ty _res = NULL;
5175 int _mark = p->mark;
5176 { // slash_no_default param_no_default* param_with_default* star_etc?
5177 if (p->error_indicator) {
5178 D(p->level--);
5179 return NULL;
5180 }
5181 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?"));
5182 asdl_seq* a;
5183 asdl_seq * b;
5184 asdl_seq * c;
5185 void *d;
5186 if (
5187 (a = slash_no_default_rule(p)) // slash_no_default
5188 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005189 (b = _loop0_54_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005190 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005191 (c = _loop0_55_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005192 &&
5193 (d = star_etc_rule(p), 1) // star_etc?
5194 )
5195 {
5196 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?"));
5197 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
5198 if (_res == NULL && PyErr_Occurred()) {
5199 p->error_indicator = 1;
5200 D(p->level--);
5201 return NULL;
5202 }
5203 goto done;
5204 }
5205 p->mark = _mark;
5206 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5207 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
5208 }
5209 { // slash_with_default param_with_default* star_etc?
5210 if (p->error_indicator) {
5211 D(p->level--);
5212 return NULL;
5213 }
5214 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5215 SlashWithDefault* a;
5216 asdl_seq * b;
5217 void *c;
5218 if (
5219 (a = slash_with_default_rule(p)) // slash_with_default
5220 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005221 (b = _loop0_56_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005222 &&
5223 (c = star_etc_rule(p), 1) // star_etc?
5224 )
5225 {
5226 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5227 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
5228 if (_res == NULL && PyErr_Occurred()) {
5229 p->error_indicator = 1;
5230 D(p->level--);
5231 return NULL;
5232 }
5233 goto done;
5234 }
5235 p->mark = _mark;
5236 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5237 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5238 }
5239 { // param_no_default+ param_with_default* star_etc?
5240 if (p->error_indicator) {
5241 D(p->level--);
5242 return NULL;
5243 }
5244 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5245 asdl_seq * a;
5246 asdl_seq * b;
5247 void *c;
5248 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005249 (a = _loop1_57_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005250 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005251 (b = _loop0_58_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005252 &&
5253 (c = star_etc_rule(p), 1) // star_etc?
5254 )
5255 {
5256 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5257 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
5258 if (_res == NULL && PyErr_Occurred()) {
5259 p->error_indicator = 1;
5260 D(p->level--);
5261 return NULL;
5262 }
5263 goto done;
5264 }
5265 p->mark = _mark;
5266 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5267 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5268 }
5269 { // param_with_default+ star_etc?
5270 if (p->error_indicator) {
5271 D(p->level--);
5272 return NULL;
5273 }
5274 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5275 asdl_seq * a;
5276 void *b;
5277 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005278 (a = _loop1_59_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005279 &&
5280 (b = star_etc_rule(p), 1) // star_etc?
5281 )
5282 {
5283 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5284 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
5285 if (_res == NULL && PyErr_Occurred()) {
5286 p->error_indicator = 1;
5287 D(p->level--);
5288 return NULL;
5289 }
5290 goto done;
5291 }
5292 p->mark = _mark;
5293 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5294 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
5295 }
5296 { // star_etc
5297 if (p->error_indicator) {
5298 D(p->level--);
5299 return NULL;
5300 }
5301 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
5302 StarEtc* a;
5303 if (
5304 (a = star_etc_rule(p)) // star_etc
5305 )
5306 {
5307 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
5308 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
5309 if (_res == NULL && PyErr_Occurred()) {
5310 p->error_indicator = 1;
5311 D(p->level--);
5312 return NULL;
5313 }
5314 goto done;
5315 }
5316 p->mark = _mark;
5317 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5318 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
5319 }
5320 _res = NULL;
5321 done:
5322 D(p->level--);
5323 return _res;
5324}
5325
5326// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
5327static asdl_seq*
5328slash_no_default_rule(Parser *p)
5329{
5330 D(p->level++);
5331 if (p->error_indicator) {
5332 D(p->level--);
5333 return NULL;
5334 }
5335 asdl_seq* _res = NULL;
5336 int _mark = p->mark;
5337 { // param_no_default+ '/' ','
5338 if (p->error_indicator) {
5339 D(p->level--);
5340 return NULL;
5341 }
5342 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5343 Token * _literal;
5344 Token * _literal_1;
5345 asdl_seq * a;
5346 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005347 (a = _loop1_60_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005348 &&
5349 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5350 &&
5351 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5352 )
5353 {
5354 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5355 _res = a;
5356 if (_res == NULL && PyErr_Occurred()) {
5357 p->error_indicator = 1;
5358 D(p->level--);
5359 return NULL;
5360 }
5361 goto done;
5362 }
5363 p->mark = _mark;
5364 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5365 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
5366 }
5367 { // param_no_default+ '/' &')'
5368 if (p->error_indicator) {
5369 D(p->level--);
5370 return NULL;
5371 }
5372 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5373 Token * _literal;
5374 asdl_seq * a;
5375 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005376 (a = _loop1_61_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005377 &&
5378 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5379 &&
5380 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5381 )
5382 {
5383 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5384 _res = a;
5385 if (_res == NULL && PyErr_Occurred()) {
5386 p->error_indicator = 1;
5387 D(p->level--);
5388 return NULL;
5389 }
5390 goto done;
5391 }
5392 p->mark = _mark;
5393 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5394 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
5395 }
5396 _res = NULL;
5397 done:
5398 D(p->level--);
5399 return _res;
5400}
5401
5402// slash_with_default:
5403// | param_no_default* param_with_default+ '/' ','
5404// | param_no_default* param_with_default+ '/' &')'
5405static SlashWithDefault*
5406slash_with_default_rule(Parser *p)
5407{
5408 D(p->level++);
5409 if (p->error_indicator) {
5410 D(p->level--);
5411 return NULL;
5412 }
5413 SlashWithDefault* _res = NULL;
5414 int _mark = p->mark;
5415 { // param_no_default* param_with_default+ '/' ','
5416 if (p->error_indicator) {
5417 D(p->level--);
5418 return NULL;
5419 }
5420 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5421 Token * _literal;
5422 Token * _literal_1;
5423 asdl_seq * a;
5424 asdl_seq * b;
5425 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005426 (a = _loop0_62_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005427 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005428 (b = _loop1_63_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005429 &&
5430 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5431 &&
5432 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5433 )
5434 {
5435 D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5436 _res = _PyPegen_slash_with_default ( p , a , b );
5437 if (_res == NULL && PyErr_Occurred()) {
5438 p->error_indicator = 1;
5439 D(p->level--);
5440 return NULL;
5441 }
5442 goto done;
5443 }
5444 p->mark = _mark;
5445 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5446 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5447 }
5448 { // param_no_default* param_with_default+ '/' &')'
5449 if (p->error_indicator) {
5450 D(p->level--);
5451 return NULL;
5452 }
5453 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5454 Token * _literal;
5455 asdl_seq * a;
5456 asdl_seq * b;
5457 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005458 (a = _loop0_64_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005459 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005460 (b = _loop1_65_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005461 &&
5462 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5463 &&
5464 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5465 )
5466 {
5467 D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5468 _res = _PyPegen_slash_with_default ( p , a , b );
5469 if (_res == NULL && PyErr_Occurred()) {
5470 p->error_indicator = 1;
5471 D(p->level--);
5472 return NULL;
5473 }
5474 goto done;
5475 }
5476 p->mark = _mark;
5477 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5478 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5479 }
5480 _res = NULL;
5481 done:
5482 D(p->level--);
5483 return _res;
5484}
5485
5486// star_etc:
5487// | '*' param_no_default param_maybe_default* kwds?
5488// | '*' ',' param_maybe_default+ kwds?
5489// | kwds
5490// | invalid_star_etc
5491static StarEtc*
5492star_etc_rule(Parser *p)
5493{
5494 D(p->level++);
5495 if (p->error_indicator) {
5496 D(p->level--);
5497 return NULL;
5498 }
5499 StarEtc* _res = NULL;
5500 int _mark = p->mark;
5501 { // '*' param_no_default param_maybe_default* kwds?
5502 if (p->error_indicator) {
5503 D(p->level--);
5504 return NULL;
5505 }
5506 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5507 Token * _literal;
5508 arg_ty a;
5509 asdl_seq * b;
5510 void *c;
5511 if (
5512 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5513 &&
5514 (a = param_no_default_rule(p)) // param_no_default
5515 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005516 (b = _loop0_66_rule(p)) // param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005517 &&
5518 (c = kwds_rule(p), 1) // kwds?
5519 )
5520 {
5521 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5522 _res = _PyPegen_star_etc ( p , a , b , c );
5523 if (_res == NULL && PyErr_Occurred()) {
5524 p->error_indicator = 1;
5525 D(p->level--);
5526 return NULL;
5527 }
5528 goto done;
5529 }
5530 p->mark = _mark;
5531 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5532 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5533 }
5534 { // '*' ',' param_maybe_default+ kwds?
5535 if (p->error_indicator) {
5536 D(p->level--);
5537 return NULL;
5538 }
5539 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5540 Token * _literal;
5541 Token * _literal_1;
5542 asdl_seq * b;
5543 void *c;
5544 if (
5545 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5546 &&
5547 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5548 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005549 (b = _loop1_67_rule(p)) // param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005550 &&
5551 (c = kwds_rule(p), 1) // kwds?
5552 )
5553 {
5554 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5555 _res = _PyPegen_star_etc ( p , NULL , b , c );
5556 if (_res == NULL && PyErr_Occurred()) {
5557 p->error_indicator = 1;
5558 D(p->level--);
5559 return NULL;
5560 }
5561 goto done;
5562 }
5563 p->mark = _mark;
5564 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5565 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5566 }
5567 { // kwds
5568 if (p->error_indicator) {
5569 D(p->level--);
5570 return NULL;
5571 }
5572 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
5573 arg_ty a;
5574 if (
5575 (a = kwds_rule(p)) // kwds
5576 )
5577 {
5578 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
5579 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
5580 if (_res == NULL && PyErr_Occurred()) {
5581 p->error_indicator = 1;
5582 D(p->level--);
5583 return NULL;
5584 }
5585 goto done;
5586 }
5587 p->mark = _mark;
5588 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5589 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
5590 }
5591 { // invalid_star_etc
5592 if (p->error_indicator) {
5593 D(p->level--);
5594 return NULL;
5595 }
5596 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5597 void *invalid_star_etc_var;
5598 if (
5599 (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc
5600 )
5601 {
5602 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5603 _res = invalid_star_etc_var;
5604 goto done;
5605 }
5606 p->mark = _mark;
5607 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5608 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
5609 }
5610 _res = NULL;
5611 done:
5612 D(p->level--);
5613 return _res;
5614}
5615
5616// kwds: '**' param_no_default
5617static arg_ty
5618kwds_rule(Parser *p)
5619{
5620 D(p->level++);
5621 if (p->error_indicator) {
5622 D(p->level--);
5623 return NULL;
5624 }
5625 arg_ty _res = NULL;
5626 int _mark = p->mark;
5627 { // '**' param_no_default
5628 if (p->error_indicator) {
5629 D(p->level--);
5630 return NULL;
5631 }
5632 D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5633 Token * _literal;
5634 arg_ty a;
5635 if (
5636 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
5637 &&
5638 (a = param_no_default_rule(p)) // param_no_default
5639 )
5640 {
5641 D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5642 _res = a;
5643 if (_res == NULL && PyErr_Occurred()) {
5644 p->error_indicator = 1;
5645 D(p->level--);
5646 return NULL;
5647 }
5648 goto done;
5649 }
5650 p->mark = _mark;
5651 D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
5652 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
5653 }
5654 _res = NULL;
5655 done:
5656 D(p->level--);
5657 return _res;
5658}
5659
5660// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
5661static arg_ty
5662param_no_default_rule(Parser *p)
5663{
5664 D(p->level++);
5665 if (p->error_indicator) {
5666 D(p->level--);
5667 return NULL;
5668 }
5669 arg_ty _res = NULL;
5670 int _mark = p->mark;
5671 { // param ',' TYPE_COMMENT?
5672 if (p->error_indicator) {
5673 D(p->level--);
5674 return NULL;
5675 }
5676 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5677 Token * _literal;
5678 arg_ty a;
5679 void *tc;
5680 if (
5681 (a = param_rule(p)) // param
5682 &&
5683 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5684 &&
5685 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5686 )
5687 {
5688 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5689 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5690 if (_res == NULL && PyErr_Occurred()) {
5691 p->error_indicator = 1;
5692 D(p->level--);
5693 return NULL;
5694 }
5695 goto done;
5696 }
5697 p->mark = _mark;
5698 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5699 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
5700 }
5701 { // param TYPE_COMMENT? &')'
5702 if (p->error_indicator) {
5703 D(p->level--);
5704 return NULL;
5705 }
5706 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5707 arg_ty a;
5708 void *tc;
5709 if (
5710 (a = param_rule(p)) // param
5711 &&
5712 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5713 &&
5714 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5715 )
5716 {
5717 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5718 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5719 if (_res == NULL && PyErr_Occurred()) {
5720 p->error_indicator = 1;
5721 D(p->level--);
5722 return NULL;
5723 }
5724 goto done;
5725 }
5726 p->mark = _mark;
5727 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5728 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
5729 }
5730 _res = NULL;
5731 done:
5732 D(p->level--);
5733 return _res;
5734}
5735
5736// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
5737static NameDefaultPair*
5738param_with_default_rule(Parser *p)
5739{
5740 D(p->level++);
5741 if (p->error_indicator) {
5742 D(p->level--);
5743 return NULL;
5744 }
5745 NameDefaultPair* _res = NULL;
5746 int _mark = p->mark;
5747 { // param default ',' TYPE_COMMENT?
5748 if (p->error_indicator) {
5749 D(p->level--);
5750 return NULL;
5751 }
5752 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5753 Token * _literal;
5754 arg_ty a;
5755 expr_ty c;
5756 void *tc;
5757 if (
5758 (a = param_rule(p)) // param
5759 &&
5760 (c = default_rule(p)) // default
5761 &&
5762 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5763 &&
5764 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5765 )
5766 {
5767 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5768 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5769 if (_res == NULL && PyErr_Occurred()) {
5770 p->error_indicator = 1;
5771 D(p->level--);
5772 return NULL;
5773 }
5774 goto done;
5775 }
5776 p->mark = _mark;
5777 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5778 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5779 }
5780 { // param default TYPE_COMMENT? &')'
5781 if (p->error_indicator) {
5782 D(p->level--);
5783 return NULL;
5784 }
5785 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5786 arg_ty a;
5787 expr_ty c;
5788 void *tc;
5789 if (
5790 (a = param_rule(p)) // param
5791 &&
5792 (c = default_rule(p)) // default
5793 &&
5794 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5795 &&
5796 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5797 )
5798 {
5799 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5800 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5801 if (_res == NULL && PyErr_Occurred()) {
5802 p->error_indicator = 1;
5803 D(p->level--);
5804 return NULL;
5805 }
5806 goto done;
5807 }
5808 p->mark = _mark;
5809 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5810 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5811 }
5812 _res = NULL;
5813 done:
5814 D(p->level--);
5815 return _res;
5816}
5817
5818// param_maybe_default:
5819// | param default? ',' TYPE_COMMENT?
5820// | param default? TYPE_COMMENT? &')'
5821static NameDefaultPair*
5822param_maybe_default_rule(Parser *p)
5823{
5824 D(p->level++);
5825 if (p->error_indicator) {
5826 D(p->level--);
5827 return NULL;
5828 }
5829 NameDefaultPair* _res = NULL;
5830 int _mark = p->mark;
5831 { // param default? ',' TYPE_COMMENT?
5832 if (p->error_indicator) {
5833 D(p->level--);
5834 return NULL;
5835 }
5836 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5837 Token * _literal;
5838 arg_ty a;
5839 void *c;
5840 void *tc;
5841 if (
5842 (a = param_rule(p)) // param
5843 &&
5844 (c = default_rule(p), 1) // default?
5845 &&
5846 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5847 &&
5848 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5849 )
5850 {
5851 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5852 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5853 if (_res == NULL && PyErr_Occurred()) {
5854 p->error_indicator = 1;
5855 D(p->level--);
5856 return NULL;
5857 }
5858 goto done;
5859 }
5860 p->mark = _mark;
5861 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5862 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5863 }
5864 { // param default? TYPE_COMMENT? &')'
5865 if (p->error_indicator) {
5866 D(p->level--);
5867 return NULL;
5868 }
5869 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5870 arg_ty a;
5871 void *c;
5872 void *tc;
5873 if (
5874 (a = param_rule(p)) // param
5875 &&
5876 (c = default_rule(p), 1) // default?
5877 &&
5878 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5879 &&
5880 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5881 )
5882 {
5883 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5884 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5885 if (_res == NULL && PyErr_Occurred()) {
5886 p->error_indicator = 1;
5887 D(p->level--);
5888 return NULL;
5889 }
5890 goto done;
5891 }
5892 p->mark = _mark;
5893 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5894 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5895 }
5896 _res = NULL;
5897 done:
5898 D(p->level--);
5899 return _res;
5900}
5901
5902// param: NAME annotation?
5903static arg_ty
5904param_rule(Parser *p)
5905{
5906 D(p->level++);
5907 if (p->error_indicator) {
5908 D(p->level--);
5909 return NULL;
5910 }
5911 arg_ty _res = NULL;
5912 int _mark = p->mark;
5913 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5914 p->error_indicator = 1;
5915 D(p->level--);
5916 return NULL;
5917 }
5918 int _start_lineno = p->tokens[_mark]->lineno;
5919 UNUSED(_start_lineno); // Only used by EXTRA macro
5920 int _start_col_offset = p->tokens[_mark]->col_offset;
5921 UNUSED(_start_col_offset); // Only used by EXTRA macro
5922 { // NAME annotation?
5923 if (p->error_indicator) {
5924 D(p->level--);
5925 return NULL;
5926 }
5927 D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5928 expr_ty a;
5929 void *b;
5930 if (
5931 (a = _PyPegen_name_token(p)) // NAME
5932 &&
5933 (b = annotation_rule(p), 1) // annotation?
5934 )
5935 {
5936 D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5937 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
5938 if (_token == NULL) {
5939 D(p->level--);
5940 return NULL;
5941 }
5942 int _end_lineno = _token->end_lineno;
5943 UNUSED(_end_lineno); // Only used by EXTRA macro
5944 int _end_col_offset = _token->end_col_offset;
5945 UNUSED(_end_col_offset); // Only used by EXTRA macro
5946 _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
5947 if (_res == NULL && PyErr_Occurred()) {
5948 p->error_indicator = 1;
5949 D(p->level--);
5950 return NULL;
5951 }
5952 goto done;
5953 }
5954 p->mark = _mark;
5955 D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
5956 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
5957 }
5958 _res = NULL;
5959 done:
5960 D(p->level--);
5961 return _res;
5962}
5963
5964// annotation: ':' expression
5965static expr_ty
5966annotation_rule(Parser *p)
5967{
5968 D(p->level++);
5969 if (p->error_indicator) {
5970 D(p->level--);
5971 return NULL;
5972 }
5973 expr_ty _res = NULL;
5974 int _mark = p->mark;
5975 { // ':' expression
5976 if (p->error_indicator) {
5977 D(p->level--);
5978 return NULL;
5979 }
5980 D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
5981 Token * _literal;
5982 expr_ty a;
5983 if (
5984 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
5985 &&
5986 (a = expression_rule(p)) // expression
5987 )
5988 {
5989 D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
5990 _res = a;
5991 if (_res == NULL && PyErr_Occurred()) {
5992 p->error_indicator = 1;
5993 D(p->level--);
5994 return NULL;
5995 }
5996 goto done;
5997 }
5998 p->mark = _mark;
5999 D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
6000 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
6001 }
6002 _res = NULL;
6003 done:
6004 D(p->level--);
6005 return _res;
6006}
6007
6008// default: '=' expression
6009static expr_ty
6010default_rule(Parser *p)
6011{
6012 D(p->level++);
6013 if (p->error_indicator) {
6014 D(p->level--);
6015 return NULL;
6016 }
6017 expr_ty _res = NULL;
6018 int _mark = p->mark;
6019 { // '=' expression
6020 if (p->error_indicator) {
6021 D(p->level--);
6022 return NULL;
6023 }
6024 D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6025 Token * _literal;
6026 expr_ty a;
6027 if (
6028 (_literal = _PyPegen_expect_token(p, 22)) // token='='
6029 &&
6030 (a = expression_rule(p)) // expression
6031 )
6032 {
6033 D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6034 _res = a;
6035 if (_res == NULL && PyErr_Occurred()) {
6036 p->error_indicator = 1;
6037 D(p->level--);
6038 return NULL;
6039 }
6040 goto done;
6041 }
6042 p->mark = _mark;
6043 D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
6044 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
6045 }
6046 _res = NULL;
6047 done:
6048 D(p->level--);
6049 return _res;
6050}
6051
6052// decorators: (('@' named_expression NEWLINE))+
6053static asdl_seq*
6054decorators_rule(Parser *p)
6055{
6056 D(p->level++);
6057 if (p->error_indicator) {
6058 D(p->level--);
6059 return NULL;
6060 }
6061 asdl_seq* _res = NULL;
6062 int _mark = p->mark;
6063 { // (('@' named_expression NEWLINE))+
6064 if (p->error_indicator) {
6065 D(p->level--);
6066 return NULL;
6067 }
6068 D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6069 asdl_seq * a;
6070 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006071 (a = _loop1_68_rule(p)) // (('@' named_expression NEWLINE))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006072 )
6073 {
6074 D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6075 _res = a;
6076 if (_res == NULL && PyErr_Occurred()) {
6077 p->error_indicator = 1;
6078 D(p->level--);
6079 return NULL;
6080 }
6081 goto done;
6082 }
6083 p->mark = _mark;
6084 D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
6085 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6086 }
6087 _res = NULL;
6088 done:
6089 D(p->level--);
6090 return _res;
6091}
6092
6093// class_def: decorators class_def_raw | class_def_raw
6094static stmt_ty
6095class_def_rule(Parser *p)
6096{
6097 D(p->level++);
6098 if (p->error_indicator) {
6099 D(p->level--);
6100 return NULL;
6101 }
6102 stmt_ty _res = NULL;
6103 int _mark = p->mark;
6104 { // decorators class_def_raw
6105 if (p->error_indicator) {
6106 D(p->level--);
6107 return NULL;
6108 }
6109 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
6110 asdl_seq* a;
6111 stmt_ty b;
6112 if (
6113 (a = decorators_rule(p)) // decorators
6114 &&
6115 (b = class_def_raw_rule(p)) // class_def_raw
6116 )
6117 {
6118 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
6119 _res = _PyPegen_class_def_decorators ( p , a , b );
6120 if (_res == NULL && PyErr_Occurred()) {
6121 p->error_indicator = 1;
6122 D(p->level--);
6123 return NULL;
6124 }
6125 goto done;
6126 }
6127 p->mark = _mark;
6128 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6129 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
6130 }
6131 { // class_def_raw
6132 if (p->error_indicator) {
6133 D(p->level--);
6134 return NULL;
6135 }
6136 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6137 stmt_ty class_def_raw_var;
6138 if (
6139 (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw
6140 )
6141 {
6142 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6143 _res = class_def_raw_var;
6144 goto done;
6145 }
6146 p->mark = _mark;
6147 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6148 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
6149 }
6150 _res = NULL;
6151 done:
6152 D(p->level--);
6153 return _res;
6154}
6155
6156// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
6157static stmt_ty
6158class_def_raw_rule(Parser *p)
6159{
6160 D(p->level++);
6161 if (p->error_indicator) {
6162 D(p->level--);
6163 return NULL;
6164 }
6165 stmt_ty _res = NULL;
6166 int _mark = p->mark;
6167 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6168 p->error_indicator = 1;
6169 D(p->level--);
6170 return NULL;
6171 }
6172 int _start_lineno = p->tokens[_mark]->lineno;
6173 UNUSED(_start_lineno); // Only used by EXTRA macro
6174 int _start_col_offset = p->tokens[_mark]->col_offset;
6175 UNUSED(_start_col_offset); // Only used by EXTRA macro
6176 { // 'class' NAME ['(' arguments? ')'] ':' block
6177 if (p->error_indicator) {
6178 D(p->level--);
6179 return NULL;
6180 }
6181 D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6182 Token * _keyword;
6183 Token * _literal;
6184 expr_ty a;
6185 void *b;
6186 asdl_seq* c;
6187 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006188 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006189 &&
6190 (a = _PyPegen_name_token(p)) // NAME
6191 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006192 (b = _tmp_69_rule(p), 1) // ['(' arguments? ')']
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006193 &&
6194 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
6195 &&
6196 (c = block_rule(p)) // block
6197 )
6198 {
6199 D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6200 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6201 if (_token == NULL) {
6202 D(p->level--);
6203 return NULL;
6204 }
6205 int _end_lineno = _token->end_lineno;
6206 UNUSED(_end_lineno); // Only used by EXTRA macro
6207 int _end_col_offset = _token->end_col_offset;
6208 UNUSED(_end_col_offset); // Only used by EXTRA macro
6209 _res = _Py_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , EXTRA );
6210 if (_res == NULL && PyErr_Occurred()) {
6211 p->error_indicator = 1;
6212 D(p->level--);
6213 return NULL;
6214 }
6215 goto done;
6216 }
6217 p->mark = _mark;
6218 D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
6219 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6220 }
6221 _res = NULL;
6222 done:
6223 D(p->level--);
6224 return _res;
6225}
6226
6227// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
6228static asdl_seq*
6229block_rule(Parser *p)
6230{
6231 D(p->level++);
6232 if (p->error_indicator) {
6233 D(p->level--);
6234 return NULL;
6235 }
6236 asdl_seq* _res = NULL;
6237 if (_PyPegen_is_memoized(p, block_type, &_res)) {
6238 D(p->level--);
6239 return _res;
6240 }
6241 int _mark = p->mark;
6242 { // NEWLINE INDENT statements DEDENT
6243 if (p->error_indicator) {
6244 D(p->level--);
6245 return NULL;
6246 }
6247 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6248 asdl_seq* a;
6249 Token * dedent_var;
6250 Token * indent_var;
6251 Token * newline_var;
6252 if (
6253 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
6254 &&
6255 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
6256 &&
6257 (a = statements_rule(p)) // statements
6258 &&
6259 (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
6260 )
6261 {
6262 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6263 _res = a;
6264 if (_res == NULL && PyErr_Occurred()) {
6265 p->error_indicator = 1;
6266 D(p->level--);
6267 return NULL;
6268 }
6269 goto done;
6270 }
6271 p->mark = _mark;
6272 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6273 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6274 }
6275 { // simple_stmt
6276 if (p->error_indicator) {
6277 D(p->level--);
6278 return NULL;
6279 }
6280 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
6281 asdl_seq* simple_stmt_var;
6282 if (
6283 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
6284 )
6285 {
6286 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
6287 _res = simple_stmt_var;
6288 goto done;
6289 }
6290 p->mark = _mark;
6291 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6292 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
6293 }
6294 { // invalid_block
6295 if (p->error_indicator) {
6296 D(p->level--);
6297 return NULL;
6298 }
6299 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6300 void *invalid_block_var;
6301 if (
6302 (invalid_block_var = invalid_block_rule(p)) // invalid_block
6303 )
6304 {
6305 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6306 _res = invalid_block_var;
6307 goto done;
6308 }
6309 p->mark = _mark;
6310 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6311 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
6312 }
6313 _res = NULL;
6314 done:
6315 _PyPegen_insert_memo(p, _mark, block_type, _res);
6316 D(p->level--);
6317 return _res;
6318}
6319
6320// expressions_list: ','.star_expression+ ','?
6321static asdl_seq*
6322expressions_list_rule(Parser *p)
6323{
6324 D(p->level++);
6325 if (p->error_indicator) {
6326 D(p->level--);
6327 return NULL;
6328 }
6329 asdl_seq* _res = NULL;
6330 int _mark = p->mark;
6331 { // ','.star_expression+ ','?
6332 if (p->error_indicator) {
6333 D(p->level--);
6334 return NULL;
6335 }
6336 D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6337 void *_opt_var;
6338 UNUSED(_opt_var); // Silence compiler warnings
6339 asdl_seq * a;
6340 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006341 (a = _gather_70_rule(p)) // ','.star_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006342 &&
6343 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6344 )
6345 {
6346 D(fprintf(stderr, "%*c+ expressions_list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6347 _res = a;
6348 if (_res == NULL && PyErr_Occurred()) {
6349 p->error_indicator = 1;
6350 D(p->level--);
6351 return NULL;
6352 }
6353 goto done;
6354 }
6355 p->mark = _mark;
6356 D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ',
6357 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?"));
6358 }
6359 _res = NULL;
6360 done:
6361 D(p->level--);
6362 return _res;
6363}
6364
6365// star_expressions:
6366// | star_expression ((',' star_expression))+ ','?
6367// | star_expression ','
6368// | star_expression
6369static expr_ty
6370star_expressions_rule(Parser *p)
6371{
6372 D(p->level++);
6373 if (p->error_indicator) {
6374 D(p->level--);
6375 return NULL;
6376 }
6377 expr_ty _res = NULL;
6378 int _mark = p->mark;
6379 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6380 p->error_indicator = 1;
6381 D(p->level--);
6382 return NULL;
6383 }
6384 int _start_lineno = p->tokens[_mark]->lineno;
6385 UNUSED(_start_lineno); // Only used by EXTRA macro
6386 int _start_col_offset = p->tokens[_mark]->col_offset;
6387 UNUSED(_start_col_offset); // Only used by EXTRA macro
6388 { // star_expression ((',' star_expression))+ ','?
6389 if (p->error_indicator) {
6390 D(p->level--);
6391 return NULL;
6392 }
6393 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6394 void *_opt_var;
6395 UNUSED(_opt_var); // Silence compiler warnings
6396 expr_ty a;
6397 asdl_seq * b;
6398 if (
6399 (a = star_expression_rule(p)) // star_expression
6400 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006401 (b = _loop1_72_rule(p)) // ((',' star_expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006402 &&
6403 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6404 )
6405 {
6406 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6407 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6408 if (_token == NULL) {
6409 D(p->level--);
6410 return NULL;
6411 }
6412 int _end_lineno = _token->end_lineno;
6413 UNUSED(_end_lineno); // Only used by EXTRA macro
6414 int _end_col_offset = _token->end_col_offset;
6415 UNUSED(_end_col_offset); // Only used by EXTRA macro
6416 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
6417 if (_res == NULL && PyErr_Occurred()) {
6418 p->error_indicator = 1;
6419 D(p->level--);
6420 return NULL;
6421 }
6422 goto done;
6423 }
6424 p->mark = _mark;
6425 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6426 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6427 }
6428 { // star_expression ','
6429 if (p->error_indicator) {
6430 D(p->level--);
6431 return NULL;
6432 }
6433 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6434 Token * _literal;
6435 expr_ty a;
6436 if (
6437 (a = star_expression_rule(p)) // star_expression
6438 &&
6439 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6440 )
6441 {
6442 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6443 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6444 if (_token == NULL) {
6445 D(p->level--);
6446 return NULL;
6447 }
6448 int _end_lineno = _token->end_lineno;
6449 UNUSED(_end_lineno); // Only used by EXTRA macro
6450 int _end_col_offset = _token->end_col_offset;
6451 UNUSED(_end_col_offset); // Only used by EXTRA macro
6452 _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
6453 if (_res == NULL && PyErr_Occurred()) {
6454 p->error_indicator = 1;
6455 D(p->level--);
6456 return NULL;
6457 }
6458 goto done;
6459 }
6460 p->mark = _mark;
6461 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6462 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','"));
6463 }
6464 { // star_expression
6465 if (p->error_indicator) {
6466 D(p->level--);
6467 return NULL;
6468 }
6469 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression"));
6470 expr_ty star_expression_var;
6471 if (
6472 (star_expression_var = star_expression_rule(p)) // star_expression
6473 )
6474 {
6475 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression"));
6476 _res = star_expression_var;
6477 goto done;
6478 }
6479 p->mark = _mark;
6480 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6481 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression"));
6482 }
6483 _res = NULL;
6484 done:
6485 D(p->level--);
6486 return _res;
6487}
6488
6489// star_expression: '*' bitwise_or | expression
6490static expr_ty
6491star_expression_rule(Parser *p)
6492{
6493 D(p->level++);
6494 if (p->error_indicator) {
6495 D(p->level--);
6496 return NULL;
6497 }
6498 expr_ty _res = NULL;
6499 if (_PyPegen_is_memoized(p, star_expression_type, &_res)) {
6500 D(p->level--);
6501 return _res;
6502 }
6503 int _mark = p->mark;
6504 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6505 p->error_indicator = 1;
6506 D(p->level--);
6507 return NULL;
6508 }
6509 int _start_lineno = p->tokens[_mark]->lineno;
6510 UNUSED(_start_lineno); // Only used by EXTRA macro
6511 int _start_col_offset = p->tokens[_mark]->col_offset;
6512 UNUSED(_start_col_offset); // Only used by EXTRA macro
6513 { // '*' bitwise_or
6514 if (p->error_indicator) {
6515 D(p->level--);
6516 return NULL;
6517 }
6518 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6519 Token * _literal;
6520 expr_ty a;
6521 if (
6522 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6523 &&
6524 (a = bitwise_or_rule(p)) // bitwise_or
6525 )
6526 {
6527 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6528 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6529 if (_token == NULL) {
6530 D(p->level--);
6531 return NULL;
6532 }
6533 int _end_lineno = _token->end_lineno;
6534 UNUSED(_end_lineno); // Only used by EXTRA macro
6535 int _end_col_offset = _token->end_col_offset;
6536 UNUSED(_end_col_offset); // Only used by EXTRA macro
6537 _res = _Py_Starred ( a , Load , EXTRA );
6538 if (_res == NULL && PyErr_Occurred()) {
6539 p->error_indicator = 1;
6540 D(p->level--);
6541 return NULL;
6542 }
6543 goto done;
6544 }
6545 p->mark = _mark;
6546 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6547 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6548 }
6549 { // expression
6550 if (p->error_indicator) {
6551 D(p->level--);
6552 return NULL;
6553 }
6554 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6555 expr_ty expression_var;
6556 if (
6557 (expression_var = expression_rule(p)) // expression
6558 )
6559 {
6560 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6561 _res = expression_var;
6562 goto done;
6563 }
6564 p->mark = _mark;
6565 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6566 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6567 }
6568 _res = NULL;
6569 done:
6570 _PyPegen_insert_memo(p, _mark, star_expression_type, _res);
6571 D(p->level--);
6572 return _res;
6573}
6574
6575// star_named_expressions: ','.star_named_expression+ ','?
6576static asdl_seq*
6577star_named_expressions_rule(Parser *p)
6578{
6579 D(p->level++);
6580 if (p->error_indicator) {
6581 D(p->level--);
6582 return NULL;
6583 }
6584 asdl_seq* _res = NULL;
6585 int _mark = p->mark;
6586 { // ','.star_named_expression+ ','?
6587 if (p->error_indicator) {
6588 D(p->level--);
6589 return NULL;
6590 }
6591 D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6592 void *_opt_var;
6593 UNUSED(_opt_var); // Silence compiler warnings
6594 asdl_seq * a;
6595 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006596 (a = _gather_73_rule(p)) // ','.star_named_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006597 &&
6598 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6599 )
6600 {
6601 D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6602 _res = a;
6603 if (_res == NULL && PyErr_Occurred()) {
6604 p->error_indicator = 1;
6605 D(p->level--);
6606 return NULL;
6607 }
6608 goto done;
6609 }
6610 p->mark = _mark;
6611 D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6612 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?"));
6613 }
6614 _res = NULL;
6615 done:
6616 D(p->level--);
6617 return _res;
6618}
6619
6620// star_named_expression: '*' bitwise_or | named_expression
6621static expr_ty
6622star_named_expression_rule(Parser *p)
6623{
6624 D(p->level++);
6625 if (p->error_indicator) {
6626 D(p->level--);
6627 return NULL;
6628 }
6629 expr_ty _res = NULL;
6630 int _mark = p->mark;
6631 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6632 p->error_indicator = 1;
6633 D(p->level--);
6634 return NULL;
6635 }
6636 int _start_lineno = p->tokens[_mark]->lineno;
6637 UNUSED(_start_lineno); // Only used by EXTRA macro
6638 int _start_col_offset = p->tokens[_mark]->col_offset;
6639 UNUSED(_start_col_offset); // Only used by EXTRA macro
6640 { // '*' bitwise_or
6641 if (p->error_indicator) {
6642 D(p->level--);
6643 return NULL;
6644 }
6645 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6646 Token * _literal;
6647 expr_ty a;
6648 if (
6649 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6650 &&
6651 (a = bitwise_or_rule(p)) // bitwise_or
6652 )
6653 {
6654 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6655 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6656 if (_token == NULL) {
6657 D(p->level--);
6658 return NULL;
6659 }
6660 int _end_lineno = _token->end_lineno;
6661 UNUSED(_end_lineno); // Only used by EXTRA macro
6662 int _end_col_offset = _token->end_col_offset;
6663 UNUSED(_end_col_offset); // Only used by EXTRA macro
6664 _res = _Py_Starred ( a , Load , EXTRA );
6665 if (_res == NULL && PyErr_Occurred()) {
6666 p->error_indicator = 1;
6667 D(p->level--);
6668 return NULL;
6669 }
6670 goto done;
6671 }
6672 p->mark = _mark;
6673 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6674 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6675 }
6676 { // named_expression
6677 if (p->error_indicator) {
6678 D(p->level--);
6679 return NULL;
6680 }
6681 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
6682 expr_ty named_expression_var;
6683 if (
6684 (named_expression_var = named_expression_rule(p)) // named_expression
6685 )
6686 {
6687 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
6688 _res = named_expression_var;
6689 goto done;
6690 }
6691 p->mark = _mark;
6692 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6693 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
6694 }
6695 _res = NULL;
6696 done:
6697 D(p->level--);
6698 return _res;
6699}
6700
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006701// named_expression: NAME ':=' ~ expression | expression !':=' | invalid_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006702static expr_ty
6703named_expression_rule(Parser *p)
6704{
6705 D(p->level++);
6706 if (p->error_indicator) {
6707 D(p->level--);
6708 return NULL;
6709 }
6710 expr_ty _res = NULL;
6711 int _mark = p->mark;
6712 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6713 p->error_indicator = 1;
6714 D(p->level--);
6715 return NULL;
6716 }
6717 int _start_lineno = p->tokens[_mark]->lineno;
6718 UNUSED(_start_lineno); // Only used by EXTRA macro
6719 int _start_col_offset = p->tokens[_mark]->col_offset;
6720 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006721 { // NAME ':=' ~ expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006722 if (p->error_indicator) {
6723 D(p->level--);
6724 return NULL;
6725 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006726 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
6727 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006728 Token * _literal;
6729 expr_ty a;
6730 expr_ty b;
6731 if (
6732 (a = _PyPegen_name_token(p)) // NAME
6733 &&
6734 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
6735 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006736 (_cut_var = 1)
6737 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006738 (b = expression_rule(p)) // expression
6739 )
6740 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006741 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006742 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6743 if (_token == NULL) {
6744 D(p->level--);
6745 return NULL;
6746 }
6747 int _end_lineno = _token->end_lineno;
6748 UNUSED(_end_lineno); // Only used by EXTRA macro
6749 int _end_col_offset = _token->end_col_offset;
6750 UNUSED(_end_col_offset); // Only used by EXTRA macro
6751 _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
6752 if (_res == NULL && PyErr_Occurred()) {
6753 p->error_indicator = 1;
6754 D(p->level--);
6755 return NULL;
6756 }
6757 goto done;
6758 }
6759 p->mark = _mark;
6760 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006761 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression"));
6762 if (_cut_var) {
6763 D(p->level--);
6764 return NULL;
6765 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006766 }
6767 { // expression !':='
6768 if (p->error_indicator) {
6769 D(p->level--);
6770 return NULL;
6771 }
6772 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6773 expr_ty expression_var;
6774 if (
6775 (expression_var = expression_rule(p)) // expression
6776 &&
6777 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
6778 )
6779 {
6780 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6781 _res = expression_var;
6782 goto done;
6783 }
6784 p->mark = _mark;
6785 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6786 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
6787 }
6788 { // invalid_named_expression
6789 if (p->error_indicator) {
6790 D(p->level--);
6791 return NULL;
6792 }
6793 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6794 void *invalid_named_expression_var;
6795 if (
6796 (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression
6797 )
6798 {
6799 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6800 _res = invalid_named_expression_var;
6801 goto done;
6802 }
6803 p->mark = _mark;
6804 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6805 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression"));
6806 }
6807 _res = NULL;
6808 done:
6809 D(p->level--);
6810 return _res;
6811}
6812
6813// annotated_rhs: yield_expr | star_expressions
6814static expr_ty
6815annotated_rhs_rule(Parser *p)
6816{
6817 D(p->level++);
6818 if (p->error_indicator) {
6819 D(p->level--);
6820 return NULL;
6821 }
6822 expr_ty _res = NULL;
6823 int _mark = p->mark;
6824 { // yield_expr
6825 if (p->error_indicator) {
6826 D(p->level--);
6827 return NULL;
6828 }
6829 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6830 expr_ty yield_expr_var;
6831 if (
6832 (yield_expr_var = yield_expr_rule(p)) // yield_expr
6833 )
6834 {
6835 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6836 _res = yield_expr_var;
6837 goto done;
6838 }
6839 p->mark = _mark;
6840 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6841 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
6842 }
6843 { // star_expressions
6844 if (p->error_indicator) {
6845 D(p->level--);
6846 return NULL;
6847 }
6848 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6849 expr_ty star_expressions_var;
6850 if (
6851 (star_expressions_var = star_expressions_rule(p)) // star_expressions
6852 )
6853 {
6854 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6855 _res = star_expressions_var;
6856 goto done;
6857 }
6858 p->mark = _mark;
6859 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6860 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
6861 }
6862 _res = NULL;
6863 done:
6864 D(p->level--);
6865 return _res;
6866}
6867
6868// expressions: expression ((',' expression))+ ','? | expression ',' | expression
6869static expr_ty
6870expressions_rule(Parser *p)
6871{
6872 D(p->level++);
6873 if (p->error_indicator) {
6874 D(p->level--);
6875 return NULL;
6876 }
6877 expr_ty _res = NULL;
6878 int _mark = p->mark;
6879 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6880 p->error_indicator = 1;
6881 D(p->level--);
6882 return NULL;
6883 }
6884 int _start_lineno = p->tokens[_mark]->lineno;
6885 UNUSED(_start_lineno); // Only used by EXTRA macro
6886 int _start_col_offset = p->tokens[_mark]->col_offset;
6887 UNUSED(_start_col_offset); // Only used by EXTRA macro
6888 { // expression ((',' expression))+ ','?
6889 if (p->error_indicator) {
6890 D(p->level--);
6891 return NULL;
6892 }
6893 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6894 void *_opt_var;
6895 UNUSED(_opt_var); // Silence compiler warnings
6896 expr_ty a;
6897 asdl_seq * b;
6898 if (
6899 (a = expression_rule(p)) // expression
6900 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006901 (b = _loop1_75_rule(p)) // ((',' expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006902 &&
6903 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6904 )
6905 {
6906 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6907 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6908 if (_token == NULL) {
6909 D(p->level--);
6910 return NULL;
6911 }
6912 int _end_lineno = _token->end_lineno;
6913 UNUSED(_end_lineno); // Only used by EXTRA macro
6914 int _end_col_offset = _token->end_col_offset;
6915 UNUSED(_end_col_offset); // Only used by EXTRA macro
6916 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
6917 if (_res == NULL && PyErr_Occurred()) {
6918 p->error_indicator = 1;
6919 D(p->level--);
6920 return NULL;
6921 }
6922 goto done;
6923 }
6924 p->mark = _mark;
6925 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6926 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
6927 }
6928 { // expression ','
6929 if (p->error_indicator) {
6930 D(p->level--);
6931 return NULL;
6932 }
6933 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
6934 Token * _literal;
6935 expr_ty a;
6936 if (
6937 (a = expression_rule(p)) // expression
6938 &&
6939 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6940 )
6941 {
6942 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
6943 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6944 if (_token == NULL) {
6945 D(p->level--);
6946 return NULL;
6947 }
6948 int _end_lineno = _token->end_lineno;
6949 UNUSED(_end_lineno); // Only used by EXTRA macro
6950 int _end_col_offset = _token->end_col_offset;
6951 UNUSED(_end_col_offset); // Only used by EXTRA macro
6952 _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
6953 if (_res == NULL && PyErr_Occurred()) {
6954 p->error_indicator = 1;
6955 D(p->level--);
6956 return NULL;
6957 }
6958 goto done;
6959 }
6960 p->mark = _mark;
6961 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6962 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
6963 }
6964 { // expression
6965 if (p->error_indicator) {
6966 D(p->level--);
6967 return NULL;
6968 }
6969 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6970 expr_ty expression_var;
6971 if (
6972 (expression_var = expression_rule(p)) // expression
6973 )
6974 {
6975 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6976 _res = expression_var;
6977 goto done;
6978 }
6979 p->mark = _mark;
6980 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6981 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6982 }
6983 _res = NULL;
6984 done:
6985 D(p->level--);
6986 return _res;
6987}
6988
6989// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
6990static expr_ty
6991expression_rule(Parser *p)
6992{
6993 D(p->level++);
6994 if (p->error_indicator) {
6995 D(p->level--);
6996 return NULL;
6997 }
6998 expr_ty _res = NULL;
6999 if (_PyPegen_is_memoized(p, expression_type, &_res)) {
7000 D(p->level--);
7001 return _res;
7002 }
7003 int _mark = p->mark;
7004 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7005 p->error_indicator = 1;
7006 D(p->level--);
7007 return NULL;
7008 }
7009 int _start_lineno = p->tokens[_mark]->lineno;
7010 UNUSED(_start_lineno); // Only used by EXTRA macro
7011 int _start_col_offset = p->tokens[_mark]->col_offset;
7012 UNUSED(_start_col_offset); // Only used by EXTRA macro
7013 { // disjunction 'if' disjunction 'else' expression
7014 if (p->error_indicator) {
7015 D(p->level--);
7016 return NULL;
7017 }
7018 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7019 Token * _keyword;
7020 Token * _keyword_1;
7021 expr_ty a;
7022 expr_ty b;
7023 expr_ty c;
7024 if (
7025 (a = disjunction_rule(p)) // disjunction
7026 &&
7027 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
7028 &&
7029 (b = disjunction_rule(p)) // disjunction
7030 &&
7031 (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else'
7032 &&
7033 (c = expression_rule(p)) // expression
7034 )
7035 {
7036 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7037 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7038 if (_token == NULL) {
7039 D(p->level--);
7040 return NULL;
7041 }
7042 int _end_lineno = _token->end_lineno;
7043 UNUSED(_end_lineno); // Only used by EXTRA macro
7044 int _end_col_offset = _token->end_col_offset;
7045 UNUSED(_end_col_offset); // Only used by EXTRA macro
7046 _res = _Py_IfExp ( b , a , c , EXTRA );
7047 if (_res == NULL && PyErr_Occurred()) {
7048 p->error_indicator = 1;
7049 D(p->level--);
7050 return NULL;
7051 }
7052 goto done;
7053 }
7054 p->mark = _mark;
7055 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7056 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7057 }
7058 { // disjunction
7059 if (p->error_indicator) {
7060 D(p->level--);
7061 return NULL;
7062 }
7063 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
7064 expr_ty disjunction_var;
7065 if (
7066 (disjunction_var = disjunction_rule(p)) // disjunction
7067 )
7068 {
7069 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
7070 _res = disjunction_var;
7071 goto done;
7072 }
7073 p->mark = _mark;
7074 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7075 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
7076 }
7077 { // lambdef
7078 if (p->error_indicator) {
7079 D(p->level--);
7080 return NULL;
7081 }
7082 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
7083 expr_ty lambdef_var;
7084 if (
7085 (lambdef_var = lambdef_rule(p)) // lambdef
7086 )
7087 {
7088 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
7089 _res = lambdef_var;
7090 goto done;
7091 }
7092 p->mark = _mark;
7093 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7094 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
7095 }
7096 _res = NULL;
7097 done:
7098 _PyPegen_insert_memo(p, _mark, expression_type, _res);
7099 D(p->level--);
7100 return _res;
7101}
7102
7103// lambdef: 'lambda' lambda_params? ':' expression
7104static expr_ty
7105lambdef_rule(Parser *p)
7106{
7107 D(p->level++);
7108 if (p->error_indicator) {
7109 D(p->level--);
7110 return NULL;
7111 }
7112 expr_ty _res = NULL;
7113 int _mark = p->mark;
7114 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7115 p->error_indicator = 1;
7116 D(p->level--);
7117 return NULL;
7118 }
7119 int _start_lineno = p->tokens[_mark]->lineno;
7120 UNUSED(_start_lineno); // Only used by EXTRA macro
7121 int _start_col_offset = p->tokens[_mark]->col_offset;
7122 UNUSED(_start_col_offset); // Only used by EXTRA macro
7123 { // 'lambda' lambda_params? ':' expression
7124 if (p->error_indicator) {
7125 D(p->level--);
7126 return NULL;
7127 }
7128 D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7129 Token * _keyword;
7130 Token * _literal;
7131 void *a;
7132 expr_ty b;
7133 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007134 (_keyword = _PyPegen_expect_token(p, 525)) // token='lambda'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007135 &&
7136 (a = lambda_params_rule(p), 1) // lambda_params?
7137 &&
7138 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
7139 &&
7140 (b = expression_rule(p)) // expression
7141 )
7142 {
7143 D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7144 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7145 if (_token == NULL) {
7146 D(p->level--);
7147 return NULL;
7148 }
7149 int _end_lineno = _token->end_lineno;
7150 UNUSED(_end_lineno); // Only used by EXTRA macro
7151 int _end_col_offset = _token->end_col_offset;
7152 UNUSED(_end_col_offset); // Only used by EXTRA macro
7153 _res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
7154 if (_res == NULL && PyErr_Occurred()) {
7155 p->error_indicator = 1;
7156 D(p->level--);
7157 return NULL;
7158 }
7159 goto done;
7160 }
7161 p->mark = _mark;
7162 D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
7163 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7164 }
7165 _res = NULL;
7166 done:
7167 D(p->level--);
7168 return _res;
7169}
7170
7171// lambda_params: invalid_lambda_parameters | lambda_parameters
7172static arguments_ty
7173lambda_params_rule(Parser *p)
7174{
7175 D(p->level++);
7176 if (p->error_indicator) {
7177 D(p->level--);
7178 return NULL;
7179 }
7180 arguments_ty _res = NULL;
7181 int _mark = p->mark;
7182 { // invalid_lambda_parameters
7183 if (p->error_indicator) {
7184 D(p->level--);
7185 return NULL;
7186 }
7187 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7188 void *invalid_lambda_parameters_var;
7189 if (
7190 (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters
7191 )
7192 {
7193 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7194 _res = invalid_lambda_parameters_var;
7195 goto done;
7196 }
7197 p->mark = _mark;
7198 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7199 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
7200 }
7201 { // lambda_parameters
7202 if (p->error_indicator) {
7203 D(p->level--);
7204 return NULL;
7205 }
7206 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7207 arguments_ty lambda_parameters_var;
7208 if (
7209 (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters
7210 )
7211 {
7212 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7213 _res = lambda_parameters_var;
7214 goto done;
7215 }
7216 p->mark = _mark;
7217 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7218 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
7219 }
7220 _res = NULL;
7221 done:
7222 D(p->level--);
7223 return _res;
7224}
7225
7226// lambda_parameters:
7227// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7228// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7229// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7230// | lambda_param_with_default+ lambda_star_etc?
7231// | lambda_star_etc
7232static arguments_ty
7233lambda_parameters_rule(Parser *p)
7234{
7235 D(p->level++);
7236 if (p->error_indicator) {
7237 D(p->level--);
7238 return NULL;
7239 }
7240 arguments_ty _res = NULL;
7241 int _mark = p->mark;
7242 { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7243 if (p->error_indicator) {
7244 D(p->level--);
7245 return NULL;
7246 }
7247 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?"));
7248 asdl_seq* a;
7249 asdl_seq * b;
7250 asdl_seq * c;
7251 void *d;
7252 if (
7253 (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
7254 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007255 (b = _loop0_76_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007256 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007257 (c = _loop0_77_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007258 &&
7259 (d = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7260 )
7261 {
7262 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?"));
7263 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
7264 if (_res == NULL && PyErr_Occurred()) {
7265 p->error_indicator = 1;
7266 D(p->level--);
7267 return NULL;
7268 }
7269 goto done;
7270 }
7271 p->mark = _mark;
7272 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7273 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
7274 }
7275 { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7276 if (p->error_indicator) {
7277 D(p->level--);
7278 return NULL;
7279 }
7280 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?"));
7281 SlashWithDefault* a;
7282 asdl_seq * b;
7283 void *c;
7284 if (
7285 (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
7286 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007287 (b = _loop0_78_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007288 &&
7289 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7290 )
7291 {
7292 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?"));
7293 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
7294 if (_res == NULL && PyErr_Occurred()) {
7295 p->error_indicator = 1;
7296 D(p->level--);
7297 return NULL;
7298 }
7299 goto done;
7300 }
7301 p->mark = _mark;
7302 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7303 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
7304 }
7305 { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7306 if (p->error_indicator) {
7307 D(p->level--);
7308 return NULL;
7309 }
7310 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?"));
7311 asdl_seq * a;
7312 asdl_seq * b;
7313 void *c;
7314 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007315 (a = _loop1_79_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007316 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007317 (b = _loop0_80_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007318 &&
7319 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7320 )
7321 {
7322 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?"));
7323 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
7324 if (_res == NULL && PyErr_Occurred()) {
7325 p->error_indicator = 1;
7326 D(p->level--);
7327 return NULL;
7328 }
7329 goto done;
7330 }
7331 p->mark = _mark;
7332 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7333 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
7334 }
7335 { // lambda_param_with_default+ lambda_star_etc?
7336 if (p->error_indicator) {
7337 D(p->level--);
7338 return NULL;
7339 }
7340 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7341 asdl_seq * a;
7342 void *b;
7343 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007344 (a = _loop1_81_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007345 &&
7346 (b = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7347 )
7348 {
7349 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7350 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
7351 if (_res == NULL && PyErr_Occurred()) {
7352 p->error_indicator = 1;
7353 D(p->level--);
7354 return NULL;
7355 }
7356 goto done;
7357 }
7358 p->mark = _mark;
7359 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7360 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7361 }
7362 { // lambda_star_etc
7363 if (p->error_indicator) {
7364 D(p->level--);
7365 return NULL;
7366 }
7367 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7368 StarEtc* a;
7369 if (
7370 (a = lambda_star_etc_rule(p)) // lambda_star_etc
7371 )
7372 {
7373 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7374 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
7375 if (_res == NULL && PyErr_Occurred()) {
7376 p->error_indicator = 1;
7377 D(p->level--);
7378 return NULL;
7379 }
7380 goto done;
7381 }
7382 p->mark = _mark;
7383 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7384 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
7385 }
7386 _res = NULL;
7387 done:
7388 D(p->level--);
7389 return _res;
7390}
7391
7392// lambda_slash_no_default:
7393// | lambda_param_no_default+ '/' ','
7394// | lambda_param_no_default+ '/' &':'
7395static asdl_seq*
7396lambda_slash_no_default_rule(Parser *p)
7397{
7398 D(p->level++);
7399 if (p->error_indicator) {
7400 D(p->level--);
7401 return NULL;
7402 }
7403 asdl_seq* _res = NULL;
7404 int _mark = p->mark;
7405 { // lambda_param_no_default+ '/' ','
7406 if (p->error_indicator) {
7407 D(p->level--);
7408 return NULL;
7409 }
7410 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7411 Token * _literal;
7412 Token * _literal_1;
7413 asdl_seq * a;
7414 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007415 (a = _loop1_82_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007416 &&
7417 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7418 &&
7419 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7420 )
7421 {
7422 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7423 _res = a;
7424 if (_res == NULL && PyErr_Occurred()) {
7425 p->error_indicator = 1;
7426 D(p->level--);
7427 return NULL;
7428 }
7429 goto done;
7430 }
7431 p->mark = _mark;
7432 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7433 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7434 }
7435 { // lambda_param_no_default+ '/' &':'
7436 if (p->error_indicator) {
7437 D(p->level--);
7438 return NULL;
7439 }
7440 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7441 Token * _literal;
7442 asdl_seq * a;
7443 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007444 (a = _loop1_83_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007445 &&
7446 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7447 &&
7448 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7449 )
7450 {
7451 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7452 _res = a;
7453 if (_res == NULL && PyErr_Occurred()) {
7454 p->error_indicator = 1;
7455 D(p->level--);
7456 return NULL;
7457 }
7458 goto done;
7459 }
7460 p->mark = _mark;
7461 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7462 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7463 }
7464 _res = NULL;
7465 done:
7466 D(p->level--);
7467 return _res;
7468}
7469
7470// lambda_slash_with_default:
7471// | lambda_param_no_default* lambda_param_with_default+ '/' ','
7472// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
7473static SlashWithDefault*
7474lambda_slash_with_default_rule(Parser *p)
7475{
7476 D(p->level++);
7477 if (p->error_indicator) {
7478 D(p->level--);
7479 return NULL;
7480 }
7481 SlashWithDefault* _res = NULL;
7482 int _mark = p->mark;
7483 { // lambda_param_no_default* lambda_param_with_default+ '/' ','
7484 if (p->error_indicator) {
7485 D(p->level--);
7486 return NULL;
7487 }
7488 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+ '/' ','"));
7489 Token * _literal;
7490 Token * _literal_1;
7491 asdl_seq * a;
7492 asdl_seq * b;
7493 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007494 (a = _loop0_84_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007495 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007496 (b = _loop1_85_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007497 &&
7498 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7499 &&
7500 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7501 )
7502 {
7503 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+ '/' ','"));
7504 _res = _PyPegen_slash_with_default ( p , a , b );
7505 if (_res == NULL && PyErr_Occurred()) {
7506 p->error_indicator = 1;
7507 D(p->level--);
7508 return NULL;
7509 }
7510 goto done;
7511 }
7512 p->mark = _mark;
7513 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7514 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
7515 }
7516 { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
7517 if (p->error_indicator) {
7518 D(p->level--);
7519 return NULL;
7520 }
7521 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+ '/' &':'"));
7522 Token * _literal;
7523 asdl_seq * a;
7524 asdl_seq * b;
7525 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007526 (a = _loop0_86_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007527 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007528 (b = _loop1_87_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007529 &&
7530 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7531 &&
7532 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7533 )
7534 {
7535 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+ '/' &':'"));
7536 _res = _PyPegen_slash_with_default ( p , a , b );
7537 if (_res == NULL && PyErr_Occurred()) {
7538 p->error_indicator = 1;
7539 D(p->level--);
7540 return NULL;
7541 }
7542 goto done;
7543 }
7544 p->mark = _mark;
7545 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7546 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
7547 }
7548 _res = NULL;
7549 done:
7550 D(p->level--);
7551 return _res;
7552}
7553
7554// lambda_star_etc:
7555// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7556// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
7557// | lambda_kwds
7558// | invalid_lambda_star_etc
7559static StarEtc*
7560lambda_star_etc_rule(Parser *p)
7561{
7562 D(p->level++);
7563 if (p->error_indicator) {
7564 D(p->level--);
7565 return NULL;
7566 }
7567 StarEtc* _res = NULL;
7568 int _mark = p->mark;
7569 { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7570 if (p->error_indicator) {
7571 D(p->level--);
7572 return NULL;
7573 }
7574 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?"));
7575 Token * _literal;
7576 arg_ty a;
7577 asdl_seq * b;
7578 void *c;
7579 if (
7580 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7581 &&
7582 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7583 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007584 (b = _loop0_88_rule(p)) // lambda_param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007585 &&
7586 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7587 )
7588 {
7589 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?"));
7590 _res = _PyPegen_star_etc ( p , a , b , c );
7591 if (_res == NULL && PyErr_Occurred()) {
7592 p->error_indicator = 1;
7593 D(p->level--);
7594 return NULL;
7595 }
7596 goto done;
7597 }
7598 p->mark = _mark;
7599 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7600 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
7601 }
7602 { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
7603 if (p->error_indicator) {
7604 D(p->level--);
7605 return NULL;
7606 }
7607 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7608 Token * _literal;
7609 Token * _literal_1;
7610 asdl_seq * b;
7611 void *c;
7612 if (
7613 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7614 &&
7615 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7616 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007617 (b = _loop1_89_rule(p)) // lambda_param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007618 &&
7619 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7620 )
7621 {
7622 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7623 _res = _PyPegen_star_etc ( p , NULL , b , c );
7624 if (_res == NULL && PyErr_Occurred()) {
7625 p->error_indicator = 1;
7626 D(p->level--);
7627 return NULL;
7628 }
7629 goto done;
7630 }
7631 p->mark = _mark;
7632 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7633 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7634 }
7635 { // lambda_kwds
7636 if (p->error_indicator) {
7637 D(p->level--);
7638 return NULL;
7639 }
7640 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7641 arg_ty a;
7642 if (
7643 (a = lambda_kwds_rule(p)) // lambda_kwds
7644 )
7645 {
7646 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7647 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
7648 if (_res == NULL && PyErr_Occurred()) {
7649 p->error_indicator = 1;
7650 D(p->level--);
7651 return NULL;
7652 }
7653 goto done;
7654 }
7655 p->mark = _mark;
7656 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7657 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
7658 }
7659 { // invalid_lambda_star_etc
7660 if (p->error_indicator) {
7661 D(p->level--);
7662 return NULL;
7663 }
7664 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7665 void *invalid_lambda_star_etc_var;
7666 if (
7667 (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc
7668 )
7669 {
7670 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7671 _res = invalid_lambda_star_etc_var;
7672 goto done;
7673 }
7674 p->mark = _mark;
7675 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7676 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
7677 }
7678 _res = NULL;
7679 done:
7680 D(p->level--);
7681 return _res;
7682}
7683
7684// lambda_kwds: '**' lambda_param_no_default
7685static arg_ty
7686lambda_kwds_rule(Parser *p)
7687{
7688 D(p->level++);
7689 if (p->error_indicator) {
7690 D(p->level--);
7691 return NULL;
7692 }
7693 arg_ty _res = NULL;
7694 int _mark = p->mark;
7695 { // '**' lambda_param_no_default
7696 if (p->error_indicator) {
7697 D(p->level--);
7698 return NULL;
7699 }
7700 D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7701 Token * _literal;
7702 arg_ty a;
7703 if (
7704 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
7705 &&
7706 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7707 )
7708 {
7709 D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7710 _res = a;
7711 if (_res == NULL && PyErr_Occurred()) {
7712 p->error_indicator = 1;
7713 D(p->level--);
7714 return NULL;
7715 }
7716 goto done;
7717 }
7718 p->mark = _mark;
7719 D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
7720 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
7721 }
7722 _res = NULL;
7723 done:
7724 D(p->level--);
7725 return _res;
7726}
7727
7728// lambda_param_no_default: lambda_param ',' | lambda_param &':'
7729static arg_ty
7730lambda_param_no_default_rule(Parser *p)
7731{
7732 D(p->level++);
7733 if (p->error_indicator) {
7734 D(p->level--);
7735 return NULL;
7736 }
7737 arg_ty _res = NULL;
7738 int _mark = p->mark;
7739 { // lambda_param ','
7740 if (p->error_indicator) {
7741 D(p->level--);
7742 return NULL;
7743 }
7744 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7745 Token * _literal;
7746 arg_ty a;
7747 if (
7748 (a = lambda_param_rule(p)) // lambda_param
7749 &&
7750 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7751 )
7752 {
7753 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7754 _res = a;
7755 if (_res == NULL && PyErr_Occurred()) {
7756 p->error_indicator = 1;
7757 D(p->level--);
7758 return NULL;
7759 }
7760 goto done;
7761 }
7762 p->mark = _mark;
7763 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7764 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
7765 }
7766 { // lambda_param &':'
7767 if (p->error_indicator) {
7768 D(p->level--);
7769 return NULL;
7770 }
7771 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7772 arg_ty a;
7773 if (
7774 (a = lambda_param_rule(p)) // lambda_param
7775 &&
7776 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7777 )
7778 {
7779 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7780 _res = a;
7781 if (_res == NULL && PyErr_Occurred()) {
7782 p->error_indicator = 1;
7783 D(p->level--);
7784 return NULL;
7785 }
7786 goto done;
7787 }
7788 p->mark = _mark;
7789 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7790 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
7791 }
7792 _res = NULL;
7793 done:
7794 D(p->level--);
7795 return _res;
7796}
7797
7798// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
7799static NameDefaultPair*
7800lambda_param_with_default_rule(Parser *p)
7801{
7802 D(p->level++);
7803 if (p->error_indicator) {
7804 D(p->level--);
7805 return NULL;
7806 }
7807 NameDefaultPair* _res = NULL;
7808 int _mark = p->mark;
7809 { // lambda_param default ','
7810 if (p->error_indicator) {
7811 D(p->level--);
7812 return NULL;
7813 }
7814 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7815 Token * _literal;
7816 arg_ty a;
7817 expr_ty c;
7818 if (
7819 (a = lambda_param_rule(p)) // lambda_param
7820 &&
7821 (c = default_rule(p)) // default
7822 &&
7823 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7824 )
7825 {
7826 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7827 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7828 if (_res == NULL && PyErr_Occurred()) {
7829 p->error_indicator = 1;
7830 D(p->level--);
7831 return NULL;
7832 }
7833 goto done;
7834 }
7835 p->mark = _mark;
7836 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7837 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
7838 }
7839 { // lambda_param default &':'
7840 if (p->error_indicator) {
7841 D(p->level--);
7842 return NULL;
7843 }
7844 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7845 arg_ty a;
7846 expr_ty c;
7847 if (
7848 (a = lambda_param_rule(p)) // lambda_param
7849 &&
7850 (c = default_rule(p)) // default
7851 &&
7852 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7853 )
7854 {
7855 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7856 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7857 if (_res == NULL && PyErr_Occurred()) {
7858 p->error_indicator = 1;
7859 D(p->level--);
7860 return NULL;
7861 }
7862 goto done;
7863 }
7864 p->mark = _mark;
7865 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7866 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
7867 }
7868 _res = NULL;
7869 done:
7870 D(p->level--);
7871 return _res;
7872}
7873
7874// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
7875static NameDefaultPair*
7876lambda_param_maybe_default_rule(Parser *p)
7877{
7878 D(p->level++);
7879 if (p->error_indicator) {
7880 D(p->level--);
7881 return NULL;
7882 }
7883 NameDefaultPair* _res = NULL;
7884 int _mark = p->mark;
7885 { // lambda_param default? ','
7886 if (p->error_indicator) {
7887 D(p->level--);
7888 return NULL;
7889 }
7890 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7891 Token * _literal;
7892 arg_ty a;
7893 void *c;
7894 if (
7895 (a = lambda_param_rule(p)) // lambda_param
7896 &&
7897 (c = default_rule(p), 1) // default?
7898 &&
7899 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7900 )
7901 {
7902 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7903 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7904 if (_res == NULL && PyErr_Occurred()) {
7905 p->error_indicator = 1;
7906 D(p->level--);
7907 return NULL;
7908 }
7909 goto done;
7910 }
7911 p->mark = _mark;
7912 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7913 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
7914 }
7915 { // lambda_param default? &':'
7916 if (p->error_indicator) {
7917 D(p->level--);
7918 return NULL;
7919 }
7920 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7921 arg_ty a;
7922 void *c;
7923 if (
7924 (a = lambda_param_rule(p)) // lambda_param
7925 &&
7926 (c = default_rule(p), 1) // default?
7927 &&
7928 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7929 )
7930 {
7931 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7932 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7933 if (_res == NULL && PyErr_Occurred()) {
7934 p->error_indicator = 1;
7935 D(p->level--);
7936 return NULL;
7937 }
7938 goto done;
7939 }
7940 p->mark = _mark;
7941 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7942 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
7943 }
7944 _res = NULL;
7945 done:
7946 D(p->level--);
7947 return _res;
7948}
7949
7950// lambda_param: NAME
7951static arg_ty
7952lambda_param_rule(Parser *p)
7953{
7954 D(p->level++);
7955 if (p->error_indicator) {
7956 D(p->level--);
7957 return NULL;
7958 }
7959 arg_ty _res = NULL;
7960 int _mark = p->mark;
7961 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7962 p->error_indicator = 1;
7963 D(p->level--);
7964 return NULL;
7965 }
7966 int _start_lineno = p->tokens[_mark]->lineno;
7967 UNUSED(_start_lineno); // Only used by EXTRA macro
7968 int _start_col_offset = p->tokens[_mark]->col_offset;
7969 UNUSED(_start_col_offset); // Only used by EXTRA macro
7970 { // NAME
7971 if (p->error_indicator) {
7972 D(p->level--);
7973 return NULL;
7974 }
7975 D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
7976 expr_ty a;
7977 if (
7978 (a = _PyPegen_name_token(p)) // NAME
7979 )
7980 {
7981 D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
7982 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7983 if (_token == NULL) {
7984 D(p->level--);
7985 return NULL;
7986 }
7987 int _end_lineno = _token->end_lineno;
7988 UNUSED(_end_lineno); // Only used by EXTRA macro
7989 int _end_col_offset = _token->end_col_offset;
7990 UNUSED(_end_col_offset); // Only used by EXTRA macro
7991 _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
7992 if (_res == NULL && PyErr_Occurred()) {
7993 p->error_indicator = 1;
7994 D(p->level--);
7995 return NULL;
7996 }
7997 goto done;
7998 }
7999 p->mark = _mark;
8000 D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
8001 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
8002 }
8003 _res = NULL;
8004 done:
8005 D(p->level--);
8006 return _res;
8007}
8008
8009// disjunction: conjunction (('or' conjunction))+ | conjunction
8010static expr_ty
8011disjunction_rule(Parser *p)
8012{
8013 D(p->level++);
8014 if (p->error_indicator) {
8015 D(p->level--);
8016 return NULL;
8017 }
8018 expr_ty _res = NULL;
8019 if (_PyPegen_is_memoized(p, disjunction_type, &_res)) {
8020 D(p->level--);
8021 return _res;
8022 }
8023 int _mark = p->mark;
8024 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8025 p->error_indicator = 1;
8026 D(p->level--);
8027 return NULL;
8028 }
8029 int _start_lineno = p->tokens[_mark]->lineno;
8030 UNUSED(_start_lineno); // Only used by EXTRA macro
8031 int _start_col_offset = p->tokens[_mark]->col_offset;
8032 UNUSED(_start_col_offset); // Only used by EXTRA macro
8033 { // conjunction (('or' conjunction))+
8034 if (p->error_indicator) {
8035 D(p->level--);
8036 return NULL;
8037 }
8038 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8039 expr_ty a;
8040 asdl_seq * b;
8041 if (
8042 (a = conjunction_rule(p)) // conjunction
8043 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008044 (b = _loop1_90_rule(p)) // (('or' conjunction))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008045 )
8046 {
8047 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8048 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8049 if (_token == NULL) {
8050 D(p->level--);
8051 return NULL;
8052 }
8053 int _end_lineno = _token->end_lineno;
8054 UNUSED(_end_lineno); // Only used by EXTRA macro
8055 int _end_col_offset = _token->end_col_offset;
8056 UNUSED(_end_col_offset); // Only used by EXTRA macro
8057 _res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
8058 if (_res == NULL && PyErr_Occurred()) {
8059 p->error_indicator = 1;
8060 D(p->level--);
8061 return NULL;
8062 }
8063 goto done;
8064 }
8065 p->mark = _mark;
8066 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8067 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+"));
8068 }
8069 { // conjunction
8070 if (p->error_indicator) {
8071 D(p->level--);
8072 return NULL;
8073 }
8074 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction"));
8075 expr_ty conjunction_var;
8076 if (
8077 (conjunction_var = conjunction_rule(p)) // conjunction
8078 )
8079 {
8080 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction"));
8081 _res = conjunction_var;
8082 goto done;
8083 }
8084 p->mark = _mark;
8085 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8086 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction"));
8087 }
8088 _res = NULL;
8089 done:
8090 _PyPegen_insert_memo(p, _mark, disjunction_type, _res);
8091 D(p->level--);
8092 return _res;
8093}
8094
8095// conjunction: inversion (('and' inversion))+ | inversion
8096static expr_ty
8097conjunction_rule(Parser *p)
8098{
8099 D(p->level++);
8100 if (p->error_indicator) {
8101 D(p->level--);
8102 return NULL;
8103 }
8104 expr_ty _res = NULL;
8105 if (_PyPegen_is_memoized(p, conjunction_type, &_res)) {
8106 D(p->level--);
8107 return _res;
8108 }
8109 int _mark = p->mark;
8110 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8111 p->error_indicator = 1;
8112 D(p->level--);
8113 return NULL;
8114 }
8115 int _start_lineno = p->tokens[_mark]->lineno;
8116 UNUSED(_start_lineno); // Only used by EXTRA macro
8117 int _start_col_offset = p->tokens[_mark]->col_offset;
8118 UNUSED(_start_col_offset); // Only used by EXTRA macro
8119 { // inversion (('and' inversion))+
8120 if (p->error_indicator) {
8121 D(p->level--);
8122 return NULL;
8123 }
8124 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8125 expr_ty a;
8126 asdl_seq * b;
8127 if (
8128 (a = inversion_rule(p)) // inversion
8129 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008130 (b = _loop1_91_rule(p)) // (('and' inversion))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008131 )
8132 {
8133 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8134 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8135 if (_token == NULL) {
8136 D(p->level--);
8137 return NULL;
8138 }
8139 int _end_lineno = _token->end_lineno;
8140 UNUSED(_end_lineno); // Only used by EXTRA macro
8141 int _end_col_offset = _token->end_col_offset;
8142 UNUSED(_end_col_offset); // Only used by EXTRA macro
8143 _res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
8144 if (_res == NULL && PyErr_Occurred()) {
8145 p->error_indicator = 1;
8146 D(p->level--);
8147 return NULL;
8148 }
8149 goto done;
8150 }
8151 p->mark = _mark;
8152 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8153 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+"));
8154 }
8155 { // inversion
8156 if (p->error_indicator) {
8157 D(p->level--);
8158 return NULL;
8159 }
8160 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion"));
8161 expr_ty inversion_var;
8162 if (
8163 (inversion_var = inversion_rule(p)) // inversion
8164 )
8165 {
8166 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion"));
8167 _res = inversion_var;
8168 goto done;
8169 }
8170 p->mark = _mark;
8171 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8172 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion"));
8173 }
8174 _res = NULL;
8175 done:
8176 _PyPegen_insert_memo(p, _mark, conjunction_type, _res);
8177 D(p->level--);
8178 return _res;
8179}
8180
8181// inversion: 'not' inversion | comparison
8182static expr_ty
8183inversion_rule(Parser *p)
8184{
8185 D(p->level++);
8186 if (p->error_indicator) {
8187 D(p->level--);
8188 return NULL;
8189 }
8190 expr_ty _res = NULL;
8191 if (_PyPegen_is_memoized(p, inversion_type, &_res)) {
8192 D(p->level--);
8193 return _res;
8194 }
8195 int _mark = p->mark;
8196 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8197 p->error_indicator = 1;
8198 D(p->level--);
8199 return NULL;
8200 }
8201 int _start_lineno = p->tokens[_mark]->lineno;
8202 UNUSED(_start_lineno); // Only used by EXTRA macro
8203 int _start_col_offset = p->tokens[_mark]->col_offset;
8204 UNUSED(_start_col_offset); // Only used by EXTRA macro
8205 { // 'not' inversion
8206 if (p->error_indicator) {
8207 D(p->level--);
8208 return NULL;
8209 }
8210 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8211 Token * _keyword;
8212 expr_ty a;
8213 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008214 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008215 &&
8216 (a = inversion_rule(p)) // inversion
8217 )
8218 {
8219 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8220 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8221 if (_token == NULL) {
8222 D(p->level--);
8223 return NULL;
8224 }
8225 int _end_lineno = _token->end_lineno;
8226 UNUSED(_end_lineno); // Only used by EXTRA macro
8227 int _end_col_offset = _token->end_col_offset;
8228 UNUSED(_end_col_offset); // Only used by EXTRA macro
8229 _res = _Py_UnaryOp ( Not , a , EXTRA );
8230 if (_res == NULL && PyErr_Occurred()) {
8231 p->error_indicator = 1;
8232 D(p->level--);
8233 return NULL;
8234 }
8235 goto done;
8236 }
8237 p->mark = _mark;
8238 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8239 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion"));
8240 }
8241 { // comparison
8242 if (p->error_indicator) {
8243 D(p->level--);
8244 return NULL;
8245 }
8246 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison"));
8247 expr_ty comparison_var;
8248 if (
8249 (comparison_var = comparison_rule(p)) // comparison
8250 )
8251 {
8252 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison"));
8253 _res = comparison_var;
8254 goto done;
8255 }
8256 p->mark = _mark;
8257 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8258 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison"));
8259 }
8260 _res = NULL;
8261 done:
8262 _PyPegen_insert_memo(p, _mark, inversion_type, _res);
8263 D(p->level--);
8264 return _res;
8265}
8266
8267// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
8268static expr_ty
8269comparison_rule(Parser *p)
8270{
8271 D(p->level++);
8272 if (p->error_indicator) {
8273 D(p->level--);
8274 return NULL;
8275 }
8276 expr_ty _res = NULL;
8277 int _mark = p->mark;
8278 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8279 p->error_indicator = 1;
8280 D(p->level--);
8281 return NULL;
8282 }
8283 int _start_lineno = p->tokens[_mark]->lineno;
8284 UNUSED(_start_lineno); // Only used by EXTRA macro
8285 int _start_col_offset = p->tokens[_mark]->col_offset;
8286 UNUSED(_start_col_offset); // Only used by EXTRA macro
8287 { // bitwise_or compare_op_bitwise_or_pair+
8288 if (p->error_indicator) {
8289 D(p->level--);
8290 return NULL;
8291 }
8292 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8293 expr_ty a;
8294 asdl_seq * b;
8295 if (
8296 (a = bitwise_or_rule(p)) // bitwise_or
8297 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008298 (b = _loop1_92_rule(p)) // compare_op_bitwise_or_pair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008299 )
8300 {
8301 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8302 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8303 if (_token == NULL) {
8304 D(p->level--);
8305 return NULL;
8306 }
8307 int _end_lineno = _token->end_lineno;
8308 UNUSED(_end_lineno); // Only used by EXTRA macro
8309 int _end_col_offset = _token->end_col_offset;
8310 UNUSED(_end_col_offset); // Only used by EXTRA macro
8311 _res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA );
8312 if (_res == NULL && PyErr_Occurred()) {
8313 p->error_indicator = 1;
8314 D(p->level--);
8315 return NULL;
8316 }
8317 goto done;
8318 }
8319 p->mark = _mark;
8320 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8321 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8322 }
8323 { // bitwise_or
8324 if (p->error_indicator) {
8325 D(p->level--);
8326 return NULL;
8327 }
8328 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8329 expr_ty bitwise_or_var;
8330 if (
8331 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
8332 )
8333 {
8334 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8335 _res = bitwise_or_var;
8336 goto done;
8337 }
8338 p->mark = _mark;
8339 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8340 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or"));
8341 }
8342 _res = NULL;
8343 done:
8344 D(p->level--);
8345 return _res;
8346}
8347
8348// compare_op_bitwise_or_pair:
8349// | eq_bitwise_or
8350// | noteq_bitwise_or
8351// | lte_bitwise_or
8352// | lt_bitwise_or
8353// | gte_bitwise_or
8354// | gt_bitwise_or
8355// | notin_bitwise_or
8356// | in_bitwise_or
8357// | isnot_bitwise_or
8358// | is_bitwise_or
8359static CmpopExprPair*
8360compare_op_bitwise_or_pair_rule(Parser *p)
8361{
8362 D(p->level++);
8363 if (p->error_indicator) {
8364 D(p->level--);
8365 return NULL;
8366 }
8367 CmpopExprPair* _res = NULL;
8368 int _mark = p->mark;
8369 { // eq_bitwise_or
8370 if (p->error_indicator) {
8371 D(p->level--);
8372 return NULL;
8373 }
8374 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8375 CmpopExprPair* eq_bitwise_or_var;
8376 if (
8377 (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or
8378 )
8379 {
8380 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8381 _res = eq_bitwise_or_var;
8382 goto done;
8383 }
8384 p->mark = _mark;
8385 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8386 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or"));
8387 }
8388 { // noteq_bitwise_or
8389 if (p->error_indicator) {
8390 D(p->level--);
8391 return NULL;
8392 }
8393 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8394 CmpopExprPair* noteq_bitwise_or_var;
8395 if (
8396 (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or
8397 )
8398 {
8399 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8400 _res = noteq_bitwise_or_var;
8401 goto done;
8402 }
8403 p->mark = _mark;
8404 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8405 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or"));
8406 }
8407 { // lte_bitwise_or
8408 if (p->error_indicator) {
8409 D(p->level--);
8410 return NULL;
8411 }
8412 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8413 CmpopExprPair* lte_bitwise_or_var;
8414 if (
8415 (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or
8416 )
8417 {
8418 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8419 _res = lte_bitwise_or_var;
8420 goto done;
8421 }
8422 p->mark = _mark;
8423 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8424 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or"));
8425 }
8426 { // lt_bitwise_or
8427 if (p->error_indicator) {
8428 D(p->level--);
8429 return NULL;
8430 }
8431 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8432 CmpopExprPair* lt_bitwise_or_var;
8433 if (
8434 (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or
8435 )
8436 {
8437 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8438 _res = lt_bitwise_or_var;
8439 goto done;
8440 }
8441 p->mark = _mark;
8442 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8443 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or"));
8444 }
8445 { // gte_bitwise_or
8446 if (p->error_indicator) {
8447 D(p->level--);
8448 return NULL;
8449 }
8450 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8451 CmpopExprPair* gte_bitwise_or_var;
8452 if (
8453 (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or
8454 )
8455 {
8456 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8457 _res = gte_bitwise_or_var;
8458 goto done;
8459 }
8460 p->mark = _mark;
8461 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8462 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or"));
8463 }
8464 { // gt_bitwise_or
8465 if (p->error_indicator) {
8466 D(p->level--);
8467 return NULL;
8468 }
8469 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8470 CmpopExprPair* gt_bitwise_or_var;
8471 if (
8472 (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or
8473 )
8474 {
8475 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8476 _res = gt_bitwise_or_var;
8477 goto done;
8478 }
8479 p->mark = _mark;
8480 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8481 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or"));
8482 }
8483 { // notin_bitwise_or
8484 if (p->error_indicator) {
8485 D(p->level--);
8486 return NULL;
8487 }
8488 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8489 CmpopExprPair* notin_bitwise_or_var;
8490 if (
8491 (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or
8492 )
8493 {
8494 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8495 _res = notin_bitwise_or_var;
8496 goto done;
8497 }
8498 p->mark = _mark;
8499 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8500 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or"));
8501 }
8502 { // in_bitwise_or
8503 if (p->error_indicator) {
8504 D(p->level--);
8505 return NULL;
8506 }
8507 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8508 CmpopExprPair* in_bitwise_or_var;
8509 if (
8510 (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or
8511 )
8512 {
8513 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8514 _res = in_bitwise_or_var;
8515 goto done;
8516 }
8517 p->mark = _mark;
8518 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8519 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or"));
8520 }
8521 { // isnot_bitwise_or
8522 if (p->error_indicator) {
8523 D(p->level--);
8524 return NULL;
8525 }
8526 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8527 CmpopExprPair* isnot_bitwise_or_var;
8528 if (
8529 (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or
8530 )
8531 {
8532 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8533 _res = isnot_bitwise_or_var;
8534 goto done;
8535 }
8536 p->mark = _mark;
8537 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8538 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or"));
8539 }
8540 { // is_bitwise_or
8541 if (p->error_indicator) {
8542 D(p->level--);
8543 return NULL;
8544 }
8545 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8546 CmpopExprPair* is_bitwise_or_var;
8547 if (
8548 (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or
8549 )
8550 {
8551 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8552 _res = is_bitwise_or_var;
8553 goto done;
8554 }
8555 p->mark = _mark;
8556 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8557 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or"));
8558 }
8559 _res = NULL;
8560 done:
8561 D(p->level--);
8562 return _res;
8563}
8564
8565// eq_bitwise_or: '==' bitwise_or
8566static CmpopExprPair*
8567eq_bitwise_or_rule(Parser *p)
8568{
8569 D(p->level++);
8570 if (p->error_indicator) {
8571 D(p->level--);
8572 return NULL;
8573 }
8574 CmpopExprPair* _res = NULL;
8575 int _mark = p->mark;
8576 { // '==' bitwise_or
8577 if (p->error_indicator) {
8578 D(p->level--);
8579 return NULL;
8580 }
8581 D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8582 Token * _literal;
8583 expr_ty a;
8584 if (
8585 (_literal = _PyPegen_expect_token(p, 27)) // token='=='
8586 &&
8587 (a = bitwise_or_rule(p)) // bitwise_or
8588 )
8589 {
8590 D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8591 _res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
8592 if (_res == NULL && PyErr_Occurred()) {
8593 p->error_indicator = 1;
8594 D(p->level--);
8595 return NULL;
8596 }
8597 goto done;
8598 }
8599 p->mark = _mark;
8600 D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8601 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or"));
8602 }
8603 _res = NULL;
8604 done:
8605 D(p->level--);
8606 return _res;
8607}
8608
8609// noteq_bitwise_or: ('!=') bitwise_or
8610static CmpopExprPair*
8611noteq_bitwise_or_rule(Parser *p)
8612{
8613 D(p->level++);
8614 if (p->error_indicator) {
8615 D(p->level--);
8616 return NULL;
8617 }
8618 CmpopExprPair* _res = NULL;
8619 int _mark = p->mark;
8620 { // ('!=') bitwise_or
8621 if (p->error_indicator) {
8622 D(p->level--);
8623 return NULL;
8624 }
8625 D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008626 void *_tmp_93_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008627 expr_ty a;
8628 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008629 (_tmp_93_var = _tmp_93_rule(p)) // '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008630 &&
8631 (a = bitwise_or_rule(p)) // bitwise_or
8632 )
8633 {
8634 D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
8635 _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
8636 if (_res == NULL && PyErr_Occurred()) {
8637 p->error_indicator = 1;
8638 D(p->level--);
8639 return NULL;
8640 }
8641 goto done;
8642 }
8643 p->mark = _mark;
8644 D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8645 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or"));
8646 }
8647 _res = NULL;
8648 done:
8649 D(p->level--);
8650 return _res;
8651}
8652
8653// lte_bitwise_or: '<=' bitwise_or
8654static CmpopExprPair*
8655lte_bitwise_or_rule(Parser *p)
8656{
8657 D(p->level++);
8658 if (p->error_indicator) {
8659 D(p->level--);
8660 return NULL;
8661 }
8662 CmpopExprPair* _res = NULL;
8663 int _mark = p->mark;
8664 { // '<=' bitwise_or
8665 if (p->error_indicator) {
8666 D(p->level--);
8667 return NULL;
8668 }
8669 D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8670 Token * _literal;
8671 expr_ty a;
8672 if (
8673 (_literal = _PyPegen_expect_token(p, 29)) // token='<='
8674 &&
8675 (a = bitwise_or_rule(p)) // bitwise_or
8676 )
8677 {
8678 D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8679 _res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
8680 if (_res == NULL && PyErr_Occurred()) {
8681 p->error_indicator = 1;
8682 D(p->level--);
8683 return NULL;
8684 }
8685 goto done;
8686 }
8687 p->mark = _mark;
8688 D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8689 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or"));
8690 }
8691 _res = NULL;
8692 done:
8693 D(p->level--);
8694 return _res;
8695}
8696
8697// lt_bitwise_or: '<' bitwise_or
8698static CmpopExprPair*
8699lt_bitwise_or_rule(Parser *p)
8700{
8701 D(p->level++);
8702 if (p->error_indicator) {
8703 D(p->level--);
8704 return NULL;
8705 }
8706 CmpopExprPair* _res = NULL;
8707 int _mark = p->mark;
8708 { // '<' bitwise_or
8709 if (p->error_indicator) {
8710 D(p->level--);
8711 return NULL;
8712 }
8713 D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8714 Token * _literal;
8715 expr_ty a;
8716 if (
8717 (_literal = _PyPegen_expect_token(p, 20)) // token='<'
8718 &&
8719 (a = bitwise_or_rule(p)) // bitwise_or
8720 )
8721 {
8722 D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8723 _res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
8724 if (_res == NULL && PyErr_Occurred()) {
8725 p->error_indicator = 1;
8726 D(p->level--);
8727 return NULL;
8728 }
8729 goto done;
8730 }
8731 p->mark = _mark;
8732 D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8733 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or"));
8734 }
8735 _res = NULL;
8736 done:
8737 D(p->level--);
8738 return _res;
8739}
8740
8741// gte_bitwise_or: '>=' bitwise_or
8742static CmpopExprPair*
8743gte_bitwise_or_rule(Parser *p)
8744{
8745 D(p->level++);
8746 if (p->error_indicator) {
8747 D(p->level--);
8748 return NULL;
8749 }
8750 CmpopExprPair* _res = NULL;
8751 int _mark = p->mark;
8752 { // '>=' bitwise_or
8753 if (p->error_indicator) {
8754 D(p->level--);
8755 return NULL;
8756 }
8757 D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8758 Token * _literal;
8759 expr_ty a;
8760 if (
8761 (_literal = _PyPegen_expect_token(p, 30)) // token='>='
8762 &&
8763 (a = bitwise_or_rule(p)) // bitwise_or
8764 )
8765 {
8766 D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8767 _res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
8768 if (_res == NULL && PyErr_Occurred()) {
8769 p->error_indicator = 1;
8770 D(p->level--);
8771 return NULL;
8772 }
8773 goto done;
8774 }
8775 p->mark = _mark;
8776 D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8777 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or"));
8778 }
8779 _res = NULL;
8780 done:
8781 D(p->level--);
8782 return _res;
8783}
8784
8785// gt_bitwise_or: '>' bitwise_or
8786static CmpopExprPair*
8787gt_bitwise_or_rule(Parser *p)
8788{
8789 D(p->level++);
8790 if (p->error_indicator) {
8791 D(p->level--);
8792 return NULL;
8793 }
8794 CmpopExprPair* _res = NULL;
8795 int _mark = p->mark;
8796 { // '>' bitwise_or
8797 if (p->error_indicator) {
8798 D(p->level--);
8799 return NULL;
8800 }
8801 D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8802 Token * _literal;
8803 expr_ty a;
8804 if (
8805 (_literal = _PyPegen_expect_token(p, 21)) // token='>'
8806 &&
8807 (a = bitwise_or_rule(p)) // bitwise_or
8808 )
8809 {
8810 D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8811 _res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
8812 if (_res == NULL && PyErr_Occurred()) {
8813 p->error_indicator = 1;
8814 D(p->level--);
8815 return NULL;
8816 }
8817 goto done;
8818 }
8819 p->mark = _mark;
8820 D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8821 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or"));
8822 }
8823 _res = NULL;
8824 done:
8825 D(p->level--);
8826 return _res;
8827}
8828
8829// notin_bitwise_or: 'not' 'in' bitwise_or
8830static CmpopExprPair*
8831notin_bitwise_or_rule(Parser *p)
8832{
8833 D(p->level++);
8834 if (p->error_indicator) {
8835 D(p->level--);
8836 return NULL;
8837 }
8838 CmpopExprPair* _res = NULL;
8839 int _mark = p->mark;
8840 { // 'not' 'in' bitwise_or
8841 if (p->error_indicator) {
8842 D(p->level--);
8843 return NULL;
8844 }
8845 D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8846 Token * _keyword;
8847 Token * _keyword_1;
8848 expr_ty a;
8849 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008850 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008851 &&
8852 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
8853 &&
8854 (a = bitwise_or_rule(p)) // bitwise_or
8855 )
8856 {
8857 D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8858 _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
8859 if (_res == NULL && PyErr_Occurred()) {
8860 p->error_indicator = 1;
8861 D(p->level--);
8862 return NULL;
8863 }
8864 goto done;
8865 }
8866 p->mark = _mark;
8867 D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8868 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or"));
8869 }
8870 _res = NULL;
8871 done:
8872 D(p->level--);
8873 return _res;
8874}
8875
8876// in_bitwise_or: 'in' bitwise_or
8877static CmpopExprPair*
8878in_bitwise_or_rule(Parser *p)
8879{
8880 D(p->level++);
8881 if (p->error_indicator) {
8882 D(p->level--);
8883 return NULL;
8884 }
8885 CmpopExprPair* _res = NULL;
8886 int _mark = p->mark;
8887 { // 'in' bitwise_or
8888 if (p->error_indicator) {
8889 D(p->level--);
8890 return NULL;
8891 }
8892 D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8893 Token * _keyword;
8894 expr_ty a;
8895 if (
8896 (_keyword = _PyPegen_expect_token(p, 518)) // token='in'
8897 &&
8898 (a = bitwise_or_rule(p)) // bitwise_or
8899 )
8900 {
8901 D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8902 _res = _PyPegen_cmpop_expr_pair ( p , In , a );
8903 if (_res == NULL && PyErr_Occurred()) {
8904 p->error_indicator = 1;
8905 D(p->level--);
8906 return NULL;
8907 }
8908 goto done;
8909 }
8910 p->mark = _mark;
8911 D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8912 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or"));
8913 }
8914 _res = NULL;
8915 done:
8916 D(p->level--);
8917 return _res;
8918}
8919
8920// isnot_bitwise_or: 'is' 'not' bitwise_or
8921static CmpopExprPair*
8922isnot_bitwise_or_rule(Parser *p)
8923{
8924 D(p->level++);
8925 if (p->error_indicator) {
8926 D(p->level--);
8927 return NULL;
8928 }
8929 CmpopExprPair* _res = NULL;
8930 int _mark = p->mark;
8931 { // 'is' 'not' bitwise_or
8932 if (p->error_indicator) {
8933 D(p->level--);
8934 return NULL;
8935 }
8936 D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8937 Token * _keyword;
8938 Token * _keyword_1;
8939 expr_ty a;
8940 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008941 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008942 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008943 (_keyword_1 = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008944 &&
8945 (a = bitwise_or_rule(p)) // bitwise_or
8946 )
8947 {
8948 D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8949 _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
8950 if (_res == NULL && PyErr_Occurred()) {
8951 p->error_indicator = 1;
8952 D(p->level--);
8953 return NULL;
8954 }
8955 goto done;
8956 }
8957 p->mark = _mark;
8958 D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8959 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or"));
8960 }
8961 _res = NULL;
8962 done:
8963 D(p->level--);
8964 return _res;
8965}
8966
8967// is_bitwise_or: 'is' bitwise_or
8968static CmpopExprPair*
8969is_bitwise_or_rule(Parser *p)
8970{
8971 D(p->level++);
8972 if (p->error_indicator) {
8973 D(p->level--);
8974 return NULL;
8975 }
8976 CmpopExprPair* _res = NULL;
8977 int _mark = p->mark;
8978 { // 'is' bitwise_or
8979 if (p->error_indicator) {
8980 D(p->level--);
8981 return NULL;
8982 }
8983 D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
8984 Token * _keyword;
8985 expr_ty a;
8986 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008987 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008988 &&
8989 (a = bitwise_or_rule(p)) // bitwise_or
8990 )
8991 {
8992 D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
8993 _res = _PyPegen_cmpop_expr_pair ( p , Is , a );
8994 if (_res == NULL && PyErr_Occurred()) {
8995 p->error_indicator = 1;
8996 D(p->level--);
8997 return NULL;
8998 }
8999 goto done;
9000 }
9001 p->mark = _mark;
9002 D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9003 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or"));
9004 }
9005 _res = NULL;
9006 done:
9007 D(p->level--);
9008 return _res;
9009}
9010
9011// Left-recursive
9012// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
9013static expr_ty bitwise_or_raw(Parser *);
9014static expr_ty
9015bitwise_or_rule(Parser *p)
9016{
9017 D(p->level++);
9018 expr_ty _res = NULL;
9019 if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) {
9020 D(p->level--);
9021 return _res;
9022 }
9023 int _mark = p->mark;
9024 int _resmark = p->mark;
9025 while (1) {
9026 int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res);
9027 if (tmpvar_1) {
9028 D(p->level--);
9029 return _res;
9030 }
9031 p->mark = _mark;
9032 void *_raw = bitwise_or_raw(p);
9033 if (_raw == NULL || p->mark <= _resmark)
9034 break;
9035 _resmark = p->mark;
9036 _res = _raw;
9037 }
9038 p->mark = _resmark;
9039 D(p->level--);
9040 return _res;
9041}
9042static expr_ty
9043bitwise_or_raw(Parser *p)
9044{
9045 D(p->level++);
9046 if (p->error_indicator) {
9047 D(p->level--);
9048 return NULL;
9049 }
9050 expr_ty _res = NULL;
9051 int _mark = p->mark;
9052 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9053 p->error_indicator = 1;
9054 D(p->level--);
9055 return NULL;
9056 }
9057 int _start_lineno = p->tokens[_mark]->lineno;
9058 UNUSED(_start_lineno); // Only used by EXTRA macro
9059 int _start_col_offset = p->tokens[_mark]->col_offset;
9060 UNUSED(_start_col_offset); // Only used by EXTRA macro
9061 { // bitwise_or '|' bitwise_xor
9062 if (p->error_indicator) {
9063 D(p->level--);
9064 return NULL;
9065 }
9066 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9067 Token * _literal;
9068 expr_ty a;
9069 expr_ty b;
9070 if (
9071 (a = bitwise_or_rule(p)) // bitwise_or
9072 &&
9073 (_literal = _PyPegen_expect_token(p, 18)) // token='|'
9074 &&
9075 (b = bitwise_xor_rule(p)) // bitwise_xor
9076 )
9077 {
9078 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9079 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9080 if (_token == NULL) {
9081 D(p->level--);
9082 return NULL;
9083 }
9084 int _end_lineno = _token->end_lineno;
9085 UNUSED(_end_lineno); // Only used by EXTRA macro
9086 int _end_col_offset = _token->end_col_offset;
9087 UNUSED(_end_col_offset); // Only used by EXTRA macro
9088 _res = _Py_BinOp ( a , BitOr , b , EXTRA );
9089 if (_res == NULL && PyErr_Occurred()) {
9090 p->error_indicator = 1;
9091 D(p->level--);
9092 return NULL;
9093 }
9094 goto done;
9095 }
9096 p->mark = _mark;
9097 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9098 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9099 }
9100 { // bitwise_xor
9101 if (p->error_indicator) {
9102 D(p->level--);
9103 return NULL;
9104 }
9105 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9106 expr_ty bitwise_xor_var;
9107 if (
9108 (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor
9109 )
9110 {
9111 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9112 _res = bitwise_xor_var;
9113 goto done;
9114 }
9115 p->mark = _mark;
9116 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9117 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor"));
9118 }
9119 _res = NULL;
9120 done:
9121 D(p->level--);
9122 return _res;
9123}
9124
9125// Left-recursive
9126// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
9127static expr_ty bitwise_xor_raw(Parser *);
9128static expr_ty
9129bitwise_xor_rule(Parser *p)
9130{
9131 D(p->level++);
9132 expr_ty _res = NULL;
9133 if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) {
9134 D(p->level--);
9135 return _res;
9136 }
9137 int _mark = p->mark;
9138 int _resmark = p->mark;
9139 while (1) {
9140 int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res);
9141 if (tmpvar_2) {
9142 D(p->level--);
9143 return _res;
9144 }
9145 p->mark = _mark;
9146 void *_raw = bitwise_xor_raw(p);
9147 if (_raw == NULL || p->mark <= _resmark)
9148 break;
9149 _resmark = p->mark;
9150 _res = _raw;
9151 }
9152 p->mark = _resmark;
9153 D(p->level--);
9154 return _res;
9155}
9156static expr_ty
9157bitwise_xor_raw(Parser *p)
9158{
9159 D(p->level++);
9160 if (p->error_indicator) {
9161 D(p->level--);
9162 return NULL;
9163 }
9164 expr_ty _res = NULL;
9165 int _mark = p->mark;
9166 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9167 p->error_indicator = 1;
9168 D(p->level--);
9169 return NULL;
9170 }
9171 int _start_lineno = p->tokens[_mark]->lineno;
9172 UNUSED(_start_lineno); // Only used by EXTRA macro
9173 int _start_col_offset = p->tokens[_mark]->col_offset;
9174 UNUSED(_start_col_offset); // Only used by EXTRA macro
9175 { // bitwise_xor '^' bitwise_and
9176 if (p->error_indicator) {
9177 D(p->level--);
9178 return NULL;
9179 }
9180 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9181 Token * _literal;
9182 expr_ty a;
9183 expr_ty b;
9184 if (
9185 (a = bitwise_xor_rule(p)) // bitwise_xor
9186 &&
9187 (_literal = _PyPegen_expect_token(p, 32)) // token='^'
9188 &&
9189 (b = bitwise_and_rule(p)) // bitwise_and
9190 )
9191 {
9192 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9193 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9194 if (_token == NULL) {
9195 D(p->level--);
9196 return NULL;
9197 }
9198 int _end_lineno = _token->end_lineno;
9199 UNUSED(_end_lineno); // Only used by EXTRA macro
9200 int _end_col_offset = _token->end_col_offset;
9201 UNUSED(_end_col_offset); // Only used by EXTRA macro
9202 _res = _Py_BinOp ( a , BitXor , b , EXTRA );
9203 if (_res == NULL && PyErr_Occurred()) {
9204 p->error_indicator = 1;
9205 D(p->level--);
9206 return NULL;
9207 }
9208 goto done;
9209 }
9210 p->mark = _mark;
9211 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9212 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9213 }
9214 { // bitwise_and
9215 if (p->error_indicator) {
9216 D(p->level--);
9217 return NULL;
9218 }
9219 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9220 expr_ty bitwise_and_var;
9221 if (
9222 (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and
9223 )
9224 {
9225 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9226 _res = bitwise_and_var;
9227 goto done;
9228 }
9229 p->mark = _mark;
9230 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9231 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and"));
9232 }
9233 _res = NULL;
9234 done:
9235 D(p->level--);
9236 return _res;
9237}
9238
9239// Left-recursive
9240// bitwise_and: bitwise_and '&' shift_expr | shift_expr
9241static expr_ty bitwise_and_raw(Parser *);
9242static expr_ty
9243bitwise_and_rule(Parser *p)
9244{
9245 D(p->level++);
9246 expr_ty _res = NULL;
9247 if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) {
9248 D(p->level--);
9249 return _res;
9250 }
9251 int _mark = p->mark;
9252 int _resmark = p->mark;
9253 while (1) {
9254 int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res);
9255 if (tmpvar_3) {
9256 D(p->level--);
9257 return _res;
9258 }
9259 p->mark = _mark;
9260 void *_raw = bitwise_and_raw(p);
9261 if (_raw == NULL || p->mark <= _resmark)
9262 break;
9263 _resmark = p->mark;
9264 _res = _raw;
9265 }
9266 p->mark = _resmark;
9267 D(p->level--);
9268 return _res;
9269}
9270static expr_ty
9271bitwise_and_raw(Parser *p)
9272{
9273 D(p->level++);
9274 if (p->error_indicator) {
9275 D(p->level--);
9276 return NULL;
9277 }
9278 expr_ty _res = NULL;
9279 int _mark = p->mark;
9280 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9281 p->error_indicator = 1;
9282 D(p->level--);
9283 return NULL;
9284 }
9285 int _start_lineno = p->tokens[_mark]->lineno;
9286 UNUSED(_start_lineno); // Only used by EXTRA macro
9287 int _start_col_offset = p->tokens[_mark]->col_offset;
9288 UNUSED(_start_col_offset); // Only used by EXTRA macro
9289 { // bitwise_and '&' shift_expr
9290 if (p->error_indicator) {
9291 D(p->level--);
9292 return NULL;
9293 }
9294 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9295 Token * _literal;
9296 expr_ty a;
9297 expr_ty b;
9298 if (
9299 (a = bitwise_and_rule(p)) // bitwise_and
9300 &&
9301 (_literal = _PyPegen_expect_token(p, 19)) // token='&'
9302 &&
9303 (b = shift_expr_rule(p)) // shift_expr
9304 )
9305 {
9306 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9307 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9308 if (_token == NULL) {
9309 D(p->level--);
9310 return NULL;
9311 }
9312 int _end_lineno = _token->end_lineno;
9313 UNUSED(_end_lineno); // Only used by EXTRA macro
9314 int _end_col_offset = _token->end_col_offset;
9315 UNUSED(_end_col_offset); // Only used by EXTRA macro
9316 _res = _Py_BinOp ( a , BitAnd , b , EXTRA );
9317 if (_res == NULL && PyErr_Occurred()) {
9318 p->error_indicator = 1;
9319 D(p->level--);
9320 return NULL;
9321 }
9322 goto done;
9323 }
9324 p->mark = _mark;
9325 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9326 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr"));
9327 }
9328 { // shift_expr
9329 if (p->error_indicator) {
9330 D(p->level--);
9331 return NULL;
9332 }
9333 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9334 expr_ty shift_expr_var;
9335 if (
9336 (shift_expr_var = shift_expr_rule(p)) // shift_expr
9337 )
9338 {
9339 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9340 _res = shift_expr_var;
9341 goto done;
9342 }
9343 p->mark = _mark;
9344 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9345 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr"));
9346 }
9347 _res = NULL;
9348 done:
9349 D(p->level--);
9350 return _res;
9351}
9352
9353// Left-recursive
9354// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
9355static expr_ty shift_expr_raw(Parser *);
9356static expr_ty
9357shift_expr_rule(Parser *p)
9358{
9359 D(p->level++);
9360 expr_ty _res = NULL;
9361 if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) {
9362 D(p->level--);
9363 return _res;
9364 }
9365 int _mark = p->mark;
9366 int _resmark = p->mark;
9367 while (1) {
9368 int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res);
9369 if (tmpvar_4) {
9370 D(p->level--);
9371 return _res;
9372 }
9373 p->mark = _mark;
9374 void *_raw = shift_expr_raw(p);
9375 if (_raw == NULL || p->mark <= _resmark)
9376 break;
9377 _resmark = p->mark;
9378 _res = _raw;
9379 }
9380 p->mark = _resmark;
9381 D(p->level--);
9382 return _res;
9383}
9384static expr_ty
9385shift_expr_raw(Parser *p)
9386{
9387 D(p->level++);
9388 if (p->error_indicator) {
9389 D(p->level--);
9390 return NULL;
9391 }
9392 expr_ty _res = NULL;
9393 int _mark = p->mark;
9394 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9395 p->error_indicator = 1;
9396 D(p->level--);
9397 return NULL;
9398 }
9399 int _start_lineno = p->tokens[_mark]->lineno;
9400 UNUSED(_start_lineno); // Only used by EXTRA macro
9401 int _start_col_offset = p->tokens[_mark]->col_offset;
9402 UNUSED(_start_col_offset); // Only used by EXTRA macro
9403 { // shift_expr '<<' sum
9404 if (p->error_indicator) {
9405 D(p->level--);
9406 return NULL;
9407 }
9408 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9409 Token * _literal;
9410 expr_ty a;
9411 expr_ty b;
9412 if (
9413 (a = shift_expr_rule(p)) // shift_expr
9414 &&
9415 (_literal = _PyPegen_expect_token(p, 33)) // token='<<'
9416 &&
9417 (b = sum_rule(p)) // sum
9418 )
9419 {
9420 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9421 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9422 if (_token == NULL) {
9423 D(p->level--);
9424 return NULL;
9425 }
9426 int _end_lineno = _token->end_lineno;
9427 UNUSED(_end_lineno); // Only used by EXTRA macro
9428 int _end_col_offset = _token->end_col_offset;
9429 UNUSED(_end_col_offset); // Only used by EXTRA macro
9430 _res = _Py_BinOp ( a , LShift , b , EXTRA );
9431 if (_res == NULL && PyErr_Occurred()) {
9432 p->error_indicator = 1;
9433 D(p->level--);
9434 return NULL;
9435 }
9436 goto done;
9437 }
9438 p->mark = _mark;
9439 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9440 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum"));
9441 }
9442 { // shift_expr '>>' sum
9443 if (p->error_indicator) {
9444 D(p->level--);
9445 return NULL;
9446 }
9447 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9448 Token * _literal;
9449 expr_ty a;
9450 expr_ty b;
9451 if (
9452 (a = shift_expr_rule(p)) // shift_expr
9453 &&
9454 (_literal = _PyPegen_expect_token(p, 34)) // token='>>'
9455 &&
9456 (b = sum_rule(p)) // sum
9457 )
9458 {
9459 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9460 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9461 if (_token == NULL) {
9462 D(p->level--);
9463 return NULL;
9464 }
9465 int _end_lineno = _token->end_lineno;
9466 UNUSED(_end_lineno); // Only used by EXTRA macro
9467 int _end_col_offset = _token->end_col_offset;
9468 UNUSED(_end_col_offset); // Only used by EXTRA macro
9469 _res = _Py_BinOp ( a , RShift , b , EXTRA );
9470 if (_res == NULL && PyErr_Occurred()) {
9471 p->error_indicator = 1;
9472 D(p->level--);
9473 return NULL;
9474 }
9475 goto done;
9476 }
9477 p->mark = _mark;
9478 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9479 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum"));
9480 }
9481 { // sum
9482 if (p->error_indicator) {
9483 D(p->level--);
9484 return NULL;
9485 }
9486 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum"));
9487 expr_ty sum_var;
9488 if (
9489 (sum_var = sum_rule(p)) // sum
9490 )
9491 {
9492 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum"));
9493 _res = sum_var;
9494 goto done;
9495 }
9496 p->mark = _mark;
9497 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9498 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum"));
9499 }
9500 _res = NULL;
9501 done:
9502 D(p->level--);
9503 return _res;
9504}
9505
9506// Left-recursive
9507// sum: sum '+' term | sum '-' term | term
9508static expr_ty sum_raw(Parser *);
9509static expr_ty
9510sum_rule(Parser *p)
9511{
9512 D(p->level++);
9513 expr_ty _res = NULL;
9514 if (_PyPegen_is_memoized(p, sum_type, &_res)) {
9515 D(p->level--);
9516 return _res;
9517 }
9518 int _mark = p->mark;
9519 int _resmark = p->mark;
9520 while (1) {
9521 int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res);
9522 if (tmpvar_5) {
9523 D(p->level--);
9524 return _res;
9525 }
9526 p->mark = _mark;
9527 void *_raw = sum_raw(p);
9528 if (_raw == NULL || p->mark <= _resmark)
9529 break;
9530 _resmark = p->mark;
9531 _res = _raw;
9532 }
9533 p->mark = _resmark;
9534 D(p->level--);
9535 return _res;
9536}
9537static expr_ty
9538sum_raw(Parser *p)
9539{
9540 D(p->level++);
9541 if (p->error_indicator) {
9542 D(p->level--);
9543 return NULL;
9544 }
9545 expr_ty _res = NULL;
9546 int _mark = p->mark;
9547 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9548 p->error_indicator = 1;
9549 D(p->level--);
9550 return NULL;
9551 }
9552 int _start_lineno = p->tokens[_mark]->lineno;
9553 UNUSED(_start_lineno); // Only used by EXTRA macro
9554 int _start_col_offset = p->tokens[_mark]->col_offset;
9555 UNUSED(_start_col_offset); // Only used by EXTRA macro
9556 { // sum '+' term
9557 if (p->error_indicator) {
9558 D(p->level--);
9559 return NULL;
9560 }
9561 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9562 Token * _literal;
9563 expr_ty a;
9564 expr_ty b;
9565 if (
9566 (a = sum_rule(p)) // sum
9567 &&
9568 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9569 &&
9570 (b = term_rule(p)) // term
9571 )
9572 {
9573 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9574 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9575 if (_token == NULL) {
9576 D(p->level--);
9577 return NULL;
9578 }
9579 int _end_lineno = _token->end_lineno;
9580 UNUSED(_end_lineno); // Only used by EXTRA macro
9581 int _end_col_offset = _token->end_col_offset;
9582 UNUSED(_end_col_offset); // Only used by EXTRA macro
9583 _res = _Py_BinOp ( a , Add , b , EXTRA );
9584 if (_res == NULL && PyErr_Occurred()) {
9585 p->error_indicator = 1;
9586 D(p->level--);
9587 return NULL;
9588 }
9589 goto done;
9590 }
9591 p->mark = _mark;
9592 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9593 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term"));
9594 }
9595 { // sum '-' term
9596 if (p->error_indicator) {
9597 D(p->level--);
9598 return NULL;
9599 }
9600 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9601 Token * _literal;
9602 expr_ty a;
9603 expr_ty b;
9604 if (
9605 (a = sum_rule(p)) // sum
9606 &&
9607 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
9608 &&
9609 (b = term_rule(p)) // term
9610 )
9611 {
9612 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9613 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9614 if (_token == NULL) {
9615 D(p->level--);
9616 return NULL;
9617 }
9618 int _end_lineno = _token->end_lineno;
9619 UNUSED(_end_lineno); // Only used by EXTRA macro
9620 int _end_col_offset = _token->end_col_offset;
9621 UNUSED(_end_col_offset); // Only used by EXTRA macro
9622 _res = _Py_BinOp ( a , Sub , b , EXTRA );
9623 if (_res == NULL && PyErr_Occurred()) {
9624 p->error_indicator = 1;
9625 D(p->level--);
9626 return NULL;
9627 }
9628 goto done;
9629 }
9630 p->mark = _mark;
9631 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9632 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term"));
9633 }
9634 { // term
9635 if (p->error_indicator) {
9636 D(p->level--);
9637 return NULL;
9638 }
9639 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term"));
9640 expr_ty term_var;
9641 if (
9642 (term_var = term_rule(p)) // term
9643 )
9644 {
9645 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term"));
9646 _res = term_var;
9647 goto done;
9648 }
9649 p->mark = _mark;
9650 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9651 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term"));
9652 }
9653 _res = NULL;
9654 done:
9655 D(p->level--);
9656 return _res;
9657}
9658
9659// Left-recursive
9660// term:
9661// | term '*' factor
9662// | term '/' factor
9663// | term '//' factor
9664// | term '%' factor
9665// | term '@' factor
9666// | factor
9667static expr_ty term_raw(Parser *);
9668static expr_ty
9669term_rule(Parser *p)
9670{
9671 D(p->level++);
9672 expr_ty _res = NULL;
9673 if (_PyPegen_is_memoized(p, term_type, &_res)) {
9674 D(p->level--);
9675 return _res;
9676 }
9677 int _mark = p->mark;
9678 int _resmark = p->mark;
9679 while (1) {
9680 int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res);
9681 if (tmpvar_6) {
9682 D(p->level--);
9683 return _res;
9684 }
9685 p->mark = _mark;
9686 void *_raw = term_raw(p);
9687 if (_raw == NULL || p->mark <= _resmark)
9688 break;
9689 _resmark = p->mark;
9690 _res = _raw;
9691 }
9692 p->mark = _resmark;
9693 D(p->level--);
9694 return _res;
9695}
9696static expr_ty
9697term_raw(Parser *p)
9698{
9699 D(p->level++);
9700 if (p->error_indicator) {
9701 D(p->level--);
9702 return NULL;
9703 }
9704 expr_ty _res = NULL;
9705 int _mark = p->mark;
9706 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9707 p->error_indicator = 1;
9708 D(p->level--);
9709 return NULL;
9710 }
9711 int _start_lineno = p->tokens[_mark]->lineno;
9712 UNUSED(_start_lineno); // Only used by EXTRA macro
9713 int _start_col_offset = p->tokens[_mark]->col_offset;
9714 UNUSED(_start_col_offset); // Only used by EXTRA macro
9715 { // term '*' factor
9716 if (p->error_indicator) {
9717 D(p->level--);
9718 return NULL;
9719 }
9720 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9721 Token * _literal;
9722 expr_ty a;
9723 expr_ty b;
9724 if (
9725 (a = term_rule(p)) // term
9726 &&
9727 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
9728 &&
9729 (b = factor_rule(p)) // factor
9730 )
9731 {
9732 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9733 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9734 if (_token == NULL) {
9735 D(p->level--);
9736 return NULL;
9737 }
9738 int _end_lineno = _token->end_lineno;
9739 UNUSED(_end_lineno); // Only used by EXTRA macro
9740 int _end_col_offset = _token->end_col_offset;
9741 UNUSED(_end_col_offset); // Only used by EXTRA macro
9742 _res = _Py_BinOp ( a , Mult , b , EXTRA );
9743 if (_res == NULL && PyErr_Occurred()) {
9744 p->error_indicator = 1;
9745 D(p->level--);
9746 return NULL;
9747 }
9748 goto done;
9749 }
9750 p->mark = _mark;
9751 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9752 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor"));
9753 }
9754 { // term '/' factor
9755 if (p->error_indicator) {
9756 D(p->level--);
9757 return NULL;
9758 }
9759 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9760 Token * _literal;
9761 expr_ty a;
9762 expr_ty b;
9763 if (
9764 (a = term_rule(p)) // term
9765 &&
9766 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
9767 &&
9768 (b = factor_rule(p)) // factor
9769 )
9770 {
9771 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9772 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9773 if (_token == NULL) {
9774 D(p->level--);
9775 return NULL;
9776 }
9777 int _end_lineno = _token->end_lineno;
9778 UNUSED(_end_lineno); // Only used by EXTRA macro
9779 int _end_col_offset = _token->end_col_offset;
9780 UNUSED(_end_col_offset); // Only used by EXTRA macro
9781 _res = _Py_BinOp ( a , Div , b , EXTRA );
9782 if (_res == NULL && PyErr_Occurred()) {
9783 p->error_indicator = 1;
9784 D(p->level--);
9785 return NULL;
9786 }
9787 goto done;
9788 }
9789 p->mark = _mark;
9790 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9791 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor"));
9792 }
9793 { // term '//' factor
9794 if (p->error_indicator) {
9795 D(p->level--);
9796 return NULL;
9797 }
9798 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9799 Token * _literal;
9800 expr_ty a;
9801 expr_ty b;
9802 if (
9803 (a = term_rule(p)) // term
9804 &&
9805 (_literal = _PyPegen_expect_token(p, 47)) // token='//'
9806 &&
9807 (b = factor_rule(p)) // factor
9808 )
9809 {
9810 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9811 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9812 if (_token == NULL) {
9813 D(p->level--);
9814 return NULL;
9815 }
9816 int _end_lineno = _token->end_lineno;
9817 UNUSED(_end_lineno); // Only used by EXTRA macro
9818 int _end_col_offset = _token->end_col_offset;
9819 UNUSED(_end_col_offset); // Only used by EXTRA macro
9820 _res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
9821 if (_res == NULL && PyErr_Occurred()) {
9822 p->error_indicator = 1;
9823 D(p->level--);
9824 return NULL;
9825 }
9826 goto done;
9827 }
9828 p->mark = _mark;
9829 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9830 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor"));
9831 }
9832 { // term '%' factor
9833 if (p->error_indicator) {
9834 D(p->level--);
9835 return NULL;
9836 }
9837 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9838 Token * _literal;
9839 expr_ty a;
9840 expr_ty b;
9841 if (
9842 (a = term_rule(p)) // term
9843 &&
9844 (_literal = _PyPegen_expect_token(p, 24)) // token='%'
9845 &&
9846 (b = factor_rule(p)) // factor
9847 )
9848 {
9849 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9850 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9851 if (_token == NULL) {
9852 D(p->level--);
9853 return NULL;
9854 }
9855 int _end_lineno = _token->end_lineno;
9856 UNUSED(_end_lineno); // Only used by EXTRA macro
9857 int _end_col_offset = _token->end_col_offset;
9858 UNUSED(_end_col_offset); // Only used by EXTRA macro
9859 _res = _Py_BinOp ( a , Mod , b , EXTRA );
9860 if (_res == NULL && PyErr_Occurred()) {
9861 p->error_indicator = 1;
9862 D(p->level--);
9863 return NULL;
9864 }
9865 goto done;
9866 }
9867 p->mark = _mark;
9868 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9869 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor"));
9870 }
9871 { // term '@' factor
9872 if (p->error_indicator) {
9873 D(p->level--);
9874 return NULL;
9875 }
9876 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9877 Token * _literal;
9878 expr_ty a;
9879 expr_ty b;
9880 if (
9881 (a = term_rule(p)) // term
9882 &&
9883 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
9884 &&
9885 (b = factor_rule(p)) // factor
9886 )
9887 {
9888 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9889 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9890 if (_token == NULL) {
9891 D(p->level--);
9892 return NULL;
9893 }
9894 int _end_lineno = _token->end_lineno;
9895 UNUSED(_end_lineno); // Only used by EXTRA macro
9896 int _end_col_offset = _token->end_col_offset;
9897 UNUSED(_end_col_offset); // Only used by EXTRA macro
9898 _res = CHECK_VERSION ( 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) );
9899 if (_res == NULL && PyErr_Occurred()) {
9900 p->error_indicator = 1;
9901 D(p->level--);
9902 return NULL;
9903 }
9904 goto done;
9905 }
9906 p->mark = _mark;
9907 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9908 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor"));
9909 }
9910 { // factor
9911 if (p->error_indicator) {
9912 D(p->level--);
9913 return NULL;
9914 }
9915 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor"));
9916 expr_ty factor_var;
9917 if (
9918 (factor_var = factor_rule(p)) // factor
9919 )
9920 {
9921 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor"));
9922 _res = factor_var;
9923 goto done;
9924 }
9925 p->mark = _mark;
9926 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9927 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor"));
9928 }
9929 _res = NULL;
9930 done:
9931 D(p->level--);
9932 return _res;
9933}
9934
9935// factor: '+' factor | '-' factor | '~' factor | power
9936static expr_ty
9937factor_rule(Parser *p)
9938{
9939 D(p->level++);
9940 if (p->error_indicator) {
9941 D(p->level--);
9942 return NULL;
9943 }
9944 expr_ty _res = NULL;
9945 if (_PyPegen_is_memoized(p, factor_type, &_res)) {
9946 D(p->level--);
9947 return _res;
9948 }
9949 int _mark = p->mark;
9950 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9951 p->error_indicator = 1;
9952 D(p->level--);
9953 return NULL;
9954 }
9955 int _start_lineno = p->tokens[_mark]->lineno;
9956 UNUSED(_start_lineno); // Only used by EXTRA macro
9957 int _start_col_offset = p->tokens[_mark]->col_offset;
9958 UNUSED(_start_col_offset); // Only used by EXTRA macro
9959 { // '+' factor
9960 if (p->error_indicator) {
9961 D(p->level--);
9962 return NULL;
9963 }
9964 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9965 Token * _literal;
9966 expr_ty a;
9967 if (
9968 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9969 &&
9970 (a = factor_rule(p)) // factor
9971 )
9972 {
9973 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9974 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9975 if (_token == NULL) {
9976 D(p->level--);
9977 return NULL;
9978 }
9979 int _end_lineno = _token->end_lineno;
9980 UNUSED(_end_lineno); // Only used by EXTRA macro
9981 int _end_col_offset = _token->end_col_offset;
9982 UNUSED(_end_col_offset); // Only used by EXTRA macro
9983 _res = _Py_UnaryOp ( UAdd , a , EXTRA );
9984 if (_res == NULL && PyErr_Occurred()) {
9985 p->error_indicator = 1;
9986 D(p->level--);
9987 return NULL;
9988 }
9989 goto done;
9990 }
9991 p->mark = _mark;
9992 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
9993 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor"));
9994 }
9995 { // '-' factor
9996 if (p->error_indicator) {
9997 D(p->level--);
9998 return NULL;
9999 }
10000 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10001 Token * _literal;
10002 expr_ty a;
10003 if (
10004 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
10005 &&
10006 (a = factor_rule(p)) // factor
10007 )
10008 {
10009 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10010 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10011 if (_token == NULL) {
10012 D(p->level--);
10013 return NULL;
10014 }
10015 int _end_lineno = _token->end_lineno;
10016 UNUSED(_end_lineno); // Only used by EXTRA macro
10017 int _end_col_offset = _token->end_col_offset;
10018 UNUSED(_end_col_offset); // Only used by EXTRA macro
10019 _res = _Py_UnaryOp ( USub , a , EXTRA );
10020 if (_res == NULL && PyErr_Occurred()) {
10021 p->error_indicator = 1;
10022 D(p->level--);
10023 return NULL;
10024 }
10025 goto done;
10026 }
10027 p->mark = _mark;
10028 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10029 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor"));
10030 }
10031 { // '~' factor
10032 if (p->error_indicator) {
10033 D(p->level--);
10034 return NULL;
10035 }
10036 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10037 Token * _literal;
10038 expr_ty a;
10039 if (
10040 (_literal = _PyPegen_expect_token(p, 31)) // token='~'
10041 &&
10042 (a = factor_rule(p)) // factor
10043 )
10044 {
10045 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10046 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10047 if (_token == NULL) {
10048 D(p->level--);
10049 return NULL;
10050 }
10051 int _end_lineno = _token->end_lineno;
10052 UNUSED(_end_lineno); // Only used by EXTRA macro
10053 int _end_col_offset = _token->end_col_offset;
10054 UNUSED(_end_col_offset); // Only used by EXTRA macro
10055 _res = _Py_UnaryOp ( Invert , a , EXTRA );
10056 if (_res == NULL && PyErr_Occurred()) {
10057 p->error_indicator = 1;
10058 D(p->level--);
10059 return NULL;
10060 }
10061 goto done;
10062 }
10063 p->mark = _mark;
10064 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10065 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor"));
10066 }
10067 { // power
10068 if (p->error_indicator) {
10069 D(p->level--);
10070 return NULL;
10071 }
10072 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power"));
10073 expr_ty power_var;
10074 if (
10075 (power_var = power_rule(p)) // power
10076 )
10077 {
10078 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power"));
10079 _res = power_var;
10080 goto done;
10081 }
10082 p->mark = _mark;
10083 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10084 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power"));
10085 }
10086 _res = NULL;
10087 done:
10088 _PyPegen_insert_memo(p, _mark, factor_type, _res);
10089 D(p->level--);
10090 return _res;
10091}
10092
10093// power: await_primary '**' factor | await_primary
10094static expr_ty
10095power_rule(Parser *p)
10096{
10097 D(p->level++);
10098 if (p->error_indicator) {
10099 D(p->level--);
10100 return NULL;
10101 }
10102 expr_ty _res = NULL;
10103 int _mark = p->mark;
10104 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10105 p->error_indicator = 1;
10106 D(p->level--);
10107 return NULL;
10108 }
10109 int _start_lineno = p->tokens[_mark]->lineno;
10110 UNUSED(_start_lineno); // Only used by EXTRA macro
10111 int _start_col_offset = p->tokens[_mark]->col_offset;
10112 UNUSED(_start_col_offset); // Only used by EXTRA macro
10113 { // await_primary '**' factor
10114 if (p->error_indicator) {
10115 D(p->level--);
10116 return NULL;
10117 }
10118 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10119 Token * _literal;
10120 expr_ty a;
10121 expr_ty b;
10122 if (
10123 (a = await_primary_rule(p)) // await_primary
10124 &&
10125 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
10126 &&
10127 (b = factor_rule(p)) // factor
10128 )
10129 {
10130 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10131 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10132 if (_token == NULL) {
10133 D(p->level--);
10134 return NULL;
10135 }
10136 int _end_lineno = _token->end_lineno;
10137 UNUSED(_end_lineno); // Only used by EXTRA macro
10138 int _end_col_offset = _token->end_col_offset;
10139 UNUSED(_end_col_offset); // Only used by EXTRA macro
10140 _res = _Py_BinOp ( a , Pow , b , EXTRA );
10141 if (_res == NULL && PyErr_Occurred()) {
10142 p->error_indicator = 1;
10143 D(p->level--);
10144 return NULL;
10145 }
10146 goto done;
10147 }
10148 p->mark = _mark;
10149 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10150 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor"));
10151 }
10152 { // await_primary
10153 if (p->error_indicator) {
10154 D(p->level--);
10155 return NULL;
10156 }
10157 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary"));
10158 expr_ty await_primary_var;
10159 if (
10160 (await_primary_var = await_primary_rule(p)) // await_primary
10161 )
10162 {
10163 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary"));
10164 _res = await_primary_var;
10165 goto done;
10166 }
10167 p->mark = _mark;
10168 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10169 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary"));
10170 }
10171 _res = NULL;
10172 done:
10173 D(p->level--);
10174 return _res;
10175}
10176
10177// await_primary: AWAIT primary | primary
10178static expr_ty
10179await_primary_rule(Parser *p)
10180{
10181 D(p->level++);
10182 if (p->error_indicator) {
10183 D(p->level--);
10184 return NULL;
10185 }
10186 expr_ty _res = NULL;
10187 if (_PyPegen_is_memoized(p, await_primary_type, &_res)) {
10188 D(p->level--);
10189 return _res;
10190 }
10191 int _mark = p->mark;
10192 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10193 p->error_indicator = 1;
10194 D(p->level--);
10195 return NULL;
10196 }
10197 int _start_lineno = p->tokens[_mark]->lineno;
10198 UNUSED(_start_lineno); // Only used by EXTRA macro
10199 int _start_col_offset = p->tokens[_mark]->col_offset;
10200 UNUSED(_start_col_offset); // Only used by EXTRA macro
10201 { // AWAIT primary
10202 if (p->error_indicator) {
10203 D(p->level--);
10204 return NULL;
10205 }
10206 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10207 expr_ty a;
10208 Token * await_var;
10209 if (
10210 (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT'
10211 &&
10212 (a = primary_rule(p)) // primary
10213 )
10214 {
10215 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10216 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10217 if (_token == NULL) {
10218 D(p->level--);
10219 return NULL;
10220 }
10221 int _end_lineno = _token->end_lineno;
10222 UNUSED(_end_lineno); // Only used by EXTRA macro
10223 int _end_col_offset = _token->end_col_offset;
10224 UNUSED(_end_col_offset); // Only used by EXTRA macro
10225 _res = CHECK_VERSION ( 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) );
10226 if (_res == NULL && PyErr_Occurred()) {
10227 p->error_indicator = 1;
10228 D(p->level--);
10229 return NULL;
10230 }
10231 goto done;
10232 }
10233 p->mark = _mark;
10234 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10235 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary"));
10236 }
10237 { // primary
10238 if (p->error_indicator) {
10239 D(p->level--);
10240 return NULL;
10241 }
10242 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary"));
10243 expr_ty primary_var;
10244 if (
10245 (primary_var = primary_rule(p)) // primary
10246 )
10247 {
10248 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary"));
10249 _res = primary_var;
10250 goto done;
10251 }
10252 p->mark = _mark;
10253 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10254 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary"));
10255 }
10256 _res = NULL;
10257 done:
10258 _PyPegen_insert_memo(p, _mark, await_primary_type, _res);
10259 D(p->level--);
10260 return _res;
10261}
10262
10263// Left-recursive
10264// primary:
10265// | primary '.' NAME
10266// | primary genexp
10267// | primary '(' arguments? ')'
10268// | primary '[' slices ']'
10269// | atom
10270static expr_ty primary_raw(Parser *);
10271static expr_ty
10272primary_rule(Parser *p)
10273{
10274 D(p->level++);
10275 expr_ty _res = NULL;
10276 if (_PyPegen_is_memoized(p, primary_type, &_res)) {
10277 D(p->level--);
10278 return _res;
10279 }
10280 int _mark = p->mark;
10281 int _resmark = p->mark;
10282 while (1) {
10283 int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res);
10284 if (tmpvar_7) {
10285 D(p->level--);
10286 return _res;
10287 }
10288 p->mark = _mark;
10289 void *_raw = primary_raw(p);
10290 if (_raw == NULL || p->mark <= _resmark)
10291 break;
10292 _resmark = p->mark;
10293 _res = _raw;
10294 }
10295 p->mark = _resmark;
10296 D(p->level--);
10297 return _res;
10298}
10299static expr_ty
10300primary_raw(Parser *p)
10301{
10302 D(p->level++);
10303 if (p->error_indicator) {
10304 D(p->level--);
10305 return NULL;
10306 }
10307 expr_ty _res = NULL;
10308 int _mark = p->mark;
10309 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10310 p->error_indicator = 1;
10311 D(p->level--);
10312 return NULL;
10313 }
10314 int _start_lineno = p->tokens[_mark]->lineno;
10315 UNUSED(_start_lineno); // Only used by EXTRA macro
10316 int _start_col_offset = p->tokens[_mark]->col_offset;
10317 UNUSED(_start_col_offset); // Only used by EXTRA macro
10318 { // primary '.' NAME
10319 if (p->error_indicator) {
10320 D(p->level--);
10321 return NULL;
10322 }
10323 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10324 Token * _literal;
10325 expr_ty a;
10326 expr_ty b;
10327 if (
10328 (a = primary_rule(p)) // primary
10329 &&
10330 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
10331 &&
10332 (b = _PyPegen_name_token(p)) // NAME
10333 )
10334 {
10335 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10336 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10337 if (_token == NULL) {
10338 D(p->level--);
10339 return NULL;
10340 }
10341 int _end_lineno = _token->end_lineno;
10342 UNUSED(_end_lineno); // Only used by EXTRA macro
10343 int _end_col_offset = _token->end_col_offset;
10344 UNUSED(_end_col_offset); // Only used by EXTRA macro
10345 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
10346 if (_res == NULL && PyErr_Occurred()) {
10347 p->error_indicator = 1;
10348 D(p->level--);
10349 return NULL;
10350 }
10351 goto done;
10352 }
10353 p->mark = _mark;
10354 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10355 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME"));
10356 }
10357 { // primary genexp
10358 if (p->error_indicator) {
10359 D(p->level--);
10360 return NULL;
10361 }
10362 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10363 expr_ty a;
10364 expr_ty b;
10365 if (
10366 (a = primary_rule(p)) // primary
10367 &&
10368 (b = genexp_rule(p)) // genexp
10369 )
10370 {
10371 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10372 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10373 if (_token == NULL) {
10374 D(p->level--);
10375 return NULL;
10376 }
10377 int _end_lineno = _token->end_lineno;
10378 UNUSED(_end_lineno); // Only used by EXTRA macro
10379 int _end_col_offset = _token->end_col_offset;
10380 UNUSED(_end_col_offset); // Only used by EXTRA macro
10381 _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
10382 if (_res == NULL && PyErr_Occurred()) {
10383 p->error_indicator = 1;
10384 D(p->level--);
10385 return NULL;
10386 }
10387 goto done;
10388 }
10389 p->mark = _mark;
10390 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10391 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp"));
10392 }
10393 { // primary '(' arguments? ')'
10394 if (p->error_indicator) {
10395 D(p->level--);
10396 return NULL;
10397 }
10398 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10399 Token * _literal;
10400 Token * _literal_1;
10401 expr_ty a;
10402 void *b;
10403 if (
10404 (a = primary_rule(p)) // primary
10405 &&
10406 (_literal = _PyPegen_expect_token(p, 7)) // token='('
10407 &&
10408 (b = arguments_rule(p), 1) // arguments?
10409 &&
10410 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
10411 )
10412 {
10413 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10414 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10415 if (_token == NULL) {
10416 D(p->level--);
10417 return NULL;
10418 }
10419 int _end_lineno = _token->end_lineno;
10420 UNUSED(_end_lineno); // Only used by EXTRA macro
10421 int _end_col_offset = _token->end_col_offset;
10422 UNUSED(_end_col_offset); // Only used by EXTRA macro
10423 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
10424 if (_res == NULL && PyErr_Occurred()) {
10425 p->error_indicator = 1;
10426 D(p->level--);
10427 return NULL;
10428 }
10429 goto done;
10430 }
10431 p->mark = _mark;
10432 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10433 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'"));
10434 }
10435 { // primary '[' slices ']'
10436 if (p->error_indicator) {
10437 D(p->level--);
10438 return NULL;
10439 }
10440 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10441 Token * _literal;
10442 Token * _literal_1;
10443 expr_ty a;
10444 expr_ty b;
10445 if (
10446 (a = primary_rule(p)) // primary
10447 &&
10448 (_literal = _PyPegen_expect_token(p, 9)) // token='['
10449 &&
10450 (b = slices_rule(p)) // slices
10451 &&
10452 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
10453 )
10454 {
10455 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10456 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10457 if (_token == NULL) {
10458 D(p->level--);
10459 return NULL;
10460 }
10461 int _end_lineno = _token->end_lineno;
10462 UNUSED(_end_lineno); // Only used by EXTRA macro
10463 int _end_col_offset = _token->end_col_offset;
10464 UNUSED(_end_col_offset); // Only used by EXTRA macro
10465 _res = _Py_Subscript ( a , b , Load , EXTRA );
10466 if (_res == NULL && PyErr_Occurred()) {
10467 p->error_indicator = 1;
10468 D(p->level--);
10469 return NULL;
10470 }
10471 goto done;
10472 }
10473 p->mark = _mark;
10474 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'"));
10476 }
10477 { // atom
10478 if (p->error_indicator) {
10479 D(p->level--);
10480 return NULL;
10481 }
10482 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom"));
10483 expr_ty atom_var;
10484 if (
10485 (atom_var = atom_rule(p)) // atom
10486 )
10487 {
10488 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom"));
10489 _res = atom_var;
10490 goto done;
10491 }
10492 p->mark = _mark;
10493 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10494 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom"));
10495 }
10496 _res = NULL;
10497 done:
10498 D(p->level--);
10499 return _res;
10500}
10501
10502// slices: slice !',' | ','.slice+ ','?
10503static expr_ty
10504slices_rule(Parser *p)
10505{
10506 D(p->level++);
10507 if (p->error_indicator) {
10508 D(p->level--);
10509 return NULL;
10510 }
10511 expr_ty _res = NULL;
10512 int _mark = p->mark;
10513 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10514 p->error_indicator = 1;
10515 D(p->level--);
10516 return NULL;
10517 }
10518 int _start_lineno = p->tokens[_mark]->lineno;
10519 UNUSED(_start_lineno); // Only used by EXTRA macro
10520 int _start_col_offset = p->tokens[_mark]->col_offset;
10521 UNUSED(_start_col_offset); // Only used by EXTRA macro
10522 { // slice !','
10523 if (p->error_indicator) {
10524 D(p->level--);
10525 return NULL;
10526 }
10527 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','"));
10528 expr_ty a;
10529 if (
10530 (a = slice_rule(p)) // slice
10531 &&
10532 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
10533 )
10534 {
10535 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
10536 _res = a;
10537 if (_res == NULL && PyErr_Occurred()) {
10538 p->error_indicator = 1;
10539 D(p->level--);
10540 return NULL;
10541 }
10542 goto done;
10543 }
10544 p->mark = _mark;
10545 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10546 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','"));
10547 }
10548 { // ','.slice+ ','?
10549 if (p->error_indicator) {
10550 D(p->level--);
10551 return NULL;
10552 }
10553 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10554 void *_opt_var;
10555 UNUSED(_opt_var); // Silence compiler warnings
10556 asdl_seq * a;
10557 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010558 (a = _gather_94_rule(p)) // ','.slice+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010559 &&
10560 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
10561 )
10562 {
10563 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10564 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10565 if (_token == NULL) {
10566 D(p->level--);
10567 return NULL;
10568 }
10569 int _end_lineno = _token->end_lineno;
10570 UNUSED(_end_lineno); // Only used by EXTRA macro
10571 int _end_col_offset = _token->end_col_offset;
10572 UNUSED(_end_col_offset); // Only used by EXTRA macro
10573 _res = _Py_Tuple ( a , Load , EXTRA );
10574 if (_res == NULL && PyErr_Occurred()) {
10575 p->error_indicator = 1;
10576 D(p->level--);
10577 return NULL;
10578 }
10579 goto done;
10580 }
10581 p->mark = _mark;
10582 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10583 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?"));
10584 }
10585 _res = NULL;
10586 done:
10587 D(p->level--);
10588 return _res;
10589}
10590
10591// slice: expression? ':' expression? [':' expression?] | expression
10592static expr_ty
10593slice_rule(Parser *p)
10594{
10595 D(p->level++);
10596 if (p->error_indicator) {
10597 D(p->level--);
10598 return NULL;
10599 }
10600 expr_ty _res = NULL;
10601 int _mark = p->mark;
10602 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10603 p->error_indicator = 1;
10604 D(p->level--);
10605 return NULL;
10606 }
10607 int _start_lineno = p->tokens[_mark]->lineno;
10608 UNUSED(_start_lineno); // Only used by EXTRA macro
10609 int _start_col_offset = p->tokens[_mark]->col_offset;
10610 UNUSED(_start_col_offset); // Only used by EXTRA macro
10611 { // expression? ':' expression? [':' expression?]
10612 if (p->error_indicator) {
10613 D(p->level--);
10614 return NULL;
10615 }
10616 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10617 Token * _literal;
10618 void *a;
10619 void *b;
10620 void *c;
10621 if (
10622 (a = expression_rule(p), 1) // expression?
10623 &&
10624 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
10625 &&
10626 (b = expression_rule(p), 1) // expression?
10627 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010628 (c = _tmp_96_rule(p), 1) // [':' expression?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010629 )
10630 {
10631 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10632 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10633 if (_token == NULL) {
10634 D(p->level--);
10635 return NULL;
10636 }
10637 int _end_lineno = _token->end_lineno;
10638 UNUSED(_end_lineno); // Only used by EXTRA macro
10639 int _end_col_offset = _token->end_col_offset;
10640 UNUSED(_end_col_offset); // Only used by EXTRA macro
10641 _res = _Py_Slice ( a , b , c , EXTRA );
10642 if (_res == NULL && PyErr_Occurred()) {
10643 p->error_indicator = 1;
10644 D(p->level--);
10645 return NULL;
10646 }
10647 goto done;
10648 }
10649 p->mark = _mark;
10650 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10651 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10652 }
10653 { // expression
10654 if (p->error_indicator) {
10655 D(p->level--);
10656 return NULL;
10657 }
10658 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
10659 expr_ty a;
10660 if (
10661 (a = expression_rule(p)) // expression
10662 )
10663 {
10664 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
10665 _res = a;
10666 if (_res == NULL && PyErr_Occurred()) {
10667 p->error_indicator = 1;
10668 D(p->level--);
10669 return NULL;
10670 }
10671 goto done;
10672 }
10673 p->mark = _mark;
10674 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10675 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
10676 }
10677 _res = NULL;
10678 done:
10679 D(p->level--);
10680 return _res;
10681}
10682
10683// atom:
10684// | NAME
10685// | 'True'
10686// | 'False'
10687// | 'None'
10688// | &STRING strings
10689// | NUMBER
10690// | &'(' (tuple | group | genexp)
10691// | &'[' (list | listcomp)
10692// | &'{' (dict | set | dictcomp | setcomp)
10693// | '...'
10694static expr_ty
10695atom_rule(Parser *p)
10696{
10697 D(p->level++);
10698 if (p->error_indicator) {
10699 D(p->level--);
10700 return NULL;
10701 }
10702 expr_ty _res = NULL;
10703 int _mark = p->mark;
10704 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10705 p->error_indicator = 1;
10706 D(p->level--);
10707 return NULL;
10708 }
10709 int _start_lineno = p->tokens[_mark]->lineno;
10710 UNUSED(_start_lineno); // Only used by EXTRA macro
10711 int _start_col_offset = p->tokens[_mark]->col_offset;
10712 UNUSED(_start_col_offset); // Only used by EXTRA macro
10713 { // NAME
10714 if (p->error_indicator) {
10715 D(p->level--);
10716 return NULL;
10717 }
10718 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
10719 expr_ty name_var;
10720 if (
10721 (name_var = _PyPegen_name_token(p)) // NAME
10722 )
10723 {
10724 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
10725 _res = name_var;
10726 goto done;
10727 }
10728 p->mark = _mark;
10729 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10730 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
10731 }
10732 { // 'True'
10733 if (p->error_indicator) {
10734 D(p->level--);
10735 return NULL;
10736 }
10737 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
10738 Token * _keyword;
10739 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010740 (_keyword = _PyPegen_expect_token(p, 528)) // token='True'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010741 )
10742 {
10743 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
10744 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10745 if (_token == NULL) {
10746 D(p->level--);
10747 return NULL;
10748 }
10749 int _end_lineno = _token->end_lineno;
10750 UNUSED(_end_lineno); // Only used by EXTRA macro
10751 int _end_col_offset = _token->end_col_offset;
10752 UNUSED(_end_col_offset); // Only used by EXTRA macro
10753 _res = _Py_Constant ( Py_True , NULL , EXTRA );
10754 if (_res == NULL && PyErr_Occurred()) {
10755 p->error_indicator = 1;
10756 D(p->level--);
10757 return NULL;
10758 }
10759 goto done;
10760 }
10761 p->mark = _mark;
10762 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10763 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
10764 }
10765 { // 'False'
10766 if (p->error_indicator) {
10767 D(p->level--);
10768 return NULL;
10769 }
10770 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
10771 Token * _keyword;
10772 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010773 (_keyword = _PyPegen_expect_token(p, 529)) // token='False'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010774 )
10775 {
10776 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
10777 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10778 if (_token == NULL) {
10779 D(p->level--);
10780 return NULL;
10781 }
10782 int _end_lineno = _token->end_lineno;
10783 UNUSED(_end_lineno); // Only used by EXTRA macro
10784 int _end_col_offset = _token->end_col_offset;
10785 UNUSED(_end_col_offset); // Only used by EXTRA macro
10786 _res = _Py_Constant ( Py_False , NULL , EXTRA );
10787 if (_res == NULL && PyErr_Occurred()) {
10788 p->error_indicator = 1;
10789 D(p->level--);
10790 return NULL;
10791 }
10792 goto done;
10793 }
10794 p->mark = _mark;
10795 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10796 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
10797 }
10798 { // 'None'
10799 if (p->error_indicator) {
10800 D(p->level--);
10801 return NULL;
10802 }
10803 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
10804 Token * _keyword;
10805 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010806 (_keyword = _PyPegen_expect_token(p, 530)) // token='None'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010807 )
10808 {
10809 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
10810 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10811 if (_token == NULL) {
10812 D(p->level--);
10813 return NULL;
10814 }
10815 int _end_lineno = _token->end_lineno;
10816 UNUSED(_end_lineno); // Only used by EXTRA macro
10817 int _end_col_offset = _token->end_col_offset;
10818 UNUSED(_end_col_offset); // Only used by EXTRA macro
10819 _res = _Py_Constant ( Py_None , NULL , EXTRA );
10820 if (_res == NULL && PyErr_Occurred()) {
10821 p->error_indicator = 1;
10822 D(p->level--);
10823 return NULL;
10824 }
10825 goto done;
10826 }
10827 p->mark = _mark;
10828 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10829 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
10830 }
10831 { // &STRING strings
10832 if (p->error_indicator) {
10833 D(p->level--);
10834 return NULL;
10835 }
10836 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10837 expr_ty strings_var;
10838 if (
10839 _PyPegen_lookahead(1, _PyPegen_string_token, p)
10840 &&
10841 (strings_var = strings_rule(p)) // strings
10842 )
10843 {
10844 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10845 _res = strings_var;
10846 goto done;
10847 }
10848 p->mark = _mark;
10849 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10850 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings"));
10851 }
10852 { // NUMBER
10853 if (p->error_indicator) {
10854 D(p->level--);
10855 return NULL;
10856 }
10857 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10858 expr_ty number_var;
10859 if (
10860 (number_var = _PyPegen_number_token(p)) // NUMBER
10861 )
10862 {
10863 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10864 _res = number_var;
10865 goto done;
10866 }
10867 p->mark = _mark;
10868 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10869 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
10870 }
10871 { // &'(' (tuple | group | genexp)
10872 if (p->error_indicator) {
10873 D(p->level--);
10874 return NULL;
10875 }
10876 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010877 void *_tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010878 if (
10879 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='('
10880 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010881 (_tmp_97_var = _tmp_97_rule(p)) // tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010882 )
10883 {
10884 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010885 _res = _tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010886 goto done;
10887 }
10888 p->mark = _mark;
10889 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10890 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)"));
10891 }
10892 { // &'[' (list | listcomp)
10893 if (p->error_indicator) {
10894 D(p->level--);
10895 return NULL;
10896 }
10897 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010898 void *_tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010899 if (
10900 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='['
10901 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010902 (_tmp_98_var = _tmp_98_rule(p)) // list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010903 )
10904 {
10905 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010906 _res = _tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010907 goto done;
10908 }
10909 p->mark = _mark;
10910 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10911 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)"));
10912 }
10913 { // &'{' (dict | set | dictcomp | setcomp)
10914 if (p->error_indicator) {
10915 D(p->level--);
10916 return NULL;
10917 }
10918 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010919 void *_tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010920 if (
10921 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{'
10922 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010923 (_tmp_99_var = _tmp_99_rule(p)) // dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010924 )
10925 {
10926 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010927 _res = _tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010928 goto done;
10929 }
10930 p->mark = _mark;
10931 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10932 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
10933 }
10934 { // '...'
10935 if (p->error_indicator) {
10936 D(p->level--);
10937 return NULL;
10938 }
10939 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
10940 Token * _literal;
10941 if (
10942 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
10943 )
10944 {
10945 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
10946 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10947 if (_token == NULL) {
10948 D(p->level--);
10949 return NULL;
10950 }
10951 int _end_lineno = _token->end_lineno;
10952 UNUSED(_end_lineno); // Only used by EXTRA macro
10953 int _end_col_offset = _token->end_col_offset;
10954 UNUSED(_end_col_offset); // Only used by EXTRA macro
10955 _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
10956 if (_res == NULL && PyErr_Occurred()) {
10957 p->error_indicator = 1;
10958 D(p->level--);
10959 return NULL;
10960 }
10961 goto done;
10962 }
10963 p->mark = _mark;
10964 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10965 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
10966 }
10967 _res = NULL;
10968 done:
10969 D(p->level--);
10970 return _res;
10971}
10972
10973// strings: STRING+
10974static expr_ty
10975strings_rule(Parser *p)
10976{
10977 D(p->level++);
10978 if (p->error_indicator) {
10979 D(p->level--);
10980 return NULL;
10981 }
10982 expr_ty _res = NULL;
10983 if (_PyPegen_is_memoized(p, strings_type, &_res)) {
10984 D(p->level--);
10985 return _res;
10986 }
10987 int _mark = p->mark;
10988 { // STRING+
10989 if (p->error_indicator) {
10990 D(p->level--);
10991 return NULL;
10992 }
10993 D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+"));
10994 asdl_seq * a;
10995 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010996 (a = _loop1_100_rule(p)) // STRING+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010997 )
10998 {
10999 D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+"));
11000 _res = _PyPegen_concatenate_strings ( p , a );
11001 if (_res == NULL && PyErr_Occurred()) {
11002 p->error_indicator = 1;
11003 D(p->level--);
11004 return NULL;
11005 }
11006 goto done;
11007 }
11008 p->mark = _mark;
11009 D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
11010 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+"));
11011 }
11012 _res = NULL;
11013 done:
11014 _PyPegen_insert_memo(p, _mark, strings_type, _res);
11015 D(p->level--);
11016 return _res;
11017}
11018
11019// list: '[' star_named_expressions? ']'
11020static expr_ty
11021list_rule(Parser *p)
11022{
11023 D(p->level++);
11024 if (p->error_indicator) {
11025 D(p->level--);
11026 return NULL;
11027 }
11028 expr_ty _res = NULL;
11029 int _mark = p->mark;
11030 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11031 p->error_indicator = 1;
11032 D(p->level--);
11033 return NULL;
11034 }
11035 int _start_lineno = p->tokens[_mark]->lineno;
11036 UNUSED(_start_lineno); // Only used by EXTRA macro
11037 int _start_col_offset = p->tokens[_mark]->col_offset;
11038 UNUSED(_start_col_offset); // Only used by EXTRA macro
11039 { // '[' star_named_expressions? ']'
11040 if (p->error_indicator) {
11041 D(p->level--);
11042 return NULL;
11043 }
11044 D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11045 Token * _literal;
11046 Token * _literal_1;
11047 void *a;
11048 if (
11049 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11050 &&
11051 (a = star_named_expressions_rule(p), 1) // star_named_expressions?
11052 &&
11053 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11054 )
11055 {
11056 D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11057 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11058 if (_token == NULL) {
11059 D(p->level--);
11060 return NULL;
11061 }
11062 int _end_lineno = _token->end_lineno;
11063 UNUSED(_end_lineno); // Only used by EXTRA macro
11064 int _end_col_offset = _token->end_col_offset;
11065 UNUSED(_end_col_offset); // Only used by EXTRA macro
11066 _res = _Py_List ( a , Load , EXTRA );
11067 if (_res == NULL && PyErr_Occurred()) {
11068 p->error_indicator = 1;
11069 D(p->level--);
11070 return NULL;
11071 }
11072 goto done;
11073 }
11074 p->mark = _mark;
11075 D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
11076 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
11077 }
11078 _res = NULL;
11079 done:
11080 D(p->level--);
11081 return _res;
11082}
11083
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011084// listcomp: '[' named_expression ~ for_if_clauses ']' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011085static expr_ty
11086listcomp_rule(Parser *p)
11087{
11088 D(p->level++);
11089 if (p->error_indicator) {
11090 D(p->level--);
11091 return NULL;
11092 }
11093 expr_ty _res = NULL;
11094 int _mark = p->mark;
11095 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11096 p->error_indicator = 1;
11097 D(p->level--);
11098 return NULL;
11099 }
11100 int _start_lineno = p->tokens[_mark]->lineno;
11101 UNUSED(_start_lineno); // Only used by EXTRA macro
11102 int _start_col_offset = p->tokens[_mark]->col_offset;
11103 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011104 { // '[' named_expression ~ for_if_clauses ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011105 if (p->error_indicator) {
11106 D(p->level--);
11107 return NULL;
11108 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011109 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11110 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011111 Token * _literal;
11112 Token * _literal_1;
11113 expr_ty a;
11114 asdl_seq* b;
11115 if (
11116 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11117 &&
11118 (a = named_expression_rule(p)) // named_expression
11119 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011120 (_cut_var = 1)
11121 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011122 (b = for_if_clauses_rule(p)) // for_if_clauses
11123 &&
11124 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11125 )
11126 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011127 D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011128 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11129 if (_token == NULL) {
11130 D(p->level--);
11131 return NULL;
11132 }
11133 int _end_lineno = _token->end_lineno;
11134 UNUSED(_end_lineno); // Only used by EXTRA macro
11135 int _end_col_offset = _token->end_col_offset;
11136 UNUSED(_end_col_offset); // Only used by EXTRA macro
11137 _res = _Py_ListComp ( a , b , EXTRA );
11138 if (_res == NULL && PyErr_Occurred()) {
11139 p->error_indicator = 1;
11140 D(p->level--);
11141 return NULL;
11142 }
11143 goto done;
11144 }
11145 p->mark = _mark;
11146 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011147 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11148 if (_cut_var) {
11149 D(p->level--);
11150 return NULL;
11151 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011152 }
11153 { // invalid_comprehension
11154 if (p->error_indicator) {
11155 D(p->level--);
11156 return NULL;
11157 }
11158 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11159 void *invalid_comprehension_var;
11160 if (
11161 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11162 )
11163 {
11164 D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11165 _res = invalid_comprehension_var;
11166 goto done;
11167 }
11168 p->mark = _mark;
11169 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
11170 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11171 }
11172 _res = NULL;
11173 done:
11174 D(p->level--);
11175 return _res;
11176}
11177
11178// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
11179static expr_ty
11180tuple_rule(Parser *p)
11181{
11182 D(p->level++);
11183 if (p->error_indicator) {
11184 D(p->level--);
11185 return NULL;
11186 }
11187 expr_ty _res = NULL;
11188 int _mark = p->mark;
11189 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11190 p->error_indicator = 1;
11191 D(p->level--);
11192 return NULL;
11193 }
11194 int _start_lineno = p->tokens[_mark]->lineno;
11195 UNUSED(_start_lineno); // Only used by EXTRA macro
11196 int _start_col_offset = p->tokens[_mark]->col_offset;
11197 UNUSED(_start_col_offset); // Only used by EXTRA macro
11198 { // '(' [star_named_expression ',' star_named_expressions?] ')'
11199 if (p->error_indicator) {
11200 D(p->level--);
11201 return NULL;
11202 }
11203 D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11204 Token * _literal;
11205 Token * _literal_1;
11206 void *a;
11207 if (
11208 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11209 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011210 (a = _tmp_101_rule(p), 1) // [star_named_expression ',' star_named_expressions?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011211 &&
11212 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11213 )
11214 {
11215 D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11216 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11217 if (_token == NULL) {
11218 D(p->level--);
11219 return NULL;
11220 }
11221 int _end_lineno = _token->end_lineno;
11222 UNUSED(_end_lineno); // Only used by EXTRA macro
11223 int _end_col_offset = _token->end_col_offset;
11224 UNUSED(_end_col_offset); // Only used by EXTRA macro
11225 _res = _Py_Tuple ( a , Load , EXTRA );
11226 if (_res == NULL && PyErr_Occurred()) {
11227 p->error_indicator = 1;
11228 D(p->level--);
11229 return NULL;
11230 }
11231 goto done;
11232 }
11233 p->mark = _mark;
11234 D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
11235 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11236 }
11237 _res = NULL;
11238 done:
11239 D(p->level--);
11240 return _res;
11241}
11242
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011243// group: '(' (yield_expr | named_expression) ')' | invalid_group
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011244static expr_ty
11245group_rule(Parser *p)
11246{
11247 D(p->level++);
11248 if (p->error_indicator) {
11249 D(p->level--);
11250 return NULL;
11251 }
11252 expr_ty _res = NULL;
11253 int _mark = p->mark;
11254 { // '(' (yield_expr | named_expression) ')'
11255 if (p->error_indicator) {
11256 D(p->level--);
11257 return NULL;
11258 }
11259 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11260 Token * _literal;
11261 Token * _literal_1;
11262 void *a;
11263 if (
11264 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11265 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011266 (a = _tmp_102_rule(p)) // yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011267 &&
11268 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11269 )
11270 {
11271 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11272 _res = a;
11273 if (_res == NULL && PyErr_Occurred()) {
11274 p->error_indicator = 1;
11275 D(p->level--);
11276 return NULL;
11277 }
11278 goto done;
11279 }
11280 p->mark = _mark;
11281 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11282 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11283 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011284 { // invalid_group
11285 if (p->error_indicator) {
11286 D(p->level--);
11287 return NULL;
11288 }
11289 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11290 void *invalid_group_var;
11291 if (
11292 (invalid_group_var = invalid_group_rule(p)) // invalid_group
11293 )
11294 {
11295 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11296 _res = invalid_group_var;
11297 goto done;
11298 }
11299 p->mark = _mark;
11300 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11301 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
11302 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011303 _res = NULL;
11304 done:
11305 D(p->level--);
11306 return _res;
11307}
11308
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011309// genexp: '(' expression ~ for_if_clauses ')' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011310static expr_ty
11311genexp_rule(Parser *p)
11312{
11313 D(p->level++);
11314 if (p->error_indicator) {
11315 D(p->level--);
11316 return NULL;
11317 }
11318 expr_ty _res = NULL;
11319 int _mark = p->mark;
11320 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11321 p->error_indicator = 1;
11322 D(p->level--);
11323 return NULL;
11324 }
11325 int _start_lineno = p->tokens[_mark]->lineno;
11326 UNUSED(_start_lineno); // Only used by EXTRA macro
11327 int _start_col_offset = p->tokens[_mark]->col_offset;
11328 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011329 { // '(' expression ~ for_if_clauses ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011330 if (p->error_indicator) {
11331 D(p->level--);
11332 return NULL;
11333 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011334 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11335 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011336 Token * _literal;
11337 Token * _literal_1;
11338 expr_ty a;
11339 asdl_seq* b;
11340 if (
11341 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11342 &&
11343 (a = expression_rule(p)) // expression
11344 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011345 (_cut_var = 1)
11346 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011347 (b = for_if_clauses_rule(p)) // for_if_clauses
11348 &&
11349 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11350 )
11351 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011352 D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011353 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11354 if (_token == NULL) {
11355 D(p->level--);
11356 return NULL;
11357 }
11358 int _end_lineno = _token->end_lineno;
11359 UNUSED(_end_lineno); // Only used by EXTRA macro
11360 int _end_col_offset = _token->end_col_offset;
11361 UNUSED(_end_col_offset); // Only used by EXTRA macro
11362 _res = _Py_GeneratorExp ( a , b , EXTRA );
11363 if (_res == NULL && PyErr_Occurred()) {
11364 p->error_indicator = 1;
11365 D(p->level--);
11366 return NULL;
11367 }
11368 goto done;
11369 }
11370 p->mark = _mark;
11371 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011372 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11373 if (_cut_var) {
11374 D(p->level--);
11375 return NULL;
11376 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011377 }
11378 { // invalid_comprehension
11379 if (p->error_indicator) {
11380 D(p->level--);
11381 return NULL;
11382 }
11383 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11384 void *invalid_comprehension_var;
11385 if (
11386 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11387 )
11388 {
11389 D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11390 _res = invalid_comprehension_var;
11391 goto done;
11392 }
11393 p->mark = _mark;
11394 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
11395 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11396 }
11397 _res = NULL;
11398 done:
11399 D(p->level--);
11400 return _res;
11401}
11402
11403// set: '{' expressions_list '}'
11404static expr_ty
11405set_rule(Parser *p)
11406{
11407 D(p->level++);
11408 if (p->error_indicator) {
11409 D(p->level--);
11410 return NULL;
11411 }
11412 expr_ty _res = NULL;
11413 int _mark = p->mark;
11414 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11415 p->error_indicator = 1;
11416 D(p->level--);
11417 return NULL;
11418 }
11419 int _start_lineno = p->tokens[_mark]->lineno;
11420 UNUSED(_start_lineno); // Only used by EXTRA macro
11421 int _start_col_offset = p->tokens[_mark]->col_offset;
11422 UNUSED(_start_col_offset); // Only used by EXTRA macro
11423 { // '{' expressions_list '}'
11424 if (p->error_indicator) {
11425 D(p->level--);
11426 return NULL;
11427 }
11428 D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11429 Token * _literal;
11430 Token * _literal_1;
11431 asdl_seq* a;
11432 if (
11433 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11434 &&
11435 (a = expressions_list_rule(p)) // expressions_list
11436 &&
11437 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11438 )
11439 {
11440 D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11441 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11442 if (_token == NULL) {
11443 D(p->level--);
11444 return NULL;
11445 }
11446 int _end_lineno = _token->end_lineno;
11447 UNUSED(_end_lineno); // Only used by EXTRA macro
11448 int _end_col_offset = _token->end_col_offset;
11449 UNUSED(_end_col_offset); // Only used by EXTRA macro
11450 _res = _Py_Set ( a , EXTRA );
11451 if (_res == NULL && PyErr_Occurred()) {
11452 p->error_indicator = 1;
11453 D(p->level--);
11454 return NULL;
11455 }
11456 goto done;
11457 }
11458 p->mark = _mark;
11459 D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
11460 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'"));
11461 }
11462 _res = NULL;
11463 done:
11464 D(p->level--);
11465 return _res;
11466}
11467
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011468// setcomp: '{' expression ~ for_if_clauses '}' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011469static expr_ty
11470setcomp_rule(Parser *p)
11471{
11472 D(p->level++);
11473 if (p->error_indicator) {
11474 D(p->level--);
11475 return NULL;
11476 }
11477 expr_ty _res = NULL;
11478 int _mark = p->mark;
11479 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11480 p->error_indicator = 1;
11481 D(p->level--);
11482 return NULL;
11483 }
11484 int _start_lineno = p->tokens[_mark]->lineno;
11485 UNUSED(_start_lineno); // Only used by EXTRA macro
11486 int _start_col_offset = p->tokens[_mark]->col_offset;
11487 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011488 { // '{' expression ~ for_if_clauses '}'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011489 if (p->error_indicator) {
11490 D(p->level--);
11491 return NULL;
11492 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011493 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11494 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011495 Token * _literal;
11496 Token * _literal_1;
11497 expr_ty a;
11498 asdl_seq* b;
11499 if (
11500 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11501 &&
11502 (a = expression_rule(p)) // expression
11503 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011504 (_cut_var = 1)
11505 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011506 (b = for_if_clauses_rule(p)) // for_if_clauses
11507 &&
11508 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11509 )
11510 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011511 D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011512 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11513 if (_token == NULL) {
11514 D(p->level--);
11515 return NULL;
11516 }
11517 int _end_lineno = _token->end_lineno;
11518 UNUSED(_end_lineno); // Only used by EXTRA macro
11519 int _end_col_offset = _token->end_col_offset;
11520 UNUSED(_end_col_offset); // Only used by EXTRA macro
11521 _res = _Py_SetComp ( a , b , EXTRA );
11522 if (_res == NULL && PyErr_Occurred()) {
11523 p->error_indicator = 1;
11524 D(p->level--);
11525 return NULL;
11526 }
11527 goto done;
11528 }
11529 p->mark = _mark;
11530 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011531 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11532 if (_cut_var) {
11533 D(p->level--);
11534 return NULL;
11535 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011536 }
11537 { // invalid_comprehension
11538 if (p->error_indicator) {
11539 D(p->level--);
11540 return NULL;
11541 }
11542 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11543 void *invalid_comprehension_var;
11544 if (
11545 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11546 )
11547 {
11548 D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11549 _res = invalid_comprehension_var;
11550 goto done;
11551 }
11552 p->mark = _mark;
11553 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
11554 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11555 }
11556 _res = NULL;
11557 done:
11558 D(p->level--);
11559 return _res;
11560}
11561
11562// dict: '{' double_starred_kvpairs? '}'
11563static expr_ty
11564dict_rule(Parser *p)
11565{
11566 D(p->level++);
11567 if (p->error_indicator) {
11568 D(p->level--);
11569 return NULL;
11570 }
11571 expr_ty _res = NULL;
11572 int _mark = p->mark;
11573 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11574 p->error_indicator = 1;
11575 D(p->level--);
11576 return NULL;
11577 }
11578 int _start_lineno = p->tokens[_mark]->lineno;
11579 UNUSED(_start_lineno); // Only used by EXTRA macro
11580 int _start_col_offset = p->tokens[_mark]->col_offset;
11581 UNUSED(_start_col_offset); // Only used by EXTRA macro
11582 { // '{' double_starred_kvpairs? '}'
11583 if (p->error_indicator) {
11584 D(p->level--);
11585 return NULL;
11586 }
11587 D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11588 Token * _literal;
11589 Token * _literal_1;
11590 void *a;
11591 if (
11592 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11593 &&
11594 (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs?
11595 &&
11596 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11597 )
11598 {
11599 D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11600 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11601 if (_token == NULL) {
11602 D(p->level--);
11603 return NULL;
11604 }
11605 int _end_lineno = _token->end_lineno;
11606 UNUSED(_end_lineno); // Only used by EXTRA macro
11607 int _end_col_offset = _token->end_col_offset;
11608 UNUSED(_end_col_offset); // Only used by EXTRA macro
11609 _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA );
11610 if (_res == NULL && PyErr_Occurred()) {
11611 p->error_indicator = 1;
11612 D(p->level--);
11613 return NULL;
11614 }
11615 goto done;
11616 }
11617 p->mark = _mark;
11618 D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
11619 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11620 }
11621 _res = NULL;
11622 done:
11623 D(p->level--);
11624 return _res;
11625}
11626
11627// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
11628static expr_ty
11629dictcomp_rule(Parser *p)
11630{
11631 D(p->level++);
11632 if (p->error_indicator) {
11633 D(p->level--);
11634 return NULL;
11635 }
11636 expr_ty _res = NULL;
11637 int _mark = p->mark;
11638 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11639 p->error_indicator = 1;
11640 D(p->level--);
11641 return NULL;
11642 }
11643 int _start_lineno = p->tokens[_mark]->lineno;
11644 UNUSED(_start_lineno); // Only used by EXTRA macro
11645 int _start_col_offset = p->tokens[_mark]->col_offset;
11646 UNUSED(_start_col_offset); // Only used by EXTRA macro
11647 { // '{' kvpair for_if_clauses '}'
11648 if (p->error_indicator) {
11649 D(p->level--);
11650 return NULL;
11651 }
11652 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11653 Token * _literal;
11654 Token * _literal_1;
11655 KeyValuePair* a;
11656 asdl_seq* b;
11657 if (
11658 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11659 &&
11660 (a = kvpair_rule(p)) // kvpair
11661 &&
11662 (b = for_if_clauses_rule(p)) // for_if_clauses
11663 &&
11664 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11665 )
11666 {
11667 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11668 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11669 if (_token == NULL) {
11670 D(p->level--);
11671 return NULL;
11672 }
11673 int _end_lineno = _token->end_lineno;
11674 UNUSED(_end_lineno); // Only used by EXTRA macro
11675 int _end_col_offset = _token->end_col_offset;
11676 UNUSED(_end_col_offset); // Only used by EXTRA macro
11677 _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
11678 if (_res == NULL && PyErr_Occurred()) {
11679 p->error_indicator = 1;
11680 D(p->level--);
11681 return NULL;
11682 }
11683 goto done;
11684 }
11685 p->mark = _mark;
11686 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11687 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11688 }
11689 { // invalid_dict_comprehension
11690 if (p->error_indicator) {
11691 D(p->level--);
11692 return NULL;
11693 }
11694 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11695 void *invalid_dict_comprehension_var;
11696 if (
11697 (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension
11698 )
11699 {
11700 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11701 _res = invalid_dict_comprehension_var;
11702 goto done;
11703 }
11704 p->mark = _mark;
11705 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11706 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
11707 }
11708 _res = NULL;
11709 done:
11710 D(p->level--);
11711 return _res;
11712}
11713
11714// double_starred_kvpairs: ','.double_starred_kvpair+ ','?
11715static asdl_seq*
11716double_starred_kvpairs_rule(Parser *p)
11717{
11718 D(p->level++);
11719 if (p->error_indicator) {
11720 D(p->level--);
11721 return NULL;
11722 }
11723 asdl_seq* _res = NULL;
11724 int _mark = p->mark;
11725 { // ','.double_starred_kvpair+ ','?
11726 if (p->error_indicator) {
11727 D(p->level--);
11728 return NULL;
11729 }
11730 D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11731 void *_opt_var;
11732 UNUSED(_opt_var); // Silence compiler warnings
11733 asdl_seq * a;
11734 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011735 (a = _gather_103_rule(p)) // ','.double_starred_kvpair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011736 &&
11737 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
11738 )
11739 {
11740 D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11741 _res = a;
11742 if (_res == NULL && PyErr_Occurred()) {
11743 p->error_indicator = 1;
11744 D(p->level--);
11745 return NULL;
11746 }
11747 goto done;
11748 }
11749 p->mark = _mark;
11750 D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
11751 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11752 }
11753 _res = NULL;
11754 done:
11755 D(p->level--);
11756 return _res;
11757}
11758
11759// double_starred_kvpair: '**' bitwise_or | kvpair
11760static KeyValuePair*
11761double_starred_kvpair_rule(Parser *p)
11762{
11763 D(p->level++);
11764 if (p->error_indicator) {
11765 D(p->level--);
11766 return NULL;
11767 }
11768 KeyValuePair* _res = NULL;
11769 int _mark = p->mark;
11770 { // '**' bitwise_or
11771 if (p->error_indicator) {
11772 D(p->level--);
11773 return NULL;
11774 }
11775 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11776 Token * _literal;
11777 expr_ty a;
11778 if (
11779 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
11780 &&
11781 (a = bitwise_or_rule(p)) // bitwise_or
11782 )
11783 {
11784 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11785 _res = _PyPegen_key_value_pair ( p , NULL , a );
11786 if (_res == NULL && PyErr_Occurred()) {
11787 p->error_indicator = 1;
11788 D(p->level--);
11789 return NULL;
11790 }
11791 goto done;
11792 }
11793 p->mark = _mark;
11794 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11795 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or"));
11796 }
11797 { // kvpair
11798 if (p->error_indicator) {
11799 D(p->level--);
11800 return NULL;
11801 }
11802 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair"));
11803 KeyValuePair* kvpair_var;
11804 if (
11805 (kvpair_var = kvpair_rule(p)) // kvpair
11806 )
11807 {
11808 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair"));
11809 _res = kvpair_var;
11810 goto done;
11811 }
11812 p->mark = _mark;
11813 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11814 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair"));
11815 }
11816 _res = NULL;
11817 done:
11818 D(p->level--);
11819 return _res;
11820}
11821
11822// kvpair: expression ':' expression
11823static KeyValuePair*
11824kvpair_rule(Parser *p)
11825{
11826 D(p->level++);
11827 if (p->error_indicator) {
11828 D(p->level--);
11829 return NULL;
11830 }
11831 KeyValuePair* _res = NULL;
11832 int _mark = p->mark;
11833 { // expression ':' expression
11834 if (p->error_indicator) {
11835 D(p->level--);
11836 return NULL;
11837 }
11838 D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11839 Token * _literal;
11840 expr_ty a;
11841 expr_ty b;
11842 if (
11843 (a = expression_rule(p)) // expression
11844 &&
11845 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
11846 &&
11847 (b = expression_rule(p)) // expression
11848 )
11849 {
11850 D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11851 _res = _PyPegen_key_value_pair ( p , a , b );
11852 if (_res == NULL && PyErr_Occurred()) {
11853 p->error_indicator = 1;
11854 D(p->level--);
11855 return NULL;
11856 }
11857 goto done;
11858 }
11859 p->mark = _mark;
11860 D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11861 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
11862 }
11863 _res = NULL;
11864 done:
11865 D(p->level--);
11866 return _res;
11867}
11868
11869// for_if_clauses: for_if_clause+
11870static asdl_seq*
11871for_if_clauses_rule(Parser *p)
11872{
11873 D(p->level++);
11874 if (p->error_indicator) {
11875 D(p->level--);
11876 return NULL;
11877 }
11878 asdl_seq* _res = NULL;
11879 int _mark = p->mark;
11880 { // for_if_clause+
11881 if (p->error_indicator) {
11882 D(p->level--);
11883 return NULL;
11884 }
11885 D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011886 asdl_seq * _loop1_105_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011887 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011888 (_loop1_105_var = _loop1_105_rule(p)) // for_if_clause+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011889 )
11890 {
11891 D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011892 _res = _loop1_105_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011893 goto done;
11894 }
11895 p->mark = _mark;
11896 D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ',
11897 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+"));
11898 }
11899 _res = NULL;
11900 done:
11901 D(p->level--);
11902 return _res;
11903}
11904
11905// for_if_clause:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011906// | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11907// | 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11908// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011909static comprehension_ty
11910for_if_clause_rule(Parser *p)
11911{
11912 D(p->level++);
11913 if (p->error_indicator) {
11914 D(p->level--);
11915 return NULL;
11916 }
11917 comprehension_ty _res = NULL;
11918 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011919 { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011920 if (p->error_indicator) {
11921 D(p->level--);
11922 return NULL;
11923 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011924 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11925 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011926 Token * _keyword;
11927 Token * _keyword_1;
11928 expr_ty a;
11929 Token * async_var;
11930 expr_ty b;
11931 asdl_seq * c;
11932 if (
11933 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
11934 &&
11935 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11936 &&
11937 (a = star_targets_rule(p)) // star_targets
11938 &&
11939 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11940 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011941 (_cut_var = 1)
11942 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011943 (b = disjunction_rule(p)) // disjunction
11944 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011945 (c = _loop0_106_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011946 )
11947 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011948 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))*"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011949 _res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) );
11950 if (_res == NULL && PyErr_Occurred()) {
11951 p->error_indicator = 1;
11952 D(p->level--);
11953 return NULL;
11954 }
11955 goto done;
11956 }
11957 p->mark = _mark;
11958 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011959 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11960 if (_cut_var) {
11961 D(p->level--);
11962 return NULL;
11963 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011964 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011965 { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011966 if (p->error_indicator) {
11967 D(p->level--);
11968 return NULL;
11969 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011970 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11971 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011972 Token * _keyword;
11973 Token * _keyword_1;
11974 expr_ty a;
11975 expr_ty b;
11976 asdl_seq * c;
11977 if (
11978 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11979 &&
11980 (a = star_targets_rule(p)) // star_targets
11981 &&
11982 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11983 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011984 (_cut_var = 1)
11985 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011986 (b = disjunction_rule(p)) // disjunction
11987 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011988 (c = _loop0_107_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011989 )
11990 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011991 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011992 _res = _Py_comprehension ( a , b , c , 0 , p -> arena );
11993 if (_res == NULL && PyErr_Occurred()) {
11994 p->error_indicator = 1;
11995 D(p->level--);
11996 return NULL;
11997 }
11998 goto done;
11999 }
12000 p->mark = _mark;
12001 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012002 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
12003 if (_cut_var) {
12004 D(p->level--);
12005 return NULL;
12006 }
12007 }
12008 { // invalid_for_target
12009 if (p->error_indicator) {
12010 D(p->level--);
12011 return NULL;
12012 }
12013 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12014 void *invalid_for_target_var;
12015 if (
12016 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
12017 )
12018 {
12019 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12020 _res = invalid_for_target_var;
12021 goto done;
12022 }
12023 p->mark = _mark;
12024 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
12025 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012026 }
12027 _res = NULL;
12028 done:
12029 D(p->level--);
12030 return _res;
12031}
12032
12033// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
12034static expr_ty
12035yield_expr_rule(Parser *p)
12036{
12037 D(p->level++);
12038 if (p->error_indicator) {
12039 D(p->level--);
12040 return NULL;
12041 }
12042 expr_ty _res = NULL;
12043 int _mark = p->mark;
12044 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12045 p->error_indicator = 1;
12046 D(p->level--);
12047 return NULL;
12048 }
12049 int _start_lineno = p->tokens[_mark]->lineno;
12050 UNUSED(_start_lineno); // Only used by EXTRA macro
12051 int _start_col_offset = p->tokens[_mark]->col_offset;
12052 UNUSED(_start_col_offset); // Only used by EXTRA macro
12053 { // 'yield' 'from' expression
12054 if (p->error_indicator) {
12055 D(p->level--);
12056 return NULL;
12057 }
12058 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12059 Token * _keyword;
12060 Token * _keyword_1;
12061 expr_ty a;
12062 if (
12063 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12064 &&
12065 (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from'
12066 &&
12067 (a = expression_rule(p)) // expression
12068 )
12069 {
12070 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12071 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12072 if (_token == NULL) {
12073 D(p->level--);
12074 return NULL;
12075 }
12076 int _end_lineno = _token->end_lineno;
12077 UNUSED(_end_lineno); // Only used by EXTRA macro
12078 int _end_col_offset = _token->end_col_offset;
12079 UNUSED(_end_col_offset); // Only used by EXTRA macro
12080 _res = _Py_YieldFrom ( a , EXTRA );
12081 if (_res == NULL && PyErr_Occurred()) {
12082 p->error_indicator = 1;
12083 D(p->level--);
12084 return NULL;
12085 }
12086 goto done;
12087 }
12088 p->mark = _mark;
12089 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12090 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
12091 }
12092 { // 'yield' star_expressions?
12093 if (p->error_indicator) {
12094 D(p->level--);
12095 return NULL;
12096 }
12097 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12098 Token * _keyword;
12099 void *a;
12100 if (
12101 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12102 &&
12103 (a = star_expressions_rule(p), 1) // star_expressions?
12104 )
12105 {
12106 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12107 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12108 if (_token == NULL) {
12109 D(p->level--);
12110 return NULL;
12111 }
12112 int _end_lineno = _token->end_lineno;
12113 UNUSED(_end_lineno); // Only used by EXTRA macro
12114 int _end_col_offset = _token->end_col_offset;
12115 UNUSED(_end_col_offset); // Only used by EXTRA macro
12116 _res = _Py_Yield ( a , EXTRA );
12117 if (_res == NULL && PyErr_Occurred()) {
12118 p->error_indicator = 1;
12119 D(p->level--);
12120 return NULL;
12121 }
12122 goto done;
12123 }
12124 p->mark = _mark;
12125 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12126 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
12127 }
12128 _res = NULL;
12129 done:
12130 D(p->level--);
12131 return _res;
12132}
12133
12134// arguments: args ','? &')' | incorrect_arguments
12135static expr_ty
12136arguments_rule(Parser *p)
12137{
12138 D(p->level++);
12139 if (p->error_indicator) {
12140 D(p->level--);
12141 return NULL;
12142 }
12143 expr_ty _res = NULL;
12144 if (_PyPegen_is_memoized(p, arguments_type, &_res)) {
12145 D(p->level--);
12146 return _res;
12147 }
12148 int _mark = p->mark;
12149 { // args ','? &')'
12150 if (p->error_indicator) {
12151 D(p->level--);
12152 return NULL;
12153 }
12154 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12155 void *_opt_var;
12156 UNUSED(_opt_var); // Silence compiler warnings
12157 expr_ty a;
12158 if (
12159 (a = args_rule(p)) // args
12160 &&
12161 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12162 &&
12163 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
12164 )
12165 {
12166 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12167 _res = a;
12168 if (_res == NULL && PyErr_Occurred()) {
12169 p->error_indicator = 1;
12170 D(p->level--);
12171 return NULL;
12172 }
12173 goto done;
12174 }
12175 p->mark = _mark;
12176 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12177 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'"));
12178 }
12179 { // incorrect_arguments
12180 if (p->error_indicator) {
12181 D(p->level--);
12182 return NULL;
12183 }
12184 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "incorrect_arguments"));
12185 void *incorrect_arguments_var;
12186 if (
12187 (incorrect_arguments_var = incorrect_arguments_rule(p)) // incorrect_arguments
12188 )
12189 {
12190 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "incorrect_arguments"));
12191 _res = incorrect_arguments_var;
12192 goto done;
12193 }
12194 p->mark = _mark;
12195 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12196 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "incorrect_arguments"));
12197 }
12198 _res = NULL;
12199 done:
12200 _PyPegen_insert_memo(p, _mark, arguments_type, _res);
12201 D(p->level--);
12202 return _res;
12203}
12204
Pablo Galindo4a97b152020-09-02 17:44:19 +010012205// args: ','.(starred_expression | named_expression !'=')+ [',' kwargs] | kwargs
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012206static expr_ty
12207args_rule(Parser *p)
12208{
12209 D(p->level++);
12210 if (p->error_indicator) {
12211 D(p->level--);
12212 return NULL;
12213 }
12214 expr_ty _res = NULL;
12215 int _mark = p->mark;
12216 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12217 p->error_indicator = 1;
12218 D(p->level--);
12219 return NULL;
12220 }
12221 int _start_lineno = p->tokens[_mark]->lineno;
12222 UNUSED(_start_lineno); // Only used by EXTRA macro
12223 int _start_col_offset = p->tokens[_mark]->col_offset;
12224 UNUSED(_start_col_offset); // Only used by EXTRA macro
Pablo Galindo4a97b152020-09-02 17:44:19 +010012225 { // ','.(starred_expression | named_expression !'=')+ [',' kwargs]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012226 if (p->error_indicator) {
12227 D(p->level--);
12228 return NULL;
12229 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010012230 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
12231 asdl_seq * a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012232 void *b;
12233 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012234 (a = _gather_108_rule(p)) // ','.(starred_expression | named_expression !'=')+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012235 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012236 (b = _tmp_110_rule(p), 1) // [',' kwargs]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012237 )
12238 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010012239 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
12240 _res = _PyPegen_collect_call_seqs ( p , a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012241 if (_res == NULL && PyErr_Occurred()) {
12242 p->error_indicator = 1;
12243 D(p->level--);
12244 return NULL;
12245 }
12246 goto done;
12247 }
12248 p->mark = _mark;
12249 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010012250 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012251 }
12252 { // kwargs
12253 if (p->error_indicator) {
12254 D(p->level--);
12255 return NULL;
12256 }
12257 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
12258 asdl_seq* a;
12259 if (
12260 (a = kwargs_rule(p)) // kwargs
12261 )
12262 {
12263 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
12264 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12265 if (_token == NULL) {
12266 D(p->level--);
12267 return NULL;
12268 }
12269 int _end_lineno = _token->end_lineno;
12270 UNUSED(_end_lineno); // Only used by EXTRA macro
12271 int _end_col_offset = _token->end_col_offset;
12272 UNUSED(_end_col_offset); // Only used by EXTRA macro
12273 _res = _Py_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA );
12274 if (_res == NULL && PyErr_Occurred()) {
12275 p->error_indicator = 1;
12276 D(p->level--);
12277 return NULL;
12278 }
12279 goto done;
12280 }
12281 p->mark = _mark;
12282 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
12283 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
12284 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012285 _res = NULL;
12286 done:
12287 D(p->level--);
12288 return _res;
12289}
12290
12291// kwargs:
12292// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12293// | ','.kwarg_or_starred+
12294// | ','.kwarg_or_double_starred+
12295static asdl_seq*
12296kwargs_rule(Parser *p)
12297{
12298 D(p->level++);
12299 if (p->error_indicator) {
12300 D(p->level--);
12301 return NULL;
12302 }
12303 asdl_seq* _res = NULL;
12304 int _mark = p->mark;
12305 { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12306 if (p->error_indicator) {
12307 D(p->level--);
12308 return NULL;
12309 }
12310 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12311 Token * _literal;
12312 asdl_seq * a;
12313 asdl_seq * b;
12314 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012315 (a = _gather_111_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012316 &&
12317 (_literal = _PyPegen_expect_token(p, 12)) // token=','
12318 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012319 (b = _gather_113_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012320 )
12321 {
12322 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12323 _res = _PyPegen_join_sequences ( p , a , b );
12324 if (_res == NULL && PyErr_Occurred()) {
12325 p->error_indicator = 1;
12326 D(p->level--);
12327 return NULL;
12328 }
12329 goto done;
12330 }
12331 p->mark = _mark;
12332 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12333 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12334 }
12335 { // ','.kwarg_or_starred+
12336 if (p->error_indicator) {
12337 D(p->level--);
12338 return NULL;
12339 }
12340 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010012341 asdl_seq * _gather_115_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012342 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012343 (_gather_115_var = _gather_115_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012344 )
12345 {
12346 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010012347 _res = _gather_115_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012348 goto done;
12349 }
12350 p->mark = _mark;
12351 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12352 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+"));
12353 }
12354 { // ','.kwarg_or_double_starred+
12355 if (p->error_indicator) {
12356 D(p->level--);
12357 return NULL;
12358 }
12359 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010012360 asdl_seq * _gather_117_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012361 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012362 (_gather_117_var = _gather_117_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012363 )
12364 {
12365 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010012366 _res = _gather_117_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012367 goto done;
12368 }
12369 p->mark = _mark;
12370 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12371 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+"));
12372 }
12373 _res = NULL;
12374 done:
12375 D(p->level--);
12376 return _res;
12377}
12378
12379// starred_expression: '*' expression
12380static expr_ty
12381starred_expression_rule(Parser *p)
12382{
12383 D(p->level++);
12384 if (p->error_indicator) {
12385 D(p->level--);
12386 return NULL;
12387 }
12388 expr_ty _res = NULL;
12389 int _mark = p->mark;
12390 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12391 p->error_indicator = 1;
12392 D(p->level--);
12393 return NULL;
12394 }
12395 int _start_lineno = p->tokens[_mark]->lineno;
12396 UNUSED(_start_lineno); // Only used by EXTRA macro
12397 int _start_col_offset = p->tokens[_mark]->col_offset;
12398 UNUSED(_start_col_offset); // Only used by EXTRA macro
12399 { // '*' expression
12400 if (p->error_indicator) {
12401 D(p->level--);
12402 return NULL;
12403 }
12404 D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12405 Token * _literal;
12406 expr_ty a;
12407 if (
12408 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12409 &&
12410 (a = expression_rule(p)) // expression
12411 )
12412 {
12413 D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12414 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12415 if (_token == NULL) {
12416 D(p->level--);
12417 return NULL;
12418 }
12419 int _end_lineno = _token->end_lineno;
12420 UNUSED(_end_lineno); // Only used by EXTRA macro
12421 int _end_col_offset = _token->end_col_offset;
12422 UNUSED(_end_col_offset); // Only used by EXTRA macro
12423 _res = _Py_Starred ( a , Load , EXTRA );
12424 if (_res == NULL && PyErr_Occurred()) {
12425 p->error_indicator = 1;
12426 D(p->level--);
12427 return NULL;
12428 }
12429 goto done;
12430 }
12431 p->mark = _mark;
12432 D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
12433 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
12434 }
12435 _res = NULL;
12436 done:
12437 D(p->level--);
12438 return _res;
12439}
12440
12441// kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg
12442static KeywordOrStarred*
12443kwarg_or_starred_rule(Parser *p)
12444{
12445 D(p->level++);
12446 if (p->error_indicator) {
12447 D(p->level--);
12448 return NULL;
12449 }
12450 KeywordOrStarred* _res = NULL;
12451 int _mark = p->mark;
12452 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12453 p->error_indicator = 1;
12454 D(p->level--);
12455 return NULL;
12456 }
12457 int _start_lineno = p->tokens[_mark]->lineno;
12458 UNUSED(_start_lineno); // Only used by EXTRA macro
12459 int _start_col_offset = p->tokens[_mark]->col_offset;
12460 UNUSED(_start_col_offset); // Only used by EXTRA macro
12461 { // NAME '=' expression
12462 if (p->error_indicator) {
12463 D(p->level--);
12464 return NULL;
12465 }
12466 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12467 Token * _literal;
12468 expr_ty a;
12469 expr_ty b;
12470 if (
12471 (a = _PyPegen_name_token(p)) // NAME
12472 &&
12473 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12474 &&
12475 (b = expression_rule(p)) // expression
12476 )
12477 {
12478 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12479 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12480 if (_token == NULL) {
12481 D(p->level--);
12482 return NULL;
12483 }
12484 int _end_lineno = _token->end_lineno;
12485 UNUSED(_end_lineno); // Only used by EXTRA macro
12486 int _end_col_offset = _token->end_col_offset;
12487 UNUSED(_end_col_offset); // Only used by EXTRA macro
12488 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
12489 if (_res == NULL && PyErr_Occurred()) {
12490 p->error_indicator = 1;
12491 D(p->level--);
12492 return NULL;
12493 }
12494 goto done;
12495 }
12496 p->mark = _mark;
12497 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12498 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12499 }
12500 { // starred_expression
12501 if (p->error_indicator) {
12502 D(p->level--);
12503 return NULL;
12504 }
12505 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12506 expr_ty a;
12507 if (
12508 (a = starred_expression_rule(p)) // starred_expression
12509 )
12510 {
12511 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12512 _res = _PyPegen_keyword_or_starred ( p , a , 0 );
12513 if (_res == NULL && PyErr_Occurred()) {
12514 p->error_indicator = 1;
12515 D(p->level--);
12516 return NULL;
12517 }
12518 goto done;
12519 }
12520 p->mark = _mark;
12521 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12522 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
12523 }
12524 { // invalid_kwarg
12525 if (p->error_indicator) {
12526 D(p->level--);
12527 return NULL;
12528 }
12529 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12530 void *invalid_kwarg_var;
12531 if (
12532 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12533 )
12534 {
12535 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12536 _res = invalid_kwarg_var;
12537 goto done;
12538 }
12539 p->mark = _mark;
12540 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12541 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12542 }
12543 _res = NULL;
12544 done:
12545 D(p->level--);
12546 return _res;
12547}
12548
12549// kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg
12550static KeywordOrStarred*
12551kwarg_or_double_starred_rule(Parser *p)
12552{
12553 D(p->level++);
12554 if (p->error_indicator) {
12555 D(p->level--);
12556 return NULL;
12557 }
12558 KeywordOrStarred* _res = NULL;
12559 int _mark = p->mark;
12560 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12561 p->error_indicator = 1;
12562 D(p->level--);
12563 return NULL;
12564 }
12565 int _start_lineno = p->tokens[_mark]->lineno;
12566 UNUSED(_start_lineno); // Only used by EXTRA macro
12567 int _start_col_offset = p->tokens[_mark]->col_offset;
12568 UNUSED(_start_col_offset); // Only used by EXTRA macro
12569 { // NAME '=' expression
12570 if (p->error_indicator) {
12571 D(p->level--);
12572 return NULL;
12573 }
12574 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12575 Token * _literal;
12576 expr_ty a;
12577 expr_ty b;
12578 if (
12579 (a = _PyPegen_name_token(p)) // NAME
12580 &&
12581 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12582 &&
12583 (b = expression_rule(p)) // expression
12584 )
12585 {
12586 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12587 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12588 if (_token == NULL) {
12589 D(p->level--);
12590 return NULL;
12591 }
12592 int _end_lineno = _token->end_lineno;
12593 UNUSED(_end_lineno); // Only used by EXTRA macro
12594 int _end_col_offset = _token->end_col_offset;
12595 UNUSED(_end_col_offset); // Only used by EXTRA macro
12596 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
12597 if (_res == NULL && PyErr_Occurred()) {
12598 p->error_indicator = 1;
12599 D(p->level--);
12600 return NULL;
12601 }
12602 goto done;
12603 }
12604 p->mark = _mark;
12605 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12606 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12607 }
12608 { // '**' expression
12609 if (p->error_indicator) {
12610 D(p->level--);
12611 return NULL;
12612 }
12613 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12614 Token * _literal;
12615 expr_ty a;
12616 if (
12617 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
12618 &&
12619 (a = expression_rule(p)) // expression
12620 )
12621 {
12622 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12623 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12624 if (_token == NULL) {
12625 D(p->level--);
12626 return NULL;
12627 }
12628 int _end_lineno = _token->end_lineno;
12629 UNUSED(_end_lineno); // Only used by EXTRA macro
12630 int _end_col_offset = _token->end_col_offset;
12631 UNUSED(_end_col_offset); // Only used by EXTRA macro
12632 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
12633 if (_res == NULL && PyErr_Occurred()) {
12634 p->error_indicator = 1;
12635 D(p->level--);
12636 return NULL;
12637 }
12638 goto done;
12639 }
12640 p->mark = _mark;
12641 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12642 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
12643 }
12644 { // invalid_kwarg
12645 if (p->error_indicator) {
12646 D(p->level--);
12647 return NULL;
12648 }
12649 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12650 void *invalid_kwarg_var;
12651 if (
12652 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12653 )
12654 {
12655 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12656 _res = invalid_kwarg_var;
12657 goto done;
12658 }
12659 p->mark = _mark;
12660 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12661 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12662 }
12663 _res = NULL;
12664 done:
12665 D(p->level--);
12666 return _res;
12667}
12668
12669// star_targets: star_target !',' | star_target ((',' star_target))* ','?
12670static expr_ty
12671star_targets_rule(Parser *p)
12672{
12673 D(p->level++);
12674 if (p->error_indicator) {
12675 D(p->level--);
12676 return NULL;
12677 }
12678 expr_ty _res = NULL;
12679 int _mark = p->mark;
12680 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12681 p->error_indicator = 1;
12682 D(p->level--);
12683 return NULL;
12684 }
12685 int _start_lineno = p->tokens[_mark]->lineno;
12686 UNUSED(_start_lineno); // Only used by EXTRA macro
12687 int _start_col_offset = p->tokens[_mark]->col_offset;
12688 UNUSED(_start_col_offset); // Only used by EXTRA macro
12689 { // star_target !','
12690 if (p->error_indicator) {
12691 D(p->level--);
12692 return NULL;
12693 }
12694 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12695 expr_ty a;
12696 if (
12697 (a = star_target_rule(p)) // star_target
12698 &&
12699 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
12700 )
12701 {
12702 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12703 _res = a;
12704 if (_res == NULL && PyErr_Occurred()) {
12705 p->error_indicator = 1;
12706 D(p->level--);
12707 return NULL;
12708 }
12709 goto done;
12710 }
12711 p->mark = _mark;
12712 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12713 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','"));
12714 }
12715 { // star_target ((',' star_target))* ','?
12716 if (p->error_indicator) {
12717 D(p->level--);
12718 return NULL;
12719 }
12720 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12721 void *_opt_var;
12722 UNUSED(_opt_var); // Silence compiler warnings
12723 expr_ty a;
12724 asdl_seq * b;
12725 if (
12726 (a = star_target_rule(p)) // star_target
12727 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012728 (b = _loop0_119_rule(p)) // ((',' star_target))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012729 &&
12730 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12731 )
12732 {
12733 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12734 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12735 if (_token == NULL) {
12736 D(p->level--);
12737 return NULL;
12738 }
12739 int _end_lineno = _token->end_lineno;
12740 UNUSED(_end_lineno); // Only used by EXTRA macro
12741 int _end_col_offset = _token->end_col_offset;
12742 UNUSED(_end_col_offset); // Only used by EXTRA macro
12743 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
12744 if (_res == NULL && PyErr_Occurred()) {
12745 p->error_indicator = 1;
12746 D(p->level--);
12747 return NULL;
12748 }
12749 goto done;
12750 }
12751 p->mark = _mark;
12752 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12753 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?"));
12754 }
12755 _res = NULL;
12756 done:
12757 D(p->level--);
12758 return _res;
12759}
12760
12761// star_targets_seq: ','.star_target+ ','?
12762static asdl_seq*
12763star_targets_seq_rule(Parser *p)
12764{
12765 D(p->level++);
12766 if (p->error_indicator) {
12767 D(p->level--);
12768 return NULL;
12769 }
12770 asdl_seq* _res = NULL;
12771 int _mark = p->mark;
12772 { // ','.star_target+ ','?
12773 if (p->error_indicator) {
12774 D(p->level--);
12775 return NULL;
12776 }
12777 D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12778 void *_opt_var;
12779 UNUSED(_opt_var); // Silence compiler warnings
12780 asdl_seq * a;
12781 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012782 (a = _gather_120_rule(p)) // ','.star_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012783 &&
12784 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12785 )
12786 {
12787 D(fprintf(stderr, "%*c+ star_targets_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12788 _res = a;
12789 if (_res == NULL && PyErr_Occurred()) {
12790 p->error_indicator = 1;
12791 D(p->level--);
12792 return NULL;
12793 }
12794 goto done;
12795 }
12796 p->mark = _mark;
12797 D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ',
12798 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?"));
12799 }
12800 _res = NULL;
12801 done:
12802 D(p->level--);
12803 return _res;
12804}
12805
12806// star_target:
12807// | '*' (!'*' star_target)
12808// | t_primary '.' NAME !t_lookahead
12809// | t_primary '[' slices ']' !t_lookahead
12810// | star_atom
12811static expr_ty
12812star_target_rule(Parser *p)
12813{
12814 D(p->level++);
12815 if (p->error_indicator) {
12816 D(p->level--);
12817 return NULL;
12818 }
12819 expr_ty _res = NULL;
12820 if (_PyPegen_is_memoized(p, star_target_type, &_res)) {
12821 D(p->level--);
12822 return _res;
12823 }
12824 int _mark = p->mark;
12825 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12826 p->error_indicator = 1;
12827 D(p->level--);
12828 return NULL;
12829 }
12830 int _start_lineno = p->tokens[_mark]->lineno;
12831 UNUSED(_start_lineno); // Only used by EXTRA macro
12832 int _start_col_offset = p->tokens[_mark]->col_offset;
12833 UNUSED(_start_col_offset); // Only used by EXTRA macro
12834 { // '*' (!'*' star_target)
12835 if (p->error_indicator) {
12836 D(p->level--);
12837 return NULL;
12838 }
12839 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12840 Token * _literal;
12841 void *a;
12842 if (
12843 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12844 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012845 (a = _tmp_122_rule(p)) // !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012846 )
12847 {
12848 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12849 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12850 if (_token == NULL) {
12851 D(p->level--);
12852 return NULL;
12853 }
12854 int _end_lineno = _token->end_lineno;
12855 UNUSED(_end_lineno); // Only used by EXTRA macro
12856 int _end_col_offset = _token->end_col_offset;
12857 UNUSED(_end_col_offset); // Only used by EXTRA macro
12858 _res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
12859 if (_res == NULL && PyErr_Occurred()) {
12860 p->error_indicator = 1;
12861 D(p->level--);
12862 return NULL;
12863 }
12864 goto done;
12865 }
12866 p->mark = _mark;
12867 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12868 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)"));
12869 }
12870 { // t_primary '.' NAME !t_lookahead
12871 if (p->error_indicator) {
12872 D(p->level--);
12873 return NULL;
12874 }
12875 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12876 Token * _literal;
12877 expr_ty a;
12878 expr_ty b;
12879 if (
12880 (a = t_primary_rule(p)) // t_primary
12881 &&
12882 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
12883 &&
12884 (b = _PyPegen_name_token(p)) // NAME
12885 &&
12886 _PyPegen_lookahead(0, t_lookahead_rule, p)
12887 )
12888 {
12889 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12890 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12891 if (_token == NULL) {
12892 D(p->level--);
12893 return NULL;
12894 }
12895 int _end_lineno = _token->end_lineno;
12896 UNUSED(_end_lineno); // Only used by EXTRA macro
12897 int _end_col_offset = _token->end_col_offset;
12898 UNUSED(_end_col_offset); // Only used by EXTRA macro
12899 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
12900 if (_res == NULL && PyErr_Occurred()) {
12901 p->error_indicator = 1;
12902 D(p->level--);
12903 return NULL;
12904 }
12905 goto done;
12906 }
12907 p->mark = _mark;
12908 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12909 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12910 }
12911 { // t_primary '[' slices ']' !t_lookahead
12912 if (p->error_indicator) {
12913 D(p->level--);
12914 return NULL;
12915 }
12916 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12917 Token * _literal;
12918 Token * _literal_1;
12919 expr_ty a;
12920 expr_ty b;
12921 if (
12922 (a = t_primary_rule(p)) // t_primary
12923 &&
12924 (_literal = _PyPegen_expect_token(p, 9)) // token='['
12925 &&
12926 (b = slices_rule(p)) // slices
12927 &&
12928 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
12929 &&
12930 _PyPegen_lookahead(0, t_lookahead_rule, p)
12931 )
12932 {
12933 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12934 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12935 if (_token == NULL) {
12936 D(p->level--);
12937 return NULL;
12938 }
12939 int _end_lineno = _token->end_lineno;
12940 UNUSED(_end_lineno); // Only used by EXTRA macro
12941 int _end_col_offset = _token->end_col_offset;
12942 UNUSED(_end_col_offset); // Only used by EXTRA macro
12943 _res = _Py_Subscript ( a , b , Store , EXTRA );
12944 if (_res == NULL && PyErr_Occurred()) {
12945 p->error_indicator = 1;
12946 D(p->level--);
12947 return NULL;
12948 }
12949 goto done;
12950 }
12951 p->mark = _mark;
12952 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12953 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12954 }
12955 { // star_atom
12956 if (p->error_indicator) {
12957 D(p->level--);
12958 return NULL;
12959 }
12960 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom"));
12961 expr_ty star_atom_var;
12962 if (
12963 (star_atom_var = star_atom_rule(p)) // star_atom
12964 )
12965 {
12966 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom"));
12967 _res = star_atom_var;
12968 goto done;
12969 }
12970 p->mark = _mark;
12971 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12972 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom"));
12973 }
12974 _res = NULL;
12975 done:
12976 _PyPegen_insert_memo(p, _mark, star_target_type, _res);
12977 D(p->level--);
12978 return _res;
12979}
12980
12981// star_atom:
12982// | NAME
12983// | '(' star_target ')'
12984// | '(' star_targets_seq? ')'
12985// | '[' star_targets_seq? ']'
12986static expr_ty
12987star_atom_rule(Parser *p)
12988{
12989 D(p->level++);
12990 if (p->error_indicator) {
12991 D(p->level--);
12992 return NULL;
12993 }
12994 expr_ty _res = NULL;
12995 int _mark = p->mark;
12996 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12997 p->error_indicator = 1;
12998 D(p->level--);
12999 return NULL;
13000 }
13001 int _start_lineno = p->tokens[_mark]->lineno;
13002 UNUSED(_start_lineno); // Only used by EXTRA macro
13003 int _start_col_offset = p->tokens[_mark]->col_offset;
13004 UNUSED(_start_col_offset); // Only used by EXTRA macro
13005 { // NAME
13006 if (p->error_indicator) {
13007 D(p->level--);
13008 return NULL;
13009 }
13010 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13011 expr_ty a;
13012 if (
13013 (a = _PyPegen_name_token(p)) // NAME
13014 )
13015 {
13016 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13017 _res = _PyPegen_set_expr_context ( p , a , Store );
13018 if (_res == NULL && PyErr_Occurred()) {
13019 p->error_indicator = 1;
13020 D(p->level--);
13021 return NULL;
13022 }
13023 goto done;
13024 }
13025 p->mark = _mark;
13026 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13027 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13028 }
13029 { // '(' star_target ')'
13030 if (p->error_indicator) {
13031 D(p->level--);
13032 return NULL;
13033 }
13034 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13035 Token * _literal;
13036 Token * _literal_1;
13037 expr_ty a;
13038 if (
13039 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13040 &&
13041 (a = star_target_rule(p)) // star_target
13042 &&
13043 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13044 )
13045 {
13046 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13047 _res = _PyPegen_set_expr_context ( p , a , Store );
13048 if (_res == NULL && PyErr_Occurred()) {
13049 p->error_indicator = 1;
13050 D(p->level--);
13051 return NULL;
13052 }
13053 goto done;
13054 }
13055 p->mark = _mark;
13056 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13057 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'"));
13058 }
13059 { // '(' star_targets_seq? ')'
13060 if (p->error_indicator) {
13061 D(p->level--);
13062 return NULL;
13063 }
13064 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13065 Token * _literal;
13066 Token * _literal_1;
13067 void *a;
13068 if (
13069 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13070 &&
13071 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13072 &&
13073 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13074 )
13075 {
13076 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13077 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13078 if (_token == NULL) {
13079 D(p->level--);
13080 return NULL;
13081 }
13082 int _end_lineno = _token->end_lineno;
13083 UNUSED(_end_lineno); // Only used by EXTRA macro
13084 int _end_col_offset = _token->end_col_offset;
13085 UNUSED(_end_col_offset); // Only used by EXTRA macro
13086 _res = _Py_Tuple ( a , Store , EXTRA );
13087 if (_res == NULL && PyErr_Occurred()) {
13088 p->error_indicator = 1;
13089 D(p->level--);
13090 return NULL;
13091 }
13092 goto done;
13093 }
13094 p->mark = _mark;
13095 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13096 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'"));
13097 }
13098 { // '[' star_targets_seq? ']'
13099 if (p->error_indicator) {
13100 D(p->level--);
13101 return NULL;
13102 }
13103 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13104 Token * _literal;
13105 Token * _literal_1;
13106 void *a;
13107 if (
13108 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13109 &&
13110 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13111 &&
13112 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13113 )
13114 {
13115 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13116 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13117 if (_token == NULL) {
13118 D(p->level--);
13119 return NULL;
13120 }
13121 int _end_lineno = _token->end_lineno;
13122 UNUSED(_end_lineno); // Only used by EXTRA macro
13123 int _end_col_offset = _token->end_col_offset;
13124 UNUSED(_end_col_offset); // Only used by EXTRA macro
13125 _res = _Py_List ( a , Store , EXTRA );
13126 if (_res == NULL && PyErr_Occurred()) {
13127 p->error_indicator = 1;
13128 D(p->level--);
13129 return NULL;
13130 }
13131 goto done;
13132 }
13133 p->mark = _mark;
13134 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13135 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'"));
13136 }
13137 _res = NULL;
13138 done:
13139 D(p->level--);
13140 return _res;
13141}
13142
13143// single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
13144static expr_ty
13145single_target_rule(Parser *p)
13146{
13147 D(p->level++);
13148 if (p->error_indicator) {
13149 D(p->level--);
13150 return NULL;
13151 }
13152 expr_ty _res = NULL;
13153 int _mark = p->mark;
13154 { // single_subscript_attribute_target
13155 if (p->error_indicator) {
13156 D(p->level--);
13157 return NULL;
13158 }
13159 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13160 expr_ty single_subscript_attribute_target_var;
13161 if (
13162 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
13163 )
13164 {
13165 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13166 _res = single_subscript_attribute_target_var;
13167 goto done;
13168 }
13169 p->mark = _mark;
13170 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13171 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
13172 }
13173 { // NAME
13174 if (p->error_indicator) {
13175 D(p->level--);
13176 return NULL;
13177 }
13178 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13179 expr_ty a;
13180 if (
13181 (a = _PyPegen_name_token(p)) // NAME
13182 )
13183 {
13184 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13185 _res = _PyPegen_set_expr_context ( p , a , Store );
13186 if (_res == NULL && PyErr_Occurred()) {
13187 p->error_indicator = 1;
13188 D(p->level--);
13189 return NULL;
13190 }
13191 goto done;
13192 }
13193 p->mark = _mark;
13194 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13195 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13196 }
13197 { // '(' single_target ')'
13198 if (p->error_indicator) {
13199 D(p->level--);
13200 return NULL;
13201 }
13202 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13203 Token * _literal;
13204 Token * _literal_1;
13205 expr_ty a;
13206 if (
13207 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13208 &&
13209 (a = single_target_rule(p)) // single_target
13210 &&
13211 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13212 )
13213 {
13214 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13215 _res = a;
13216 if (_res == NULL && PyErr_Occurred()) {
13217 p->error_indicator = 1;
13218 D(p->level--);
13219 return NULL;
13220 }
13221 goto done;
13222 }
13223 p->mark = _mark;
13224 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13225 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
13226 }
13227 _res = NULL;
13228 done:
13229 D(p->level--);
13230 return _res;
13231}
13232
13233// single_subscript_attribute_target:
13234// | t_primary '.' NAME !t_lookahead
13235// | t_primary '[' slices ']' !t_lookahead
13236static expr_ty
13237single_subscript_attribute_target_rule(Parser *p)
13238{
13239 D(p->level++);
13240 if (p->error_indicator) {
13241 D(p->level--);
13242 return NULL;
13243 }
13244 expr_ty _res = NULL;
13245 int _mark = p->mark;
13246 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13247 p->error_indicator = 1;
13248 D(p->level--);
13249 return NULL;
13250 }
13251 int _start_lineno = p->tokens[_mark]->lineno;
13252 UNUSED(_start_lineno); // Only used by EXTRA macro
13253 int _start_col_offset = p->tokens[_mark]->col_offset;
13254 UNUSED(_start_col_offset); // Only used by EXTRA macro
13255 { // t_primary '.' NAME !t_lookahead
13256 if (p->error_indicator) {
13257 D(p->level--);
13258 return NULL;
13259 }
13260 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13261 Token * _literal;
13262 expr_ty a;
13263 expr_ty b;
13264 if (
13265 (a = t_primary_rule(p)) // t_primary
13266 &&
13267 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13268 &&
13269 (b = _PyPegen_name_token(p)) // NAME
13270 &&
13271 _PyPegen_lookahead(0, t_lookahead_rule, p)
13272 )
13273 {
13274 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13275 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13276 if (_token == NULL) {
13277 D(p->level--);
13278 return NULL;
13279 }
13280 int _end_lineno = _token->end_lineno;
13281 UNUSED(_end_lineno); // Only used by EXTRA macro
13282 int _end_col_offset = _token->end_col_offset;
13283 UNUSED(_end_col_offset); // Only used by EXTRA macro
13284 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13285 if (_res == NULL && PyErr_Occurred()) {
13286 p->error_indicator = 1;
13287 D(p->level--);
13288 return NULL;
13289 }
13290 goto done;
13291 }
13292 p->mark = _mark;
13293 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13294 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13295 }
13296 { // t_primary '[' slices ']' !t_lookahead
13297 if (p->error_indicator) {
13298 D(p->level--);
13299 return NULL;
13300 }
13301 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13302 Token * _literal;
13303 Token * _literal_1;
13304 expr_ty a;
13305 expr_ty b;
13306 if (
13307 (a = t_primary_rule(p)) // t_primary
13308 &&
13309 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13310 &&
13311 (b = slices_rule(p)) // slices
13312 &&
13313 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13314 &&
13315 _PyPegen_lookahead(0, t_lookahead_rule, p)
13316 )
13317 {
13318 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13319 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13320 if (_token == NULL) {
13321 D(p->level--);
13322 return NULL;
13323 }
13324 int _end_lineno = _token->end_lineno;
13325 UNUSED(_end_lineno); // Only used by EXTRA macro
13326 int _end_col_offset = _token->end_col_offset;
13327 UNUSED(_end_col_offset); // Only used by EXTRA macro
13328 _res = _Py_Subscript ( a , b , Store , EXTRA );
13329 if (_res == NULL && PyErr_Occurred()) {
13330 p->error_indicator = 1;
13331 D(p->level--);
13332 return NULL;
13333 }
13334 goto done;
13335 }
13336 p->mark = _mark;
13337 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13338 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13339 }
13340 _res = NULL;
13341 done:
13342 D(p->level--);
13343 return _res;
13344}
13345
13346// del_targets: ','.del_target+ ','?
13347static asdl_seq*
13348del_targets_rule(Parser *p)
13349{
13350 D(p->level++);
13351 if (p->error_indicator) {
13352 D(p->level--);
13353 return NULL;
13354 }
13355 asdl_seq* _res = NULL;
13356 int _mark = p->mark;
13357 { // ','.del_target+ ','?
13358 if (p->error_indicator) {
13359 D(p->level--);
13360 return NULL;
13361 }
13362 D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13363 void *_opt_var;
13364 UNUSED(_opt_var); // Silence compiler warnings
13365 asdl_seq * a;
13366 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010013367 (a = _gather_123_rule(p)) // ','.del_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013368 &&
13369 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13370 )
13371 {
13372 D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13373 _res = a;
13374 if (_res == NULL && PyErr_Occurred()) {
13375 p->error_indicator = 1;
13376 D(p->level--);
13377 return NULL;
13378 }
13379 goto done;
13380 }
13381 p->mark = _mark;
13382 D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ',
13383 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?"));
13384 }
13385 _res = NULL;
13386 done:
13387 D(p->level--);
13388 return _res;
13389}
13390
13391// del_target:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013392// | t_primary '.' NAME !t_lookahead
13393// | t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013394// | del_t_atom
13395static expr_ty
13396del_target_rule(Parser *p)
13397{
13398 D(p->level++);
13399 if (p->error_indicator) {
13400 D(p->level--);
13401 return NULL;
13402 }
13403 expr_ty _res = NULL;
13404 if (_PyPegen_is_memoized(p, del_target_type, &_res)) {
13405 D(p->level--);
13406 return _res;
13407 }
13408 int _mark = p->mark;
13409 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13410 p->error_indicator = 1;
13411 D(p->level--);
13412 return NULL;
13413 }
13414 int _start_lineno = p->tokens[_mark]->lineno;
13415 UNUSED(_start_lineno); // Only used by EXTRA macro
13416 int _start_col_offset = p->tokens[_mark]->col_offset;
13417 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013418 { // t_primary '.' NAME !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013419 if (p->error_indicator) {
13420 D(p->level--);
13421 return NULL;
13422 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013423 D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013424 Token * _literal;
13425 expr_ty a;
13426 expr_ty b;
13427 if (
13428 (a = t_primary_rule(p)) // t_primary
13429 &&
13430 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13431 &&
13432 (b = _PyPegen_name_token(p)) // NAME
13433 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013434 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013435 )
13436 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013437 D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013438 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13439 if (_token == NULL) {
13440 D(p->level--);
13441 return NULL;
13442 }
13443 int _end_lineno = _token->end_lineno;
13444 UNUSED(_end_lineno); // Only used by EXTRA macro
13445 int _end_col_offset = _token->end_col_offset;
13446 UNUSED(_end_col_offset); // Only used by EXTRA macro
13447 _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
13448 if (_res == NULL && PyErr_Occurred()) {
13449 p->error_indicator = 1;
13450 D(p->level--);
13451 return NULL;
13452 }
13453 goto done;
13454 }
13455 p->mark = _mark;
13456 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013457 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013458 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013459 { // t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013460 if (p->error_indicator) {
13461 D(p->level--);
13462 return NULL;
13463 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013464 D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013465 Token * _literal;
13466 Token * _literal_1;
13467 expr_ty a;
13468 expr_ty b;
13469 if (
13470 (a = t_primary_rule(p)) // t_primary
13471 &&
13472 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13473 &&
13474 (b = slices_rule(p)) // slices
13475 &&
13476 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13477 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013478 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013479 )
13480 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013481 D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013482 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13483 if (_token == NULL) {
13484 D(p->level--);
13485 return NULL;
13486 }
13487 int _end_lineno = _token->end_lineno;
13488 UNUSED(_end_lineno); // Only used by EXTRA macro
13489 int _end_col_offset = _token->end_col_offset;
13490 UNUSED(_end_col_offset); // Only used by EXTRA macro
13491 _res = _Py_Subscript ( a , b , Del , EXTRA );
13492 if (_res == NULL && PyErr_Occurred()) {
13493 p->error_indicator = 1;
13494 D(p->level--);
13495 return NULL;
13496 }
13497 goto done;
13498 }
13499 p->mark = _mark;
13500 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013501 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013502 }
13503 { // del_t_atom
13504 if (p->error_indicator) {
13505 D(p->level--);
13506 return NULL;
13507 }
13508 D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13509 expr_ty del_t_atom_var;
13510 if (
13511 (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom
13512 )
13513 {
13514 D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13515 _res = del_t_atom_var;
13516 goto done;
13517 }
13518 p->mark = _mark;
13519 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
13520 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom"));
13521 }
13522 _res = NULL;
13523 done:
13524 _PyPegen_insert_memo(p, _mark, del_target_type, _res);
13525 D(p->level--);
13526 return _res;
13527}
13528
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013529// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013530static expr_ty
13531del_t_atom_rule(Parser *p)
13532{
13533 D(p->level++);
13534 if (p->error_indicator) {
13535 D(p->level--);
13536 return NULL;
13537 }
13538 expr_ty _res = NULL;
13539 int _mark = p->mark;
13540 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13541 p->error_indicator = 1;
13542 D(p->level--);
13543 return NULL;
13544 }
13545 int _start_lineno = p->tokens[_mark]->lineno;
13546 UNUSED(_start_lineno); // Only used by EXTRA macro
13547 int _start_col_offset = p->tokens[_mark]->col_offset;
13548 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013549 { // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013550 if (p->error_indicator) {
13551 D(p->level--);
13552 return NULL;
13553 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013554 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013555 expr_ty a;
13556 if (
13557 (a = _PyPegen_name_token(p)) // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013558 )
13559 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013560 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013561 _res = _PyPegen_set_expr_context ( p , a , Del );
13562 if (_res == NULL && PyErr_Occurred()) {
13563 p->error_indicator = 1;
13564 D(p->level--);
13565 return NULL;
13566 }
13567 goto done;
13568 }
13569 p->mark = _mark;
13570 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013571 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013572 }
13573 { // '(' del_target ')'
13574 if (p->error_indicator) {
13575 D(p->level--);
13576 return NULL;
13577 }
13578 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13579 Token * _literal;
13580 Token * _literal_1;
13581 expr_ty a;
13582 if (
13583 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13584 &&
13585 (a = del_target_rule(p)) // del_target
13586 &&
13587 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13588 )
13589 {
13590 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13591 _res = _PyPegen_set_expr_context ( p , a , Del );
13592 if (_res == NULL && PyErr_Occurred()) {
13593 p->error_indicator = 1;
13594 D(p->level--);
13595 return NULL;
13596 }
13597 goto done;
13598 }
13599 p->mark = _mark;
13600 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13601 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'"));
13602 }
13603 { // '(' del_targets? ')'
13604 if (p->error_indicator) {
13605 D(p->level--);
13606 return NULL;
13607 }
13608 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13609 Token * _literal;
13610 Token * _literal_1;
13611 void *a;
13612 if (
13613 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13614 &&
13615 (a = del_targets_rule(p), 1) // del_targets?
13616 &&
13617 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13618 )
13619 {
13620 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13621 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13622 if (_token == NULL) {
13623 D(p->level--);
13624 return NULL;
13625 }
13626 int _end_lineno = _token->end_lineno;
13627 UNUSED(_end_lineno); // Only used by EXTRA macro
13628 int _end_col_offset = _token->end_col_offset;
13629 UNUSED(_end_col_offset); // Only used by EXTRA macro
13630 _res = _Py_Tuple ( a , Del , EXTRA );
13631 if (_res == NULL && PyErr_Occurred()) {
13632 p->error_indicator = 1;
13633 D(p->level--);
13634 return NULL;
13635 }
13636 goto done;
13637 }
13638 p->mark = _mark;
13639 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13640 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'"));
13641 }
13642 { // '[' del_targets? ']'
13643 if (p->error_indicator) {
13644 D(p->level--);
13645 return NULL;
13646 }
13647 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13648 Token * _literal;
13649 Token * _literal_1;
13650 void *a;
13651 if (
13652 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13653 &&
13654 (a = del_targets_rule(p), 1) // del_targets?
13655 &&
13656 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13657 )
13658 {
13659 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13660 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13661 if (_token == NULL) {
13662 D(p->level--);
13663 return NULL;
13664 }
13665 int _end_lineno = _token->end_lineno;
13666 UNUSED(_end_lineno); // Only used by EXTRA macro
13667 int _end_col_offset = _token->end_col_offset;
13668 UNUSED(_end_col_offset); // Only used by EXTRA macro
13669 _res = _Py_List ( a , Del , EXTRA );
13670 if (_res == NULL && PyErr_Occurred()) {
13671 p->error_indicator = 1;
13672 D(p->level--);
13673 return NULL;
13674 }
13675 goto done;
13676 }
13677 p->mark = _mark;
13678 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13679 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'"));
13680 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013681 _res = NULL;
13682 done:
13683 D(p->level--);
13684 return _res;
13685}
13686
13687// targets: ','.target+ ','?
13688static asdl_seq*
13689targets_rule(Parser *p)
13690{
13691 D(p->level++);
13692 if (p->error_indicator) {
13693 D(p->level--);
13694 return NULL;
13695 }
13696 asdl_seq* _res = NULL;
13697 int _mark = p->mark;
13698 { // ','.target+ ','?
13699 if (p->error_indicator) {
13700 D(p->level--);
13701 return NULL;
13702 }
13703 D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13704 void *_opt_var;
13705 UNUSED(_opt_var); // Silence compiler warnings
13706 asdl_seq * a;
13707 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010013708 (a = _gather_125_rule(p)) // ','.target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013709 &&
13710 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13711 )
13712 {
13713 D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13714 _res = a;
13715 if (_res == NULL && PyErr_Occurred()) {
13716 p->error_indicator = 1;
13717 D(p->level--);
13718 return NULL;
13719 }
13720 goto done;
13721 }
13722 p->mark = _mark;
13723 D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ',
13724 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?"));
13725 }
13726 _res = NULL;
13727 done:
13728 D(p->level--);
13729 return _res;
13730}
13731
13732// target:
13733// | t_primary '.' NAME !t_lookahead
13734// | t_primary '[' slices ']' !t_lookahead
13735// | t_atom
13736static expr_ty
13737target_rule(Parser *p)
13738{
13739 D(p->level++);
13740 if (p->error_indicator) {
13741 D(p->level--);
13742 return NULL;
13743 }
13744 expr_ty _res = NULL;
13745 if (_PyPegen_is_memoized(p, target_type, &_res)) {
13746 D(p->level--);
13747 return _res;
13748 }
13749 int _mark = p->mark;
13750 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13751 p->error_indicator = 1;
13752 D(p->level--);
13753 return NULL;
13754 }
13755 int _start_lineno = p->tokens[_mark]->lineno;
13756 UNUSED(_start_lineno); // Only used by EXTRA macro
13757 int _start_col_offset = p->tokens[_mark]->col_offset;
13758 UNUSED(_start_col_offset); // Only used by EXTRA macro
13759 { // t_primary '.' NAME !t_lookahead
13760 if (p->error_indicator) {
13761 D(p->level--);
13762 return NULL;
13763 }
13764 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13765 Token * _literal;
13766 expr_ty a;
13767 expr_ty b;
13768 if (
13769 (a = t_primary_rule(p)) // t_primary
13770 &&
13771 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13772 &&
13773 (b = _PyPegen_name_token(p)) // NAME
13774 &&
13775 _PyPegen_lookahead(0, t_lookahead_rule, p)
13776 )
13777 {
13778 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13779 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13780 if (_token == NULL) {
13781 D(p->level--);
13782 return NULL;
13783 }
13784 int _end_lineno = _token->end_lineno;
13785 UNUSED(_end_lineno); // Only used by EXTRA macro
13786 int _end_col_offset = _token->end_col_offset;
13787 UNUSED(_end_col_offset); // Only used by EXTRA macro
13788 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13789 if (_res == NULL && PyErr_Occurred()) {
13790 p->error_indicator = 1;
13791 D(p->level--);
13792 return NULL;
13793 }
13794 goto done;
13795 }
13796 p->mark = _mark;
13797 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13798 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13799 }
13800 { // t_primary '[' slices ']' !t_lookahead
13801 if (p->error_indicator) {
13802 D(p->level--);
13803 return NULL;
13804 }
13805 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13806 Token * _literal;
13807 Token * _literal_1;
13808 expr_ty a;
13809 expr_ty b;
13810 if (
13811 (a = t_primary_rule(p)) // t_primary
13812 &&
13813 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13814 &&
13815 (b = slices_rule(p)) // slices
13816 &&
13817 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13818 &&
13819 _PyPegen_lookahead(0, t_lookahead_rule, p)
13820 )
13821 {
13822 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13823 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13824 if (_token == NULL) {
13825 D(p->level--);
13826 return NULL;
13827 }
13828 int _end_lineno = _token->end_lineno;
13829 UNUSED(_end_lineno); // Only used by EXTRA macro
13830 int _end_col_offset = _token->end_col_offset;
13831 UNUSED(_end_col_offset); // Only used by EXTRA macro
13832 _res = _Py_Subscript ( a , b , Store , EXTRA );
13833 if (_res == NULL && PyErr_Occurred()) {
13834 p->error_indicator = 1;
13835 D(p->level--);
13836 return NULL;
13837 }
13838 goto done;
13839 }
13840 p->mark = _mark;
13841 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13842 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13843 }
13844 { // t_atom
13845 if (p->error_indicator) {
13846 D(p->level--);
13847 return NULL;
13848 }
13849 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom"));
13850 expr_ty t_atom_var;
13851 if (
13852 (t_atom_var = t_atom_rule(p)) // t_atom
13853 )
13854 {
13855 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom"));
13856 _res = t_atom_var;
13857 goto done;
13858 }
13859 p->mark = _mark;
13860 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13861 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom"));
13862 }
13863 _res = NULL;
13864 done:
13865 _PyPegen_insert_memo(p, _mark, target_type, _res);
13866 D(p->level--);
13867 return _res;
13868}
13869
13870// Left-recursive
13871// t_primary:
13872// | t_primary '.' NAME &t_lookahead
13873// | t_primary '[' slices ']' &t_lookahead
13874// | t_primary genexp &t_lookahead
13875// | t_primary '(' arguments? ')' &t_lookahead
13876// | atom &t_lookahead
13877static expr_ty t_primary_raw(Parser *);
13878static expr_ty
13879t_primary_rule(Parser *p)
13880{
13881 D(p->level++);
13882 expr_ty _res = NULL;
13883 if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
13884 D(p->level--);
13885 return _res;
13886 }
13887 int _mark = p->mark;
13888 int _resmark = p->mark;
13889 while (1) {
13890 int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
13891 if (tmpvar_8) {
13892 D(p->level--);
13893 return _res;
13894 }
13895 p->mark = _mark;
13896 void *_raw = t_primary_raw(p);
13897 if (_raw == NULL || p->mark <= _resmark)
13898 break;
13899 _resmark = p->mark;
13900 _res = _raw;
13901 }
13902 p->mark = _resmark;
13903 D(p->level--);
13904 return _res;
13905}
13906static expr_ty
13907t_primary_raw(Parser *p)
13908{
13909 D(p->level++);
13910 if (p->error_indicator) {
13911 D(p->level--);
13912 return NULL;
13913 }
13914 expr_ty _res = NULL;
13915 int _mark = p->mark;
13916 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13917 p->error_indicator = 1;
13918 D(p->level--);
13919 return NULL;
13920 }
13921 int _start_lineno = p->tokens[_mark]->lineno;
13922 UNUSED(_start_lineno); // Only used by EXTRA macro
13923 int _start_col_offset = p->tokens[_mark]->col_offset;
13924 UNUSED(_start_col_offset); // Only used by EXTRA macro
13925 { // t_primary '.' NAME &t_lookahead
13926 if (p->error_indicator) {
13927 D(p->level--);
13928 return NULL;
13929 }
13930 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13931 Token * _literal;
13932 expr_ty a;
13933 expr_ty b;
13934 if (
13935 (a = t_primary_rule(p)) // t_primary
13936 &&
13937 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13938 &&
13939 (b = _PyPegen_name_token(p)) // NAME
13940 &&
13941 _PyPegen_lookahead(1, t_lookahead_rule, p)
13942 )
13943 {
13944 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13945 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13946 if (_token == NULL) {
13947 D(p->level--);
13948 return NULL;
13949 }
13950 int _end_lineno = _token->end_lineno;
13951 UNUSED(_end_lineno); // Only used by EXTRA macro
13952 int _end_col_offset = _token->end_col_offset;
13953 UNUSED(_end_col_offset); // Only used by EXTRA macro
13954 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
13955 if (_res == NULL && PyErr_Occurred()) {
13956 p->error_indicator = 1;
13957 D(p->level--);
13958 return NULL;
13959 }
13960 goto done;
13961 }
13962 p->mark = _mark;
13963 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
13964 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13965 }
13966 { // t_primary '[' slices ']' &t_lookahead
13967 if (p->error_indicator) {
13968 D(p->level--);
13969 return NULL;
13970 }
13971 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
13972 Token * _literal;
13973 Token * _literal_1;
13974 expr_ty a;
13975 expr_ty b;
13976 if (
13977 (a = t_primary_rule(p)) // t_primary
13978 &&
13979 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13980 &&
13981 (b = slices_rule(p)) // slices
13982 &&
13983 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13984 &&
13985 _PyPegen_lookahead(1, t_lookahead_rule, p)
13986 )
13987 {
13988 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
13989 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13990 if (_token == NULL) {
13991 D(p->level--);
13992 return NULL;
13993 }
13994 int _end_lineno = _token->end_lineno;
13995 UNUSED(_end_lineno); // Only used by EXTRA macro
13996 int _end_col_offset = _token->end_col_offset;
13997 UNUSED(_end_col_offset); // Only used by EXTRA macro
13998 _res = _Py_Subscript ( a , b , Load , EXTRA );
13999 if (_res == NULL && PyErr_Occurred()) {
14000 p->error_indicator = 1;
14001 D(p->level--);
14002 return NULL;
14003 }
14004 goto done;
14005 }
14006 p->mark = _mark;
14007 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14008 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14009 }
14010 { // t_primary genexp &t_lookahead
14011 if (p->error_indicator) {
14012 D(p->level--);
14013 return NULL;
14014 }
14015 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14016 expr_ty a;
14017 expr_ty b;
14018 if (
14019 (a = t_primary_rule(p)) // t_primary
14020 &&
14021 (b = genexp_rule(p)) // genexp
14022 &&
14023 _PyPegen_lookahead(1, t_lookahead_rule, p)
14024 )
14025 {
14026 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14027 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14028 if (_token == NULL) {
14029 D(p->level--);
14030 return NULL;
14031 }
14032 int _end_lineno = _token->end_lineno;
14033 UNUSED(_end_lineno); // Only used by EXTRA macro
14034 int _end_col_offset = _token->end_col_offset;
14035 UNUSED(_end_col_offset); // Only used by EXTRA macro
14036 _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
14037 if (_res == NULL && PyErr_Occurred()) {
14038 p->error_indicator = 1;
14039 D(p->level--);
14040 return NULL;
14041 }
14042 goto done;
14043 }
14044 p->mark = _mark;
14045 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14046 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
14047 }
14048 { // t_primary '(' arguments? ')' &t_lookahead
14049 if (p->error_indicator) {
14050 D(p->level--);
14051 return NULL;
14052 }
14053 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14054 Token * _literal;
14055 Token * _literal_1;
14056 expr_ty a;
14057 void *b;
14058 if (
14059 (a = t_primary_rule(p)) // t_primary
14060 &&
14061 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14062 &&
14063 (b = arguments_rule(p), 1) // arguments?
14064 &&
14065 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14066 &&
14067 _PyPegen_lookahead(1, t_lookahead_rule, p)
14068 )
14069 {
14070 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14071 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14072 if (_token == NULL) {
14073 D(p->level--);
14074 return NULL;
14075 }
14076 int _end_lineno = _token->end_lineno;
14077 UNUSED(_end_lineno); // Only used by EXTRA macro
14078 int _end_col_offset = _token->end_col_offset;
14079 UNUSED(_end_col_offset); // Only used by EXTRA macro
14080 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
14081 if (_res == NULL && PyErr_Occurred()) {
14082 p->error_indicator = 1;
14083 D(p->level--);
14084 return NULL;
14085 }
14086 goto done;
14087 }
14088 p->mark = _mark;
14089 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14090 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14091 }
14092 { // atom &t_lookahead
14093 if (p->error_indicator) {
14094 D(p->level--);
14095 return NULL;
14096 }
14097 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14098 expr_ty a;
14099 if (
14100 (a = atom_rule(p)) // atom
14101 &&
14102 _PyPegen_lookahead(1, t_lookahead_rule, p)
14103 )
14104 {
14105 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14106 _res = a;
14107 if (_res == NULL && PyErr_Occurred()) {
14108 p->error_indicator = 1;
14109 D(p->level--);
14110 return NULL;
14111 }
14112 goto done;
14113 }
14114 p->mark = _mark;
14115 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14116 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
14117 }
14118 _res = NULL;
14119 done:
14120 D(p->level--);
14121 return _res;
14122}
14123
14124// t_lookahead: '(' | '[' | '.'
14125static void *
14126t_lookahead_rule(Parser *p)
14127{
14128 D(p->level++);
14129 if (p->error_indicator) {
14130 D(p->level--);
14131 return NULL;
14132 }
14133 void * _res = NULL;
14134 int _mark = p->mark;
14135 { // '('
14136 if (p->error_indicator) {
14137 D(p->level--);
14138 return NULL;
14139 }
14140 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
14141 Token * _literal;
14142 if (
14143 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14144 )
14145 {
14146 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
14147 _res = _literal;
14148 goto done;
14149 }
14150 p->mark = _mark;
14151 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14152 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
14153 }
14154 { // '['
14155 if (p->error_indicator) {
14156 D(p->level--);
14157 return NULL;
14158 }
14159 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
14160 Token * _literal;
14161 if (
14162 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14163 )
14164 {
14165 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
14166 _res = _literal;
14167 goto done;
14168 }
14169 p->mark = _mark;
14170 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14171 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
14172 }
14173 { // '.'
14174 if (p->error_indicator) {
14175 D(p->level--);
14176 return NULL;
14177 }
14178 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
14179 Token * _literal;
14180 if (
14181 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
14182 )
14183 {
14184 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
14185 _res = _literal;
14186 goto done;
14187 }
14188 p->mark = _mark;
14189 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14190 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
14191 }
14192 _res = NULL;
14193 done:
14194 D(p->level--);
14195 return _res;
14196}
14197
14198// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
14199static expr_ty
14200t_atom_rule(Parser *p)
14201{
14202 D(p->level++);
14203 if (p->error_indicator) {
14204 D(p->level--);
14205 return NULL;
14206 }
14207 expr_ty _res = NULL;
14208 int _mark = p->mark;
14209 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
14210 p->error_indicator = 1;
14211 D(p->level--);
14212 return NULL;
14213 }
14214 int _start_lineno = p->tokens[_mark]->lineno;
14215 UNUSED(_start_lineno); // Only used by EXTRA macro
14216 int _start_col_offset = p->tokens[_mark]->col_offset;
14217 UNUSED(_start_col_offset); // Only used by EXTRA macro
14218 { // NAME
14219 if (p->error_indicator) {
14220 D(p->level--);
14221 return NULL;
14222 }
14223 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
14224 expr_ty a;
14225 if (
14226 (a = _PyPegen_name_token(p)) // NAME
14227 )
14228 {
14229 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
14230 _res = _PyPegen_set_expr_context ( p , a , Store );
14231 if (_res == NULL && PyErr_Occurred()) {
14232 p->error_indicator = 1;
14233 D(p->level--);
14234 return NULL;
14235 }
14236 goto done;
14237 }
14238 p->mark = _mark;
14239 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14240 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
14241 }
14242 { // '(' target ')'
14243 if (p->error_indicator) {
14244 D(p->level--);
14245 return NULL;
14246 }
14247 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14248 Token * _literal;
14249 Token * _literal_1;
14250 expr_ty a;
14251 if (
14252 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14253 &&
14254 (a = target_rule(p)) // target
14255 &&
14256 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14257 )
14258 {
14259 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14260 _res = _PyPegen_set_expr_context ( p , a , Store );
14261 if (_res == NULL && PyErr_Occurred()) {
14262 p->error_indicator = 1;
14263 D(p->level--);
14264 return NULL;
14265 }
14266 goto done;
14267 }
14268 p->mark = _mark;
14269 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14270 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'"));
14271 }
14272 { // '(' targets? ')'
14273 if (p->error_indicator) {
14274 D(p->level--);
14275 return NULL;
14276 }
14277 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14278 Token * _literal;
14279 Token * _literal_1;
14280 void *b;
14281 if (
14282 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14283 &&
14284 (b = targets_rule(p), 1) // targets?
14285 &&
14286 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14287 )
14288 {
14289 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14290 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14291 if (_token == NULL) {
14292 D(p->level--);
14293 return NULL;
14294 }
14295 int _end_lineno = _token->end_lineno;
14296 UNUSED(_end_lineno); // Only used by EXTRA macro
14297 int _end_col_offset = _token->end_col_offset;
14298 UNUSED(_end_col_offset); // Only used by EXTRA macro
14299 _res = _Py_Tuple ( b , Store , EXTRA );
14300 if (_res == NULL && PyErr_Occurred()) {
14301 p->error_indicator = 1;
14302 D(p->level--);
14303 return NULL;
14304 }
14305 goto done;
14306 }
14307 p->mark = _mark;
14308 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14309 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'"));
14310 }
14311 { // '[' targets? ']'
14312 if (p->error_indicator) {
14313 D(p->level--);
14314 return NULL;
14315 }
14316 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14317 Token * _literal;
14318 Token * _literal_1;
14319 void *b;
14320 if (
14321 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14322 &&
14323 (b = targets_rule(p), 1) // targets?
14324 &&
14325 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14326 )
14327 {
14328 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14329 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14330 if (_token == NULL) {
14331 D(p->level--);
14332 return NULL;
14333 }
14334 int _end_lineno = _token->end_lineno;
14335 UNUSED(_end_lineno); // Only used by EXTRA macro
14336 int _end_col_offset = _token->end_col_offset;
14337 UNUSED(_end_col_offset); // Only used by EXTRA macro
14338 _res = _Py_List ( b , Store , EXTRA );
14339 if (_res == NULL && PyErr_Occurred()) {
14340 p->error_indicator = 1;
14341 D(p->level--);
14342 return NULL;
14343 }
14344 goto done;
14345 }
14346 p->mark = _mark;
14347 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14348 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'"));
14349 }
14350 _res = NULL;
14351 done:
14352 D(p->level--);
14353 return _res;
14354}
14355
14356// incorrect_arguments:
14357// | args ',' '*'
14358// | expression for_if_clauses ',' [args | expression for_if_clauses]
14359// | args for_if_clauses
14360// | args ',' expression for_if_clauses
14361// | args ',' args
14362static void *
14363incorrect_arguments_rule(Parser *p)
14364{
14365 D(p->level++);
14366 if (p->error_indicator) {
14367 D(p->level--);
14368 return NULL;
14369 }
14370 void * _res = NULL;
14371 int _mark = p->mark;
14372 { // args ',' '*'
14373 if (p->error_indicator) {
14374 D(p->level--);
14375 return NULL;
14376 }
14377 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
14378 Token * _literal;
14379 Token * _literal_1;
14380 expr_ty args_var;
14381 if (
14382 (args_var = args_rule(p)) // args
14383 &&
14384 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14385 &&
14386 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
14387 )
14388 {
14389 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
14390 _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
14391 if (_res == NULL && PyErr_Occurred()) {
14392 p->error_indicator = 1;
14393 D(p->level--);
14394 return NULL;
14395 }
14396 goto done;
14397 }
14398 p->mark = _mark;
14399 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14400 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'"));
14401 }
14402 { // expression for_if_clauses ',' [args | expression for_if_clauses]
14403 if (p->error_indicator) {
14404 D(p->level--);
14405 return NULL;
14406 }
14407 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14408 Token * _literal;
14409 void *_opt_var;
14410 UNUSED(_opt_var); // Silence compiler warnings
14411 expr_ty a;
14412 asdl_seq* for_if_clauses_var;
14413 if (
14414 (a = expression_rule(p)) // expression
14415 &&
14416 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14417 &&
14418 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14419 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014420 (_opt_var = _tmp_127_rule(p), 1) // [args | expression for_if_clauses]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014421 )
14422 {
14423 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14424 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14425 if (_res == NULL && PyErr_Occurred()) {
14426 p->error_indicator = 1;
14427 D(p->level--);
14428 return NULL;
14429 }
14430 goto done;
14431 }
14432 p->mark = _mark;
14433 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14434 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14435 }
14436 { // args for_if_clauses
14437 if (p->error_indicator) {
14438 D(p->level--);
14439 return NULL;
14440 }
14441 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
14442 expr_ty a;
14443 asdl_seq* for_if_clauses_var;
14444 if (
14445 (a = args_rule(p)) // args
14446 &&
14447 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14448 )
14449 {
14450 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
14451 _res = _PyPegen_nonparen_genexp_in_call ( p , a );
14452 if (_res == NULL && PyErr_Occurred()) {
14453 p->error_indicator = 1;
14454 D(p->level--);
14455 return NULL;
14456 }
14457 goto done;
14458 }
14459 p->mark = _mark;
14460 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14461 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses"));
14462 }
14463 { // args ',' expression for_if_clauses
14464 if (p->error_indicator) {
14465 D(p->level--);
14466 return NULL;
14467 }
14468 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
14469 Token * _literal;
14470 expr_ty a;
14471 expr_ty args_var;
14472 asdl_seq* for_if_clauses_var;
14473 if (
14474 (args_var = args_rule(p)) // args
14475 &&
14476 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14477 &&
14478 (a = expression_rule(p)) // expression
14479 &&
14480 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14481 )
14482 {
14483 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
14484 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14485 if (_res == NULL && PyErr_Occurred()) {
14486 p->error_indicator = 1;
14487 D(p->level--);
14488 return NULL;
14489 }
14490 goto done;
14491 }
14492 p->mark = _mark;
14493 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14494 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses"));
14495 }
14496 { // args ',' args
14497 if (p->error_indicator) {
14498 D(p->level--);
14499 return NULL;
14500 }
14501 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args"));
14502 Token * _literal;
14503 expr_ty a;
14504 expr_ty args_var;
14505 if (
14506 (a = args_rule(p)) // args
14507 &&
14508 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14509 &&
14510 (args_var = args_rule(p)) // args
14511 )
14512 {
14513 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args"));
14514 _res = _PyPegen_arguments_parsing_error ( p , a );
14515 if (_res == NULL && PyErr_Occurred()) {
14516 p->error_indicator = 1;
14517 D(p->level--);
14518 return NULL;
14519 }
14520 goto done;
14521 }
14522 p->mark = _mark;
14523 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14524 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args"));
14525 }
14526 _res = NULL;
14527 done:
14528 D(p->level--);
14529 return _res;
14530}
14531
14532// invalid_kwarg: expression '='
14533static void *
14534invalid_kwarg_rule(Parser *p)
14535{
14536 D(p->level++);
14537 if (p->error_indicator) {
14538 D(p->level--);
14539 return NULL;
14540 }
14541 void * _res = NULL;
14542 int _mark = p->mark;
14543 { // expression '='
14544 if (p->error_indicator) {
14545 D(p->level--);
14546 return NULL;
14547 }
14548 D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='"));
14549 Token * _literal;
14550 expr_ty a;
14551 if (
14552 (a = expression_rule(p)) // expression
14553 &&
14554 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14555 )
14556 {
14557 D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='"));
14558 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" );
14559 if (_res == NULL && PyErr_Occurred()) {
14560 p->error_indicator = 1;
14561 D(p->level--);
14562 return NULL;
14563 }
14564 goto done;
14565 }
14566 p->mark = _mark;
14567 D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
14568 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='"));
14569 }
14570 _res = NULL;
14571 done:
14572 D(p->level--);
14573 return _res;
14574}
14575
14576// invalid_named_expression: expression ':=' expression
14577static void *
14578invalid_named_expression_rule(Parser *p)
14579{
14580 D(p->level++);
14581 if (p->error_indicator) {
14582 D(p->level--);
14583 return NULL;
14584 }
14585 void * _res = NULL;
14586 int _mark = p->mark;
14587 { // expression ':=' expression
14588 if (p->error_indicator) {
14589 D(p->level--);
14590 return NULL;
14591 }
14592 D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14593 Token * _literal;
14594 expr_ty a;
14595 expr_ty expression_var;
14596 if (
14597 (a = expression_rule(p)) // expression
14598 &&
14599 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
14600 &&
14601 (expression_var = expression_rule(p)) // expression
14602 )
14603 {
14604 D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14605 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
14606 if (_res == NULL && PyErr_Occurred()) {
14607 p->error_indicator = 1;
14608 D(p->level--);
14609 return NULL;
14610 }
14611 goto done;
14612 }
14613 p->mark = _mark;
14614 D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
14615 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression"));
14616 }
14617 _res = NULL;
14618 done:
14619 D(p->level--);
14620 return _res;
14621}
14622
14623// invalid_assignment:
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014624// | invalid_ann_assign_target ':' expression
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014625// | star_named_expression ',' star_named_expressions* ':' expression
14626// | expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014627// | ((star_targets '='))* star_expressions '='
14628// | ((star_targets '='))* yield_expr '='
14629// | star_expressions augassign (yield_expr | star_expressions)
14630static void *
14631invalid_assignment_rule(Parser *p)
14632{
14633 D(p->level++);
14634 if (p->error_indicator) {
14635 D(p->level--);
14636 return NULL;
14637 }
14638 void * _res = NULL;
14639 int _mark = p->mark;
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014640 { // invalid_ann_assign_target ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014641 if (p->error_indicator) {
14642 D(p->level--);
14643 return NULL;
14644 }
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014645 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014646 Token * _literal;
14647 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014648 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014649 if (
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014650 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014651 &&
14652 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014653 &&
14654 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014655 )
14656 {
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014657 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
14658 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not %s) can be annotated" , _PyPegen_get_expr_name ( a ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014659 if (_res == NULL && PyErr_Occurred()) {
14660 p->error_indicator = 1;
14661 D(p->level--);
14662 return NULL;
14663 }
14664 goto done;
14665 }
14666 p->mark = _mark;
14667 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014668 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014669 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014670 { // star_named_expression ',' star_named_expressions* ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014671 if (p->error_indicator) {
14672 D(p->level--);
14673 return NULL;
14674 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014675 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014676 Token * _literal;
14677 Token * _literal_1;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014678 asdl_seq * _loop0_128_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014679 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014680 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014681 if (
14682 (a = star_named_expression_rule(p)) // star_named_expression
14683 &&
14684 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14685 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014686 (_loop0_128_var = _loop0_128_rule(p)) // star_named_expressions*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014687 &&
14688 (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014689 &&
14690 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014691 )
14692 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014693 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014694 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
14695 if (_res == NULL && PyErr_Occurred()) {
14696 p->error_indicator = 1;
14697 D(p->level--);
14698 return NULL;
14699 }
14700 goto done;
14701 }
14702 p->mark = _mark;
14703 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014704 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014705 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014706 { // expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014707 if (p->error_indicator) {
14708 D(p->level--);
14709 return NULL;
14710 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014711 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014712 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014713 expr_ty a;
14714 expr_ty expression_var;
14715 if (
14716 (a = expression_rule(p)) // expression
14717 &&
14718 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
14719 &&
14720 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014721 )
14722 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014723 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014724 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
14725 if (_res == NULL && PyErr_Occurred()) {
14726 p->error_indicator = 1;
14727 D(p->level--);
14728 return NULL;
14729 }
14730 goto done;
14731 }
14732 p->mark = _mark;
14733 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014734 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014735 }
14736 { // ((star_targets '='))* star_expressions '='
14737 if (p->error_indicator) {
14738 D(p->level--);
14739 return NULL;
14740 }
14741 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14742 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014743 asdl_seq * _loop0_129_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014744 expr_ty a;
14745 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010014746 (_loop0_129_var = _loop0_129_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014747 &&
14748 (a = star_expressions_rule(p)) // star_expressions
14749 &&
14750 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14751 )
14752 {
14753 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
Lysandros Nikolaou6c4e0bd2020-06-21 05:18:01 +030014754 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014755 if (_res == NULL && PyErr_Occurred()) {
14756 p->error_indicator = 1;
14757 D(p->level--);
14758 return NULL;
14759 }
14760 goto done;
14761 }
14762 p->mark = _mark;
14763 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14764 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14765 }
14766 { // ((star_targets '='))* yield_expr '='
14767 if (p->error_indicator) {
14768 D(p->level--);
14769 return NULL;
14770 }
14771 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14772 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014773 asdl_seq * _loop0_130_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014774 expr_ty a;
14775 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010014776 (_loop0_130_var = _loop0_130_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014777 &&
14778 (a = yield_expr_rule(p)) // yield_expr
14779 &&
14780 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14781 )
14782 {
14783 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14784 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
14785 if (_res == NULL && PyErr_Occurred()) {
14786 p->error_indicator = 1;
14787 D(p->level--);
14788 return NULL;
14789 }
14790 goto done;
14791 }
14792 p->mark = _mark;
14793 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14794 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14795 }
14796 { // star_expressions augassign (yield_expr | star_expressions)
14797 if (p->error_indicator) {
14798 D(p->level--);
14799 return NULL;
14800 }
14801 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010014802 void *_tmp_131_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014803 expr_ty a;
14804 AugOperator* augassign_var;
14805 if (
14806 (a = star_expressions_rule(p)) // star_expressions
14807 &&
14808 (augassign_var = augassign_rule(p)) // augassign
14809 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014810 (_tmp_131_var = _tmp_131_rule(p)) // yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014811 )
14812 {
14813 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14814 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
14815 if (_res == NULL && PyErr_Occurred()) {
14816 p->error_indicator = 1;
14817 D(p->level--);
14818 return NULL;
14819 }
14820 goto done;
14821 }
14822 p->mark = _mark;
14823 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14824 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14825 }
14826 _res = NULL;
14827 done:
14828 D(p->level--);
14829 return _res;
14830}
14831
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014832// invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')'
14833static expr_ty
14834invalid_ann_assign_target_rule(Parser *p)
14835{
14836 D(p->level++);
14837 if (p->error_indicator) {
14838 D(p->level--);
14839 return NULL;
14840 }
14841 expr_ty _res = NULL;
14842 int _mark = p->mark;
14843 { // list
14844 if (p->error_indicator) {
14845 D(p->level--);
14846 return NULL;
14847 }
14848 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
14849 expr_ty list_var;
14850 if (
14851 (list_var = list_rule(p)) // list
14852 )
14853 {
14854 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
14855 _res = list_var;
14856 goto done;
14857 }
14858 p->mark = _mark;
14859 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14860 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
14861 }
14862 { // tuple
14863 if (p->error_indicator) {
14864 D(p->level--);
14865 return NULL;
14866 }
14867 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
14868 expr_ty tuple_var;
14869 if (
14870 (tuple_var = tuple_rule(p)) // tuple
14871 )
14872 {
14873 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
14874 _res = tuple_var;
14875 goto done;
14876 }
14877 p->mark = _mark;
14878 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14879 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
14880 }
14881 { // '(' invalid_ann_assign_target ')'
14882 if (p->error_indicator) {
14883 D(p->level--);
14884 return NULL;
14885 }
14886 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14887 Token * _literal;
14888 Token * _literal_1;
14889 expr_ty a;
14890 if (
14891 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14892 &&
14893 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
14894 &&
14895 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14896 )
14897 {
14898 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14899 _res = a;
14900 if (_res == NULL && PyErr_Occurred()) {
14901 p->error_indicator = 1;
14902 D(p->level--);
14903 return NULL;
14904 }
14905 goto done;
14906 }
14907 p->mark = _mark;
14908 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14909 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14910 }
14911 _res = NULL;
14912 done:
14913 D(p->level--);
14914 return _res;
14915}
14916
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014917// invalid_del_stmt: 'del' star_expressions
14918static void *
14919invalid_del_stmt_rule(Parser *p)
14920{
14921 D(p->level++);
14922 if (p->error_indicator) {
14923 D(p->level--);
14924 return NULL;
14925 }
14926 void * _res = NULL;
14927 int _mark = p->mark;
14928 { // 'del' star_expressions
14929 if (p->error_indicator) {
14930 D(p->level--);
14931 return NULL;
14932 }
14933 D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
14934 Token * _keyword;
14935 expr_ty a;
14936 if (
14937 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
14938 &&
14939 (a = star_expressions_rule(p)) // star_expressions
14940 )
14941 {
14942 D(fprintf(stderr, "%*c+ invalid_del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
Lysandros Nikolaou6c4e0bd2020-06-21 05:18:01 +030014943 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014944 if (_res == NULL && PyErr_Occurred()) {
14945 p->error_indicator = 1;
14946 D(p->level--);
14947 return NULL;
14948 }
14949 goto done;
14950 }
14951 p->mark = _mark;
14952 D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
14953 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions"));
14954 }
14955 _res = NULL;
14956 done:
14957 D(p->level--);
14958 return _res;
14959}
14960
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014961// invalid_block: NEWLINE !INDENT
14962static void *
14963invalid_block_rule(Parser *p)
14964{
14965 D(p->level++);
14966 if (p->error_indicator) {
14967 D(p->level--);
14968 return NULL;
14969 }
14970 void * _res = NULL;
14971 int _mark = p->mark;
14972 { // NEWLINE !INDENT
14973 if (p->error_indicator) {
14974 D(p->level--);
14975 return NULL;
14976 }
14977 D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
14978 Token * newline_var;
14979 if (
14980 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
14981 &&
14982 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
14983 )
14984 {
14985 D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
14986 _res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
14987 if (_res == NULL && PyErr_Occurred()) {
14988 p->error_indicator = 1;
14989 D(p->level--);
14990 return NULL;
14991 }
14992 goto done;
14993 }
14994 p->mark = _mark;
14995 D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ',
14996 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT"));
14997 }
14998 _res = NULL;
14999 done:
15000 D(p->level--);
15001 return _res;
15002}
15003
15004// invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses
15005static void *
15006invalid_comprehension_rule(Parser *p)
15007{
15008 D(p->level++);
15009 if (p->error_indicator) {
15010 D(p->level--);
15011 return NULL;
15012 }
15013 void * _res = NULL;
15014 int _mark = p->mark;
15015 { // ('[' | '(' | '{') starred_expression for_if_clauses
15016 if (p->error_indicator) {
15017 D(p->level--);
15018 return NULL;
15019 }
15020 D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010015021 void *_tmp_132_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015022 expr_ty a;
15023 asdl_seq* for_if_clauses_var;
15024 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015025 (_tmp_132_var = _tmp_132_rule(p)) // '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015026 &&
15027 (a = starred_expression_rule(p)) // starred_expression
15028 &&
15029 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15030 )
15031 {
15032 D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15033 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" );
15034 if (_res == NULL && PyErr_Occurred()) {
15035 p->error_indicator = 1;
15036 D(p->level--);
15037 return NULL;
15038 }
15039 goto done;
15040 }
15041 p->mark = _mark;
15042 D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15043 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15044 }
15045 _res = NULL;
15046 done:
15047 D(p->level--);
15048 return _res;
15049}
15050
15051// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
15052static void *
15053invalid_dict_comprehension_rule(Parser *p)
15054{
15055 D(p->level++);
15056 if (p->error_indicator) {
15057 D(p->level--);
15058 return NULL;
15059 }
15060 void * _res = NULL;
15061 int _mark = p->mark;
15062 { // '{' '**' bitwise_or for_if_clauses '}'
15063 if (p->error_indicator) {
15064 D(p->level--);
15065 return NULL;
15066 }
15067 D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15068 Token * _literal;
15069 Token * _literal_1;
15070 Token * a;
15071 expr_ty bitwise_or_var;
15072 asdl_seq* for_if_clauses_var;
15073 if (
15074 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
15075 &&
15076 (a = _PyPegen_expect_token(p, 35)) // token='**'
15077 &&
15078 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
15079 &&
15080 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15081 &&
15082 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
15083 )
15084 {
15085 D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15086 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
15087 if (_res == NULL && PyErr_Occurred()) {
15088 p->error_indicator = 1;
15089 D(p->level--);
15090 return NULL;
15091 }
15092 goto done;
15093 }
15094 p->mark = _mark;
15095 D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15096 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15097 }
15098 _res = NULL;
15099 done:
15100 D(p->level--);
15101 return _res;
15102}
15103
15104// invalid_parameters:
15105// | param_no_default* (slash_with_default | param_with_default+) param_no_default
15106static void *
15107invalid_parameters_rule(Parser *p)
15108{
15109 D(p->level++);
15110 if (p->error_indicator) {
15111 D(p->level--);
15112 return NULL;
15113 }
15114 void * _res = NULL;
15115 int _mark = p->mark;
15116 { // param_no_default* (slash_with_default | param_with_default+) param_no_default
15117 if (p->error_indicator) {
15118 D(p->level--);
15119 return NULL;
15120 }
15121 D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010015122 asdl_seq * _loop0_133_var;
15123 void *_tmp_134_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015124 arg_ty param_no_default_var;
15125 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015126 (_loop0_133_var = _loop0_133_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015127 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015128 (_tmp_134_var = _tmp_134_rule(p)) // slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015129 &&
15130 (param_no_default_var = param_no_default_rule(p)) // param_no_default
15131 )
15132 {
15133 D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
15134 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15135 if (_res == NULL && PyErr_Occurred()) {
15136 p->error_indicator = 1;
15137 D(p->level--);
15138 return NULL;
15139 }
15140 goto done;
15141 }
15142 p->mark = _mark;
15143 D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15144 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
15145 }
15146 _res = NULL;
15147 done:
15148 D(p->level--);
15149 return _res;
15150}
15151
15152// invalid_lambda_parameters:
15153// | lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15154static void *
15155invalid_lambda_parameters_rule(Parser *p)
15156{
15157 D(p->level++);
15158 if (p->error_indicator) {
15159 D(p->level--);
15160 return NULL;
15161 }
15162 void * _res = NULL;
15163 int _mark = p->mark;
15164 { // lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15165 if (p->error_indicator) {
15166 D(p->level--);
15167 return NULL;
15168 }
15169 D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010015170 asdl_seq * _loop0_135_var;
15171 void *_tmp_136_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015172 arg_ty lambda_param_no_default_var;
15173 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015174 (_loop0_135_var = _loop0_135_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015175 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015176 (_tmp_136_var = _tmp_136_rule(p)) // lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015177 &&
15178 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
15179 )
15180 {
15181 D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
15182 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15183 if (_res == NULL && PyErr_Occurred()) {
15184 p->error_indicator = 1;
15185 D(p->level--);
15186 return NULL;
15187 }
15188 goto done;
15189 }
15190 p->mark = _mark;
15191 D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15192 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
15193 }
15194 _res = NULL;
15195 done:
15196 D(p->level--);
15197 return _res;
15198}
15199
15200// invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT
15201static void *
15202invalid_star_etc_rule(Parser *p)
15203{
15204 D(p->level++);
15205 if (p->error_indicator) {
15206 D(p->level--);
15207 return NULL;
15208 }
15209 void * _res = NULL;
15210 int _mark = p->mark;
15211 { // '*' (')' | ',' (')' | '**'))
15212 if (p->error_indicator) {
15213 D(p->level--);
15214 return NULL;
15215 }
15216 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15217 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010015218 void *_tmp_137_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015219 if (
15220 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15221 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015222 (_tmp_137_var = _tmp_137_rule(p)) // ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015223 )
15224 {
15225 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15226 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15227 if (_res == NULL && PyErr_Occurred()) {
15228 p->error_indicator = 1;
15229 D(p->level--);
15230 return NULL;
15231 }
15232 goto done;
15233 }
15234 p->mark = _mark;
15235 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15236 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15237 }
15238 { // '*' ',' TYPE_COMMENT
15239 if (p->error_indicator) {
15240 D(p->level--);
15241 return NULL;
15242 }
15243 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15244 Token * _literal;
15245 Token * _literal_1;
15246 Token * type_comment_var;
15247 if (
15248 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15249 &&
15250 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
15251 &&
15252 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15253 )
15254 {
15255 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15256 _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
15257 if (_res == NULL && PyErr_Occurred()) {
15258 p->error_indicator = 1;
15259 D(p->level--);
15260 return NULL;
15261 }
15262 goto done;
15263 }
15264 p->mark = _mark;
15265 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15266 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15267 }
15268 _res = NULL;
15269 done:
15270 D(p->level--);
15271 return _res;
15272}
15273
15274// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**'))
15275static void *
15276invalid_lambda_star_etc_rule(Parser *p)
15277{
15278 D(p->level++);
15279 if (p->error_indicator) {
15280 D(p->level--);
15281 return NULL;
15282 }
15283 void * _res = NULL;
15284 int _mark = p->mark;
15285 { // '*' (':' | ',' (':' | '**'))
15286 if (p->error_indicator) {
15287 D(p->level--);
15288 return NULL;
15289 }
15290 D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15291 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010015292 void *_tmp_138_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015293 if (
15294 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15295 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015296 (_tmp_138_var = _tmp_138_rule(p)) // ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015297 )
15298 {
15299 D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15300 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15301 if (_res == NULL && PyErr_Occurred()) {
15302 p->error_indicator = 1;
15303 D(p->level--);
15304 return NULL;
15305 }
15306 goto done;
15307 }
15308 p->mark = _mark;
15309 D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15310 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15311 }
15312 _res = NULL;
15313 done:
15314 D(p->level--);
15315 return _res;
15316}
15317
15318// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15319static void *
15320invalid_double_type_comments_rule(Parser *p)
15321{
15322 D(p->level++);
15323 if (p->error_indicator) {
15324 D(p->level--);
15325 return NULL;
15326 }
15327 void * _res = NULL;
15328 int _mark = p->mark;
15329 { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15330 if (p->error_indicator) {
15331 D(p->level--);
15332 return NULL;
15333 }
15334 D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15335 Token * indent_var;
15336 Token * newline_var;
15337 Token * newline_var_1;
15338 Token * type_comment_var;
15339 Token * type_comment_var_1;
15340 if (
15341 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15342 &&
15343 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15344 &&
15345 (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15346 &&
15347 (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15348 &&
15349 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
15350 )
15351 {
15352 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"));
15353 _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
15354 if (_res == NULL && PyErr_Occurred()) {
15355 p->error_indicator = 1;
15356 D(p->level--);
15357 return NULL;
15358 }
15359 goto done;
15360 }
15361 p->mark = _mark;
15362 D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ',
15363 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15364 }
15365 _res = NULL;
15366 done:
15367 D(p->level--);
15368 return _res;
15369}
15370
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015371// invalid_with_item: expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015372static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015373invalid_with_item_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015374{
15375 D(p->level++);
15376 if (p->error_indicator) {
15377 D(p->level--);
15378 return NULL;
15379 }
15380 void * _res = NULL;
15381 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015382 { // expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015383 if (p->error_indicator) {
15384 D(p->level--);
15385 return NULL;
15386 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015387 D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression"));
15388 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015389 expr_ty a;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015390 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015391 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015392 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015393 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015394 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
15395 &&
15396 (a = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015397 )
15398 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015399 D(fprintf(stderr, "%*c+ invalid_with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' expression"));
Lysandros Nikolaou6c4e0bd2020-06-21 05:18:01 +030015400 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015401 if (_res == NULL && PyErr_Occurred()) {
15402 p->error_indicator = 1;
15403 D(p->level--);
15404 return NULL;
15405 }
15406 goto done;
15407 }
15408 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015409 D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ',
15410 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression"));
15411 }
15412 _res = NULL;
15413 done:
15414 D(p->level--);
15415 return _res;
15416}
15417
15418// invalid_for_target: ASYNC? 'for' star_expressions
15419static void *
15420invalid_for_target_rule(Parser *p)
15421{
15422 D(p->level++);
15423 if (p->error_indicator) {
15424 D(p->level--);
15425 return NULL;
15426 }
15427 void * _res = NULL;
15428 int _mark = p->mark;
15429 { // ASYNC? 'for' star_expressions
15430 if (p->error_indicator) {
15431 D(p->level--);
15432 return NULL;
15433 }
15434 D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
15435 Token * _keyword;
15436 void *_opt_var;
15437 UNUSED(_opt_var); // Silence compiler warnings
15438 expr_ty a;
15439 if (
15440 (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
15441 &&
15442 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
15443 &&
15444 (a = star_expressions_rule(p)) // star_expressions
15445 )
15446 {
15447 D(fprintf(stderr, "%*c+ invalid_for_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
Lysandros Nikolaou6c4e0bd2020-06-21 05:18:01 +030015448 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015449 if (_res == NULL && PyErr_Occurred()) {
15450 p->error_indicator = 1;
15451 D(p->level--);
15452 return NULL;
15453 }
15454 goto done;
15455 }
15456 p->mark = _mark;
15457 D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ',
15458 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions"));
15459 }
15460 _res = NULL;
15461 done:
15462 D(p->level--);
15463 return _res;
15464}
15465
15466// invalid_group: '(' starred_expression ')'
15467static void *
15468invalid_group_rule(Parser *p)
15469{
15470 D(p->level++);
15471 if (p->error_indicator) {
15472 D(p->level--);
15473 return NULL;
15474 }
15475 void * _res = NULL;
15476 int _mark = p->mark;
15477 { // '(' starred_expression ')'
15478 if (p->error_indicator) {
15479 D(p->level--);
15480 return NULL;
15481 }
15482 D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15483 Token * _literal;
15484 Token * _literal_1;
15485 expr_ty a;
15486 if (
15487 (_literal = _PyPegen_expect_token(p, 7)) // token='('
15488 &&
15489 (a = starred_expression_rule(p)) // starred_expression
15490 &&
15491 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
15492 )
15493 {
15494 D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15495 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "can't use starred expression here" );
15496 if (_res == NULL && PyErr_Occurred()) {
15497 p->error_indicator = 1;
15498 D(p->level--);
15499 return NULL;
15500 }
15501 goto done;
15502 }
15503 p->mark = _mark;
15504 D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
15505 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015506 }
15507 _res = NULL;
15508 done:
15509 D(p->level--);
15510 return _res;
15511}
15512
15513// invalid_import_from_targets: import_from_as_names ','
15514static void *
15515invalid_import_from_targets_rule(Parser *p)
15516{
15517 D(p->level++);
15518 if (p->error_indicator) {
15519 D(p->level--);
15520 return NULL;
15521 }
15522 void * _res = NULL;
15523 int _mark = p->mark;
15524 { // import_from_as_names ','
15525 if (p->error_indicator) {
15526 D(p->level--);
15527 return NULL;
15528 }
15529 D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15530 Token * _literal;
15531 asdl_seq* import_from_as_names_var;
15532 if (
15533 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
15534 &&
15535 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15536 )
15537 {
15538 D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15539 _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
15540 if (_res == NULL && PyErr_Occurred()) {
15541 p->error_indicator = 1;
15542 D(p->level--);
15543 return NULL;
15544 }
15545 goto done;
15546 }
15547 p->mark = _mark;
15548 D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
15549 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','"));
15550 }
15551 _res = NULL;
15552 done:
15553 D(p->level--);
15554 return _res;
15555}
15556
15557// _loop0_1: NEWLINE
15558static asdl_seq *
15559_loop0_1_rule(Parser *p)
15560{
15561 D(p->level++);
15562 if (p->error_indicator) {
15563 D(p->level--);
15564 return NULL;
15565 }
15566 void *_res = NULL;
15567 int _mark = p->mark;
15568 int _start_mark = p->mark;
15569 void **_children = PyMem_Malloc(sizeof(void *));
15570 if (!_children) {
15571 p->error_indicator = 1;
15572 PyErr_NoMemory();
15573 D(p->level--);
15574 return NULL;
15575 }
15576 ssize_t _children_capacity = 1;
15577 ssize_t _n = 0;
15578 { // NEWLINE
15579 if (p->error_indicator) {
15580 D(p->level--);
15581 return NULL;
15582 }
15583 D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15584 Token * newline_var;
15585 while (
15586 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15587 )
15588 {
15589 _res = newline_var;
15590 if (_n == _children_capacity) {
15591 _children_capacity *= 2;
15592 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15593 if (!_new_children) {
15594 p->error_indicator = 1;
15595 PyErr_NoMemory();
15596 D(p->level--);
15597 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015598 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015599 _children = _new_children;
15600 }
15601 _children[_n++] = _res;
15602 _mark = p->mark;
15603 }
15604 p->mark = _mark;
15605 D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
15606 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15607 }
15608 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15609 if (!_seq) {
15610 PyMem_Free(_children);
15611 p->error_indicator = 1;
15612 PyErr_NoMemory();
15613 D(p->level--);
15614 return NULL;
15615 }
15616 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15617 PyMem_Free(_children);
15618 _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq);
15619 D(p->level--);
15620 return _seq;
15621}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015622
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015623// _loop0_2: NEWLINE
15624static asdl_seq *
15625_loop0_2_rule(Parser *p)
15626{
15627 D(p->level++);
15628 if (p->error_indicator) {
15629 D(p->level--);
15630 return NULL;
15631 }
15632 void *_res = NULL;
15633 int _mark = p->mark;
15634 int _start_mark = p->mark;
15635 void **_children = PyMem_Malloc(sizeof(void *));
15636 if (!_children) {
15637 p->error_indicator = 1;
15638 PyErr_NoMemory();
15639 D(p->level--);
15640 return NULL;
15641 }
15642 ssize_t _children_capacity = 1;
15643 ssize_t _n = 0;
15644 { // NEWLINE
15645 if (p->error_indicator) {
15646 D(p->level--);
15647 return NULL;
15648 }
15649 D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15650 Token * newline_var;
15651 while (
15652 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15653 )
15654 {
15655 _res = newline_var;
15656 if (_n == _children_capacity) {
15657 _children_capacity *= 2;
15658 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15659 if (!_new_children) {
15660 p->error_indicator = 1;
15661 PyErr_NoMemory();
15662 D(p->level--);
15663 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015664 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015665 _children = _new_children;
15666 }
15667 _children[_n++] = _res;
15668 _mark = p->mark;
15669 }
15670 p->mark = _mark;
15671 D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ',
15672 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15673 }
15674 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15675 if (!_seq) {
15676 PyMem_Free(_children);
15677 p->error_indicator = 1;
15678 PyErr_NoMemory();
15679 D(p->level--);
15680 return NULL;
15681 }
15682 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15683 PyMem_Free(_children);
15684 _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq);
15685 D(p->level--);
15686 return _seq;
15687}
15688
15689// _loop0_4: ',' expression
15690static asdl_seq *
15691_loop0_4_rule(Parser *p)
15692{
15693 D(p->level++);
15694 if (p->error_indicator) {
15695 D(p->level--);
15696 return NULL;
15697 }
15698 void *_res = NULL;
15699 int _mark = p->mark;
15700 int _start_mark = p->mark;
15701 void **_children = PyMem_Malloc(sizeof(void *));
15702 if (!_children) {
15703 p->error_indicator = 1;
15704 PyErr_NoMemory();
15705 D(p->level--);
15706 return NULL;
15707 }
15708 ssize_t _children_capacity = 1;
15709 ssize_t _n = 0;
15710 { // ',' expression
15711 if (p->error_indicator) {
15712 D(p->level--);
15713 return NULL;
15714 }
15715 D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15716 Token * _literal;
15717 expr_ty elem;
15718 while (
15719 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15720 &&
15721 (elem = expression_rule(p)) // expression
15722 )
15723 {
15724 _res = elem;
15725 if (_res == NULL && PyErr_Occurred()) {
15726 p->error_indicator = 1;
15727 PyMem_Free(_children);
15728 D(p->level--);
15729 return NULL;
15730 }
15731 if (_n == _children_capacity) {
15732 _children_capacity *= 2;
15733 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15734 if (!_new_children) {
15735 p->error_indicator = 1;
15736 PyErr_NoMemory();
15737 D(p->level--);
15738 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015739 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015740 _children = _new_children;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015741 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015742 _children[_n++] = _res;
15743 _mark = p->mark;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015744 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015745 p->mark = _mark;
15746 D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ',
15747 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015748 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015749 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15750 if (!_seq) {
15751 PyMem_Free(_children);
15752 p->error_indicator = 1;
15753 PyErr_NoMemory();
15754 D(p->level--);
15755 return NULL;
15756 }
15757 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15758 PyMem_Free(_children);
15759 _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq);
15760 D(p->level--);
15761 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015762}
15763
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015764// _gather_3: expression _loop0_4
15765static asdl_seq *
15766_gather_3_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015767{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015768 D(p->level++);
15769 if (p->error_indicator) {
15770 D(p->level--);
15771 return NULL;
15772 }
15773 asdl_seq * _res = NULL;
15774 int _mark = p->mark;
15775 { // expression _loop0_4
15776 if (p->error_indicator) {
15777 D(p->level--);
15778 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015779 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015780 D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15781 expr_ty elem;
15782 asdl_seq * seq;
15783 if (
15784 (elem = expression_rule(p)) // expression
15785 &&
15786 (seq = _loop0_4_rule(p)) // _loop0_4
15787 )
15788 {
15789 D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15790 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15791 goto done;
15792 }
15793 p->mark = _mark;
15794 D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ',
15795 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015796 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015797 _res = NULL;
15798 done:
15799 D(p->level--);
15800 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015801}
15802
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015803// _loop0_6: ',' expression
15804static asdl_seq *
15805_loop0_6_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015806{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015807 D(p->level++);
15808 if (p->error_indicator) {
15809 D(p->level--);
15810 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015811 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015812 void *_res = NULL;
15813 int _mark = p->mark;
15814 int _start_mark = p->mark;
15815 void **_children = PyMem_Malloc(sizeof(void *));
15816 if (!_children) {
15817 p->error_indicator = 1;
15818 PyErr_NoMemory();
15819 D(p->level--);
15820 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015821 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015822 ssize_t _children_capacity = 1;
15823 ssize_t _n = 0;
15824 { // ',' expression
15825 if (p->error_indicator) {
15826 D(p->level--);
15827 return NULL;
15828 }
15829 D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15830 Token * _literal;
15831 expr_ty elem;
15832 while (
15833 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15834 &&
15835 (elem = expression_rule(p)) // expression
15836 )
15837 {
15838 _res = elem;
15839 if (_res == NULL && PyErr_Occurred()) {
15840 p->error_indicator = 1;
15841 PyMem_Free(_children);
15842 D(p->level--);
15843 return NULL;
15844 }
15845 if (_n == _children_capacity) {
15846 _children_capacity *= 2;
15847 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15848 if (!_new_children) {
15849 p->error_indicator = 1;
15850 PyErr_NoMemory();
15851 D(p->level--);
15852 return NULL;
15853 }
15854 _children = _new_children;
15855 }
15856 _children[_n++] = _res;
15857 _mark = p->mark;
15858 }
15859 p->mark = _mark;
15860 D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ',
15861 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
15862 }
15863 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15864 if (!_seq) {
15865 PyMem_Free(_children);
15866 p->error_indicator = 1;
15867 PyErr_NoMemory();
15868 D(p->level--);
15869 return NULL;
15870 }
15871 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15872 PyMem_Free(_children);
15873 _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq);
15874 D(p->level--);
15875 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015876}
15877
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015878// _gather_5: expression _loop0_6
15879static asdl_seq *
15880_gather_5_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015881{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015882 D(p->level++);
15883 if (p->error_indicator) {
15884 D(p->level--);
15885 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015886 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015887 asdl_seq * _res = NULL;
15888 int _mark = p->mark;
15889 { // expression _loop0_6
15890 if (p->error_indicator) {
15891 D(p->level--);
15892 return NULL;
15893 }
15894 D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15895 expr_ty elem;
15896 asdl_seq * seq;
15897 if (
15898 (elem = expression_rule(p)) // expression
15899 &&
15900 (seq = _loop0_6_rule(p)) // _loop0_6
15901 )
15902 {
15903 D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15904 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15905 goto done;
15906 }
15907 p->mark = _mark;
15908 D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ',
15909 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6"));
15910 }
15911 _res = NULL;
15912 done:
15913 D(p->level--);
15914 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015915}
15916
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015917// _loop0_8: ',' expression
15918static asdl_seq *
15919_loop0_8_rule(Parser *p)
15920{
15921 D(p->level++);
15922 if (p->error_indicator) {
15923 D(p->level--);
15924 return NULL;
15925 }
15926 void *_res = NULL;
15927 int _mark = p->mark;
15928 int _start_mark = p->mark;
15929 void **_children = PyMem_Malloc(sizeof(void *));
15930 if (!_children) {
15931 p->error_indicator = 1;
15932 PyErr_NoMemory();
15933 D(p->level--);
15934 return NULL;
15935 }
15936 ssize_t _children_capacity = 1;
15937 ssize_t _n = 0;
15938 { // ',' expression
15939 if (p->error_indicator) {
15940 D(p->level--);
15941 return NULL;
15942 }
15943 D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15944 Token * _literal;
15945 expr_ty elem;
15946 while (
15947 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15948 &&
15949 (elem = expression_rule(p)) // expression
15950 )
15951 {
15952 _res = elem;
15953 if (_res == NULL && PyErr_Occurred()) {
15954 p->error_indicator = 1;
15955 PyMem_Free(_children);
15956 D(p->level--);
15957 return NULL;
15958 }
15959 if (_n == _children_capacity) {
15960 _children_capacity *= 2;
15961 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15962 if (!_new_children) {
15963 p->error_indicator = 1;
15964 PyErr_NoMemory();
15965 D(p->level--);
15966 return NULL;
15967 }
15968 _children = _new_children;
15969 }
15970 _children[_n++] = _res;
15971 _mark = p->mark;
15972 }
15973 p->mark = _mark;
15974 D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ',
15975 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
15976 }
15977 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
15978 if (!_seq) {
15979 PyMem_Free(_children);
15980 p->error_indicator = 1;
15981 PyErr_NoMemory();
15982 D(p->level--);
15983 return NULL;
15984 }
15985 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
15986 PyMem_Free(_children);
15987 _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq);
15988 D(p->level--);
15989 return _seq;
15990}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015991
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015992// _gather_7: expression _loop0_8
15993static asdl_seq *
15994_gather_7_rule(Parser *p)
15995{
15996 D(p->level++);
15997 if (p->error_indicator) {
15998 D(p->level--);
15999 return NULL;
16000 }
16001 asdl_seq * _res = NULL;
16002 int _mark = p->mark;
16003 { // expression _loop0_8
16004 if (p->error_indicator) {
16005 D(p->level--);
16006 return NULL;
16007 }
16008 D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16009 expr_ty elem;
16010 asdl_seq * seq;
16011 if (
16012 (elem = expression_rule(p)) // expression
16013 &&
16014 (seq = _loop0_8_rule(p)) // _loop0_8
16015 )
16016 {
16017 D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16018 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16019 goto done;
16020 }
16021 p->mark = _mark;
16022 D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ',
16023 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8"));
16024 }
16025 _res = NULL;
16026 done:
16027 D(p->level--);
16028 return _res;
16029}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016030
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016031// _loop0_10: ',' expression
16032static asdl_seq *
16033_loop0_10_rule(Parser *p)
16034{
16035 D(p->level++);
16036 if (p->error_indicator) {
16037 D(p->level--);
16038 return NULL;
16039 }
16040 void *_res = NULL;
16041 int _mark = p->mark;
16042 int _start_mark = p->mark;
16043 void **_children = PyMem_Malloc(sizeof(void *));
16044 if (!_children) {
16045 p->error_indicator = 1;
16046 PyErr_NoMemory();
16047 D(p->level--);
16048 return NULL;
16049 }
16050 ssize_t _children_capacity = 1;
16051 ssize_t _n = 0;
16052 { // ',' expression
16053 if (p->error_indicator) {
16054 D(p->level--);
16055 return NULL;
16056 }
16057 D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
16058 Token * _literal;
16059 expr_ty elem;
16060 while (
16061 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16062 &&
16063 (elem = expression_rule(p)) // expression
16064 )
16065 {
16066 _res = elem;
16067 if (_res == NULL && PyErr_Occurred()) {
16068 p->error_indicator = 1;
16069 PyMem_Free(_children);
16070 D(p->level--);
16071 return NULL;
16072 }
16073 if (_n == _children_capacity) {
16074 _children_capacity *= 2;
16075 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16076 if (!_new_children) {
16077 p->error_indicator = 1;
16078 PyErr_NoMemory();
16079 D(p->level--);
16080 return NULL;
16081 }
16082 _children = _new_children;
16083 }
16084 _children[_n++] = _res;
16085 _mark = p->mark;
16086 }
16087 p->mark = _mark;
16088 D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ',
16089 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16090 }
16091 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16092 if (!_seq) {
16093 PyMem_Free(_children);
16094 p->error_indicator = 1;
16095 PyErr_NoMemory();
16096 D(p->level--);
16097 return NULL;
16098 }
16099 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16100 PyMem_Free(_children);
16101 _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq);
16102 D(p->level--);
16103 return _seq;
16104}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016105
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016106// _gather_9: expression _loop0_10
16107static asdl_seq *
16108_gather_9_rule(Parser *p)
16109{
16110 D(p->level++);
16111 if (p->error_indicator) {
16112 D(p->level--);
16113 return NULL;
16114 }
16115 asdl_seq * _res = NULL;
16116 int _mark = p->mark;
16117 { // expression _loop0_10
16118 if (p->error_indicator) {
16119 D(p->level--);
16120 return NULL;
16121 }
16122 D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16123 expr_ty elem;
16124 asdl_seq * seq;
16125 if (
16126 (elem = expression_rule(p)) // expression
16127 &&
16128 (seq = _loop0_10_rule(p)) // _loop0_10
16129 )
16130 {
16131 D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16132 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16133 goto done;
16134 }
16135 p->mark = _mark;
16136 D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ',
16137 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10"));
16138 }
16139 _res = NULL;
16140 done:
16141 D(p->level--);
16142 return _res;
16143}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016144
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016145// _loop1_11: statement
16146static asdl_seq *
16147_loop1_11_rule(Parser *p)
16148{
16149 D(p->level++);
16150 if (p->error_indicator) {
16151 D(p->level--);
16152 return NULL;
16153 }
16154 void *_res = NULL;
16155 int _mark = p->mark;
16156 int _start_mark = p->mark;
16157 void **_children = PyMem_Malloc(sizeof(void *));
16158 if (!_children) {
16159 p->error_indicator = 1;
16160 PyErr_NoMemory();
16161 D(p->level--);
16162 return NULL;
16163 }
16164 ssize_t _children_capacity = 1;
16165 ssize_t _n = 0;
16166 { // statement
16167 if (p->error_indicator) {
16168 D(p->level--);
16169 return NULL;
16170 }
16171 D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
16172 asdl_seq* statement_var;
16173 while (
16174 (statement_var = statement_rule(p)) // statement
16175 )
16176 {
16177 _res = statement_var;
16178 if (_n == _children_capacity) {
16179 _children_capacity *= 2;
16180 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16181 if (!_new_children) {
16182 p->error_indicator = 1;
16183 PyErr_NoMemory();
16184 D(p->level--);
16185 return NULL;
16186 }
16187 _children = _new_children;
16188 }
16189 _children[_n++] = _res;
16190 _mark = p->mark;
16191 }
16192 p->mark = _mark;
16193 D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ',
16194 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
16195 }
16196 if (_n == 0 || p->error_indicator) {
16197 PyMem_Free(_children);
16198 D(p->level--);
16199 return NULL;
16200 }
16201 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16202 if (!_seq) {
16203 PyMem_Free(_children);
16204 p->error_indicator = 1;
16205 PyErr_NoMemory();
16206 D(p->level--);
16207 return NULL;
16208 }
16209 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16210 PyMem_Free(_children);
16211 _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq);
16212 D(p->level--);
16213 return _seq;
16214}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016215
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016216// _loop0_13: ';' small_stmt
16217static asdl_seq *
16218_loop0_13_rule(Parser *p)
16219{
16220 D(p->level++);
16221 if (p->error_indicator) {
16222 D(p->level--);
16223 return NULL;
16224 }
16225 void *_res = NULL;
16226 int _mark = p->mark;
16227 int _start_mark = p->mark;
16228 void **_children = PyMem_Malloc(sizeof(void *));
16229 if (!_children) {
16230 p->error_indicator = 1;
16231 PyErr_NoMemory();
16232 D(p->level--);
16233 return NULL;
16234 }
16235 ssize_t _children_capacity = 1;
16236 ssize_t _n = 0;
16237 { // ';' small_stmt
16238 if (p->error_indicator) {
16239 D(p->level--);
16240 return NULL;
16241 }
16242 D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt"));
16243 Token * _literal;
16244 stmt_ty elem;
16245 while (
16246 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
16247 &&
16248 (elem = small_stmt_rule(p)) // small_stmt
16249 )
16250 {
16251 _res = elem;
16252 if (_res == NULL && PyErr_Occurred()) {
16253 p->error_indicator = 1;
16254 PyMem_Free(_children);
16255 D(p->level--);
16256 return NULL;
16257 }
16258 if (_n == _children_capacity) {
16259 _children_capacity *= 2;
16260 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16261 if (!_new_children) {
16262 p->error_indicator = 1;
16263 PyErr_NoMemory();
16264 D(p->level--);
16265 return NULL;
16266 }
16267 _children = _new_children;
16268 }
16269 _children[_n++] = _res;
16270 _mark = p->mark;
16271 }
16272 p->mark = _mark;
16273 D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ',
16274 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt"));
16275 }
16276 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16277 if (!_seq) {
16278 PyMem_Free(_children);
16279 p->error_indicator = 1;
16280 PyErr_NoMemory();
16281 D(p->level--);
16282 return NULL;
16283 }
16284 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16285 PyMem_Free(_children);
16286 _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq);
16287 D(p->level--);
16288 return _seq;
16289}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016290
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016291// _gather_12: small_stmt _loop0_13
16292static asdl_seq *
16293_gather_12_rule(Parser *p)
16294{
16295 D(p->level++);
16296 if (p->error_indicator) {
16297 D(p->level--);
16298 return NULL;
16299 }
16300 asdl_seq * _res = NULL;
16301 int _mark = p->mark;
16302 { // small_stmt _loop0_13
16303 if (p->error_indicator) {
16304 D(p->level--);
16305 return NULL;
16306 }
16307 D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16308 stmt_ty elem;
16309 asdl_seq * seq;
16310 if (
16311 (elem = small_stmt_rule(p)) // small_stmt
16312 &&
16313 (seq = _loop0_13_rule(p)) // _loop0_13
16314 )
16315 {
16316 D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16317 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16318 goto done;
16319 }
16320 p->mark = _mark;
16321 D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ',
16322 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13"));
16323 }
16324 _res = NULL;
16325 done:
16326 D(p->level--);
16327 return _res;
16328}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016329
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016330// _tmp_14: 'import' | 'from'
16331static void *
16332_tmp_14_rule(Parser *p)
16333{
16334 D(p->level++);
16335 if (p->error_indicator) {
16336 D(p->level--);
16337 return NULL;
16338 }
16339 void * _res = NULL;
16340 int _mark = p->mark;
16341 { // 'import'
16342 if (p->error_indicator) {
16343 D(p->level--);
16344 return NULL;
16345 }
16346 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
16347 Token * _keyword;
16348 if (
16349 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
16350 )
16351 {
16352 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
16353 _res = _keyword;
16354 goto done;
16355 }
16356 p->mark = _mark;
16357 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16358 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
16359 }
16360 { // 'from'
16361 if (p->error_indicator) {
16362 D(p->level--);
16363 return NULL;
16364 }
16365 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
16366 Token * _keyword;
16367 if (
16368 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
16369 )
16370 {
16371 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
16372 _res = _keyword;
16373 goto done;
16374 }
16375 p->mark = _mark;
16376 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16377 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
16378 }
16379 _res = NULL;
16380 done:
16381 D(p->level--);
16382 return _res;
16383}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016384
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016385// _tmp_15: 'def' | '@' | ASYNC
16386static void *
16387_tmp_15_rule(Parser *p)
16388{
16389 D(p->level++);
16390 if (p->error_indicator) {
16391 D(p->level--);
16392 return NULL;
16393 }
16394 void * _res = NULL;
16395 int _mark = p->mark;
16396 { // 'def'
16397 if (p->error_indicator) {
16398 D(p->level--);
16399 return NULL;
16400 }
16401 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
16402 Token * _keyword;
16403 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016404 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016405 )
16406 {
16407 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
16408 _res = _keyword;
16409 goto done;
16410 }
16411 p->mark = _mark;
16412 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16413 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
16414 }
16415 { // '@'
16416 if (p->error_indicator) {
16417 D(p->level--);
16418 return NULL;
16419 }
16420 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16421 Token * _literal;
16422 if (
16423 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16424 )
16425 {
16426 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16427 _res = _literal;
16428 goto done;
16429 }
16430 p->mark = _mark;
16431 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16432 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16433 }
16434 { // ASYNC
16435 if (p->error_indicator) {
16436 D(p->level--);
16437 return NULL;
16438 }
16439 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16440 Token * async_var;
16441 if (
16442 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16443 )
16444 {
16445 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16446 _res = async_var;
16447 goto done;
16448 }
16449 p->mark = _mark;
16450 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16451 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16452 }
16453 _res = NULL;
16454 done:
16455 D(p->level--);
16456 return _res;
16457}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016458
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016459// _tmp_16: 'class' | '@'
16460static void *
16461_tmp_16_rule(Parser *p)
16462{
16463 D(p->level++);
16464 if (p->error_indicator) {
16465 D(p->level--);
16466 return NULL;
16467 }
16468 void * _res = NULL;
16469 int _mark = p->mark;
16470 { // 'class'
16471 if (p->error_indicator) {
16472 D(p->level--);
16473 return NULL;
16474 }
16475 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
16476 Token * _keyword;
16477 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016478 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016479 )
16480 {
16481 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
16482 _res = _keyword;
16483 goto done;
16484 }
16485 p->mark = _mark;
16486 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16487 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
16488 }
16489 { // '@'
16490 if (p->error_indicator) {
16491 D(p->level--);
16492 return NULL;
16493 }
16494 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16495 Token * _literal;
16496 if (
16497 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16498 )
16499 {
16500 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16501 _res = _literal;
16502 goto done;
16503 }
16504 p->mark = _mark;
16505 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16506 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16507 }
16508 _res = NULL;
16509 done:
16510 D(p->level--);
16511 return _res;
16512}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016513
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016514// _tmp_17: 'with' | ASYNC
16515static void *
16516_tmp_17_rule(Parser *p)
16517{
16518 D(p->level++);
16519 if (p->error_indicator) {
16520 D(p->level--);
16521 return NULL;
16522 }
16523 void * _res = NULL;
16524 int _mark = p->mark;
16525 { // 'with'
16526 if (p->error_indicator) {
16527 D(p->level--);
16528 return NULL;
16529 }
16530 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
16531 Token * _keyword;
16532 if (
16533 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
16534 )
16535 {
16536 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
16537 _res = _keyword;
16538 goto done;
16539 }
16540 p->mark = _mark;
16541 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16542 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
16543 }
16544 { // ASYNC
16545 if (p->error_indicator) {
16546 D(p->level--);
16547 return NULL;
16548 }
16549 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16550 Token * async_var;
16551 if (
16552 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16553 )
16554 {
16555 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16556 _res = async_var;
16557 goto done;
16558 }
16559 p->mark = _mark;
16560 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16561 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16562 }
16563 _res = NULL;
16564 done:
16565 D(p->level--);
16566 return _res;
16567}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016568
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016569// _tmp_18: 'for' | ASYNC
16570static void *
16571_tmp_18_rule(Parser *p)
16572{
16573 D(p->level++);
16574 if (p->error_indicator) {
16575 D(p->level--);
16576 return NULL;
16577 }
16578 void * _res = NULL;
16579 int _mark = p->mark;
16580 { // 'for'
16581 if (p->error_indicator) {
16582 D(p->level--);
16583 return NULL;
16584 }
16585 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
16586 Token * _keyword;
16587 if (
16588 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
16589 )
16590 {
16591 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
16592 _res = _keyword;
16593 goto done;
16594 }
16595 p->mark = _mark;
16596 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16597 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
16598 }
16599 { // ASYNC
16600 if (p->error_indicator) {
16601 D(p->level--);
16602 return NULL;
16603 }
16604 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16605 Token * async_var;
16606 if (
16607 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16608 )
16609 {
16610 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16611 _res = async_var;
16612 goto done;
16613 }
16614 p->mark = _mark;
16615 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16616 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16617 }
16618 _res = NULL;
16619 done:
16620 D(p->level--);
16621 return _res;
16622}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016623
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016624// _tmp_19: '=' annotated_rhs
16625static void *
16626_tmp_19_rule(Parser *p)
16627{
16628 D(p->level++);
16629 if (p->error_indicator) {
16630 D(p->level--);
16631 return NULL;
16632 }
16633 void * _res = NULL;
16634 int _mark = p->mark;
16635 { // '=' annotated_rhs
16636 if (p->error_indicator) {
16637 D(p->level--);
16638 return NULL;
16639 }
16640 D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16641 Token * _literal;
16642 expr_ty d;
16643 if (
16644 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16645 &&
16646 (d = annotated_rhs_rule(p)) // annotated_rhs
16647 )
16648 {
16649 D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16650 _res = d;
16651 if (_res == NULL && PyErr_Occurred()) {
16652 p->error_indicator = 1;
16653 D(p->level--);
16654 return NULL;
16655 }
16656 goto done;
16657 }
16658 p->mark = _mark;
16659 D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ',
16660 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16661 }
16662 _res = NULL;
16663 done:
16664 D(p->level--);
16665 return _res;
16666}
16667
16668// _tmp_20: '(' single_target ')' | single_subscript_attribute_target
16669static void *
16670_tmp_20_rule(Parser *p)
16671{
16672 D(p->level++);
16673 if (p->error_indicator) {
16674 D(p->level--);
16675 return NULL;
16676 }
16677 void * _res = NULL;
16678 int _mark = p->mark;
16679 { // '(' single_target ')'
16680 if (p->error_indicator) {
16681 D(p->level--);
16682 return NULL;
16683 }
16684 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16685 Token * _literal;
16686 Token * _literal_1;
16687 expr_ty b;
16688 if (
16689 (_literal = _PyPegen_expect_token(p, 7)) // token='('
16690 &&
16691 (b = single_target_rule(p)) // single_target
16692 &&
16693 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
16694 )
16695 {
16696 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16697 _res = b;
16698 if (_res == NULL && PyErr_Occurred()) {
16699 p->error_indicator = 1;
16700 D(p->level--);
16701 return NULL;
16702 }
16703 goto done;
16704 }
16705 p->mark = _mark;
16706 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16707 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
16708 }
16709 { // single_subscript_attribute_target
16710 if (p->error_indicator) {
16711 D(p->level--);
16712 return NULL;
16713 }
16714 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16715 expr_ty single_subscript_attribute_target_var;
16716 if (
16717 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
16718 )
16719 {
16720 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16721 _res = single_subscript_attribute_target_var;
16722 goto done;
16723 }
16724 p->mark = _mark;
16725 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16726 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
16727 }
16728 _res = NULL;
16729 done:
16730 D(p->level--);
16731 return _res;
16732}
16733
16734// _tmp_21: '=' annotated_rhs
16735static void *
16736_tmp_21_rule(Parser *p)
16737{
16738 D(p->level++);
16739 if (p->error_indicator) {
16740 D(p->level--);
16741 return NULL;
16742 }
16743 void * _res = NULL;
16744 int _mark = p->mark;
16745 { // '=' annotated_rhs
16746 if (p->error_indicator) {
16747 D(p->level--);
16748 return NULL;
16749 }
16750 D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16751 Token * _literal;
16752 expr_ty d;
16753 if (
16754 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16755 &&
16756 (d = annotated_rhs_rule(p)) // annotated_rhs
16757 )
16758 {
16759 D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16760 _res = d;
16761 if (_res == NULL && PyErr_Occurred()) {
16762 p->error_indicator = 1;
16763 D(p->level--);
16764 return NULL;
16765 }
16766 goto done;
16767 }
16768 p->mark = _mark;
16769 D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ',
16770 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16771 }
16772 _res = NULL;
16773 done:
16774 D(p->level--);
16775 return _res;
16776}
16777
16778// _loop1_22: (star_targets '=')
16779static asdl_seq *
16780_loop1_22_rule(Parser *p)
16781{
16782 D(p->level++);
16783 if (p->error_indicator) {
16784 D(p->level--);
16785 return NULL;
16786 }
16787 void *_res = NULL;
16788 int _mark = p->mark;
16789 int _start_mark = p->mark;
16790 void **_children = PyMem_Malloc(sizeof(void *));
16791 if (!_children) {
16792 p->error_indicator = 1;
16793 PyErr_NoMemory();
16794 D(p->level--);
16795 return NULL;
16796 }
16797 ssize_t _children_capacity = 1;
16798 ssize_t _n = 0;
16799 { // (star_targets '=')
16800 if (p->error_indicator) {
16801 D(p->level--);
16802 return NULL;
16803 }
16804 D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010016805 void *_tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016806 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010016807 (_tmp_139_var = _tmp_139_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016808 )
16809 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010016810 _res = _tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016811 if (_n == _children_capacity) {
16812 _children_capacity *= 2;
16813 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16814 if (!_new_children) {
16815 p->error_indicator = 1;
16816 PyErr_NoMemory();
16817 D(p->level--);
16818 return NULL;
16819 }
16820 _children = _new_children;
16821 }
16822 _children[_n++] = _res;
16823 _mark = p->mark;
16824 }
16825 p->mark = _mark;
16826 D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ',
16827 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
16828 }
16829 if (_n == 0 || p->error_indicator) {
16830 PyMem_Free(_children);
16831 D(p->level--);
16832 return NULL;
16833 }
16834 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
16835 if (!_seq) {
16836 PyMem_Free(_children);
16837 p->error_indicator = 1;
16838 PyErr_NoMemory();
16839 D(p->level--);
16840 return NULL;
16841 }
16842 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
16843 PyMem_Free(_children);
16844 _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq);
16845 D(p->level--);
16846 return _seq;
16847}
16848
16849// _tmp_23: yield_expr | star_expressions
16850static void *
16851_tmp_23_rule(Parser *p)
16852{
16853 D(p->level++);
16854 if (p->error_indicator) {
16855 D(p->level--);
16856 return NULL;
16857 }
16858 void * _res = NULL;
16859 int _mark = p->mark;
16860 { // yield_expr
16861 if (p->error_indicator) {
16862 D(p->level--);
16863 return NULL;
16864 }
16865 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16866 expr_ty yield_expr_var;
16867 if (
16868 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16869 )
16870 {
16871 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16872 _res = yield_expr_var;
16873 goto done;
16874 }
16875 p->mark = _mark;
16876 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16877 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16878 }
16879 { // star_expressions
16880 if (p->error_indicator) {
16881 D(p->level--);
16882 return NULL;
16883 }
16884 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16885 expr_ty star_expressions_var;
16886 if (
16887 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16888 )
16889 {
16890 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16891 _res = star_expressions_var;
16892 goto done;
16893 }
16894 p->mark = _mark;
16895 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16896 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16897 }
16898 _res = NULL;
16899 done:
16900 D(p->level--);
16901 return _res;
16902}
16903
16904// _tmp_24: yield_expr | star_expressions
16905static void *
16906_tmp_24_rule(Parser *p)
16907{
16908 D(p->level++);
16909 if (p->error_indicator) {
16910 D(p->level--);
16911 return NULL;
16912 }
16913 void * _res = NULL;
16914 int _mark = p->mark;
16915 { // yield_expr
16916 if (p->error_indicator) {
16917 D(p->level--);
16918 return NULL;
16919 }
16920 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16921 expr_ty yield_expr_var;
16922 if (
16923 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16924 )
16925 {
16926 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16927 _res = yield_expr_var;
16928 goto done;
16929 }
16930 p->mark = _mark;
16931 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
16932 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16933 }
16934 { // star_expressions
16935 if (p->error_indicator) {
16936 D(p->level--);
16937 return NULL;
16938 }
16939 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16940 expr_ty star_expressions_var;
16941 if (
16942 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16943 )
16944 {
16945 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16946 _res = star_expressions_var;
16947 goto done;
16948 }
16949 p->mark = _mark;
16950 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
16951 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16952 }
16953 _res = NULL;
16954 done:
16955 D(p->level--);
16956 return _res;
16957}
16958
16959// _loop0_26: ',' NAME
16960static asdl_seq *
16961_loop0_26_rule(Parser *p)
16962{
16963 D(p->level++);
16964 if (p->error_indicator) {
16965 D(p->level--);
16966 return NULL;
16967 }
16968 void *_res = NULL;
16969 int _mark = p->mark;
16970 int _start_mark = p->mark;
16971 void **_children = PyMem_Malloc(sizeof(void *));
16972 if (!_children) {
16973 p->error_indicator = 1;
16974 PyErr_NoMemory();
16975 D(p->level--);
16976 return NULL;
16977 }
16978 ssize_t _children_capacity = 1;
16979 ssize_t _n = 0;
16980 { // ',' NAME
16981 if (p->error_indicator) {
16982 D(p->level--);
16983 return NULL;
16984 }
16985 D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
16986 Token * _literal;
16987 expr_ty elem;
16988 while (
16989 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16990 &&
16991 (elem = _PyPegen_name_token(p)) // NAME
16992 )
16993 {
16994 _res = elem;
16995 if (_res == NULL && PyErr_Occurred()) {
16996 p->error_indicator = 1;
16997 PyMem_Free(_children);
16998 D(p->level--);
16999 return NULL;
17000 }
17001 if (_n == _children_capacity) {
17002 _children_capacity *= 2;
17003 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17004 if (!_new_children) {
17005 p->error_indicator = 1;
17006 PyErr_NoMemory();
17007 D(p->level--);
17008 return NULL;
17009 }
17010 _children = _new_children;
17011 }
17012 _children[_n++] = _res;
17013 _mark = p->mark;
17014 }
17015 p->mark = _mark;
17016 D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ',
17017 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17018 }
17019 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17020 if (!_seq) {
17021 PyMem_Free(_children);
17022 p->error_indicator = 1;
17023 PyErr_NoMemory();
17024 D(p->level--);
17025 return NULL;
17026 }
17027 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17028 PyMem_Free(_children);
17029 _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq);
17030 D(p->level--);
17031 return _seq;
17032}
17033
17034// _gather_25: NAME _loop0_26
17035static asdl_seq *
17036_gather_25_rule(Parser *p)
17037{
17038 D(p->level++);
17039 if (p->error_indicator) {
17040 D(p->level--);
17041 return NULL;
17042 }
17043 asdl_seq * _res = NULL;
17044 int _mark = p->mark;
17045 { // NAME _loop0_26
17046 if (p->error_indicator) {
17047 D(p->level--);
17048 return NULL;
17049 }
17050 D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17051 expr_ty elem;
17052 asdl_seq * seq;
17053 if (
17054 (elem = _PyPegen_name_token(p)) // NAME
17055 &&
17056 (seq = _loop0_26_rule(p)) // _loop0_26
17057 )
17058 {
17059 D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17060 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17061 goto done;
17062 }
17063 p->mark = _mark;
17064 D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ',
17065 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26"));
17066 }
17067 _res = NULL;
17068 done:
17069 D(p->level--);
17070 return _res;
17071}
17072
17073// _loop0_28: ',' NAME
17074static asdl_seq *
17075_loop0_28_rule(Parser *p)
17076{
17077 D(p->level++);
17078 if (p->error_indicator) {
17079 D(p->level--);
17080 return NULL;
17081 }
17082 void *_res = NULL;
17083 int _mark = p->mark;
17084 int _start_mark = p->mark;
17085 void **_children = PyMem_Malloc(sizeof(void *));
17086 if (!_children) {
17087 p->error_indicator = 1;
17088 PyErr_NoMemory();
17089 D(p->level--);
17090 return NULL;
17091 }
17092 ssize_t _children_capacity = 1;
17093 ssize_t _n = 0;
17094 { // ',' NAME
17095 if (p->error_indicator) {
17096 D(p->level--);
17097 return NULL;
17098 }
17099 D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17100 Token * _literal;
17101 expr_ty elem;
17102 while (
17103 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17104 &&
17105 (elem = _PyPegen_name_token(p)) // NAME
17106 )
17107 {
17108 _res = elem;
17109 if (_res == NULL && PyErr_Occurred()) {
17110 p->error_indicator = 1;
17111 PyMem_Free(_children);
17112 D(p->level--);
17113 return NULL;
17114 }
17115 if (_n == _children_capacity) {
17116 _children_capacity *= 2;
17117 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17118 if (!_new_children) {
17119 p->error_indicator = 1;
17120 PyErr_NoMemory();
17121 D(p->level--);
17122 return NULL;
17123 }
17124 _children = _new_children;
17125 }
17126 _children[_n++] = _res;
17127 _mark = p->mark;
17128 }
17129 p->mark = _mark;
17130 D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
17131 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17132 }
17133 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17134 if (!_seq) {
17135 PyMem_Free(_children);
17136 p->error_indicator = 1;
17137 PyErr_NoMemory();
17138 D(p->level--);
17139 return NULL;
17140 }
17141 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17142 PyMem_Free(_children);
17143 _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq);
17144 D(p->level--);
17145 return _seq;
17146}
17147
17148// _gather_27: NAME _loop0_28
17149static asdl_seq *
17150_gather_27_rule(Parser *p)
17151{
17152 D(p->level++);
17153 if (p->error_indicator) {
17154 D(p->level--);
17155 return NULL;
17156 }
17157 asdl_seq * _res = NULL;
17158 int _mark = p->mark;
17159 { // NAME _loop0_28
17160 if (p->error_indicator) {
17161 D(p->level--);
17162 return NULL;
17163 }
17164 D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17165 expr_ty elem;
17166 asdl_seq * seq;
17167 if (
17168 (elem = _PyPegen_name_token(p)) // NAME
17169 &&
17170 (seq = _loop0_28_rule(p)) // _loop0_28
17171 )
17172 {
17173 D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17174 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17175 goto done;
17176 }
17177 p->mark = _mark;
17178 D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ',
17179 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28"));
17180 }
17181 _res = NULL;
17182 done:
17183 D(p->level--);
17184 return _res;
17185}
17186
17187// _tmp_29: ',' expression
17188static void *
17189_tmp_29_rule(Parser *p)
17190{
17191 D(p->level++);
17192 if (p->error_indicator) {
17193 D(p->level--);
17194 return NULL;
17195 }
17196 void * _res = NULL;
17197 int _mark = p->mark;
17198 { // ',' expression
17199 if (p->error_indicator) {
17200 D(p->level--);
17201 return NULL;
17202 }
17203 D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
17204 Token * _literal;
17205 expr_ty z;
17206 if (
17207 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17208 &&
17209 (z = expression_rule(p)) // expression
17210 )
17211 {
17212 D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
17213 _res = z;
17214 if (_res == NULL && PyErr_Occurred()) {
17215 p->error_indicator = 1;
17216 D(p->level--);
17217 return NULL;
17218 }
17219 goto done;
17220 }
17221 p->mark = _mark;
17222 D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ',
17223 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
17224 }
17225 _res = NULL;
17226 done:
17227 D(p->level--);
17228 return _res;
17229}
17230
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017231// _tmp_30: ';' | NEWLINE
17232static void *
17233_tmp_30_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017234{
17235 D(p->level++);
17236 if (p->error_indicator) {
17237 D(p->level--);
17238 return NULL;
17239 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017240 void * _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017241 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017242 { // ';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017243 if (p->error_indicator) {
17244 D(p->level--);
17245 return NULL;
17246 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017247 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
17248 Token * _literal;
17249 if (
17250 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017251 )
17252 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017253 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
17254 _res = _literal;
17255 goto done;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017256 }
17257 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017258 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17259 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017260 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017261 { // NEWLINE
17262 if (p->error_indicator) {
17263 D(p->level--);
17264 return NULL;
17265 }
17266 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17267 Token * newline_var;
17268 if (
17269 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
17270 )
17271 {
17272 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17273 _res = newline_var;
17274 goto done;
17275 }
17276 p->mark = _mark;
17277 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17278 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017279 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017280 _res = NULL;
17281 done:
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017282 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017283 return _res;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017284}
17285
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017286// _loop0_31: ('.' | '...')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017287static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017288_loop0_31_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017289{
17290 D(p->level++);
17291 if (p->error_indicator) {
17292 D(p->level--);
17293 return NULL;
17294 }
17295 void *_res = NULL;
17296 int _mark = p->mark;
17297 int _start_mark = p->mark;
17298 void **_children = PyMem_Malloc(sizeof(void *));
17299 if (!_children) {
17300 p->error_indicator = 1;
17301 PyErr_NoMemory();
17302 D(p->level--);
17303 return NULL;
17304 }
17305 ssize_t _children_capacity = 1;
17306 ssize_t _n = 0;
17307 { // ('.' | '...')
17308 if (p->error_indicator) {
17309 D(p->level--);
17310 return NULL;
17311 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017312 D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010017313 void *_tmp_140_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017314 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010017315 (_tmp_140_var = _tmp_140_rule(p)) // '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017316 )
17317 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010017318 _res = _tmp_140_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017319 if (_n == _children_capacity) {
17320 _children_capacity *= 2;
17321 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17322 if (!_new_children) {
17323 p->error_indicator = 1;
17324 PyErr_NoMemory();
17325 D(p->level--);
17326 return NULL;
17327 }
17328 _children = _new_children;
17329 }
17330 _children[_n++] = _res;
17331 _mark = p->mark;
17332 }
17333 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017334 D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ',
17335 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17336 }
17337 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17338 if (!_seq) {
17339 PyMem_Free(_children);
17340 p->error_indicator = 1;
17341 PyErr_NoMemory();
17342 D(p->level--);
17343 return NULL;
17344 }
17345 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17346 PyMem_Free(_children);
17347 _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq);
17348 D(p->level--);
17349 return _seq;
17350}
17351
17352// _loop1_32: ('.' | '...')
17353static asdl_seq *
17354_loop1_32_rule(Parser *p)
17355{
17356 D(p->level++);
17357 if (p->error_indicator) {
17358 D(p->level--);
17359 return NULL;
17360 }
17361 void *_res = NULL;
17362 int _mark = p->mark;
17363 int _start_mark = p->mark;
17364 void **_children = PyMem_Malloc(sizeof(void *));
17365 if (!_children) {
17366 p->error_indicator = 1;
17367 PyErr_NoMemory();
17368 D(p->level--);
17369 return NULL;
17370 }
17371 ssize_t _children_capacity = 1;
17372 ssize_t _n = 0;
17373 { // ('.' | '...')
17374 if (p->error_indicator) {
17375 D(p->level--);
17376 return NULL;
17377 }
17378 D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010017379 void *_tmp_141_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017380 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010017381 (_tmp_141_var = _tmp_141_rule(p)) // '.' | '...'
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017382 )
17383 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010017384 _res = _tmp_141_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017385 if (_n == _children_capacity) {
17386 _children_capacity *= 2;
17387 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17388 if (!_new_children) {
17389 p->error_indicator = 1;
17390 PyErr_NoMemory();
17391 D(p->level--);
17392 return NULL;
17393 }
17394 _children = _new_children;
17395 }
17396 _children[_n++] = _res;
17397 _mark = p->mark;
17398 }
17399 p->mark = _mark;
17400 D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017401 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17402 }
17403 if (_n == 0 || p->error_indicator) {
17404 PyMem_Free(_children);
17405 D(p->level--);
17406 return NULL;
17407 }
17408 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17409 if (!_seq) {
17410 PyMem_Free(_children);
17411 p->error_indicator = 1;
17412 PyErr_NoMemory();
17413 D(p->level--);
17414 return NULL;
17415 }
17416 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17417 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017418 _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017419 D(p->level--);
17420 return _seq;
17421}
17422
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017423// _loop0_34: ',' import_from_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017424static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017425_loop0_34_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017426{
17427 D(p->level++);
17428 if (p->error_indicator) {
17429 D(p->level--);
17430 return NULL;
17431 }
17432 void *_res = NULL;
17433 int _mark = p->mark;
17434 int _start_mark = p->mark;
17435 void **_children = PyMem_Malloc(sizeof(void *));
17436 if (!_children) {
17437 p->error_indicator = 1;
17438 PyErr_NoMemory();
17439 D(p->level--);
17440 return NULL;
17441 }
17442 ssize_t _children_capacity = 1;
17443 ssize_t _n = 0;
17444 { // ',' import_from_as_name
17445 if (p->error_indicator) {
17446 D(p->level--);
17447 return NULL;
17448 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017449 D(fprintf(stderr, "%*c> _loop0_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017450 Token * _literal;
17451 alias_ty elem;
17452 while (
17453 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17454 &&
17455 (elem = import_from_as_name_rule(p)) // import_from_as_name
17456 )
17457 {
17458 _res = elem;
17459 if (_res == NULL && PyErr_Occurred()) {
17460 p->error_indicator = 1;
17461 PyMem_Free(_children);
17462 D(p->level--);
17463 return NULL;
17464 }
17465 if (_n == _children_capacity) {
17466 _children_capacity *= 2;
17467 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17468 if (!_new_children) {
17469 p->error_indicator = 1;
17470 PyErr_NoMemory();
17471 D(p->level--);
17472 return NULL;
17473 }
17474 _children = _new_children;
17475 }
17476 _children[_n++] = _res;
17477 _mark = p->mark;
17478 }
17479 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017480 D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017481 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
17482 }
17483 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17484 if (!_seq) {
17485 PyMem_Free(_children);
17486 p->error_indicator = 1;
17487 PyErr_NoMemory();
17488 D(p->level--);
17489 return NULL;
17490 }
17491 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17492 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017493 _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017494 D(p->level--);
17495 return _seq;
17496}
17497
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017498// _gather_33: import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017499static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017500_gather_33_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017501{
17502 D(p->level++);
17503 if (p->error_indicator) {
17504 D(p->level--);
17505 return NULL;
17506 }
17507 asdl_seq * _res = NULL;
17508 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017509 { // import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017510 if (p->error_indicator) {
17511 D(p->level--);
17512 return NULL;
17513 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017514 D(fprintf(stderr, "%*c> _gather_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_34"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017515 alias_ty elem;
17516 asdl_seq * seq;
17517 if (
17518 (elem = import_from_as_name_rule(p)) // import_from_as_name
17519 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017520 (seq = _loop0_34_rule(p)) // _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017521 )
17522 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017523 D(fprintf(stderr, "%*c+ _gather_33[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_34"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017524 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17525 goto done;
17526 }
17527 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017528 D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ',
17529 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_34"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017530 }
17531 _res = NULL;
17532 done:
17533 D(p->level--);
17534 return _res;
17535}
17536
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017537// _tmp_35: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017538static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017539_tmp_35_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017540{
17541 D(p->level++);
17542 if (p->error_indicator) {
17543 D(p->level--);
17544 return NULL;
17545 }
17546 void * _res = NULL;
17547 int _mark = p->mark;
17548 { // 'as' NAME
17549 if (p->error_indicator) {
17550 D(p->level--);
17551 return NULL;
17552 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017553 D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017554 Token * _keyword;
17555 expr_ty z;
17556 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017557 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017558 &&
17559 (z = _PyPegen_name_token(p)) // NAME
17560 )
17561 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017562 D(fprintf(stderr, "%*c+ _tmp_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017563 _res = z;
17564 if (_res == NULL && PyErr_Occurred()) {
17565 p->error_indicator = 1;
17566 D(p->level--);
17567 return NULL;
17568 }
17569 goto done;
17570 }
17571 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017572 D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017573 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17574 }
17575 _res = NULL;
17576 done:
17577 D(p->level--);
17578 return _res;
17579}
17580
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017581// _loop0_37: ',' dotted_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017582static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017583_loop0_37_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017584{
17585 D(p->level++);
17586 if (p->error_indicator) {
17587 D(p->level--);
17588 return NULL;
17589 }
17590 void *_res = NULL;
17591 int _mark = p->mark;
17592 int _start_mark = p->mark;
17593 void **_children = PyMem_Malloc(sizeof(void *));
17594 if (!_children) {
17595 p->error_indicator = 1;
17596 PyErr_NoMemory();
17597 D(p->level--);
17598 return NULL;
17599 }
17600 ssize_t _children_capacity = 1;
17601 ssize_t _n = 0;
17602 { // ',' dotted_as_name
17603 if (p->error_indicator) {
17604 D(p->level--);
17605 return NULL;
17606 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017607 D(fprintf(stderr, "%*c> _loop0_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017608 Token * _literal;
17609 alias_ty elem;
17610 while (
17611 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17612 &&
17613 (elem = dotted_as_name_rule(p)) // dotted_as_name
17614 )
17615 {
17616 _res = elem;
17617 if (_res == NULL && PyErr_Occurred()) {
17618 p->error_indicator = 1;
17619 PyMem_Free(_children);
17620 D(p->level--);
17621 return NULL;
17622 }
17623 if (_n == _children_capacity) {
17624 _children_capacity *= 2;
17625 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17626 if (!_new_children) {
17627 p->error_indicator = 1;
17628 PyErr_NoMemory();
17629 D(p->level--);
17630 return NULL;
17631 }
17632 _children = _new_children;
17633 }
17634 _children[_n++] = _res;
17635 _mark = p->mark;
17636 }
17637 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017638 D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017639 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
17640 }
17641 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17642 if (!_seq) {
17643 PyMem_Free(_children);
17644 p->error_indicator = 1;
17645 PyErr_NoMemory();
17646 D(p->level--);
17647 return NULL;
17648 }
17649 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17650 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017651 _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017652 D(p->level--);
17653 return _seq;
17654}
17655
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017656// _gather_36: dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017657static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017658_gather_36_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017659{
17660 D(p->level++);
17661 if (p->error_indicator) {
17662 D(p->level--);
17663 return NULL;
17664 }
17665 asdl_seq * _res = NULL;
17666 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017667 { // dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017668 if (p->error_indicator) {
17669 D(p->level--);
17670 return NULL;
17671 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017672 D(fprintf(stderr, "%*c> _gather_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_37"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017673 alias_ty elem;
17674 asdl_seq * seq;
17675 if (
17676 (elem = dotted_as_name_rule(p)) // dotted_as_name
17677 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017678 (seq = _loop0_37_rule(p)) // _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017679 )
17680 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017681 D(fprintf(stderr, "%*c+ _gather_36[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_37"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017682 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17683 goto done;
17684 }
17685 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017686 D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ',
17687 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017688 }
17689 _res = NULL;
17690 done:
17691 D(p->level--);
17692 return _res;
17693}
17694
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017695// _tmp_38: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017696static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017697_tmp_38_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017698{
17699 D(p->level++);
17700 if (p->error_indicator) {
17701 D(p->level--);
17702 return NULL;
17703 }
17704 void * _res = NULL;
17705 int _mark = p->mark;
17706 { // 'as' NAME
17707 if (p->error_indicator) {
17708 D(p->level--);
17709 return NULL;
17710 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017711 D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017712 Token * _keyword;
17713 expr_ty z;
17714 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017715 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017716 &&
17717 (z = _PyPegen_name_token(p)) // NAME
17718 )
17719 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017720 D(fprintf(stderr, "%*c+ _tmp_38[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017721 _res = z;
17722 if (_res == NULL && PyErr_Occurred()) {
17723 p->error_indicator = 1;
17724 D(p->level--);
17725 return NULL;
17726 }
17727 goto done;
17728 }
17729 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017730 D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017731 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17732 }
17733 _res = NULL;
17734 done:
17735 D(p->level--);
17736 return _res;
17737}
17738
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017739// _loop0_40: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017740static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017741_loop0_40_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017742{
17743 D(p->level++);
17744 if (p->error_indicator) {
17745 D(p->level--);
17746 return NULL;
17747 }
17748 void *_res = NULL;
17749 int _mark = p->mark;
17750 int _start_mark = p->mark;
17751 void **_children = PyMem_Malloc(sizeof(void *));
17752 if (!_children) {
17753 p->error_indicator = 1;
17754 PyErr_NoMemory();
17755 D(p->level--);
17756 return NULL;
17757 }
17758 ssize_t _children_capacity = 1;
17759 ssize_t _n = 0;
17760 { // ',' with_item
17761 if (p->error_indicator) {
17762 D(p->level--);
17763 return NULL;
17764 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017765 D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017766 Token * _literal;
17767 withitem_ty elem;
17768 while (
17769 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17770 &&
17771 (elem = with_item_rule(p)) // with_item
17772 )
17773 {
17774 _res = elem;
17775 if (_res == NULL && PyErr_Occurred()) {
17776 p->error_indicator = 1;
17777 PyMem_Free(_children);
17778 D(p->level--);
17779 return NULL;
17780 }
17781 if (_n == _children_capacity) {
17782 _children_capacity *= 2;
17783 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17784 if (!_new_children) {
17785 p->error_indicator = 1;
17786 PyErr_NoMemory();
17787 D(p->level--);
17788 return NULL;
17789 }
17790 _children = _new_children;
17791 }
17792 _children[_n++] = _res;
17793 _mark = p->mark;
17794 }
17795 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017796 D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017797 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17798 }
17799 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17800 if (!_seq) {
17801 PyMem_Free(_children);
17802 p->error_indicator = 1;
17803 PyErr_NoMemory();
17804 D(p->level--);
17805 return NULL;
17806 }
17807 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17808 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017809 _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017810 D(p->level--);
17811 return _seq;
17812}
17813
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017814// _gather_39: with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017815static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017816_gather_39_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017817{
17818 D(p->level++);
17819 if (p->error_indicator) {
17820 D(p->level--);
17821 return NULL;
17822 }
17823 asdl_seq * _res = NULL;
17824 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017825 { // with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017826 if (p->error_indicator) {
17827 D(p->level--);
17828 return NULL;
17829 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017830 D(fprintf(stderr, "%*c> _gather_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_40"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017831 withitem_ty elem;
17832 asdl_seq * seq;
17833 if (
17834 (elem = with_item_rule(p)) // with_item
17835 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017836 (seq = _loop0_40_rule(p)) // _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017837 )
17838 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017839 D(fprintf(stderr, "%*c+ _gather_39[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_40"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017840 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17841 goto done;
17842 }
17843 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017844 D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ',
17845 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017846 }
17847 _res = NULL;
17848 done:
17849 D(p->level--);
17850 return _res;
17851}
17852
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017853// _loop0_42: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017854static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017855_loop0_42_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017856{
17857 D(p->level++);
17858 if (p->error_indicator) {
17859 D(p->level--);
17860 return NULL;
17861 }
17862 void *_res = NULL;
17863 int _mark = p->mark;
17864 int _start_mark = p->mark;
17865 void **_children = PyMem_Malloc(sizeof(void *));
17866 if (!_children) {
17867 p->error_indicator = 1;
17868 PyErr_NoMemory();
17869 D(p->level--);
17870 return NULL;
17871 }
17872 ssize_t _children_capacity = 1;
17873 ssize_t _n = 0;
17874 { // ',' with_item
17875 if (p->error_indicator) {
17876 D(p->level--);
17877 return NULL;
17878 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017879 D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017880 Token * _literal;
17881 withitem_ty elem;
17882 while (
17883 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17884 &&
17885 (elem = with_item_rule(p)) // with_item
17886 )
17887 {
17888 _res = elem;
17889 if (_res == NULL && PyErr_Occurred()) {
17890 p->error_indicator = 1;
17891 PyMem_Free(_children);
17892 D(p->level--);
17893 return NULL;
17894 }
17895 if (_n == _children_capacity) {
17896 _children_capacity *= 2;
17897 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17898 if (!_new_children) {
17899 p->error_indicator = 1;
17900 PyErr_NoMemory();
17901 D(p->level--);
17902 return NULL;
17903 }
17904 _children = _new_children;
17905 }
17906 _children[_n++] = _res;
17907 _mark = p->mark;
17908 }
17909 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017910 D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017911 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17912 }
17913 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
17914 if (!_seq) {
17915 PyMem_Free(_children);
17916 p->error_indicator = 1;
17917 PyErr_NoMemory();
17918 D(p->level--);
17919 return NULL;
17920 }
17921 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
17922 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017923 _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017924 D(p->level--);
17925 return _seq;
17926}
17927
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017928// _gather_41: with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017929static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017930_gather_41_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017931{
17932 D(p->level++);
17933 if (p->error_indicator) {
17934 D(p->level--);
17935 return NULL;
17936 }
17937 asdl_seq * _res = NULL;
17938 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017939 { // with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017940 if (p->error_indicator) {
17941 D(p->level--);
17942 return NULL;
17943 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017944 D(fprintf(stderr, "%*c> _gather_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_42"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017945 withitem_ty elem;
17946 asdl_seq * seq;
17947 if (
17948 (elem = with_item_rule(p)) // with_item
17949 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017950 (seq = _loop0_42_rule(p)) // _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017951 )
17952 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017953 D(fprintf(stderr, "%*c+ _gather_41[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_42"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017954 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17955 goto done;
17956 }
17957 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017958 D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ',
17959 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017960 }
17961 _res = NULL;
17962 done:
17963 D(p->level--);
17964 return _res;
17965}
17966
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017967// _loop0_44: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017968static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017969_loop0_44_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017970{
17971 D(p->level++);
17972 if (p->error_indicator) {
17973 D(p->level--);
17974 return NULL;
17975 }
17976 void *_res = NULL;
17977 int _mark = p->mark;
17978 int _start_mark = p->mark;
17979 void **_children = PyMem_Malloc(sizeof(void *));
17980 if (!_children) {
17981 p->error_indicator = 1;
17982 PyErr_NoMemory();
17983 D(p->level--);
17984 return NULL;
17985 }
17986 ssize_t _children_capacity = 1;
17987 ssize_t _n = 0;
17988 { // ',' with_item
17989 if (p->error_indicator) {
17990 D(p->level--);
17991 return NULL;
17992 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017993 D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017994 Token * _literal;
17995 withitem_ty elem;
17996 while (
17997 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17998 &&
17999 (elem = with_item_rule(p)) // with_item
18000 )
18001 {
18002 _res = elem;
18003 if (_res == NULL && PyErr_Occurred()) {
18004 p->error_indicator = 1;
18005 PyMem_Free(_children);
18006 D(p->level--);
18007 return NULL;
18008 }
18009 if (_n == _children_capacity) {
18010 _children_capacity *= 2;
18011 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18012 if (!_new_children) {
18013 p->error_indicator = 1;
18014 PyErr_NoMemory();
18015 D(p->level--);
18016 return NULL;
18017 }
18018 _children = _new_children;
18019 }
18020 _children[_n++] = _res;
18021 _mark = p->mark;
18022 }
18023 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018024 D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018025 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18026 }
18027 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18028 if (!_seq) {
18029 PyMem_Free(_children);
18030 p->error_indicator = 1;
18031 PyErr_NoMemory();
18032 D(p->level--);
18033 return NULL;
18034 }
18035 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18036 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018037 _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018038 D(p->level--);
18039 return _seq;
18040}
18041
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018042// _gather_43: with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018043static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018044_gather_43_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018045{
18046 D(p->level++);
18047 if (p->error_indicator) {
18048 D(p->level--);
18049 return NULL;
18050 }
18051 asdl_seq * _res = NULL;
18052 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018053 { // with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018054 if (p->error_indicator) {
18055 D(p->level--);
18056 return NULL;
18057 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018058 D(fprintf(stderr, "%*c> _gather_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_44"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018059 withitem_ty elem;
18060 asdl_seq * seq;
18061 if (
18062 (elem = with_item_rule(p)) // with_item
18063 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018064 (seq = _loop0_44_rule(p)) // _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018065 )
18066 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018067 D(fprintf(stderr, "%*c+ _gather_43[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_44"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018068 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18069 goto done;
18070 }
18071 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018072 D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ',
18073 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018074 }
18075 _res = NULL;
18076 done:
18077 D(p->level--);
18078 return _res;
18079}
18080
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018081// _loop0_46: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018082static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018083_loop0_46_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018084{
18085 D(p->level++);
18086 if (p->error_indicator) {
18087 D(p->level--);
18088 return NULL;
18089 }
18090 void *_res = NULL;
18091 int _mark = p->mark;
18092 int _start_mark = p->mark;
18093 void **_children = PyMem_Malloc(sizeof(void *));
18094 if (!_children) {
18095 p->error_indicator = 1;
18096 PyErr_NoMemory();
18097 D(p->level--);
18098 return NULL;
18099 }
18100 ssize_t _children_capacity = 1;
18101 ssize_t _n = 0;
18102 { // ',' with_item
18103 if (p->error_indicator) {
18104 D(p->level--);
18105 return NULL;
18106 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018107 D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018108 Token * _literal;
18109 withitem_ty elem;
18110 while (
18111 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18112 &&
18113 (elem = with_item_rule(p)) // with_item
18114 )
18115 {
18116 _res = elem;
18117 if (_res == NULL && PyErr_Occurred()) {
18118 p->error_indicator = 1;
18119 PyMem_Free(_children);
18120 D(p->level--);
18121 return NULL;
18122 }
18123 if (_n == _children_capacity) {
18124 _children_capacity *= 2;
18125 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18126 if (!_new_children) {
18127 p->error_indicator = 1;
18128 PyErr_NoMemory();
18129 D(p->level--);
18130 return NULL;
18131 }
18132 _children = _new_children;
18133 }
18134 _children[_n++] = _res;
18135 _mark = p->mark;
18136 }
18137 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018138 D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018139 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18140 }
18141 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18142 if (!_seq) {
18143 PyMem_Free(_children);
18144 p->error_indicator = 1;
18145 PyErr_NoMemory();
18146 D(p->level--);
18147 return NULL;
18148 }
18149 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18150 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018151 _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018152 D(p->level--);
18153 return _seq;
18154}
18155
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018156// _gather_45: with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018157static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018158_gather_45_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018159{
18160 D(p->level++);
18161 if (p->error_indicator) {
18162 D(p->level--);
18163 return NULL;
18164 }
18165 asdl_seq * _res = NULL;
18166 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018167 { // with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018168 if (p->error_indicator) {
18169 D(p->level--);
18170 return NULL;
18171 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018172 D(fprintf(stderr, "%*c> _gather_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_46"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018173 withitem_ty elem;
18174 asdl_seq * seq;
18175 if (
18176 (elem = with_item_rule(p)) // with_item
18177 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018178 (seq = _loop0_46_rule(p)) // _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018179 )
18180 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018181 D(fprintf(stderr, "%*c+ _gather_45[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_46"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018182 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18183 goto done;
18184 }
18185 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018186 D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ',
18187 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018188 }
18189 _res = NULL;
18190 done:
18191 D(p->level--);
18192 return _res;
18193}
18194
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018195// _tmp_47: ',' | ')' | ':'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018196static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018197_tmp_47_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018198{
18199 D(p->level++);
18200 if (p->error_indicator) {
18201 D(p->level--);
18202 return NULL;
18203 }
18204 void * _res = NULL;
18205 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018206 { // ','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018207 if (p->error_indicator) {
18208 D(p->level--);
18209 return NULL;
18210 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018211 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
18212 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018213 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018214 (_literal = _PyPegen_expect_token(p, 12)) // token=','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018215 )
18216 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018217 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
18218 _res = _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018219 goto done;
18220 }
18221 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018222 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18223 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
18224 }
18225 { // ')'
18226 if (p->error_indicator) {
18227 D(p->level--);
18228 return NULL;
18229 }
18230 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
18231 Token * _literal;
18232 if (
18233 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
18234 )
18235 {
18236 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
18237 _res = _literal;
18238 goto done;
18239 }
18240 p->mark = _mark;
18241 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18242 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
18243 }
18244 { // ':'
18245 if (p->error_indicator) {
18246 D(p->level--);
18247 return NULL;
18248 }
18249 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
18250 Token * _literal;
18251 if (
18252 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
18253 )
18254 {
18255 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
18256 _res = _literal;
18257 goto done;
18258 }
18259 p->mark = _mark;
18260 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18261 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018262 }
18263 _res = NULL;
18264 done:
18265 D(p->level--);
18266 return _res;
18267}
18268
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018269// _loop1_48: except_block
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018270static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018271_loop1_48_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018272{
18273 D(p->level++);
18274 if (p->error_indicator) {
18275 D(p->level--);
18276 return NULL;
18277 }
18278 void *_res = NULL;
18279 int _mark = p->mark;
18280 int _start_mark = p->mark;
18281 void **_children = PyMem_Malloc(sizeof(void *));
18282 if (!_children) {
18283 p->error_indicator = 1;
18284 PyErr_NoMemory();
18285 D(p->level--);
18286 return NULL;
18287 }
18288 ssize_t _children_capacity = 1;
18289 ssize_t _n = 0;
18290 { // except_block
18291 if (p->error_indicator) {
18292 D(p->level--);
18293 return NULL;
18294 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018295 D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018296 excepthandler_ty except_block_var;
18297 while (
18298 (except_block_var = except_block_rule(p)) // except_block
18299 )
18300 {
18301 _res = except_block_var;
18302 if (_n == _children_capacity) {
18303 _children_capacity *= 2;
18304 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18305 if (!_new_children) {
18306 p->error_indicator = 1;
18307 PyErr_NoMemory();
18308 D(p->level--);
18309 return NULL;
18310 }
18311 _children = _new_children;
18312 }
18313 _children[_n++] = _res;
18314 _mark = p->mark;
18315 }
18316 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018317 D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018318 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
18319 }
18320 if (_n == 0 || p->error_indicator) {
18321 PyMem_Free(_children);
18322 D(p->level--);
18323 return NULL;
18324 }
18325 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18326 if (!_seq) {
18327 PyMem_Free(_children);
18328 p->error_indicator = 1;
18329 PyErr_NoMemory();
18330 D(p->level--);
18331 return NULL;
18332 }
18333 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18334 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018335 _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018336 D(p->level--);
18337 return _seq;
18338}
18339
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018340// _tmp_49: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018341static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018342_tmp_49_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018343{
18344 D(p->level++);
18345 if (p->error_indicator) {
18346 D(p->level--);
18347 return NULL;
18348 }
18349 void * _res = NULL;
18350 int _mark = p->mark;
18351 { // 'as' NAME
18352 if (p->error_indicator) {
18353 D(p->level--);
18354 return NULL;
18355 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018356 D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018357 Token * _keyword;
18358 expr_ty z;
18359 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018360 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018361 &&
18362 (z = _PyPegen_name_token(p)) // NAME
18363 )
18364 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018365 D(fprintf(stderr, "%*c+ _tmp_49[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018366 _res = z;
18367 if (_res == NULL && PyErr_Occurred()) {
18368 p->error_indicator = 1;
18369 D(p->level--);
18370 return NULL;
18371 }
18372 goto done;
18373 }
18374 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018375 D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018376 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
18377 }
18378 _res = NULL;
18379 done:
18380 D(p->level--);
18381 return _res;
18382}
18383
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018384// _tmp_50: 'from' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018385static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018386_tmp_50_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018387{
18388 D(p->level++);
18389 if (p->error_indicator) {
18390 D(p->level--);
18391 return NULL;
18392 }
18393 void * _res = NULL;
18394 int _mark = p->mark;
18395 { // 'from' expression
18396 if (p->error_indicator) {
18397 D(p->level--);
18398 return NULL;
18399 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018400 D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018401 Token * _keyword;
18402 expr_ty z;
18403 if (
18404 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
18405 &&
18406 (z = expression_rule(p)) // expression
18407 )
18408 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018409 D(fprintf(stderr, "%*c+ _tmp_50[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018410 _res = z;
18411 if (_res == NULL && PyErr_Occurred()) {
18412 p->error_indicator = 1;
18413 D(p->level--);
18414 return NULL;
18415 }
18416 goto done;
18417 }
18418 p->mark = _mark;
18419 D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018420 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018421 }
18422 _res = NULL;
18423 done:
18424 D(p->level--);
18425 return _res;
18426}
18427
18428// _tmp_51: '->' expression
18429static void *
18430_tmp_51_rule(Parser *p)
18431{
18432 D(p->level++);
18433 if (p->error_indicator) {
18434 D(p->level--);
18435 return NULL;
18436 }
18437 void * _res = NULL;
18438 int _mark = p->mark;
18439 { // '->' expression
18440 if (p->error_indicator) {
18441 D(p->level--);
18442 return NULL;
18443 }
18444 D(fprintf(stderr, "%*c> _tmp_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18445 Token * _literal;
18446 expr_ty z;
18447 if (
18448 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18449 &&
18450 (z = expression_rule(p)) // expression
18451 )
18452 {
18453 D(fprintf(stderr, "%*c+ _tmp_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18454 _res = z;
18455 if (_res == NULL && PyErr_Occurred()) {
18456 p->error_indicator = 1;
18457 D(p->level--);
18458 return NULL;
18459 }
18460 goto done;
18461 }
18462 p->mark = _mark;
18463 D(fprintf(stderr, "%*c%s _tmp_51[%d-%d]: %s failed!\n", p->level, ' ',
18464 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18465 }
18466 _res = NULL;
18467 done:
18468 D(p->level--);
18469 return _res;
18470}
18471
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018472// _tmp_52: '->' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018473static void *
18474_tmp_52_rule(Parser *p)
18475{
18476 D(p->level++);
18477 if (p->error_indicator) {
18478 D(p->level--);
18479 return NULL;
18480 }
18481 void * _res = NULL;
18482 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018483 { // '->' expression
18484 if (p->error_indicator) {
18485 D(p->level--);
18486 return NULL;
18487 }
18488 D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18489 Token * _literal;
18490 expr_ty z;
18491 if (
18492 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18493 &&
18494 (z = expression_rule(p)) // expression
18495 )
18496 {
18497 D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18498 _res = z;
18499 if (_res == NULL && PyErr_Occurred()) {
18500 p->error_indicator = 1;
18501 D(p->level--);
18502 return NULL;
18503 }
18504 goto done;
18505 }
18506 p->mark = _mark;
18507 D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ',
18508 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18509 }
18510 _res = NULL;
18511 done:
18512 D(p->level--);
18513 return _res;
18514}
18515
18516// _tmp_53: NEWLINE INDENT
18517static void *
18518_tmp_53_rule(Parser *p)
18519{
18520 D(p->level++);
18521 if (p->error_indicator) {
18522 D(p->level--);
18523 return NULL;
18524 }
18525 void * _res = NULL;
18526 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018527 { // NEWLINE INDENT
18528 if (p->error_indicator) {
18529 D(p->level--);
18530 return NULL;
18531 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018532 D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018533 Token * indent_var;
18534 Token * newline_var;
18535 if (
18536 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
18537 &&
18538 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
18539 )
18540 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018541 D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018542 _res = _PyPegen_dummy_name(p, newline_var, indent_var);
18543 goto done;
18544 }
18545 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018546 D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018547 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
18548 }
18549 _res = NULL;
18550 done:
18551 D(p->level--);
18552 return _res;
18553}
18554
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018555// _loop0_54: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018556static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018557_loop0_54_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018558{
18559 D(p->level++);
18560 if (p->error_indicator) {
18561 D(p->level--);
18562 return NULL;
18563 }
18564 void *_res = NULL;
18565 int _mark = p->mark;
18566 int _start_mark = p->mark;
18567 void **_children = PyMem_Malloc(sizeof(void *));
18568 if (!_children) {
18569 p->error_indicator = 1;
18570 PyErr_NoMemory();
18571 D(p->level--);
18572 return NULL;
18573 }
18574 ssize_t _children_capacity = 1;
18575 ssize_t _n = 0;
18576 { // param_no_default
18577 if (p->error_indicator) {
18578 D(p->level--);
18579 return NULL;
18580 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018581 D(fprintf(stderr, "%*c> _loop0_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018582 arg_ty param_no_default_var;
18583 while (
18584 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18585 )
18586 {
18587 _res = param_no_default_var;
18588 if (_n == _children_capacity) {
18589 _children_capacity *= 2;
18590 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18591 if (!_new_children) {
18592 p->error_indicator = 1;
18593 PyErr_NoMemory();
18594 D(p->level--);
18595 return NULL;
18596 }
18597 _children = _new_children;
18598 }
18599 _children[_n++] = _res;
18600 _mark = p->mark;
18601 }
18602 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018603 D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018604 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018605 }
18606 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18607 if (!_seq) {
18608 PyMem_Free(_children);
18609 p->error_indicator = 1;
18610 PyErr_NoMemory();
18611 D(p->level--);
18612 return NULL;
18613 }
18614 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18615 PyMem_Free(_children);
18616 _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq);
18617 D(p->level--);
18618 return _seq;
18619}
18620
18621// _loop0_55: param_with_default
18622static asdl_seq *
18623_loop0_55_rule(Parser *p)
18624{
18625 D(p->level++);
18626 if (p->error_indicator) {
18627 D(p->level--);
18628 return NULL;
18629 }
18630 void *_res = NULL;
18631 int _mark = p->mark;
18632 int _start_mark = p->mark;
18633 void **_children = PyMem_Malloc(sizeof(void *));
18634 if (!_children) {
18635 p->error_indicator = 1;
18636 PyErr_NoMemory();
18637 D(p->level--);
18638 return NULL;
18639 }
18640 ssize_t _children_capacity = 1;
18641 ssize_t _n = 0;
18642 { // param_with_default
18643 if (p->error_indicator) {
18644 D(p->level--);
18645 return NULL;
18646 }
18647 D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18648 NameDefaultPair* param_with_default_var;
18649 while (
18650 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18651 )
18652 {
18653 _res = param_with_default_var;
18654 if (_n == _children_capacity) {
18655 _children_capacity *= 2;
18656 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18657 if (!_new_children) {
18658 p->error_indicator = 1;
18659 PyErr_NoMemory();
18660 D(p->level--);
18661 return NULL;
18662 }
18663 _children = _new_children;
18664 }
18665 _children[_n++] = _res;
18666 _mark = p->mark;
18667 }
18668 p->mark = _mark;
18669 D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ',
18670 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18671 }
18672 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18673 if (!_seq) {
18674 PyMem_Free(_children);
18675 p->error_indicator = 1;
18676 PyErr_NoMemory();
18677 D(p->level--);
18678 return NULL;
18679 }
18680 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18681 PyMem_Free(_children);
18682 _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq);
18683 D(p->level--);
18684 return _seq;
18685}
18686
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018687// _loop0_56: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018688static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018689_loop0_56_rule(Parser *p)
18690{
18691 D(p->level++);
18692 if (p->error_indicator) {
18693 D(p->level--);
18694 return NULL;
18695 }
18696 void *_res = NULL;
18697 int _mark = p->mark;
18698 int _start_mark = p->mark;
18699 void **_children = PyMem_Malloc(sizeof(void *));
18700 if (!_children) {
18701 p->error_indicator = 1;
18702 PyErr_NoMemory();
18703 D(p->level--);
18704 return NULL;
18705 }
18706 ssize_t _children_capacity = 1;
18707 ssize_t _n = 0;
18708 { // param_with_default
18709 if (p->error_indicator) {
18710 D(p->level--);
18711 return NULL;
18712 }
18713 D(fprintf(stderr, "%*c> _loop0_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18714 NameDefaultPair* param_with_default_var;
18715 while (
18716 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18717 )
18718 {
18719 _res = param_with_default_var;
18720 if (_n == _children_capacity) {
18721 _children_capacity *= 2;
18722 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18723 if (!_new_children) {
18724 p->error_indicator = 1;
18725 PyErr_NoMemory();
18726 D(p->level--);
18727 return NULL;
18728 }
18729 _children = _new_children;
18730 }
18731 _children[_n++] = _res;
18732 _mark = p->mark;
18733 }
18734 p->mark = _mark;
18735 D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ',
18736 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18737 }
18738 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18739 if (!_seq) {
18740 PyMem_Free(_children);
18741 p->error_indicator = 1;
18742 PyErr_NoMemory();
18743 D(p->level--);
18744 return NULL;
18745 }
18746 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18747 PyMem_Free(_children);
18748 _PyPegen_insert_memo(p, _start_mark, _loop0_56_type, _seq);
18749 D(p->level--);
18750 return _seq;
18751}
18752
18753// _loop1_57: param_no_default
18754static asdl_seq *
18755_loop1_57_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018756{
18757 D(p->level++);
18758 if (p->error_indicator) {
18759 D(p->level--);
18760 return NULL;
18761 }
18762 void *_res = NULL;
18763 int _mark = p->mark;
18764 int _start_mark = p->mark;
18765 void **_children = PyMem_Malloc(sizeof(void *));
18766 if (!_children) {
18767 p->error_indicator = 1;
18768 PyErr_NoMemory();
18769 D(p->level--);
18770 return NULL;
18771 }
18772 ssize_t _children_capacity = 1;
18773 ssize_t _n = 0;
18774 { // param_no_default
18775 if (p->error_indicator) {
18776 D(p->level--);
18777 return NULL;
18778 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018779 D(fprintf(stderr, "%*c> _loop1_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018780 arg_ty param_no_default_var;
18781 while (
18782 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18783 )
18784 {
18785 _res = param_no_default_var;
18786 if (_n == _children_capacity) {
18787 _children_capacity *= 2;
18788 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18789 if (!_new_children) {
18790 p->error_indicator = 1;
18791 PyErr_NoMemory();
18792 D(p->level--);
18793 return NULL;
18794 }
18795 _children = _new_children;
18796 }
18797 _children[_n++] = _res;
18798 _mark = p->mark;
18799 }
18800 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018801 D(fprintf(stderr, "%*c%s _loop1_57[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018802 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
18803 }
18804 if (_n == 0 || p->error_indicator) {
18805 PyMem_Free(_children);
18806 D(p->level--);
18807 return NULL;
18808 }
18809 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18810 if (!_seq) {
18811 PyMem_Free(_children);
18812 p->error_indicator = 1;
18813 PyErr_NoMemory();
18814 D(p->level--);
18815 return NULL;
18816 }
18817 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18818 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018819 _PyPegen_insert_memo(p, _start_mark, _loop1_57_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018820 D(p->level--);
18821 return _seq;
18822}
18823
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018824// _loop0_58: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018825static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018826_loop0_58_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018827{
18828 D(p->level++);
18829 if (p->error_indicator) {
18830 D(p->level--);
18831 return NULL;
18832 }
18833 void *_res = NULL;
18834 int _mark = p->mark;
18835 int _start_mark = p->mark;
18836 void **_children = PyMem_Malloc(sizeof(void *));
18837 if (!_children) {
18838 p->error_indicator = 1;
18839 PyErr_NoMemory();
18840 D(p->level--);
18841 return NULL;
18842 }
18843 ssize_t _children_capacity = 1;
18844 ssize_t _n = 0;
18845 { // param_with_default
18846 if (p->error_indicator) {
18847 D(p->level--);
18848 return NULL;
18849 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018850 D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018851 NameDefaultPair* param_with_default_var;
18852 while (
18853 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18854 )
18855 {
18856 _res = param_with_default_var;
18857 if (_n == _children_capacity) {
18858 _children_capacity *= 2;
18859 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18860 if (!_new_children) {
18861 p->error_indicator = 1;
18862 PyErr_NoMemory();
18863 D(p->level--);
18864 return NULL;
18865 }
18866 _children = _new_children;
18867 }
18868 _children[_n++] = _res;
18869 _mark = p->mark;
18870 }
18871 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018872 D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018873 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18874 }
18875 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18876 if (!_seq) {
18877 PyMem_Free(_children);
18878 p->error_indicator = 1;
18879 PyErr_NoMemory();
18880 D(p->level--);
18881 return NULL;
18882 }
18883 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18884 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018885 _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018886 D(p->level--);
18887 return _seq;
18888}
18889
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018890// _loop1_59: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018891static asdl_seq *
18892_loop1_59_rule(Parser *p)
18893{
18894 D(p->level++);
18895 if (p->error_indicator) {
18896 D(p->level--);
18897 return NULL;
18898 }
18899 void *_res = NULL;
18900 int _mark = p->mark;
18901 int _start_mark = p->mark;
18902 void **_children = PyMem_Malloc(sizeof(void *));
18903 if (!_children) {
18904 p->error_indicator = 1;
18905 PyErr_NoMemory();
18906 D(p->level--);
18907 return NULL;
18908 }
18909 ssize_t _children_capacity = 1;
18910 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018911 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018912 if (p->error_indicator) {
18913 D(p->level--);
18914 return NULL;
18915 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018916 D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18917 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018918 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018919 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018920 )
18921 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018922 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018923 if (_n == _children_capacity) {
18924 _children_capacity *= 2;
18925 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18926 if (!_new_children) {
18927 p->error_indicator = 1;
18928 PyErr_NoMemory();
18929 D(p->level--);
18930 return NULL;
18931 }
18932 _children = _new_children;
18933 }
18934 _children[_n++] = _res;
18935 _mark = p->mark;
18936 }
18937 p->mark = _mark;
18938 D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018939 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018940 }
18941 if (_n == 0 || p->error_indicator) {
18942 PyMem_Free(_children);
18943 D(p->level--);
18944 return NULL;
18945 }
18946 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
18947 if (!_seq) {
18948 PyMem_Free(_children);
18949 p->error_indicator = 1;
18950 PyErr_NoMemory();
18951 D(p->level--);
18952 return NULL;
18953 }
18954 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
18955 PyMem_Free(_children);
18956 _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq);
18957 D(p->level--);
18958 return _seq;
18959}
18960
18961// _loop1_60: param_no_default
18962static asdl_seq *
18963_loop1_60_rule(Parser *p)
18964{
18965 D(p->level++);
18966 if (p->error_indicator) {
18967 D(p->level--);
18968 return NULL;
18969 }
18970 void *_res = NULL;
18971 int _mark = p->mark;
18972 int _start_mark = p->mark;
18973 void **_children = PyMem_Malloc(sizeof(void *));
18974 if (!_children) {
18975 p->error_indicator = 1;
18976 PyErr_NoMemory();
18977 D(p->level--);
18978 return NULL;
18979 }
18980 ssize_t _children_capacity = 1;
18981 ssize_t _n = 0;
18982 { // param_no_default
18983 if (p->error_indicator) {
18984 D(p->level--);
18985 return NULL;
18986 }
18987 D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
18988 arg_ty param_no_default_var;
18989 while (
18990 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18991 )
18992 {
18993 _res = param_no_default_var;
18994 if (_n == _children_capacity) {
18995 _children_capacity *= 2;
18996 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18997 if (!_new_children) {
18998 p->error_indicator = 1;
18999 PyErr_NoMemory();
19000 D(p->level--);
19001 return NULL;
19002 }
19003 _children = _new_children;
19004 }
19005 _children[_n++] = _res;
19006 _mark = p->mark;
19007 }
19008 p->mark = _mark;
19009 D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ',
19010 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19011 }
19012 if (_n == 0 || p->error_indicator) {
19013 PyMem_Free(_children);
19014 D(p->level--);
19015 return NULL;
19016 }
19017 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19018 if (!_seq) {
19019 PyMem_Free(_children);
19020 p->error_indicator = 1;
19021 PyErr_NoMemory();
19022 D(p->level--);
19023 return NULL;
19024 }
19025 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19026 PyMem_Free(_children);
19027 _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq);
19028 D(p->level--);
19029 return _seq;
19030}
19031
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019032// _loop1_61: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019033static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019034_loop1_61_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019035{
19036 D(p->level++);
19037 if (p->error_indicator) {
19038 D(p->level--);
19039 return NULL;
19040 }
19041 void *_res = NULL;
19042 int _mark = p->mark;
19043 int _start_mark = p->mark;
19044 void **_children = PyMem_Malloc(sizeof(void *));
19045 if (!_children) {
19046 p->error_indicator = 1;
19047 PyErr_NoMemory();
19048 D(p->level--);
19049 return NULL;
19050 }
19051 ssize_t _children_capacity = 1;
19052 ssize_t _n = 0;
19053 { // param_no_default
19054 if (p->error_indicator) {
19055 D(p->level--);
19056 return NULL;
19057 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019058 D(fprintf(stderr, "%*c> _loop1_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019059 arg_ty param_no_default_var;
19060 while (
19061 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19062 )
19063 {
19064 _res = param_no_default_var;
19065 if (_n == _children_capacity) {
19066 _children_capacity *= 2;
19067 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19068 if (!_new_children) {
19069 p->error_indicator = 1;
19070 PyErr_NoMemory();
19071 D(p->level--);
19072 return NULL;
19073 }
19074 _children = _new_children;
19075 }
19076 _children[_n++] = _res;
19077 _mark = p->mark;
19078 }
19079 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019080 D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019081 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19082 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019083 if (_n == 0 || p->error_indicator) {
19084 PyMem_Free(_children);
19085 D(p->level--);
19086 return NULL;
19087 }
19088 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19089 if (!_seq) {
19090 PyMem_Free(_children);
19091 p->error_indicator = 1;
19092 PyErr_NoMemory();
19093 D(p->level--);
19094 return NULL;
19095 }
19096 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19097 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019098 _PyPegen_insert_memo(p, _start_mark, _loop1_61_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019099 D(p->level--);
19100 return _seq;
19101}
19102
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019103// _loop0_62: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019104static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019105_loop0_62_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019106{
19107 D(p->level++);
19108 if (p->error_indicator) {
19109 D(p->level--);
19110 return NULL;
19111 }
19112 void *_res = NULL;
19113 int _mark = p->mark;
19114 int _start_mark = p->mark;
19115 void **_children = PyMem_Malloc(sizeof(void *));
19116 if (!_children) {
19117 p->error_indicator = 1;
19118 PyErr_NoMemory();
19119 D(p->level--);
19120 return NULL;
19121 }
19122 ssize_t _children_capacity = 1;
19123 ssize_t _n = 0;
19124 { // param_no_default
19125 if (p->error_indicator) {
19126 D(p->level--);
19127 return NULL;
19128 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019129 D(fprintf(stderr, "%*c> _loop0_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019130 arg_ty param_no_default_var;
19131 while (
19132 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19133 )
19134 {
19135 _res = param_no_default_var;
19136 if (_n == _children_capacity) {
19137 _children_capacity *= 2;
19138 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19139 if (!_new_children) {
19140 p->error_indicator = 1;
19141 PyErr_NoMemory();
19142 D(p->level--);
19143 return NULL;
19144 }
19145 _children = _new_children;
19146 }
19147 _children[_n++] = _res;
19148 _mark = p->mark;
19149 }
19150 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019151 D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019152 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19153 }
19154 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19155 if (!_seq) {
19156 PyMem_Free(_children);
19157 p->error_indicator = 1;
19158 PyErr_NoMemory();
19159 D(p->level--);
19160 return NULL;
19161 }
19162 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19163 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019164 _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019165 D(p->level--);
19166 return _seq;
19167}
19168
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019169// _loop1_63: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019170static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019171_loop1_63_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019172{
19173 D(p->level++);
19174 if (p->error_indicator) {
19175 D(p->level--);
19176 return NULL;
19177 }
19178 void *_res = NULL;
19179 int _mark = p->mark;
19180 int _start_mark = p->mark;
19181 void **_children = PyMem_Malloc(sizeof(void *));
19182 if (!_children) {
19183 p->error_indicator = 1;
19184 PyErr_NoMemory();
19185 D(p->level--);
19186 return NULL;
19187 }
19188 ssize_t _children_capacity = 1;
19189 ssize_t _n = 0;
19190 { // param_with_default
19191 if (p->error_indicator) {
19192 D(p->level--);
19193 return NULL;
19194 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019195 D(fprintf(stderr, "%*c> _loop1_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019196 NameDefaultPair* param_with_default_var;
19197 while (
19198 (param_with_default_var = param_with_default_rule(p)) // param_with_default
19199 )
19200 {
19201 _res = param_with_default_var;
19202 if (_n == _children_capacity) {
19203 _children_capacity *= 2;
19204 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19205 if (!_new_children) {
19206 p->error_indicator = 1;
19207 PyErr_NoMemory();
19208 D(p->level--);
19209 return NULL;
19210 }
19211 _children = _new_children;
19212 }
19213 _children[_n++] = _res;
19214 _mark = p->mark;
19215 }
19216 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019217 D(fprintf(stderr, "%*c%s _loop1_63[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019218 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
19219 }
19220 if (_n == 0 || p->error_indicator) {
19221 PyMem_Free(_children);
19222 D(p->level--);
19223 return NULL;
19224 }
19225 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19226 if (!_seq) {
19227 PyMem_Free(_children);
19228 p->error_indicator = 1;
19229 PyErr_NoMemory();
19230 D(p->level--);
19231 return NULL;
19232 }
19233 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19234 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019235 _PyPegen_insert_memo(p, _start_mark, _loop1_63_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019236 D(p->level--);
19237 return _seq;
19238}
19239
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019240// _loop0_64: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019241static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019242_loop0_64_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019243{
19244 D(p->level++);
19245 if (p->error_indicator) {
19246 D(p->level--);
19247 return NULL;
19248 }
19249 void *_res = NULL;
19250 int _mark = p->mark;
19251 int _start_mark = p->mark;
19252 void **_children = PyMem_Malloc(sizeof(void *));
19253 if (!_children) {
19254 p->error_indicator = 1;
19255 PyErr_NoMemory();
19256 D(p->level--);
19257 return NULL;
19258 }
19259 ssize_t _children_capacity = 1;
19260 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019261 { // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019262 if (p->error_indicator) {
19263 D(p->level--);
19264 return NULL;
19265 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019266 D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19267 arg_ty param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019268 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019269 (param_no_default_var = param_no_default_rule(p)) // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019270 )
19271 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019272 _res = param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019273 if (_n == _children_capacity) {
19274 _children_capacity *= 2;
19275 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19276 if (!_new_children) {
19277 p->error_indicator = 1;
19278 PyErr_NoMemory();
19279 D(p->level--);
19280 return NULL;
19281 }
19282 _children = _new_children;
19283 }
19284 _children[_n++] = _res;
19285 _mark = p->mark;
19286 }
19287 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019288 D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ',
19289 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019290 }
19291 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19292 if (!_seq) {
19293 PyMem_Free(_children);
19294 p->error_indicator = 1;
19295 PyErr_NoMemory();
19296 D(p->level--);
19297 return NULL;
19298 }
19299 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19300 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019301 _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019302 D(p->level--);
19303 return _seq;
19304}
19305
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019306// _loop1_65: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019307static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019308_loop1_65_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019309{
19310 D(p->level++);
19311 if (p->error_indicator) {
19312 D(p->level--);
19313 return NULL;
19314 }
19315 void *_res = NULL;
19316 int _mark = p->mark;
19317 int _start_mark = p->mark;
19318 void **_children = PyMem_Malloc(sizeof(void *));
19319 if (!_children) {
19320 p->error_indicator = 1;
19321 PyErr_NoMemory();
19322 D(p->level--);
19323 return NULL;
19324 }
19325 ssize_t _children_capacity = 1;
19326 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019327 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019328 if (p->error_indicator) {
19329 D(p->level--);
19330 return NULL;
19331 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019332 D(fprintf(stderr, "%*c> _loop1_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
19333 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019334 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019335 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019336 )
19337 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019338 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019339 if (_n == _children_capacity) {
19340 _children_capacity *= 2;
19341 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19342 if (!_new_children) {
19343 p->error_indicator = 1;
19344 PyErr_NoMemory();
19345 D(p->level--);
19346 return NULL;
19347 }
19348 _children = _new_children;
19349 }
19350 _children[_n++] = _res;
19351 _mark = p->mark;
19352 }
19353 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019354 D(fprintf(stderr, "%*c%s _loop1_65[%d-%d]: %s failed!\n", p->level, ' ',
19355 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019356 }
19357 if (_n == 0 || p->error_indicator) {
19358 PyMem_Free(_children);
19359 D(p->level--);
19360 return NULL;
19361 }
19362 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19363 if (!_seq) {
19364 PyMem_Free(_children);
19365 p->error_indicator = 1;
19366 PyErr_NoMemory();
19367 D(p->level--);
19368 return NULL;
19369 }
19370 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19371 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019372 _PyPegen_insert_memo(p, _start_mark, _loop1_65_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019373 D(p->level--);
19374 return _seq;
19375}
19376
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019377// _loop0_66: param_maybe_default
19378static asdl_seq *
19379_loop0_66_rule(Parser *p)
19380{
19381 D(p->level++);
19382 if (p->error_indicator) {
19383 D(p->level--);
19384 return NULL;
19385 }
19386 void *_res = NULL;
19387 int _mark = p->mark;
19388 int _start_mark = p->mark;
19389 void **_children = PyMem_Malloc(sizeof(void *));
19390 if (!_children) {
19391 p->error_indicator = 1;
19392 PyErr_NoMemory();
19393 D(p->level--);
19394 return NULL;
19395 }
19396 ssize_t _children_capacity = 1;
19397 ssize_t _n = 0;
19398 { // param_maybe_default
19399 if (p->error_indicator) {
19400 D(p->level--);
19401 return NULL;
19402 }
19403 D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19404 NameDefaultPair* param_maybe_default_var;
19405 while (
19406 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19407 )
19408 {
19409 _res = param_maybe_default_var;
19410 if (_n == _children_capacity) {
19411 _children_capacity *= 2;
19412 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19413 if (!_new_children) {
19414 p->error_indicator = 1;
19415 PyErr_NoMemory();
19416 D(p->level--);
19417 return NULL;
19418 }
19419 _children = _new_children;
19420 }
19421 _children[_n++] = _res;
19422 _mark = p->mark;
19423 }
19424 p->mark = _mark;
19425 D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ',
19426 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19427 }
19428 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19429 if (!_seq) {
19430 PyMem_Free(_children);
19431 p->error_indicator = 1;
19432 PyErr_NoMemory();
19433 D(p->level--);
19434 return NULL;
19435 }
19436 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19437 PyMem_Free(_children);
19438 _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq);
19439 D(p->level--);
19440 return _seq;
19441}
19442
19443// _loop1_67: param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019444static asdl_seq *
19445_loop1_67_rule(Parser *p)
19446{
19447 D(p->level++);
19448 if (p->error_indicator) {
19449 D(p->level--);
19450 return NULL;
19451 }
19452 void *_res = NULL;
19453 int _mark = p->mark;
19454 int _start_mark = p->mark;
19455 void **_children = PyMem_Malloc(sizeof(void *));
19456 if (!_children) {
19457 p->error_indicator = 1;
19458 PyErr_NoMemory();
19459 D(p->level--);
19460 return NULL;
19461 }
19462 ssize_t _children_capacity = 1;
19463 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019464 { // param_maybe_default
19465 if (p->error_indicator) {
19466 D(p->level--);
19467 return NULL;
19468 }
19469 D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19470 NameDefaultPair* param_maybe_default_var;
19471 while (
19472 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19473 )
19474 {
19475 _res = param_maybe_default_var;
19476 if (_n == _children_capacity) {
19477 _children_capacity *= 2;
19478 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19479 if (!_new_children) {
19480 p->error_indicator = 1;
19481 PyErr_NoMemory();
19482 D(p->level--);
19483 return NULL;
19484 }
19485 _children = _new_children;
19486 }
19487 _children[_n++] = _res;
19488 _mark = p->mark;
19489 }
19490 p->mark = _mark;
19491 D(fprintf(stderr, "%*c%s _loop1_67[%d-%d]: %s failed!\n", p->level, ' ',
19492 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19493 }
19494 if (_n == 0 || p->error_indicator) {
19495 PyMem_Free(_children);
19496 D(p->level--);
19497 return NULL;
19498 }
19499 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19500 if (!_seq) {
19501 PyMem_Free(_children);
19502 p->error_indicator = 1;
19503 PyErr_NoMemory();
19504 D(p->level--);
19505 return NULL;
19506 }
19507 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19508 PyMem_Free(_children);
19509 _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq);
19510 D(p->level--);
19511 return _seq;
19512}
19513
19514// _loop1_68: ('@' named_expression NEWLINE)
19515static asdl_seq *
19516_loop1_68_rule(Parser *p)
19517{
19518 D(p->level++);
19519 if (p->error_indicator) {
19520 D(p->level--);
19521 return NULL;
19522 }
19523 void *_res = NULL;
19524 int _mark = p->mark;
19525 int _start_mark = p->mark;
19526 void **_children = PyMem_Malloc(sizeof(void *));
19527 if (!_children) {
19528 p->error_indicator = 1;
19529 PyErr_NoMemory();
19530 D(p->level--);
19531 return NULL;
19532 }
19533 ssize_t _children_capacity = 1;
19534 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019535 { // ('@' named_expression NEWLINE)
19536 if (p->error_indicator) {
19537 D(p->level--);
19538 return NULL;
19539 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019540 D(fprintf(stderr, "%*c> _loop1_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010019541 void *_tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019542 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019543 (_tmp_142_var = _tmp_142_rule(p)) // '@' named_expression NEWLINE
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019544 )
19545 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019546 _res = _tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019547 if (_n == _children_capacity) {
19548 _children_capacity *= 2;
19549 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19550 if (!_new_children) {
19551 p->error_indicator = 1;
19552 PyErr_NoMemory();
19553 D(p->level--);
19554 return NULL;
19555 }
19556 _children = _new_children;
19557 }
19558 _children[_n++] = _res;
19559 _mark = p->mark;
19560 }
19561 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019562 D(fprintf(stderr, "%*c%s _loop1_68[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019563 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
19564 }
19565 if (_n == 0 || p->error_indicator) {
19566 PyMem_Free(_children);
19567 D(p->level--);
19568 return NULL;
19569 }
19570 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19571 if (!_seq) {
19572 PyMem_Free(_children);
19573 p->error_indicator = 1;
19574 PyErr_NoMemory();
19575 D(p->level--);
19576 return NULL;
19577 }
19578 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19579 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019580 _PyPegen_insert_memo(p, _start_mark, _loop1_68_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019581 D(p->level--);
19582 return _seq;
19583}
19584
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019585// _tmp_69: '(' arguments? ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019586static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019587_tmp_69_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019588{
19589 D(p->level++);
19590 if (p->error_indicator) {
19591 D(p->level--);
19592 return NULL;
19593 }
19594 void * _res = NULL;
19595 int _mark = p->mark;
19596 { // '(' arguments? ')'
19597 if (p->error_indicator) {
19598 D(p->level--);
19599 return NULL;
19600 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019601 D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019602 Token * _literal;
19603 Token * _literal_1;
19604 void *z;
19605 if (
19606 (_literal = _PyPegen_expect_token(p, 7)) // token='('
19607 &&
19608 (z = arguments_rule(p), 1) // arguments?
19609 &&
19610 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
19611 )
19612 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019613 D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019614 _res = z;
19615 if (_res == NULL && PyErr_Occurred()) {
19616 p->error_indicator = 1;
19617 D(p->level--);
19618 return NULL;
19619 }
19620 goto done;
19621 }
19622 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019623 D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019624 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
19625 }
19626 _res = NULL;
19627 done:
19628 D(p->level--);
19629 return _res;
19630}
19631
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019632// _loop0_71: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019633static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019634_loop0_71_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019635{
19636 D(p->level++);
19637 if (p->error_indicator) {
19638 D(p->level--);
19639 return NULL;
19640 }
19641 void *_res = NULL;
19642 int _mark = p->mark;
19643 int _start_mark = p->mark;
19644 void **_children = PyMem_Malloc(sizeof(void *));
19645 if (!_children) {
19646 p->error_indicator = 1;
19647 PyErr_NoMemory();
19648 D(p->level--);
19649 return NULL;
19650 }
19651 ssize_t _children_capacity = 1;
19652 ssize_t _n = 0;
19653 { // ',' star_expression
19654 if (p->error_indicator) {
19655 D(p->level--);
19656 return NULL;
19657 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019658 D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019659 Token * _literal;
19660 expr_ty elem;
19661 while (
19662 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19663 &&
19664 (elem = star_expression_rule(p)) // star_expression
19665 )
19666 {
19667 _res = elem;
19668 if (_res == NULL && PyErr_Occurred()) {
19669 p->error_indicator = 1;
19670 PyMem_Free(_children);
19671 D(p->level--);
19672 return NULL;
19673 }
19674 if (_n == _children_capacity) {
19675 _children_capacity *= 2;
19676 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19677 if (!_new_children) {
19678 p->error_indicator = 1;
19679 PyErr_NoMemory();
19680 D(p->level--);
19681 return NULL;
19682 }
19683 _children = _new_children;
19684 }
19685 _children[_n++] = _res;
19686 _mark = p->mark;
19687 }
19688 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019689 D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019690 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
19691 }
19692 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19693 if (!_seq) {
19694 PyMem_Free(_children);
19695 p->error_indicator = 1;
19696 PyErr_NoMemory();
19697 D(p->level--);
19698 return NULL;
19699 }
19700 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19701 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019702 _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019703 D(p->level--);
19704 return _seq;
19705}
19706
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019707// _gather_70: star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019708static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019709_gather_70_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019710{
19711 D(p->level++);
19712 if (p->error_indicator) {
19713 D(p->level--);
19714 return NULL;
19715 }
19716 asdl_seq * _res = NULL;
19717 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019718 { // star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019719 if (p->error_indicator) {
19720 D(p->level--);
19721 return NULL;
19722 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019723 D(fprintf(stderr, "%*c> _gather_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_71"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019724 expr_ty elem;
19725 asdl_seq * seq;
19726 if (
19727 (elem = star_expression_rule(p)) // star_expression
19728 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019729 (seq = _loop0_71_rule(p)) // _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019730 )
19731 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019732 D(fprintf(stderr, "%*c+ _gather_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression _loop0_71"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019733 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19734 goto done;
19735 }
19736 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019737 D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ',
19738 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_71"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019739 }
19740 _res = NULL;
19741 done:
19742 D(p->level--);
19743 return _res;
19744}
19745
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019746// _loop1_72: (',' star_expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019747static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019748_loop1_72_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019749{
19750 D(p->level++);
19751 if (p->error_indicator) {
19752 D(p->level--);
19753 return NULL;
19754 }
19755 void *_res = NULL;
19756 int _mark = p->mark;
19757 int _start_mark = p->mark;
19758 void **_children = PyMem_Malloc(sizeof(void *));
19759 if (!_children) {
19760 p->error_indicator = 1;
19761 PyErr_NoMemory();
19762 D(p->level--);
19763 return NULL;
19764 }
19765 ssize_t _children_capacity = 1;
19766 ssize_t _n = 0;
19767 { // (',' star_expression)
19768 if (p->error_indicator) {
19769 D(p->level--);
19770 return NULL;
19771 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019772 D(fprintf(stderr, "%*c> _loop1_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010019773 void *_tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019774 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019775 (_tmp_143_var = _tmp_143_rule(p)) // ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019776 )
19777 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019778 _res = _tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019779 if (_n == _children_capacity) {
19780 _children_capacity *= 2;
19781 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19782 if (!_new_children) {
19783 p->error_indicator = 1;
19784 PyErr_NoMemory();
19785 D(p->level--);
19786 return NULL;
19787 }
19788 _children = _new_children;
19789 }
19790 _children[_n++] = _res;
19791 _mark = p->mark;
19792 }
19793 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019794 D(fprintf(stderr, "%*c%s _loop1_72[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019795 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
19796 }
19797 if (_n == 0 || p->error_indicator) {
19798 PyMem_Free(_children);
19799 D(p->level--);
19800 return NULL;
19801 }
19802 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19803 if (!_seq) {
19804 PyMem_Free(_children);
19805 p->error_indicator = 1;
19806 PyErr_NoMemory();
19807 D(p->level--);
19808 return NULL;
19809 }
19810 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19811 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019812 _PyPegen_insert_memo(p, _start_mark, _loop1_72_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019813 D(p->level--);
19814 return _seq;
19815}
19816
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019817// _loop0_74: ',' star_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019818static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019819_loop0_74_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019820{
19821 D(p->level++);
19822 if (p->error_indicator) {
19823 D(p->level--);
19824 return NULL;
19825 }
19826 void *_res = NULL;
19827 int _mark = p->mark;
19828 int _start_mark = p->mark;
19829 void **_children = PyMem_Malloc(sizeof(void *));
19830 if (!_children) {
19831 p->error_indicator = 1;
19832 PyErr_NoMemory();
19833 D(p->level--);
19834 return NULL;
19835 }
19836 ssize_t _children_capacity = 1;
19837 ssize_t _n = 0;
19838 { // ',' star_named_expression
19839 if (p->error_indicator) {
19840 D(p->level--);
19841 return NULL;
19842 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019843 D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019844 Token * _literal;
19845 expr_ty elem;
19846 while (
19847 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19848 &&
19849 (elem = star_named_expression_rule(p)) // star_named_expression
19850 )
19851 {
19852 _res = elem;
19853 if (_res == NULL && PyErr_Occurred()) {
19854 p->error_indicator = 1;
19855 PyMem_Free(_children);
19856 D(p->level--);
19857 return NULL;
19858 }
19859 if (_n == _children_capacity) {
19860 _children_capacity *= 2;
19861 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19862 if (!_new_children) {
19863 p->error_indicator = 1;
19864 PyErr_NoMemory();
19865 D(p->level--);
19866 return NULL;
19867 }
19868 _children = _new_children;
19869 }
19870 _children[_n++] = _res;
19871 _mark = p->mark;
19872 }
19873 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019874 D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019875 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
19876 }
19877 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19878 if (!_seq) {
19879 PyMem_Free(_children);
19880 p->error_indicator = 1;
19881 PyErr_NoMemory();
19882 D(p->level--);
19883 return NULL;
19884 }
19885 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19886 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019887 _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019888 D(p->level--);
19889 return _seq;
19890}
19891
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019892// _gather_73: star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019893static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019894_gather_73_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019895{
19896 D(p->level++);
19897 if (p->error_indicator) {
19898 D(p->level--);
19899 return NULL;
19900 }
19901 asdl_seq * _res = NULL;
19902 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019903 { // star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019904 if (p->error_indicator) {
19905 D(p->level--);
19906 return NULL;
19907 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019908 D(fprintf(stderr, "%*c> _gather_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_74"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019909 expr_ty elem;
19910 asdl_seq * seq;
19911 if (
19912 (elem = star_named_expression_rule(p)) // star_named_expression
19913 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019914 (seq = _loop0_74_rule(p)) // _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019915 )
19916 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019917 D(fprintf(stderr, "%*c+ _gather_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_74"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019918 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19919 goto done;
19920 }
19921 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019922 D(fprintf(stderr, "%*c%s _gather_73[%d-%d]: %s failed!\n", p->level, ' ',
19923 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_74"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019924 }
19925 _res = NULL;
19926 done:
19927 D(p->level--);
19928 return _res;
19929}
19930
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019931// _loop1_75: (',' expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019932static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019933_loop1_75_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019934{
19935 D(p->level++);
19936 if (p->error_indicator) {
19937 D(p->level--);
19938 return NULL;
19939 }
19940 void *_res = NULL;
19941 int _mark = p->mark;
19942 int _start_mark = p->mark;
19943 void **_children = PyMem_Malloc(sizeof(void *));
19944 if (!_children) {
19945 p->error_indicator = 1;
19946 PyErr_NoMemory();
19947 D(p->level--);
19948 return NULL;
19949 }
19950 ssize_t _children_capacity = 1;
19951 ssize_t _n = 0;
19952 { // (',' expression)
19953 if (p->error_indicator) {
19954 D(p->level--);
19955 return NULL;
19956 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019957 D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010019958 void *_tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019959 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019960 (_tmp_144_var = _tmp_144_rule(p)) // ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019961 )
19962 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019963 _res = _tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019964 if (_n == _children_capacity) {
19965 _children_capacity *= 2;
19966 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19967 if (!_new_children) {
19968 p->error_indicator = 1;
19969 PyErr_NoMemory();
19970 D(p->level--);
19971 return NULL;
19972 }
19973 _children = _new_children;
19974 }
19975 _children[_n++] = _res;
19976 _mark = p->mark;
19977 }
19978 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019979 D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019980 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
19981 }
19982 if (_n == 0 || p->error_indicator) {
19983 PyMem_Free(_children);
19984 D(p->level--);
19985 return NULL;
19986 }
19987 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
19988 if (!_seq) {
19989 PyMem_Free(_children);
19990 p->error_indicator = 1;
19991 PyErr_NoMemory();
19992 D(p->level--);
19993 return NULL;
19994 }
19995 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
19996 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019997 _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019998 D(p->level--);
19999 return _seq;
20000}
20001
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020002// _loop0_76: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020003static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020004_loop0_76_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020005{
20006 D(p->level++);
20007 if (p->error_indicator) {
20008 D(p->level--);
20009 return NULL;
20010 }
20011 void *_res = NULL;
20012 int _mark = p->mark;
20013 int _start_mark = p->mark;
20014 void **_children = PyMem_Malloc(sizeof(void *));
20015 if (!_children) {
20016 p->error_indicator = 1;
20017 PyErr_NoMemory();
20018 D(p->level--);
20019 return NULL;
20020 }
20021 ssize_t _children_capacity = 1;
20022 ssize_t _n = 0;
20023 { // lambda_param_no_default
20024 if (p->error_indicator) {
20025 D(p->level--);
20026 return NULL;
20027 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020028 D(fprintf(stderr, "%*c> _loop0_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020029 arg_ty lambda_param_no_default_var;
20030 while (
20031 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20032 )
20033 {
20034 _res = lambda_param_no_default_var;
20035 if (_n == _children_capacity) {
20036 _children_capacity *= 2;
20037 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20038 if (!_new_children) {
20039 p->error_indicator = 1;
20040 PyErr_NoMemory();
20041 D(p->level--);
20042 return NULL;
20043 }
20044 _children = _new_children;
20045 }
20046 _children[_n++] = _res;
20047 _mark = p->mark;
20048 }
20049 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020050 D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020051 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020052 }
20053 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20054 if (!_seq) {
20055 PyMem_Free(_children);
20056 p->error_indicator = 1;
20057 PyErr_NoMemory();
20058 D(p->level--);
20059 return NULL;
20060 }
20061 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20062 PyMem_Free(_children);
20063 _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq);
20064 D(p->level--);
20065 return _seq;
20066}
20067
20068// _loop0_77: lambda_param_with_default
20069static asdl_seq *
20070_loop0_77_rule(Parser *p)
20071{
20072 D(p->level++);
20073 if (p->error_indicator) {
20074 D(p->level--);
20075 return NULL;
20076 }
20077 void *_res = NULL;
20078 int _mark = p->mark;
20079 int _start_mark = p->mark;
20080 void **_children = PyMem_Malloc(sizeof(void *));
20081 if (!_children) {
20082 p->error_indicator = 1;
20083 PyErr_NoMemory();
20084 D(p->level--);
20085 return NULL;
20086 }
20087 ssize_t _children_capacity = 1;
20088 ssize_t _n = 0;
20089 { // lambda_param_with_default
20090 if (p->error_indicator) {
20091 D(p->level--);
20092 return NULL;
20093 }
20094 D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20095 NameDefaultPair* lambda_param_with_default_var;
20096 while (
20097 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20098 )
20099 {
20100 _res = lambda_param_with_default_var;
20101 if (_n == _children_capacity) {
20102 _children_capacity *= 2;
20103 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20104 if (!_new_children) {
20105 p->error_indicator = 1;
20106 PyErr_NoMemory();
20107 D(p->level--);
20108 return NULL;
20109 }
20110 _children = _new_children;
20111 }
20112 _children[_n++] = _res;
20113 _mark = p->mark;
20114 }
20115 p->mark = _mark;
20116 D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ',
20117 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20118 }
20119 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20120 if (!_seq) {
20121 PyMem_Free(_children);
20122 p->error_indicator = 1;
20123 PyErr_NoMemory();
20124 D(p->level--);
20125 return NULL;
20126 }
20127 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20128 PyMem_Free(_children);
20129 _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq);
20130 D(p->level--);
20131 return _seq;
20132}
20133
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020134// _loop0_78: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020135static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020136_loop0_78_rule(Parser *p)
20137{
20138 D(p->level++);
20139 if (p->error_indicator) {
20140 D(p->level--);
20141 return NULL;
20142 }
20143 void *_res = NULL;
20144 int _mark = p->mark;
20145 int _start_mark = p->mark;
20146 void **_children = PyMem_Malloc(sizeof(void *));
20147 if (!_children) {
20148 p->error_indicator = 1;
20149 PyErr_NoMemory();
20150 D(p->level--);
20151 return NULL;
20152 }
20153 ssize_t _children_capacity = 1;
20154 ssize_t _n = 0;
20155 { // lambda_param_with_default
20156 if (p->error_indicator) {
20157 D(p->level--);
20158 return NULL;
20159 }
20160 D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20161 NameDefaultPair* lambda_param_with_default_var;
20162 while (
20163 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20164 )
20165 {
20166 _res = lambda_param_with_default_var;
20167 if (_n == _children_capacity) {
20168 _children_capacity *= 2;
20169 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20170 if (!_new_children) {
20171 p->error_indicator = 1;
20172 PyErr_NoMemory();
20173 D(p->level--);
20174 return NULL;
20175 }
20176 _children = _new_children;
20177 }
20178 _children[_n++] = _res;
20179 _mark = p->mark;
20180 }
20181 p->mark = _mark;
20182 D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
20183 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20184 }
20185 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20186 if (!_seq) {
20187 PyMem_Free(_children);
20188 p->error_indicator = 1;
20189 PyErr_NoMemory();
20190 D(p->level--);
20191 return NULL;
20192 }
20193 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20194 PyMem_Free(_children);
20195 _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq);
20196 D(p->level--);
20197 return _seq;
20198}
20199
20200// _loop1_79: lambda_param_no_default
20201static asdl_seq *
20202_loop1_79_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020203{
20204 D(p->level++);
20205 if (p->error_indicator) {
20206 D(p->level--);
20207 return NULL;
20208 }
20209 void *_res = NULL;
20210 int _mark = p->mark;
20211 int _start_mark = p->mark;
20212 void **_children = PyMem_Malloc(sizeof(void *));
20213 if (!_children) {
20214 p->error_indicator = 1;
20215 PyErr_NoMemory();
20216 D(p->level--);
20217 return NULL;
20218 }
20219 ssize_t _children_capacity = 1;
20220 ssize_t _n = 0;
20221 { // lambda_param_no_default
20222 if (p->error_indicator) {
20223 D(p->level--);
20224 return NULL;
20225 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020226 D(fprintf(stderr, "%*c> _loop1_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020227 arg_ty lambda_param_no_default_var;
20228 while (
20229 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20230 )
20231 {
20232 _res = lambda_param_no_default_var;
20233 if (_n == _children_capacity) {
20234 _children_capacity *= 2;
20235 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20236 if (!_new_children) {
20237 p->error_indicator = 1;
20238 PyErr_NoMemory();
20239 D(p->level--);
20240 return NULL;
20241 }
20242 _children = _new_children;
20243 }
20244 _children[_n++] = _res;
20245 _mark = p->mark;
20246 }
20247 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020248 D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020249 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20250 }
20251 if (_n == 0 || p->error_indicator) {
20252 PyMem_Free(_children);
20253 D(p->level--);
20254 return NULL;
20255 }
20256 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20257 if (!_seq) {
20258 PyMem_Free(_children);
20259 p->error_indicator = 1;
20260 PyErr_NoMemory();
20261 D(p->level--);
20262 return NULL;
20263 }
20264 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20265 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020266 _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020267 D(p->level--);
20268 return _seq;
20269}
20270
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020271// _loop0_80: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020272static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020273_loop0_80_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020274{
20275 D(p->level++);
20276 if (p->error_indicator) {
20277 D(p->level--);
20278 return NULL;
20279 }
20280 void *_res = NULL;
20281 int _mark = p->mark;
20282 int _start_mark = p->mark;
20283 void **_children = PyMem_Malloc(sizeof(void *));
20284 if (!_children) {
20285 p->error_indicator = 1;
20286 PyErr_NoMemory();
20287 D(p->level--);
20288 return NULL;
20289 }
20290 ssize_t _children_capacity = 1;
20291 ssize_t _n = 0;
20292 { // lambda_param_with_default
20293 if (p->error_indicator) {
20294 D(p->level--);
20295 return NULL;
20296 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020297 D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020298 NameDefaultPair* lambda_param_with_default_var;
20299 while (
20300 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20301 )
20302 {
20303 _res = lambda_param_with_default_var;
20304 if (_n == _children_capacity) {
20305 _children_capacity *= 2;
20306 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20307 if (!_new_children) {
20308 p->error_indicator = 1;
20309 PyErr_NoMemory();
20310 D(p->level--);
20311 return NULL;
20312 }
20313 _children = _new_children;
20314 }
20315 _children[_n++] = _res;
20316 _mark = p->mark;
20317 }
20318 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020319 D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020320 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20321 }
20322 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20323 if (!_seq) {
20324 PyMem_Free(_children);
20325 p->error_indicator = 1;
20326 PyErr_NoMemory();
20327 D(p->level--);
20328 return NULL;
20329 }
20330 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20331 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020332 _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020333 D(p->level--);
20334 return _seq;
20335}
20336
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020337// _loop1_81: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020338static asdl_seq *
20339_loop1_81_rule(Parser *p)
20340{
20341 D(p->level++);
20342 if (p->error_indicator) {
20343 D(p->level--);
20344 return NULL;
20345 }
20346 void *_res = NULL;
20347 int _mark = p->mark;
20348 int _start_mark = p->mark;
20349 void **_children = PyMem_Malloc(sizeof(void *));
20350 if (!_children) {
20351 p->error_indicator = 1;
20352 PyErr_NoMemory();
20353 D(p->level--);
20354 return NULL;
20355 }
20356 ssize_t _children_capacity = 1;
20357 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020358 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020359 if (p->error_indicator) {
20360 D(p->level--);
20361 return NULL;
20362 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020363 D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20364 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020365 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020366 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020367 )
20368 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020369 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020370 if (_n == _children_capacity) {
20371 _children_capacity *= 2;
20372 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20373 if (!_new_children) {
20374 p->error_indicator = 1;
20375 PyErr_NoMemory();
20376 D(p->level--);
20377 return NULL;
20378 }
20379 _children = _new_children;
20380 }
20381 _children[_n++] = _res;
20382 _mark = p->mark;
20383 }
20384 p->mark = _mark;
20385 D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020386 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020387 }
20388 if (_n == 0 || p->error_indicator) {
20389 PyMem_Free(_children);
20390 D(p->level--);
20391 return NULL;
20392 }
20393 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20394 if (!_seq) {
20395 PyMem_Free(_children);
20396 p->error_indicator = 1;
20397 PyErr_NoMemory();
20398 D(p->level--);
20399 return NULL;
20400 }
20401 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20402 PyMem_Free(_children);
20403 _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
20404 D(p->level--);
20405 return _seq;
20406}
20407
20408// _loop1_82: lambda_param_no_default
20409static asdl_seq *
20410_loop1_82_rule(Parser *p)
20411{
20412 D(p->level++);
20413 if (p->error_indicator) {
20414 D(p->level--);
20415 return NULL;
20416 }
20417 void *_res = NULL;
20418 int _mark = p->mark;
20419 int _start_mark = p->mark;
20420 void **_children = PyMem_Malloc(sizeof(void *));
20421 if (!_children) {
20422 p->error_indicator = 1;
20423 PyErr_NoMemory();
20424 D(p->level--);
20425 return NULL;
20426 }
20427 ssize_t _children_capacity = 1;
20428 ssize_t _n = 0;
20429 { // lambda_param_no_default
20430 if (p->error_indicator) {
20431 D(p->level--);
20432 return NULL;
20433 }
20434 D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20435 arg_ty lambda_param_no_default_var;
20436 while (
20437 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20438 )
20439 {
20440 _res = lambda_param_no_default_var;
20441 if (_n == _children_capacity) {
20442 _children_capacity *= 2;
20443 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20444 if (!_new_children) {
20445 p->error_indicator = 1;
20446 PyErr_NoMemory();
20447 D(p->level--);
20448 return NULL;
20449 }
20450 _children = _new_children;
20451 }
20452 _children[_n++] = _res;
20453 _mark = p->mark;
20454 }
20455 p->mark = _mark;
20456 D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ',
20457 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20458 }
20459 if (_n == 0 || p->error_indicator) {
20460 PyMem_Free(_children);
20461 D(p->level--);
20462 return NULL;
20463 }
20464 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20465 if (!_seq) {
20466 PyMem_Free(_children);
20467 p->error_indicator = 1;
20468 PyErr_NoMemory();
20469 D(p->level--);
20470 return NULL;
20471 }
20472 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20473 PyMem_Free(_children);
20474 _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq);
20475 D(p->level--);
20476 return _seq;
20477}
20478
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020479// _loop1_83: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020480static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020481_loop1_83_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020482{
20483 D(p->level++);
20484 if (p->error_indicator) {
20485 D(p->level--);
20486 return NULL;
20487 }
20488 void *_res = NULL;
20489 int _mark = p->mark;
20490 int _start_mark = p->mark;
20491 void **_children = PyMem_Malloc(sizeof(void *));
20492 if (!_children) {
20493 p->error_indicator = 1;
20494 PyErr_NoMemory();
20495 D(p->level--);
20496 return NULL;
20497 }
20498 ssize_t _children_capacity = 1;
20499 ssize_t _n = 0;
20500 { // lambda_param_no_default
20501 if (p->error_indicator) {
20502 D(p->level--);
20503 return NULL;
20504 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020505 D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020506 arg_ty lambda_param_no_default_var;
20507 while (
20508 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20509 )
20510 {
20511 _res = lambda_param_no_default_var;
20512 if (_n == _children_capacity) {
20513 _children_capacity *= 2;
20514 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20515 if (!_new_children) {
20516 p->error_indicator = 1;
20517 PyErr_NoMemory();
20518 D(p->level--);
20519 return NULL;
20520 }
20521 _children = _new_children;
20522 }
20523 _children[_n++] = _res;
20524 _mark = p->mark;
20525 }
20526 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020527 D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020528 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20529 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020530 if (_n == 0 || p->error_indicator) {
20531 PyMem_Free(_children);
20532 D(p->level--);
20533 return NULL;
20534 }
20535 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20536 if (!_seq) {
20537 PyMem_Free(_children);
20538 p->error_indicator = 1;
20539 PyErr_NoMemory();
20540 D(p->level--);
20541 return NULL;
20542 }
20543 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20544 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020545 _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020546 D(p->level--);
20547 return _seq;
20548}
20549
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020550// _loop0_84: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020551static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020552_loop0_84_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020553{
20554 D(p->level++);
20555 if (p->error_indicator) {
20556 D(p->level--);
20557 return NULL;
20558 }
20559 void *_res = NULL;
20560 int _mark = p->mark;
20561 int _start_mark = p->mark;
20562 void **_children = PyMem_Malloc(sizeof(void *));
20563 if (!_children) {
20564 p->error_indicator = 1;
20565 PyErr_NoMemory();
20566 D(p->level--);
20567 return NULL;
20568 }
20569 ssize_t _children_capacity = 1;
20570 ssize_t _n = 0;
20571 { // lambda_param_no_default
20572 if (p->error_indicator) {
20573 D(p->level--);
20574 return NULL;
20575 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020576 D(fprintf(stderr, "%*c> _loop0_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020577 arg_ty lambda_param_no_default_var;
20578 while (
20579 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20580 )
20581 {
20582 _res = lambda_param_no_default_var;
20583 if (_n == _children_capacity) {
20584 _children_capacity *= 2;
20585 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20586 if (!_new_children) {
20587 p->error_indicator = 1;
20588 PyErr_NoMemory();
20589 D(p->level--);
20590 return NULL;
20591 }
20592 _children = _new_children;
20593 }
20594 _children[_n++] = _res;
20595 _mark = p->mark;
20596 }
20597 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020598 D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020599 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20600 }
20601 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20602 if (!_seq) {
20603 PyMem_Free(_children);
20604 p->error_indicator = 1;
20605 PyErr_NoMemory();
20606 D(p->level--);
20607 return NULL;
20608 }
20609 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20610 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020611 _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020612 D(p->level--);
20613 return _seq;
20614}
20615
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020616// _loop1_85: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020617static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020618_loop1_85_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020619{
20620 D(p->level++);
20621 if (p->error_indicator) {
20622 D(p->level--);
20623 return NULL;
20624 }
20625 void *_res = NULL;
20626 int _mark = p->mark;
20627 int _start_mark = p->mark;
20628 void **_children = PyMem_Malloc(sizeof(void *));
20629 if (!_children) {
20630 p->error_indicator = 1;
20631 PyErr_NoMemory();
20632 D(p->level--);
20633 return NULL;
20634 }
20635 ssize_t _children_capacity = 1;
20636 ssize_t _n = 0;
20637 { // lambda_param_with_default
20638 if (p->error_indicator) {
20639 D(p->level--);
20640 return NULL;
20641 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020642 D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020643 NameDefaultPair* lambda_param_with_default_var;
20644 while (
20645 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20646 )
20647 {
20648 _res = lambda_param_with_default_var;
20649 if (_n == _children_capacity) {
20650 _children_capacity *= 2;
20651 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20652 if (!_new_children) {
20653 p->error_indicator = 1;
20654 PyErr_NoMemory();
20655 D(p->level--);
20656 return NULL;
20657 }
20658 _children = _new_children;
20659 }
20660 _children[_n++] = _res;
20661 _mark = p->mark;
20662 }
20663 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020664 D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020665 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20666 }
20667 if (_n == 0 || p->error_indicator) {
20668 PyMem_Free(_children);
20669 D(p->level--);
20670 return NULL;
20671 }
20672 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20673 if (!_seq) {
20674 PyMem_Free(_children);
20675 p->error_indicator = 1;
20676 PyErr_NoMemory();
20677 D(p->level--);
20678 return NULL;
20679 }
20680 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20681 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020682 _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020683 D(p->level--);
20684 return _seq;
20685}
20686
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020687// _loop0_86: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020688static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020689_loop0_86_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020690{
20691 D(p->level++);
20692 if (p->error_indicator) {
20693 D(p->level--);
20694 return NULL;
20695 }
20696 void *_res = NULL;
20697 int _mark = p->mark;
20698 int _start_mark = p->mark;
20699 void **_children = PyMem_Malloc(sizeof(void *));
20700 if (!_children) {
20701 p->error_indicator = 1;
20702 PyErr_NoMemory();
20703 D(p->level--);
20704 return NULL;
20705 }
20706 ssize_t _children_capacity = 1;
20707 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020708 { // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020709 if (p->error_indicator) {
20710 D(p->level--);
20711 return NULL;
20712 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020713 D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20714 arg_ty lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020715 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020716 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020717 )
20718 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020719 _res = lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020720 if (_n == _children_capacity) {
20721 _children_capacity *= 2;
20722 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20723 if (!_new_children) {
20724 p->error_indicator = 1;
20725 PyErr_NoMemory();
20726 D(p->level--);
20727 return NULL;
20728 }
20729 _children = _new_children;
20730 }
20731 _children[_n++] = _res;
20732 _mark = p->mark;
20733 }
20734 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020735 D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ',
20736 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020737 }
20738 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20739 if (!_seq) {
20740 PyMem_Free(_children);
20741 p->error_indicator = 1;
20742 PyErr_NoMemory();
20743 D(p->level--);
20744 return NULL;
20745 }
20746 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20747 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020748 _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020749 D(p->level--);
20750 return _seq;
20751}
20752
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020753// _loop1_87: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020754static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020755_loop1_87_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020756{
20757 D(p->level++);
20758 if (p->error_indicator) {
20759 D(p->level--);
20760 return NULL;
20761 }
20762 void *_res = NULL;
20763 int _mark = p->mark;
20764 int _start_mark = p->mark;
20765 void **_children = PyMem_Malloc(sizeof(void *));
20766 if (!_children) {
20767 p->error_indicator = 1;
20768 PyErr_NoMemory();
20769 D(p->level--);
20770 return NULL;
20771 }
20772 ssize_t _children_capacity = 1;
20773 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020774 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020775 if (p->error_indicator) {
20776 D(p->level--);
20777 return NULL;
20778 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020779 D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20780 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020781 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020782 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020783 )
20784 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020785 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020786 if (_n == _children_capacity) {
20787 _children_capacity *= 2;
20788 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20789 if (!_new_children) {
20790 p->error_indicator = 1;
20791 PyErr_NoMemory();
20792 D(p->level--);
20793 return NULL;
20794 }
20795 _children = _new_children;
20796 }
20797 _children[_n++] = _res;
20798 _mark = p->mark;
20799 }
20800 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020801 D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ',
20802 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020803 }
20804 if (_n == 0 || p->error_indicator) {
20805 PyMem_Free(_children);
20806 D(p->level--);
20807 return NULL;
20808 }
20809 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20810 if (!_seq) {
20811 PyMem_Free(_children);
20812 p->error_indicator = 1;
20813 PyErr_NoMemory();
20814 D(p->level--);
20815 return NULL;
20816 }
20817 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20818 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020819 _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020820 D(p->level--);
20821 return _seq;
20822}
20823
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020824// _loop0_88: lambda_param_maybe_default
20825static asdl_seq *
20826_loop0_88_rule(Parser *p)
20827{
20828 D(p->level++);
20829 if (p->error_indicator) {
20830 D(p->level--);
20831 return NULL;
20832 }
20833 void *_res = NULL;
20834 int _mark = p->mark;
20835 int _start_mark = p->mark;
20836 void **_children = PyMem_Malloc(sizeof(void *));
20837 if (!_children) {
20838 p->error_indicator = 1;
20839 PyErr_NoMemory();
20840 D(p->level--);
20841 return NULL;
20842 }
20843 ssize_t _children_capacity = 1;
20844 ssize_t _n = 0;
20845 { // lambda_param_maybe_default
20846 if (p->error_indicator) {
20847 D(p->level--);
20848 return NULL;
20849 }
20850 D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20851 NameDefaultPair* lambda_param_maybe_default_var;
20852 while (
20853 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20854 )
20855 {
20856 _res = lambda_param_maybe_default_var;
20857 if (_n == _children_capacity) {
20858 _children_capacity *= 2;
20859 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20860 if (!_new_children) {
20861 p->error_indicator = 1;
20862 PyErr_NoMemory();
20863 D(p->level--);
20864 return NULL;
20865 }
20866 _children = _new_children;
20867 }
20868 _children[_n++] = _res;
20869 _mark = p->mark;
20870 }
20871 p->mark = _mark;
20872 D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ',
20873 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20874 }
20875 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20876 if (!_seq) {
20877 PyMem_Free(_children);
20878 p->error_indicator = 1;
20879 PyErr_NoMemory();
20880 D(p->level--);
20881 return NULL;
20882 }
20883 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20884 PyMem_Free(_children);
20885 _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq);
20886 D(p->level--);
20887 return _seq;
20888}
20889
20890// _loop1_89: lambda_param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020891static asdl_seq *
20892_loop1_89_rule(Parser *p)
20893{
20894 D(p->level++);
20895 if (p->error_indicator) {
20896 D(p->level--);
20897 return NULL;
20898 }
20899 void *_res = NULL;
20900 int _mark = p->mark;
20901 int _start_mark = p->mark;
20902 void **_children = PyMem_Malloc(sizeof(void *));
20903 if (!_children) {
20904 p->error_indicator = 1;
20905 PyErr_NoMemory();
20906 D(p->level--);
20907 return NULL;
20908 }
20909 ssize_t _children_capacity = 1;
20910 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020911 { // lambda_param_maybe_default
20912 if (p->error_indicator) {
20913 D(p->level--);
20914 return NULL;
20915 }
20916 D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20917 NameDefaultPair* lambda_param_maybe_default_var;
20918 while (
20919 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20920 )
20921 {
20922 _res = lambda_param_maybe_default_var;
20923 if (_n == _children_capacity) {
20924 _children_capacity *= 2;
20925 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20926 if (!_new_children) {
20927 p->error_indicator = 1;
20928 PyErr_NoMemory();
20929 D(p->level--);
20930 return NULL;
20931 }
20932 _children = _new_children;
20933 }
20934 _children[_n++] = _res;
20935 _mark = p->mark;
20936 }
20937 p->mark = _mark;
20938 D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ',
20939 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20940 }
20941 if (_n == 0 || p->error_indicator) {
20942 PyMem_Free(_children);
20943 D(p->level--);
20944 return NULL;
20945 }
20946 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
20947 if (!_seq) {
20948 PyMem_Free(_children);
20949 p->error_indicator = 1;
20950 PyErr_NoMemory();
20951 D(p->level--);
20952 return NULL;
20953 }
20954 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
20955 PyMem_Free(_children);
20956 _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq);
20957 D(p->level--);
20958 return _seq;
20959}
20960
20961// _loop1_90: ('or' conjunction)
20962static asdl_seq *
20963_loop1_90_rule(Parser *p)
20964{
20965 D(p->level++);
20966 if (p->error_indicator) {
20967 D(p->level--);
20968 return NULL;
20969 }
20970 void *_res = NULL;
20971 int _mark = p->mark;
20972 int _start_mark = p->mark;
20973 void **_children = PyMem_Malloc(sizeof(void *));
20974 if (!_children) {
20975 p->error_indicator = 1;
20976 PyErr_NoMemory();
20977 D(p->level--);
20978 return NULL;
20979 }
20980 ssize_t _children_capacity = 1;
20981 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020982 { // ('or' conjunction)
20983 if (p->error_indicator) {
20984 D(p->level--);
20985 return NULL;
20986 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020987 D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010020988 void *_tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020989 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010020990 (_tmp_145_var = _tmp_145_rule(p)) // 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020991 )
20992 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010020993 _res = _tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020994 if (_n == _children_capacity) {
20995 _children_capacity *= 2;
20996 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20997 if (!_new_children) {
20998 p->error_indicator = 1;
20999 PyErr_NoMemory();
21000 D(p->level--);
21001 return NULL;
21002 }
21003 _children = _new_children;
21004 }
21005 _children[_n++] = _res;
21006 _mark = p->mark;
21007 }
21008 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021009 D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021010 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
21011 }
21012 if (_n == 0 || p->error_indicator) {
21013 PyMem_Free(_children);
21014 D(p->level--);
21015 return NULL;
21016 }
21017 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21018 if (!_seq) {
21019 PyMem_Free(_children);
21020 p->error_indicator = 1;
21021 PyErr_NoMemory();
21022 D(p->level--);
21023 return NULL;
21024 }
21025 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21026 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021027 _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021028 D(p->level--);
21029 return _seq;
21030}
21031
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021032// _loop1_91: ('and' inversion)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021033static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021034_loop1_91_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021035{
21036 D(p->level++);
21037 if (p->error_indicator) {
21038 D(p->level--);
21039 return NULL;
21040 }
21041 void *_res = NULL;
21042 int _mark = p->mark;
21043 int _start_mark = p->mark;
21044 void **_children = PyMem_Malloc(sizeof(void *));
21045 if (!_children) {
21046 p->error_indicator = 1;
21047 PyErr_NoMemory();
21048 D(p->level--);
21049 return NULL;
21050 }
21051 ssize_t _children_capacity = 1;
21052 ssize_t _n = 0;
21053 { // ('and' inversion)
21054 if (p->error_indicator) {
21055 D(p->level--);
21056 return NULL;
21057 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021058 D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010021059 void *_tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021060 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010021061 (_tmp_146_var = _tmp_146_rule(p)) // 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021062 )
21063 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021064 _res = _tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021065 if (_n == _children_capacity) {
21066 _children_capacity *= 2;
21067 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21068 if (!_new_children) {
21069 p->error_indicator = 1;
21070 PyErr_NoMemory();
21071 D(p->level--);
21072 return NULL;
21073 }
21074 _children = _new_children;
21075 }
21076 _children[_n++] = _res;
21077 _mark = p->mark;
21078 }
21079 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021080 D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021081 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
21082 }
21083 if (_n == 0 || p->error_indicator) {
21084 PyMem_Free(_children);
21085 D(p->level--);
21086 return NULL;
21087 }
21088 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21089 if (!_seq) {
21090 PyMem_Free(_children);
21091 p->error_indicator = 1;
21092 PyErr_NoMemory();
21093 D(p->level--);
21094 return NULL;
21095 }
21096 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21097 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021098 _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021099 D(p->level--);
21100 return _seq;
21101}
21102
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021103// _loop1_92: compare_op_bitwise_or_pair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021104static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021105_loop1_92_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021106{
21107 D(p->level++);
21108 if (p->error_indicator) {
21109 D(p->level--);
21110 return NULL;
21111 }
21112 void *_res = NULL;
21113 int _mark = p->mark;
21114 int _start_mark = p->mark;
21115 void **_children = PyMem_Malloc(sizeof(void *));
21116 if (!_children) {
21117 p->error_indicator = 1;
21118 PyErr_NoMemory();
21119 D(p->level--);
21120 return NULL;
21121 }
21122 ssize_t _children_capacity = 1;
21123 ssize_t _n = 0;
21124 { // compare_op_bitwise_or_pair
21125 if (p->error_indicator) {
21126 D(p->level--);
21127 return NULL;
21128 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021129 D(fprintf(stderr, "%*c> _loop1_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021130 CmpopExprPair* compare_op_bitwise_or_pair_var;
21131 while (
21132 (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair
21133 )
21134 {
21135 _res = compare_op_bitwise_or_pair_var;
21136 if (_n == _children_capacity) {
21137 _children_capacity *= 2;
21138 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21139 if (!_new_children) {
21140 p->error_indicator = 1;
21141 PyErr_NoMemory();
21142 D(p->level--);
21143 return NULL;
21144 }
21145 _children = _new_children;
21146 }
21147 _children[_n++] = _res;
21148 _mark = p->mark;
21149 }
21150 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021151 D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021152 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
21153 }
21154 if (_n == 0 || p->error_indicator) {
21155 PyMem_Free(_children);
21156 D(p->level--);
21157 return NULL;
21158 }
21159 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21160 if (!_seq) {
21161 PyMem_Free(_children);
21162 p->error_indicator = 1;
21163 PyErr_NoMemory();
21164 D(p->level--);
21165 return NULL;
21166 }
21167 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21168 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021169 _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021170 D(p->level--);
21171 return _seq;
21172}
21173
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021174// _tmp_93: '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021175static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021176_tmp_93_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021177{
21178 D(p->level++);
21179 if (p->error_indicator) {
21180 D(p->level--);
21181 return NULL;
21182 }
21183 void * _res = NULL;
21184 int _mark = p->mark;
21185 { // '!='
21186 if (p->error_indicator) {
21187 D(p->level--);
21188 return NULL;
21189 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021190 D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021191 Token * tok;
21192 if (
21193 (tok = _PyPegen_expect_token(p, 28)) // token='!='
21194 )
21195 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021196 D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021197 _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok;
21198 if (_res == NULL && PyErr_Occurred()) {
21199 p->error_indicator = 1;
21200 D(p->level--);
21201 return NULL;
21202 }
21203 goto done;
21204 }
21205 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021206 D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021207 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
21208 }
21209 _res = NULL;
21210 done:
21211 D(p->level--);
21212 return _res;
21213}
21214
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021215// _loop0_95: ',' slice
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021216static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021217_loop0_95_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021218{
21219 D(p->level++);
21220 if (p->error_indicator) {
21221 D(p->level--);
21222 return NULL;
21223 }
21224 void *_res = NULL;
21225 int _mark = p->mark;
21226 int _start_mark = p->mark;
21227 void **_children = PyMem_Malloc(sizeof(void *));
21228 if (!_children) {
21229 p->error_indicator = 1;
21230 PyErr_NoMemory();
21231 D(p->level--);
21232 return NULL;
21233 }
21234 ssize_t _children_capacity = 1;
21235 ssize_t _n = 0;
21236 { // ',' slice
21237 if (p->error_indicator) {
21238 D(p->level--);
21239 return NULL;
21240 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021241 D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021242 Token * _literal;
21243 expr_ty elem;
21244 while (
21245 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21246 &&
21247 (elem = slice_rule(p)) // slice
21248 )
21249 {
21250 _res = elem;
21251 if (_res == NULL && PyErr_Occurred()) {
21252 p->error_indicator = 1;
21253 PyMem_Free(_children);
21254 D(p->level--);
21255 return NULL;
21256 }
21257 if (_n == _children_capacity) {
21258 _children_capacity *= 2;
21259 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21260 if (!_new_children) {
21261 p->error_indicator = 1;
21262 PyErr_NoMemory();
21263 D(p->level--);
21264 return NULL;
21265 }
21266 _children = _new_children;
21267 }
21268 _children[_n++] = _res;
21269 _mark = p->mark;
21270 }
21271 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021272 D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021273 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
21274 }
21275 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21276 if (!_seq) {
21277 PyMem_Free(_children);
21278 p->error_indicator = 1;
21279 PyErr_NoMemory();
21280 D(p->level--);
21281 return NULL;
21282 }
21283 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21284 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021285 _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021286 D(p->level--);
21287 return _seq;
21288}
21289
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021290// _gather_94: slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021291static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021292_gather_94_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021293{
21294 D(p->level++);
21295 if (p->error_indicator) {
21296 D(p->level--);
21297 return NULL;
21298 }
21299 asdl_seq * _res = NULL;
21300 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021301 { // slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021302 if (p->error_indicator) {
21303 D(p->level--);
21304 return NULL;
21305 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021306 D(fprintf(stderr, "%*c> _gather_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_95"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021307 expr_ty elem;
21308 asdl_seq * seq;
21309 if (
21310 (elem = slice_rule(p)) // slice
21311 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021312 (seq = _loop0_95_rule(p)) // _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021313 )
21314 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021315 D(fprintf(stderr, "%*c+ _gather_94[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_95"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021316 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21317 goto done;
21318 }
21319 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021320 D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ',
21321 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_95"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021322 }
21323 _res = NULL;
21324 done:
21325 D(p->level--);
21326 return _res;
21327}
21328
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021329// _tmp_96: ':' expression?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021330static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021331_tmp_96_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021332{
21333 D(p->level++);
21334 if (p->error_indicator) {
21335 D(p->level--);
21336 return NULL;
21337 }
21338 void * _res = NULL;
21339 int _mark = p->mark;
21340 { // ':' expression?
21341 if (p->error_indicator) {
21342 D(p->level--);
21343 return NULL;
21344 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021345 D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021346 Token * _literal;
21347 void *d;
21348 if (
21349 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
21350 &&
21351 (d = expression_rule(p), 1) // expression?
21352 )
21353 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021354 D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021355 _res = d;
21356 if (_res == NULL && PyErr_Occurred()) {
21357 p->error_indicator = 1;
21358 D(p->level--);
21359 return NULL;
21360 }
21361 goto done;
21362 }
21363 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021364 D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021365 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
21366 }
21367 _res = NULL;
21368 done:
21369 D(p->level--);
21370 return _res;
21371}
21372
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021373// _tmp_97: tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021374static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021375_tmp_97_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021376{
21377 D(p->level++);
21378 if (p->error_indicator) {
21379 D(p->level--);
21380 return NULL;
21381 }
21382 void * _res = NULL;
21383 int _mark = p->mark;
21384 { // tuple
21385 if (p->error_indicator) {
21386 D(p->level--);
21387 return NULL;
21388 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021389 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021390 expr_ty tuple_var;
21391 if (
21392 (tuple_var = tuple_rule(p)) // tuple
21393 )
21394 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021395 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021396 _res = tuple_var;
21397 goto done;
21398 }
21399 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021400 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021401 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
21402 }
21403 { // group
21404 if (p->error_indicator) {
21405 D(p->level--);
21406 return NULL;
21407 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021408 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021409 expr_ty group_var;
21410 if (
21411 (group_var = group_rule(p)) // group
21412 )
21413 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021414 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021415 _res = group_var;
21416 goto done;
21417 }
21418 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021419 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021420 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
21421 }
21422 { // genexp
21423 if (p->error_indicator) {
21424 D(p->level--);
21425 return NULL;
21426 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021427 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021428 expr_ty genexp_var;
21429 if (
21430 (genexp_var = genexp_rule(p)) // genexp
21431 )
21432 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021433 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021434 _res = genexp_var;
21435 goto done;
21436 }
21437 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021438 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021439 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
21440 }
21441 _res = NULL;
21442 done:
21443 D(p->level--);
21444 return _res;
21445}
21446
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021447// _tmp_98: list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021448static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021449_tmp_98_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021450{
21451 D(p->level++);
21452 if (p->error_indicator) {
21453 D(p->level--);
21454 return NULL;
21455 }
21456 void * _res = NULL;
21457 int _mark = p->mark;
21458 { // list
21459 if (p->error_indicator) {
21460 D(p->level--);
21461 return NULL;
21462 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021463 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021464 expr_ty list_var;
21465 if (
21466 (list_var = list_rule(p)) // list
21467 )
21468 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021469 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021470 _res = list_var;
21471 goto done;
21472 }
21473 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021474 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
21476 }
21477 { // listcomp
21478 if (p->error_indicator) {
21479 D(p->level--);
21480 return NULL;
21481 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021482 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021483 expr_ty listcomp_var;
21484 if (
21485 (listcomp_var = listcomp_rule(p)) // listcomp
21486 )
21487 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021488 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021489 _res = listcomp_var;
21490 goto done;
21491 }
21492 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021493 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021494 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
21495 }
21496 _res = NULL;
21497 done:
21498 D(p->level--);
21499 return _res;
21500}
21501
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021502// _tmp_99: dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021503static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021504_tmp_99_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021505{
21506 D(p->level++);
21507 if (p->error_indicator) {
21508 D(p->level--);
21509 return NULL;
21510 }
21511 void * _res = NULL;
21512 int _mark = p->mark;
21513 { // dict
21514 if (p->error_indicator) {
21515 D(p->level--);
21516 return NULL;
21517 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021518 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021519 expr_ty dict_var;
21520 if (
21521 (dict_var = dict_rule(p)) // dict
21522 )
21523 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021524 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021525 _res = dict_var;
21526 goto done;
21527 }
21528 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021529 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021530 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
21531 }
21532 { // set
21533 if (p->error_indicator) {
21534 D(p->level--);
21535 return NULL;
21536 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021537 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021538 expr_ty set_var;
21539 if (
21540 (set_var = set_rule(p)) // set
21541 )
21542 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021543 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021544 _res = set_var;
21545 goto done;
21546 }
21547 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021548 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021549 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
21550 }
21551 { // dictcomp
21552 if (p->error_indicator) {
21553 D(p->level--);
21554 return NULL;
21555 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021556 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021557 expr_ty dictcomp_var;
21558 if (
21559 (dictcomp_var = dictcomp_rule(p)) // dictcomp
21560 )
21561 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021562 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021563 _res = dictcomp_var;
21564 goto done;
21565 }
21566 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021567 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021568 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
21569 }
21570 { // setcomp
21571 if (p->error_indicator) {
21572 D(p->level--);
21573 return NULL;
21574 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021575 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021576 expr_ty setcomp_var;
21577 if (
21578 (setcomp_var = setcomp_rule(p)) // setcomp
21579 )
21580 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021581 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021582 _res = setcomp_var;
21583 goto done;
21584 }
21585 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021586 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021587 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
21588 }
21589 _res = NULL;
21590 done:
21591 D(p->level--);
21592 return _res;
21593}
21594
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021595// _loop1_100: STRING
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021596static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021597_loop1_100_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021598{
21599 D(p->level++);
21600 if (p->error_indicator) {
21601 D(p->level--);
21602 return NULL;
21603 }
21604 void *_res = NULL;
21605 int _mark = p->mark;
21606 int _start_mark = p->mark;
21607 void **_children = PyMem_Malloc(sizeof(void *));
21608 if (!_children) {
21609 p->error_indicator = 1;
21610 PyErr_NoMemory();
21611 D(p->level--);
21612 return NULL;
21613 }
21614 ssize_t _children_capacity = 1;
21615 ssize_t _n = 0;
21616 { // STRING
21617 if (p->error_indicator) {
21618 D(p->level--);
21619 return NULL;
21620 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021621 D(fprintf(stderr, "%*c> _loop1_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021622 expr_ty string_var;
21623 while (
21624 (string_var = _PyPegen_string_token(p)) // STRING
21625 )
21626 {
21627 _res = string_var;
21628 if (_n == _children_capacity) {
21629 _children_capacity *= 2;
21630 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21631 if (!_new_children) {
21632 p->error_indicator = 1;
21633 PyErr_NoMemory();
21634 D(p->level--);
21635 return NULL;
21636 }
21637 _children = _new_children;
21638 }
21639 _children[_n++] = _res;
21640 _mark = p->mark;
21641 }
21642 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021643 D(fprintf(stderr, "%*c%s _loop1_100[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021644 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
21645 }
21646 if (_n == 0 || p->error_indicator) {
21647 PyMem_Free(_children);
21648 D(p->level--);
21649 return NULL;
21650 }
21651 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21652 if (!_seq) {
21653 PyMem_Free(_children);
21654 p->error_indicator = 1;
21655 PyErr_NoMemory();
21656 D(p->level--);
21657 return NULL;
21658 }
21659 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21660 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021661 _PyPegen_insert_memo(p, _start_mark, _loop1_100_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021662 D(p->level--);
21663 return _seq;
21664}
21665
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021666// _tmp_101: star_named_expression ',' star_named_expressions?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021667static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021668_tmp_101_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021669{
21670 D(p->level++);
21671 if (p->error_indicator) {
21672 D(p->level--);
21673 return NULL;
21674 }
21675 void * _res = NULL;
21676 int _mark = p->mark;
21677 { // star_named_expression ',' star_named_expressions?
21678 if (p->error_indicator) {
21679 D(p->level--);
21680 return NULL;
21681 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021682 D(fprintf(stderr, "%*c> _tmp_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021683 Token * _literal;
21684 expr_ty y;
21685 void *z;
21686 if (
21687 (y = star_named_expression_rule(p)) // star_named_expression
21688 &&
21689 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21690 &&
21691 (z = star_named_expressions_rule(p), 1) // star_named_expressions?
21692 )
21693 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021694 D(fprintf(stderr, "%*c+ _tmp_101[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021695 _res = _PyPegen_seq_insert_in_front ( p , y , z );
21696 if (_res == NULL && PyErr_Occurred()) {
21697 p->error_indicator = 1;
21698 D(p->level--);
21699 return NULL;
21700 }
21701 goto done;
21702 }
21703 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021704 D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021705 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
21706 }
21707 _res = NULL;
21708 done:
21709 D(p->level--);
21710 return _res;
21711}
21712
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021713// _tmp_102: yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021714static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021715_tmp_102_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021716{
21717 D(p->level++);
21718 if (p->error_indicator) {
21719 D(p->level--);
21720 return NULL;
21721 }
21722 void * _res = NULL;
21723 int _mark = p->mark;
21724 { // yield_expr
21725 if (p->error_indicator) {
21726 D(p->level--);
21727 return NULL;
21728 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021729 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021730 expr_ty yield_expr_var;
21731 if (
21732 (yield_expr_var = yield_expr_rule(p)) // yield_expr
21733 )
21734 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021735 D(fprintf(stderr, "%*c+ _tmp_102[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021736 _res = yield_expr_var;
21737 goto done;
21738 }
21739 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021740 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021741 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
21742 }
21743 { // named_expression
21744 if (p->error_indicator) {
21745 D(p->level--);
21746 return NULL;
21747 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021748 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021749 expr_ty named_expression_var;
21750 if (
21751 (named_expression_var = named_expression_rule(p)) // named_expression
21752 )
21753 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021754 D(fprintf(stderr, "%*c+ _tmp_102[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021755 _res = named_expression_var;
21756 goto done;
21757 }
21758 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021759 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021760 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
21761 }
21762 _res = NULL;
21763 done:
21764 D(p->level--);
21765 return _res;
21766}
21767
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021768// _loop0_104: ',' double_starred_kvpair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021769static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021770_loop0_104_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021771{
21772 D(p->level++);
21773 if (p->error_indicator) {
21774 D(p->level--);
21775 return NULL;
21776 }
21777 void *_res = NULL;
21778 int _mark = p->mark;
21779 int _start_mark = p->mark;
21780 void **_children = PyMem_Malloc(sizeof(void *));
21781 if (!_children) {
21782 p->error_indicator = 1;
21783 PyErr_NoMemory();
21784 D(p->level--);
21785 return NULL;
21786 }
21787 ssize_t _children_capacity = 1;
21788 ssize_t _n = 0;
21789 { // ',' double_starred_kvpair
21790 if (p->error_indicator) {
21791 D(p->level--);
21792 return NULL;
21793 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021794 D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021795 Token * _literal;
21796 KeyValuePair* elem;
21797 while (
21798 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21799 &&
21800 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21801 )
21802 {
21803 _res = elem;
21804 if (_res == NULL && PyErr_Occurred()) {
21805 p->error_indicator = 1;
21806 PyMem_Free(_children);
21807 D(p->level--);
21808 return NULL;
21809 }
21810 if (_n == _children_capacity) {
21811 _children_capacity *= 2;
21812 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21813 if (!_new_children) {
21814 p->error_indicator = 1;
21815 PyErr_NoMemory();
21816 D(p->level--);
21817 return NULL;
21818 }
21819 _children = _new_children;
21820 }
21821 _children[_n++] = _res;
21822 _mark = p->mark;
21823 }
21824 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021825 D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021826 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
21827 }
21828 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21829 if (!_seq) {
21830 PyMem_Free(_children);
21831 p->error_indicator = 1;
21832 PyErr_NoMemory();
21833 D(p->level--);
21834 return NULL;
21835 }
21836 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21837 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021838 _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021839 D(p->level--);
21840 return _seq;
21841}
21842
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021843// _gather_103: double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021844static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021845_gather_103_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021846{
21847 D(p->level++);
21848 if (p->error_indicator) {
21849 D(p->level--);
21850 return NULL;
21851 }
21852 asdl_seq * _res = NULL;
21853 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021854 { // double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021855 if (p->error_indicator) {
21856 D(p->level--);
21857 return NULL;
21858 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021859 D(fprintf(stderr, "%*c> _gather_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_104"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021860 KeyValuePair* elem;
21861 asdl_seq * seq;
21862 if (
21863 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21864 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021865 (seq = _loop0_104_rule(p)) // _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021866 )
21867 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021868 D(fprintf(stderr, "%*c+ _gather_103[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_104"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021869 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21870 goto done;
21871 }
21872 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021873 D(fprintf(stderr, "%*c%s _gather_103[%d-%d]: %s failed!\n", p->level, ' ',
21874 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_104"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021875 }
21876 _res = NULL;
21877 done:
21878 D(p->level--);
21879 return _res;
21880}
21881
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021882// _loop1_105: for_if_clause
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021883static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021884_loop1_105_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021885{
21886 D(p->level++);
21887 if (p->error_indicator) {
21888 D(p->level--);
21889 return NULL;
21890 }
21891 void *_res = NULL;
21892 int _mark = p->mark;
21893 int _start_mark = p->mark;
21894 void **_children = PyMem_Malloc(sizeof(void *));
21895 if (!_children) {
21896 p->error_indicator = 1;
21897 PyErr_NoMemory();
21898 D(p->level--);
21899 return NULL;
21900 }
21901 ssize_t _children_capacity = 1;
21902 ssize_t _n = 0;
21903 { // for_if_clause
21904 if (p->error_indicator) {
21905 D(p->level--);
21906 return NULL;
21907 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021908 D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021909 comprehension_ty for_if_clause_var;
21910 while (
21911 (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause
21912 )
21913 {
21914 _res = for_if_clause_var;
21915 if (_n == _children_capacity) {
21916 _children_capacity *= 2;
21917 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21918 if (!_new_children) {
21919 p->error_indicator = 1;
21920 PyErr_NoMemory();
21921 D(p->level--);
21922 return NULL;
21923 }
21924 _children = _new_children;
21925 }
21926 _children[_n++] = _res;
21927 _mark = p->mark;
21928 }
21929 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021930 D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021931 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
21932 }
21933 if (_n == 0 || p->error_indicator) {
21934 PyMem_Free(_children);
21935 D(p->level--);
21936 return NULL;
21937 }
21938 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
21939 if (!_seq) {
21940 PyMem_Free(_children);
21941 p->error_indicator = 1;
21942 PyErr_NoMemory();
21943 D(p->level--);
21944 return NULL;
21945 }
21946 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
21947 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021948 _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021949 D(p->level--);
21950 return _seq;
21951}
21952
21953// _loop0_106: ('if' disjunction)
21954static asdl_seq *
21955_loop0_106_rule(Parser *p)
21956{
21957 D(p->level++);
21958 if (p->error_indicator) {
21959 D(p->level--);
21960 return NULL;
21961 }
21962 void *_res = NULL;
21963 int _mark = p->mark;
21964 int _start_mark = p->mark;
21965 void **_children = PyMem_Malloc(sizeof(void *));
21966 if (!_children) {
21967 p->error_indicator = 1;
21968 PyErr_NoMemory();
21969 D(p->level--);
21970 return NULL;
21971 }
21972 ssize_t _children_capacity = 1;
21973 ssize_t _n = 0;
21974 { // ('if' disjunction)
21975 if (p->error_indicator) {
21976 D(p->level--);
21977 return NULL;
21978 }
21979 D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010021980 void *_tmp_147_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021981 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010021982 (_tmp_147_var = _tmp_147_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021983 )
21984 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021985 _res = _tmp_147_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021986 if (_n == _children_capacity) {
21987 _children_capacity *= 2;
21988 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21989 if (!_new_children) {
21990 p->error_indicator = 1;
21991 PyErr_NoMemory();
21992 D(p->level--);
21993 return NULL;
21994 }
21995 _children = _new_children;
21996 }
21997 _children[_n++] = _res;
21998 _mark = p->mark;
21999 }
22000 p->mark = _mark;
22001 D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ',
22002 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
22003 }
22004 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22005 if (!_seq) {
22006 PyMem_Free(_children);
22007 p->error_indicator = 1;
22008 PyErr_NoMemory();
22009 D(p->level--);
22010 return NULL;
22011 }
22012 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22013 PyMem_Free(_children);
22014 _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq);
22015 D(p->level--);
22016 return _seq;
22017}
22018
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022019// _loop0_107: ('if' disjunction)
22020static asdl_seq *
22021_loop0_107_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022022{
22023 D(p->level++);
22024 if (p->error_indicator) {
22025 D(p->level--);
22026 return NULL;
22027 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022028 void *_res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022029 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022030 int _start_mark = p->mark;
22031 void **_children = PyMem_Malloc(sizeof(void *));
22032 if (!_children) {
22033 p->error_indicator = 1;
22034 PyErr_NoMemory();
22035 D(p->level--);
22036 return NULL;
22037 }
22038 ssize_t _children_capacity = 1;
22039 ssize_t _n = 0;
22040 { // ('if' disjunction)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022041 if (p->error_indicator) {
22042 D(p->level--);
22043 return NULL;
22044 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022045 D(fprintf(stderr, "%*c> _loop0_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010022046 void *_tmp_148_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022047 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022048 (_tmp_148_var = _tmp_148_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022049 )
22050 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022051 _res = _tmp_148_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022052 if (_n == _children_capacity) {
22053 _children_capacity *= 2;
22054 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22055 if (!_new_children) {
22056 p->error_indicator = 1;
22057 PyErr_NoMemory();
22058 D(p->level--);
22059 return NULL;
22060 }
22061 _children = _new_children;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022062 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022063 _children[_n++] = _res;
22064 _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022065 }
22066 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022067 D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ',
22068 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022069 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022070 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22071 if (!_seq) {
22072 PyMem_Free(_children);
22073 p->error_indicator = 1;
22074 PyErr_NoMemory();
22075 D(p->level--);
22076 return NULL;
22077 }
22078 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22079 PyMem_Free(_children);
22080 _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022081 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022082 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022083}
22084
Pablo Galindo4a97b152020-09-02 17:44:19 +010022085// _loop0_109: ',' (starred_expression | named_expression !'=')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022086static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022087_loop0_109_rule(Parser *p)
22088{
22089 D(p->level++);
22090 if (p->error_indicator) {
22091 D(p->level--);
22092 return NULL;
22093 }
22094 void *_res = NULL;
22095 int _mark = p->mark;
22096 int _start_mark = p->mark;
22097 void **_children = PyMem_Malloc(sizeof(void *));
22098 if (!_children) {
22099 p->error_indicator = 1;
22100 PyErr_NoMemory();
22101 D(p->level--);
22102 return NULL;
22103 }
22104 ssize_t _children_capacity = 1;
22105 ssize_t _n = 0;
22106 { // ',' (starred_expression | named_expression !'=')
22107 if (p->error_indicator) {
22108 D(p->level--);
22109 return NULL;
22110 }
22111 D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
22112 Token * _literal;
22113 void *elem;
22114 while (
22115 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22116 &&
22117 (elem = _tmp_149_rule(p)) // starred_expression | named_expression !'='
22118 )
22119 {
22120 _res = elem;
22121 if (_res == NULL && PyErr_Occurred()) {
22122 p->error_indicator = 1;
22123 PyMem_Free(_children);
22124 D(p->level--);
22125 return NULL;
22126 }
22127 if (_n == _children_capacity) {
22128 _children_capacity *= 2;
22129 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22130 if (!_new_children) {
22131 p->error_indicator = 1;
22132 PyErr_NoMemory();
22133 D(p->level--);
22134 return NULL;
22135 }
22136 _children = _new_children;
22137 }
22138 _children[_n++] = _res;
22139 _mark = p->mark;
22140 }
22141 p->mark = _mark;
22142 D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ',
22143 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
22144 }
22145 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22146 if (!_seq) {
22147 PyMem_Free(_children);
22148 p->error_indicator = 1;
22149 PyErr_NoMemory();
22150 D(p->level--);
22151 return NULL;
22152 }
22153 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22154 PyMem_Free(_children);
22155 _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq);
22156 D(p->level--);
22157 return _seq;
22158}
22159
22160// _gather_108: (starred_expression | named_expression !'=') _loop0_109
22161static asdl_seq *
22162_gather_108_rule(Parser *p)
22163{
22164 D(p->level++);
22165 if (p->error_indicator) {
22166 D(p->level--);
22167 return NULL;
22168 }
22169 asdl_seq * _res = NULL;
22170 int _mark = p->mark;
22171 { // (starred_expression | named_expression !'=') _loop0_109
22172 if (p->error_indicator) {
22173 D(p->level--);
22174 return NULL;
22175 }
22176 D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22177 void *elem;
22178 asdl_seq * seq;
22179 if (
22180 (elem = _tmp_149_rule(p)) // starred_expression | named_expression !'='
22181 &&
22182 (seq = _loop0_109_rule(p)) // _loop0_109
22183 )
22184 {
22185 D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22186 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22187 goto done;
22188 }
22189 p->mark = _mark;
22190 D(fprintf(stderr, "%*c%s _gather_108[%d-%d]: %s failed!\n", p->level, ' ',
22191 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22192 }
22193 _res = NULL;
22194 done:
22195 D(p->level--);
22196 return _res;
22197}
22198
22199// _tmp_110: ',' kwargs
22200static void *
22201_tmp_110_rule(Parser *p)
22202{
22203 D(p->level++);
22204 if (p->error_indicator) {
22205 D(p->level--);
22206 return NULL;
22207 }
22208 void * _res = NULL;
22209 int _mark = p->mark;
22210 { // ',' kwargs
22211 if (p->error_indicator) {
22212 D(p->level--);
22213 return NULL;
22214 }
22215 D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
22216 Token * _literal;
22217 asdl_seq* k;
22218 if (
22219 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22220 &&
22221 (k = kwargs_rule(p)) // kwargs
22222 )
22223 {
22224 D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
22225 _res = k;
22226 if (_res == NULL && PyErr_Occurred()) {
22227 p->error_indicator = 1;
22228 D(p->level--);
22229 return NULL;
22230 }
22231 goto done;
22232 }
22233 p->mark = _mark;
22234 D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ',
22235 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs"));
22236 }
22237 _res = NULL;
22238 done:
22239 D(p->level--);
22240 return _res;
22241}
22242
22243// _loop0_112: ',' kwarg_or_starred
22244static asdl_seq *
22245_loop0_112_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022246{
22247 D(p->level++);
22248 if (p->error_indicator) {
22249 D(p->level--);
22250 return NULL;
22251 }
22252 void *_res = NULL;
22253 int _mark = p->mark;
22254 int _start_mark = p->mark;
22255 void **_children = PyMem_Malloc(sizeof(void *));
22256 if (!_children) {
22257 p->error_indicator = 1;
22258 PyErr_NoMemory();
22259 D(p->level--);
22260 return NULL;
22261 }
22262 ssize_t _children_capacity = 1;
22263 ssize_t _n = 0;
22264 { // ',' kwarg_or_starred
22265 if (p->error_indicator) {
22266 D(p->level--);
22267 return NULL;
22268 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022269 D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022270 Token * _literal;
22271 KeywordOrStarred* elem;
22272 while (
22273 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22274 &&
22275 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22276 )
22277 {
22278 _res = elem;
22279 if (_res == NULL && PyErr_Occurred()) {
22280 p->error_indicator = 1;
22281 PyMem_Free(_children);
22282 D(p->level--);
22283 return NULL;
22284 }
22285 if (_n == _children_capacity) {
22286 _children_capacity *= 2;
22287 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22288 if (!_new_children) {
22289 p->error_indicator = 1;
22290 PyErr_NoMemory();
22291 D(p->level--);
22292 return NULL;
22293 }
22294 _children = _new_children;
22295 }
22296 _children[_n++] = _res;
22297 _mark = p->mark;
22298 }
22299 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022300 D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022301 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22302 }
22303 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22304 if (!_seq) {
22305 PyMem_Free(_children);
22306 p->error_indicator = 1;
22307 PyErr_NoMemory();
22308 D(p->level--);
22309 return NULL;
22310 }
22311 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22312 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022313 _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022314 D(p->level--);
22315 return _seq;
22316}
22317
Pablo Galindo4a97b152020-09-02 17:44:19 +010022318// _gather_111: kwarg_or_starred _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022319static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022320_gather_111_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022321{
22322 D(p->level++);
22323 if (p->error_indicator) {
22324 D(p->level--);
22325 return NULL;
22326 }
22327 asdl_seq * _res = NULL;
22328 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022329 { // kwarg_or_starred _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022330 if (p->error_indicator) {
22331 D(p->level--);
22332 return NULL;
22333 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022334 D(fprintf(stderr, "%*c> _gather_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_112"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022335 KeywordOrStarred* elem;
22336 asdl_seq * seq;
22337 if (
22338 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22339 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022340 (seq = _loop0_112_rule(p)) // _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022341 )
22342 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022343 D(fprintf(stderr, "%*c+ _gather_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_112"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022344 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22345 goto done;
22346 }
22347 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022348 D(fprintf(stderr, "%*c%s _gather_111[%d-%d]: %s failed!\n", p->level, ' ',
22349 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_112"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022350 }
22351 _res = NULL;
22352 done:
22353 D(p->level--);
22354 return _res;
22355}
22356
Pablo Galindo4a97b152020-09-02 17:44:19 +010022357// _loop0_114: ',' kwarg_or_double_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022358static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022359_loop0_114_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022360{
22361 D(p->level++);
22362 if (p->error_indicator) {
22363 D(p->level--);
22364 return NULL;
22365 }
22366 void *_res = NULL;
22367 int _mark = p->mark;
22368 int _start_mark = p->mark;
22369 void **_children = PyMem_Malloc(sizeof(void *));
22370 if (!_children) {
22371 p->error_indicator = 1;
22372 PyErr_NoMemory();
22373 D(p->level--);
22374 return NULL;
22375 }
22376 ssize_t _children_capacity = 1;
22377 ssize_t _n = 0;
22378 { // ',' kwarg_or_double_starred
22379 if (p->error_indicator) {
22380 D(p->level--);
22381 return NULL;
22382 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022383 D(fprintf(stderr, "%*c> _loop0_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022384 Token * _literal;
22385 KeywordOrStarred* elem;
22386 while (
22387 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22388 &&
22389 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22390 )
22391 {
22392 _res = elem;
22393 if (_res == NULL && PyErr_Occurred()) {
22394 p->error_indicator = 1;
22395 PyMem_Free(_children);
22396 D(p->level--);
22397 return NULL;
22398 }
22399 if (_n == _children_capacity) {
22400 _children_capacity *= 2;
22401 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22402 if (!_new_children) {
22403 p->error_indicator = 1;
22404 PyErr_NoMemory();
22405 D(p->level--);
22406 return NULL;
22407 }
22408 _children = _new_children;
22409 }
22410 _children[_n++] = _res;
22411 _mark = p->mark;
22412 }
22413 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022414 D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022415 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22416 }
22417 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22418 if (!_seq) {
22419 PyMem_Free(_children);
22420 p->error_indicator = 1;
22421 PyErr_NoMemory();
22422 D(p->level--);
22423 return NULL;
22424 }
22425 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22426 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022427 _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022428 D(p->level--);
22429 return _seq;
22430}
22431
Pablo Galindo4a97b152020-09-02 17:44:19 +010022432// _gather_113: kwarg_or_double_starred _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022433static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022434_gather_113_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022435{
22436 D(p->level++);
22437 if (p->error_indicator) {
22438 D(p->level--);
22439 return NULL;
22440 }
22441 asdl_seq * _res = NULL;
22442 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022443 { // kwarg_or_double_starred _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022444 if (p->error_indicator) {
22445 D(p->level--);
22446 return NULL;
22447 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022448 D(fprintf(stderr, "%*c> _gather_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_114"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022449 KeywordOrStarred* elem;
22450 asdl_seq * seq;
22451 if (
22452 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22453 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022454 (seq = _loop0_114_rule(p)) // _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022455 )
22456 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022457 D(fprintf(stderr, "%*c+ _gather_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_114"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022458 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22459 goto done;
22460 }
22461 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022462 D(fprintf(stderr, "%*c%s _gather_113[%d-%d]: %s failed!\n", p->level, ' ',
22463 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_114"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022464 }
22465 _res = NULL;
22466 done:
22467 D(p->level--);
22468 return _res;
22469}
22470
Pablo Galindo4a97b152020-09-02 17:44:19 +010022471// _loop0_116: ',' kwarg_or_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022472static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022473_loop0_116_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022474{
22475 D(p->level++);
22476 if (p->error_indicator) {
22477 D(p->level--);
22478 return NULL;
22479 }
22480 void *_res = NULL;
22481 int _mark = p->mark;
22482 int _start_mark = p->mark;
22483 void **_children = PyMem_Malloc(sizeof(void *));
22484 if (!_children) {
22485 p->error_indicator = 1;
22486 PyErr_NoMemory();
22487 D(p->level--);
22488 return NULL;
22489 }
22490 ssize_t _children_capacity = 1;
22491 ssize_t _n = 0;
22492 { // ',' kwarg_or_starred
22493 if (p->error_indicator) {
22494 D(p->level--);
22495 return NULL;
22496 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022497 D(fprintf(stderr, "%*c> _loop0_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022498 Token * _literal;
22499 KeywordOrStarred* elem;
22500 while (
22501 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22502 &&
22503 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22504 )
22505 {
22506 _res = elem;
22507 if (_res == NULL && PyErr_Occurred()) {
22508 p->error_indicator = 1;
22509 PyMem_Free(_children);
22510 D(p->level--);
22511 return NULL;
22512 }
22513 if (_n == _children_capacity) {
22514 _children_capacity *= 2;
22515 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22516 if (!_new_children) {
22517 p->error_indicator = 1;
22518 PyErr_NoMemory();
22519 D(p->level--);
22520 return NULL;
22521 }
22522 _children = _new_children;
22523 }
22524 _children[_n++] = _res;
22525 _mark = p->mark;
22526 }
22527 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022528 D(fprintf(stderr, "%*c%s _loop0_116[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022529 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22530 }
22531 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22532 if (!_seq) {
22533 PyMem_Free(_children);
22534 p->error_indicator = 1;
22535 PyErr_NoMemory();
22536 D(p->level--);
22537 return NULL;
22538 }
22539 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22540 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022541 _PyPegen_insert_memo(p, _start_mark, _loop0_116_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022542 D(p->level--);
22543 return _seq;
22544}
22545
Pablo Galindo4a97b152020-09-02 17:44:19 +010022546// _gather_115: kwarg_or_starred _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022547static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022548_gather_115_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022549{
22550 D(p->level++);
22551 if (p->error_indicator) {
22552 D(p->level--);
22553 return NULL;
22554 }
22555 asdl_seq * _res = NULL;
22556 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022557 { // kwarg_or_starred _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022558 if (p->error_indicator) {
22559 D(p->level--);
22560 return NULL;
22561 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022562 D(fprintf(stderr, "%*c> _gather_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_116"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022563 KeywordOrStarred* elem;
22564 asdl_seq * seq;
22565 if (
22566 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22567 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022568 (seq = _loop0_116_rule(p)) // _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022569 )
22570 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022571 D(fprintf(stderr, "%*c+ _gather_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_116"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022572 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22573 goto done;
22574 }
22575 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022576 D(fprintf(stderr, "%*c%s _gather_115[%d-%d]: %s failed!\n", p->level, ' ',
22577 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_116"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022578 }
22579 _res = NULL;
22580 done:
22581 D(p->level--);
22582 return _res;
22583}
22584
Pablo Galindo4a97b152020-09-02 17:44:19 +010022585// _loop0_118: ',' kwarg_or_double_starred
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022586static asdl_seq *
22587_loop0_118_rule(Parser *p)
22588{
22589 D(p->level++);
22590 if (p->error_indicator) {
22591 D(p->level--);
22592 return NULL;
22593 }
22594 void *_res = NULL;
22595 int _mark = p->mark;
22596 int _start_mark = p->mark;
22597 void **_children = PyMem_Malloc(sizeof(void *));
22598 if (!_children) {
22599 p->error_indicator = 1;
22600 PyErr_NoMemory();
22601 D(p->level--);
22602 return NULL;
22603 }
22604 ssize_t _children_capacity = 1;
22605 ssize_t _n = 0;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022606 { // ',' kwarg_or_double_starred
22607 if (p->error_indicator) {
22608 D(p->level--);
22609 return NULL;
22610 }
22611 D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
22612 Token * _literal;
22613 KeywordOrStarred* elem;
22614 while (
22615 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22616 &&
22617 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22618 )
22619 {
22620 _res = elem;
22621 if (_res == NULL && PyErr_Occurred()) {
22622 p->error_indicator = 1;
22623 PyMem_Free(_children);
22624 D(p->level--);
22625 return NULL;
22626 }
22627 if (_n == _children_capacity) {
22628 _children_capacity *= 2;
22629 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22630 if (!_new_children) {
22631 p->error_indicator = 1;
22632 PyErr_NoMemory();
22633 D(p->level--);
22634 return NULL;
22635 }
22636 _children = _new_children;
22637 }
22638 _children[_n++] = _res;
22639 _mark = p->mark;
22640 }
22641 p->mark = _mark;
22642 D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ',
22643 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22644 }
22645 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22646 if (!_seq) {
22647 PyMem_Free(_children);
22648 p->error_indicator = 1;
22649 PyErr_NoMemory();
22650 D(p->level--);
22651 return NULL;
22652 }
22653 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22654 PyMem_Free(_children);
22655 _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq);
22656 D(p->level--);
22657 return _seq;
22658}
22659
22660// _gather_117: kwarg_or_double_starred _loop0_118
22661static asdl_seq *
22662_gather_117_rule(Parser *p)
22663{
22664 D(p->level++);
22665 if (p->error_indicator) {
22666 D(p->level--);
22667 return NULL;
22668 }
22669 asdl_seq * _res = NULL;
22670 int _mark = p->mark;
22671 { // kwarg_or_double_starred _loop0_118
22672 if (p->error_indicator) {
22673 D(p->level--);
22674 return NULL;
22675 }
22676 D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22677 KeywordOrStarred* elem;
22678 asdl_seq * seq;
22679 if (
22680 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22681 &&
22682 (seq = _loop0_118_rule(p)) // _loop0_118
22683 )
22684 {
22685 D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22686 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22687 goto done;
22688 }
22689 p->mark = _mark;
22690 D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ',
22691 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22692 }
22693 _res = NULL;
22694 done:
22695 D(p->level--);
22696 return _res;
22697}
22698
22699// _loop0_119: (',' star_target)
22700static asdl_seq *
22701_loop0_119_rule(Parser *p)
22702{
22703 D(p->level++);
22704 if (p->error_indicator) {
22705 D(p->level--);
22706 return NULL;
22707 }
22708 void *_res = NULL;
22709 int _mark = p->mark;
22710 int _start_mark = p->mark;
22711 void **_children = PyMem_Malloc(sizeof(void *));
22712 if (!_children) {
22713 p->error_indicator = 1;
22714 PyErr_NoMemory();
22715 D(p->level--);
22716 return NULL;
22717 }
22718 ssize_t _children_capacity = 1;
22719 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022720 { // (',' star_target)
22721 if (p->error_indicator) {
22722 D(p->level--);
22723 return NULL;
22724 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022725 D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
22726 void *_tmp_150_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022727 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022728 (_tmp_150_var = _tmp_150_rule(p)) // ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022729 )
22730 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022731 _res = _tmp_150_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022732 if (_n == _children_capacity) {
22733 _children_capacity *= 2;
22734 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22735 if (!_new_children) {
22736 p->error_indicator = 1;
22737 PyErr_NoMemory();
22738 D(p->level--);
22739 return NULL;
22740 }
22741 _children = _new_children;
22742 }
22743 _children[_n++] = _res;
22744 _mark = p->mark;
22745 }
22746 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022747 D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022748 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
22749 }
22750 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22751 if (!_seq) {
22752 PyMem_Free(_children);
22753 p->error_indicator = 1;
22754 PyErr_NoMemory();
22755 D(p->level--);
22756 return NULL;
22757 }
22758 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22759 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022760 _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022761 D(p->level--);
22762 return _seq;
22763}
22764
Pablo Galindo4a97b152020-09-02 17:44:19 +010022765// _loop0_121: ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022766static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022767_loop0_121_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022768{
22769 D(p->level++);
22770 if (p->error_indicator) {
22771 D(p->level--);
22772 return NULL;
22773 }
22774 void *_res = NULL;
22775 int _mark = p->mark;
22776 int _start_mark = p->mark;
22777 void **_children = PyMem_Malloc(sizeof(void *));
22778 if (!_children) {
22779 p->error_indicator = 1;
22780 PyErr_NoMemory();
22781 D(p->level--);
22782 return NULL;
22783 }
22784 ssize_t _children_capacity = 1;
22785 ssize_t _n = 0;
22786 { // ',' star_target
22787 if (p->error_indicator) {
22788 D(p->level--);
22789 return NULL;
22790 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022791 D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022792 Token * _literal;
22793 expr_ty elem;
22794 while (
22795 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22796 &&
22797 (elem = star_target_rule(p)) // star_target
22798 )
22799 {
22800 _res = elem;
22801 if (_res == NULL && PyErr_Occurred()) {
22802 p->error_indicator = 1;
22803 PyMem_Free(_children);
22804 D(p->level--);
22805 return NULL;
22806 }
22807 if (_n == _children_capacity) {
22808 _children_capacity *= 2;
22809 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22810 if (!_new_children) {
22811 p->error_indicator = 1;
22812 PyErr_NoMemory();
22813 D(p->level--);
22814 return NULL;
22815 }
22816 _children = _new_children;
22817 }
22818 _children[_n++] = _res;
22819 _mark = p->mark;
22820 }
22821 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022822 D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022823 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
22824 }
22825 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22826 if (!_seq) {
22827 PyMem_Free(_children);
22828 p->error_indicator = 1;
22829 PyErr_NoMemory();
22830 D(p->level--);
22831 return NULL;
22832 }
22833 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22834 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022835 _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022836 D(p->level--);
22837 return _seq;
22838}
22839
Pablo Galindo4a97b152020-09-02 17:44:19 +010022840// _gather_120: star_target _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022841static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022842_gather_120_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022843{
22844 D(p->level++);
22845 if (p->error_indicator) {
22846 D(p->level--);
22847 return NULL;
22848 }
22849 asdl_seq * _res = NULL;
22850 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022851 { // star_target _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022852 if (p->error_indicator) {
22853 D(p->level--);
22854 return NULL;
22855 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022856 D(fprintf(stderr, "%*c> _gather_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_121"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022857 expr_ty elem;
22858 asdl_seq * seq;
22859 if (
22860 (elem = star_target_rule(p)) // star_target
22861 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022862 (seq = _loop0_121_rule(p)) // _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022863 )
22864 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022865 D(fprintf(stderr, "%*c+ _gather_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_121"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022866 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22867 goto done;
22868 }
22869 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022870 D(fprintf(stderr, "%*c%s _gather_120[%d-%d]: %s failed!\n", p->level, ' ',
22871 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_121"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022872 }
22873 _res = NULL;
22874 done:
22875 D(p->level--);
22876 return _res;
22877}
22878
Pablo Galindo4a97b152020-09-02 17:44:19 +010022879// _tmp_122: !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022880static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022881_tmp_122_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022882{
22883 D(p->level++);
22884 if (p->error_indicator) {
22885 D(p->level--);
22886 return NULL;
22887 }
22888 void * _res = NULL;
22889 int _mark = p->mark;
22890 { // !'*' star_target
22891 if (p->error_indicator) {
22892 D(p->level--);
22893 return NULL;
22894 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022895 D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022896 expr_ty star_target_var;
22897 if (
22898 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*'
22899 &&
22900 (star_target_var = star_target_rule(p)) // star_target
22901 )
22902 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022903 D(fprintf(stderr, "%*c+ _tmp_122[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022904 _res = star_target_var;
22905 goto done;
22906 }
22907 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022908 D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022909 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
22910 }
22911 _res = NULL;
22912 done:
22913 D(p->level--);
22914 return _res;
22915}
22916
Pablo Galindo4a97b152020-09-02 17:44:19 +010022917// _loop0_124: ',' del_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022918static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022919_loop0_124_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022920{
22921 D(p->level++);
22922 if (p->error_indicator) {
22923 D(p->level--);
22924 return NULL;
22925 }
22926 void *_res = NULL;
22927 int _mark = p->mark;
22928 int _start_mark = p->mark;
22929 void **_children = PyMem_Malloc(sizeof(void *));
22930 if (!_children) {
22931 p->error_indicator = 1;
22932 PyErr_NoMemory();
22933 D(p->level--);
22934 return NULL;
22935 }
22936 ssize_t _children_capacity = 1;
22937 ssize_t _n = 0;
22938 { // ',' del_target
22939 if (p->error_indicator) {
22940 D(p->level--);
22941 return NULL;
22942 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022943 D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022944 Token * _literal;
22945 expr_ty elem;
22946 while (
22947 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22948 &&
22949 (elem = del_target_rule(p)) // del_target
22950 )
22951 {
22952 _res = elem;
22953 if (_res == NULL && PyErr_Occurred()) {
22954 p->error_indicator = 1;
22955 PyMem_Free(_children);
22956 D(p->level--);
22957 return NULL;
22958 }
22959 if (_n == _children_capacity) {
22960 _children_capacity *= 2;
22961 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22962 if (!_new_children) {
22963 p->error_indicator = 1;
22964 PyErr_NoMemory();
22965 D(p->level--);
22966 return NULL;
22967 }
22968 _children = _new_children;
22969 }
22970 _children[_n++] = _res;
22971 _mark = p->mark;
22972 }
22973 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022974 D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022975 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
22976 }
22977 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
22978 if (!_seq) {
22979 PyMem_Free(_children);
22980 p->error_indicator = 1;
22981 PyErr_NoMemory();
22982 D(p->level--);
22983 return NULL;
22984 }
22985 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
22986 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022987 _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022988 D(p->level--);
22989 return _seq;
22990}
22991
Pablo Galindo4a97b152020-09-02 17:44:19 +010022992// _gather_123: del_target _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022993static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022994_gather_123_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022995{
22996 D(p->level++);
22997 if (p->error_indicator) {
22998 D(p->level--);
22999 return NULL;
23000 }
23001 asdl_seq * _res = NULL;
23002 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023003 { // del_target _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023004 if (p->error_indicator) {
23005 D(p->level--);
23006 return NULL;
23007 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023008 D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_124"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023009 expr_ty elem;
23010 asdl_seq * seq;
23011 if (
23012 (elem = del_target_rule(p)) // del_target
23013 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023014 (seq = _loop0_124_rule(p)) // _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023015 )
23016 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023017 D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_124"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023018 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23019 goto done;
23020 }
23021 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023022 D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ',
23023 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_124"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023024 }
23025 _res = NULL;
23026 done:
23027 D(p->level--);
23028 return _res;
23029}
23030
Pablo Galindo4a97b152020-09-02 17:44:19 +010023031// _loop0_126: ',' target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023032static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023033_loop0_126_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023034{
23035 D(p->level++);
23036 if (p->error_indicator) {
23037 D(p->level--);
23038 return NULL;
23039 }
23040 void *_res = NULL;
23041 int _mark = p->mark;
23042 int _start_mark = p->mark;
23043 void **_children = PyMem_Malloc(sizeof(void *));
23044 if (!_children) {
23045 p->error_indicator = 1;
23046 PyErr_NoMemory();
23047 D(p->level--);
23048 return NULL;
23049 }
23050 ssize_t _children_capacity = 1;
23051 ssize_t _n = 0;
23052 { // ',' target
23053 if (p->error_indicator) {
23054 D(p->level--);
23055 return NULL;
23056 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023057 D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023058 Token * _literal;
23059 expr_ty elem;
23060 while (
23061 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23062 &&
23063 (elem = target_rule(p)) // target
23064 )
23065 {
23066 _res = elem;
23067 if (_res == NULL && PyErr_Occurred()) {
23068 p->error_indicator = 1;
23069 PyMem_Free(_children);
23070 D(p->level--);
23071 return NULL;
23072 }
23073 if (_n == _children_capacity) {
23074 _children_capacity *= 2;
23075 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23076 if (!_new_children) {
23077 p->error_indicator = 1;
23078 PyErr_NoMemory();
23079 D(p->level--);
23080 return NULL;
23081 }
23082 _children = _new_children;
23083 }
23084 _children[_n++] = _res;
23085 _mark = p->mark;
23086 }
23087 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023088 D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023089 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target"));
23090 }
23091 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23092 if (!_seq) {
23093 PyMem_Free(_children);
23094 p->error_indicator = 1;
23095 PyErr_NoMemory();
23096 D(p->level--);
23097 return NULL;
23098 }
23099 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23100 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023101 _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023102 D(p->level--);
23103 return _seq;
23104}
23105
Pablo Galindo4a97b152020-09-02 17:44:19 +010023106// _gather_125: target _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023107static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023108_gather_125_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023109{
23110 D(p->level++);
23111 if (p->error_indicator) {
23112 D(p->level--);
23113 return NULL;
23114 }
23115 asdl_seq * _res = NULL;
23116 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023117 { // target _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023118 if (p->error_indicator) {
23119 D(p->level--);
23120 return NULL;
23121 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023122 D(fprintf(stderr, "%*c> _gather_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_126"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023123 expr_ty elem;
23124 asdl_seq * seq;
23125 if (
23126 (elem = target_rule(p)) // target
23127 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023128 (seq = _loop0_126_rule(p)) // _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023129 )
23130 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023131 D(fprintf(stderr, "%*c+ _gather_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_126"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023132 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23133 goto done;
23134 }
23135 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023136 D(fprintf(stderr, "%*c%s _gather_125[%d-%d]: %s failed!\n", p->level, ' ',
23137 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_126"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023138 }
23139 _res = NULL;
23140 done:
23141 D(p->level--);
23142 return _res;
23143}
23144
Pablo Galindo4a97b152020-09-02 17:44:19 +010023145// _tmp_127: args | expression for_if_clauses
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023146static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023147_tmp_127_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023148{
23149 D(p->level++);
23150 if (p->error_indicator) {
23151 D(p->level--);
23152 return NULL;
23153 }
23154 void * _res = NULL;
23155 int _mark = p->mark;
23156 { // args
23157 if (p->error_indicator) {
23158 D(p->level--);
23159 return NULL;
23160 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023161 D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023162 expr_ty args_var;
23163 if (
23164 (args_var = args_rule(p)) // args
23165 )
23166 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023167 D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023168 _res = args_var;
23169 goto done;
23170 }
23171 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023172 D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023173 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args"));
23174 }
23175 { // expression for_if_clauses
23176 if (p->error_indicator) {
23177 D(p->level--);
23178 return NULL;
23179 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023180 D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023181 expr_ty expression_var;
23182 asdl_seq* for_if_clauses_var;
23183 if (
23184 (expression_var = expression_rule(p)) // expression
23185 &&
23186 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
23187 )
23188 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023189 D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023190 _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
23191 goto done;
23192 }
23193 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023194 D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023195 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses"));
23196 }
23197 _res = NULL;
23198 done:
23199 D(p->level--);
23200 return _res;
23201}
23202
Pablo Galindo4a97b152020-09-02 17:44:19 +010023203// _loop0_128: star_named_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023204static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023205_loop0_128_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023206{
23207 D(p->level++);
23208 if (p->error_indicator) {
23209 D(p->level--);
23210 return NULL;
23211 }
23212 void *_res = NULL;
23213 int _mark = p->mark;
23214 int _start_mark = p->mark;
23215 void **_children = PyMem_Malloc(sizeof(void *));
23216 if (!_children) {
23217 p->error_indicator = 1;
23218 PyErr_NoMemory();
23219 D(p->level--);
23220 return NULL;
23221 }
23222 ssize_t _children_capacity = 1;
23223 ssize_t _n = 0;
23224 { // star_named_expressions
23225 if (p->error_indicator) {
23226 D(p->level--);
23227 return NULL;
23228 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023229 D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023230 asdl_seq* star_named_expressions_var;
23231 while (
23232 (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions
23233 )
23234 {
23235 _res = star_named_expressions_var;
23236 if (_n == _children_capacity) {
23237 _children_capacity *= 2;
23238 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23239 if (!_new_children) {
23240 p->error_indicator = 1;
23241 PyErr_NoMemory();
23242 D(p->level--);
23243 return NULL;
23244 }
23245 _children = _new_children;
23246 }
23247 _children[_n++] = _res;
23248 _mark = p->mark;
23249 }
23250 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023251 D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010023252 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023253 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023254 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23255 if (!_seq) {
23256 PyMem_Free(_children);
23257 p->error_indicator = 1;
23258 PyErr_NoMemory();
23259 D(p->level--);
23260 return NULL;
23261 }
23262 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23263 PyMem_Free(_children);
23264 _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023265 D(p->level--);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023266 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023267}
23268
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023269// _loop0_129: (star_targets '=')
23270static asdl_seq *
23271_loop0_129_rule(Parser *p)
23272{
23273 D(p->level++);
23274 if (p->error_indicator) {
23275 D(p->level--);
23276 return NULL;
23277 }
23278 void *_res = NULL;
23279 int _mark = p->mark;
23280 int _start_mark = p->mark;
23281 void **_children = PyMem_Malloc(sizeof(void *));
23282 if (!_children) {
23283 p->error_indicator = 1;
23284 PyErr_NoMemory();
23285 D(p->level--);
23286 return NULL;
23287 }
23288 ssize_t _children_capacity = 1;
23289 ssize_t _n = 0;
23290 { // (star_targets '=')
23291 if (p->error_indicator) {
23292 D(p->level--);
23293 return NULL;
23294 }
23295 D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010023296 void *_tmp_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023297 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023298 (_tmp_151_var = _tmp_151_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023299 )
23300 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023301 _res = _tmp_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023302 if (_n == _children_capacity) {
23303 _children_capacity *= 2;
23304 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23305 if (!_new_children) {
23306 p->error_indicator = 1;
23307 PyErr_NoMemory();
23308 D(p->level--);
23309 return NULL;
23310 }
23311 _children = _new_children;
23312 }
23313 _children[_n++] = _res;
23314 _mark = p->mark;
23315 }
23316 p->mark = _mark;
23317 D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ',
23318 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23319 }
23320 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23321 if (!_seq) {
23322 PyMem_Free(_children);
23323 p->error_indicator = 1;
23324 PyErr_NoMemory();
23325 D(p->level--);
23326 return NULL;
23327 }
23328 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23329 PyMem_Free(_children);
23330 _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq);
23331 D(p->level--);
23332 return _seq;
23333}
23334
Pablo Galindo4a97b152020-09-02 17:44:19 +010023335// _loop0_130: (star_targets '=')
23336static asdl_seq *
23337_loop0_130_rule(Parser *p)
23338{
23339 D(p->level++);
23340 if (p->error_indicator) {
23341 D(p->level--);
23342 return NULL;
23343 }
23344 void *_res = NULL;
23345 int _mark = p->mark;
23346 int _start_mark = p->mark;
23347 void **_children = PyMem_Malloc(sizeof(void *));
23348 if (!_children) {
23349 p->error_indicator = 1;
23350 PyErr_NoMemory();
23351 D(p->level--);
23352 return NULL;
23353 }
23354 ssize_t _children_capacity = 1;
23355 ssize_t _n = 0;
23356 { // (star_targets '=')
23357 if (p->error_indicator) {
23358 D(p->level--);
23359 return NULL;
23360 }
23361 D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
23362 void *_tmp_152_var;
23363 while (
23364 (_tmp_152_var = _tmp_152_rule(p)) // star_targets '='
23365 )
23366 {
23367 _res = _tmp_152_var;
23368 if (_n == _children_capacity) {
23369 _children_capacity *= 2;
23370 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23371 if (!_new_children) {
23372 p->error_indicator = 1;
23373 PyErr_NoMemory();
23374 D(p->level--);
23375 return NULL;
23376 }
23377 _children = _new_children;
23378 }
23379 _children[_n++] = _res;
23380 _mark = p->mark;
23381 }
23382 p->mark = _mark;
23383 D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ',
23384 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23385 }
23386 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23387 if (!_seq) {
23388 PyMem_Free(_children);
23389 p->error_indicator = 1;
23390 PyErr_NoMemory();
23391 D(p->level--);
23392 return NULL;
23393 }
23394 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23395 PyMem_Free(_children);
23396 _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq);
23397 D(p->level--);
23398 return _seq;
23399}
23400
23401// _tmp_131: yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023402static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023403_tmp_131_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023404{
23405 D(p->level++);
23406 if (p->error_indicator) {
23407 D(p->level--);
23408 return NULL;
23409 }
23410 void * _res = NULL;
23411 int _mark = p->mark;
23412 { // yield_expr
23413 if (p->error_indicator) {
23414 D(p->level--);
23415 return NULL;
23416 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023417 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023418 expr_ty yield_expr_var;
23419 if (
23420 (yield_expr_var = yield_expr_rule(p)) // yield_expr
23421 )
23422 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023423 D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023424 _res = yield_expr_var;
23425 goto done;
23426 }
23427 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023428 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023429 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
23430 }
23431 { // star_expressions
23432 if (p->error_indicator) {
23433 D(p->level--);
23434 return NULL;
23435 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023436 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023437 expr_ty star_expressions_var;
23438 if (
23439 (star_expressions_var = star_expressions_rule(p)) // star_expressions
23440 )
23441 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023442 D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023443 _res = star_expressions_var;
23444 goto done;
23445 }
23446 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023447 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023448 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
23449 }
23450 _res = NULL;
23451 done:
23452 D(p->level--);
23453 return _res;
23454}
23455
Pablo Galindo4a97b152020-09-02 17:44:19 +010023456// _tmp_132: '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023457static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023458_tmp_132_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023459{
23460 D(p->level++);
23461 if (p->error_indicator) {
23462 D(p->level--);
23463 return NULL;
23464 }
23465 void * _res = NULL;
23466 int _mark = p->mark;
23467 { // '['
23468 if (p->error_indicator) {
23469 D(p->level--);
23470 return NULL;
23471 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023472 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023473 Token * _literal;
23474 if (
23475 (_literal = _PyPegen_expect_token(p, 9)) // token='['
23476 )
23477 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023478 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023479 _res = _literal;
23480 goto done;
23481 }
23482 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023483 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023484 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
23485 }
23486 { // '('
23487 if (p->error_indicator) {
23488 D(p->level--);
23489 return NULL;
23490 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023491 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023492 Token * _literal;
23493 if (
23494 (_literal = _PyPegen_expect_token(p, 7)) // token='('
23495 )
23496 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023497 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023498 _res = _literal;
23499 goto done;
23500 }
23501 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023502 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023503 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
23504 }
23505 { // '{'
23506 if (p->error_indicator) {
23507 D(p->level--);
23508 return NULL;
23509 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023510 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023511 Token * _literal;
23512 if (
23513 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
23514 )
23515 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023516 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023517 _res = _literal;
23518 goto done;
23519 }
23520 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023521 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023522 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
23523 }
23524 _res = NULL;
23525 done:
23526 D(p->level--);
23527 return _res;
23528}
23529
Pablo Galindo4a97b152020-09-02 17:44:19 +010023530// _loop0_133: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023531static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023532_loop0_133_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023533{
23534 D(p->level++);
23535 if (p->error_indicator) {
23536 D(p->level--);
23537 return NULL;
23538 }
23539 void *_res = NULL;
23540 int _mark = p->mark;
23541 int _start_mark = p->mark;
23542 void **_children = PyMem_Malloc(sizeof(void *));
23543 if (!_children) {
23544 p->error_indicator = 1;
23545 PyErr_NoMemory();
23546 D(p->level--);
23547 return NULL;
23548 }
23549 ssize_t _children_capacity = 1;
23550 ssize_t _n = 0;
23551 { // param_no_default
23552 if (p->error_indicator) {
23553 D(p->level--);
23554 return NULL;
23555 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023556 D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023557 arg_ty param_no_default_var;
23558 while (
23559 (param_no_default_var = param_no_default_rule(p)) // param_no_default
23560 )
23561 {
23562 _res = param_no_default_var;
23563 if (_n == _children_capacity) {
23564 _children_capacity *= 2;
23565 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23566 if (!_new_children) {
23567 p->error_indicator = 1;
23568 PyErr_NoMemory();
23569 D(p->level--);
23570 return NULL;
23571 }
23572 _children = _new_children;
23573 }
23574 _children[_n++] = _res;
23575 _mark = p->mark;
23576 }
23577 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023578 D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023579 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
23580 }
23581 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23582 if (!_seq) {
23583 PyMem_Free(_children);
23584 p->error_indicator = 1;
23585 PyErr_NoMemory();
23586 D(p->level--);
23587 return NULL;
23588 }
23589 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23590 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023591 _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023592 D(p->level--);
23593 return _seq;
23594}
23595
Pablo Galindo4a97b152020-09-02 17:44:19 +010023596// _tmp_134: slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023597static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023598_tmp_134_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023599{
23600 D(p->level++);
23601 if (p->error_indicator) {
23602 D(p->level--);
23603 return NULL;
23604 }
23605 void * _res = NULL;
23606 int _mark = p->mark;
23607 { // slash_with_default
23608 if (p->error_indicator) {
23609 D(p->level--);
23610 return NULL;
23611 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023612 D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023613 SlashWithDefault* slash_with_default_var;
23614 if (
23615 (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default
23616 )
23617 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023618 D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023619 _res = slash_with_default_var;
23620 goto done;
23621 }
23622 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023623 D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023624 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
23625 }
23626 { // param_with_default+
23627 if (p->error_indicator) {
23628 D(p->level--);
23629 return NULL;
23630 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023631 D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23632 asdl_seq * _loop1_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023633 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023634 (_loop1_153_var = _loop1_153_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023635 )
23636 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023637 D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23638 _res = _loop1_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023639 goto done;
23640 }
23641 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023642 D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023643 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+"));
23644 }
23645 _res = NULL;
23646 done:
23647 D(p->level--);
23648 return _res;
23649}
23650
Pablo Galindo4a97b152020-09-02 17:44:19 +010023651// _loop0_135: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023652static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023653_loop0_135_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023654{
23655 D(p->level++);
23656 if (p->error_indicator) {
23657 D(p->level--);
23658 return NULL;
23659 }
23660 void *_res = NULL;
23661 int _mark = p->mark;
23662 int _start_mark = p->mark;
23663 void **_children = PyMem_Malloc(sizeof(void *));
23664 if (!_children) {
23665 p->error_indicator = 1;
23666 PyErr_NoMemory();
23667 D(p->level--);
23668 return NULL;
23669 }
23670 ssize_t _children_capacity = 1;
23671 ssize_t _n = 0;
23672 { // lambda_param_no_default
23673 if (p->error_indicator) {
23674 D(p->level--);
23675 return NULL;
23676 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023677 D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023678 arg_ty lambda_param_no_default_var;
23679 while (
23680 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
23681 )
23682 {
23683 _res = lambda_param_no_default_var;
23684 if (_n == _children_capacity) {
23685 _children_capacity *= 2;
23686 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23687 if (!_new_children) {
23688 p->error_indicator = 1;
23689 PyErr_NoMemory();
23690 D(p->level--);
23691 return NULL;
23692 }
23693 _children = _new_children;
23694 }
23695 _children[_n++] = _res;
23696 _mark = p->mark;
23697 }
23698 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023699 D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023700 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
23701 }
23702 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
23703 if (!_seq) {
23704 PyMem_Free(_children);
23705 p->error_indicator = 1;
23706 PyErr_NoMemory();
23707 D(p->level--);
23708 return NULL;
23709 }
23710 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
23711 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023712 _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023713 D(p->level--);
23714 return _seq;
23715}
23716
Pablo Galindo4a97b152020-09-02 17:44:19 +010023717// _tmp_136: lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023718static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023719_tmp_136_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023720{
23721 D(p->level++);
23722 if (p->error_indicator) {
23723 D(p->level--);
23724 return NULL;
23725 }
23726 void * _res = NULL;
23727 int _mark = p->mark;
23728 { // lambda_slash_with_default
23729 if (p->error_indicator) {
23730 D(p->level--);
23731 return NULL;
23732 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023733 D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023734 SlashWithDefault* lambda_slash_with_default_var;
23735 if (
23736 (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
23737 )
23738 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023739 D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023740 _res = lambda_slash_with_default_var;
23741 goto done;
23742 }
23743 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023744 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023745 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
23746 }
23747 { // lambda_param_with_default+
23748 if (p->error_indicator) {
23749 D(p->level--);
23750 return NULL;
23751 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023752 D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23753 asdl_seq * _loop1_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023754 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023755 (_loop1_154_var = _loop1_154_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023756 )
23757 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023758 D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23759 _res = _loop1_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023760 goto done;
23761 }
23762 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023763 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023764 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+"));
23765 }
23766 _res = NULL;
23767 done:
23768 D(p->level--);
23769 return _res;
23770}
23771
Pablo Galindo4a97b152020-09-02 17:44:19 +010023772// _tmp_137: ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023773static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023774_tmp_137_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023775{
23776 D(p->level++);
23777 if (p->error_indicator) {
23778 D(p->level--);
23779 return NULL;
23780 }
23781 void * _res = NULL;
23782 int _mark = p->mark;
23783 { // ')'
23784 if (p->error_indicator) {
23785 D(p->level--);
23786 return NULL;
23787 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023788 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023789 Token * _literal;
23790 if (
23791 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
23792 )
23793 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023794 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023795 _res = _literal;
23796 goto done;
23797 }
23798 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023799 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023800 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
23801 }
23802 { // ',' (')' | '**')
23803 if (p->error_indicator) {
23804 D(p->level--);
23805 return NULL;
23806 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023807 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023808 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023809 void *_tmp_155_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023810 if (
23811 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23812 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023813 (_tmp_155_var = _tmp_155_rule(p)) // ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023814 )
23815 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023816 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
23817 _res = _PyPegen_dummy_name(p, _literal, _tmp_155_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023818 goto done;
23819 }
23820 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023821 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023822 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')"));
23823 }
23824 _res = NULL;
23825 done:
23826 D(p->level--);
23827 return _res;
23828}
23829
Pablo Galindo4a97b152020-09-02 17:44:19 +010023830// _tmp_138: ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023831static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023832_tmp_138_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023833{
23834 D(p->level++);
23835 if (p->error_indicator) {
23836 D(p->level--);
23837 return NULL;
23838 }
23839 void * _res = NULL;
23840 int _mark = p->mark;
23841 { // ':'
23842 if (p->error_indicator) {
23843 D(p->level--);
23844 return NULL;
23845 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023846 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023847 Token * _literal;
23848 if (
23849 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
23850 )
23851 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023852 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023853 _res = _literal;
23854 goto done;
23855 }
23856 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023857 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023858 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
23859 }
23860 { // ',' (':' | '**')
23861 if (p->error_indicator) {
23862 D(p->level--);
23863 return NULL;
23864 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023865 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023866 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023867 void *_tmp_156_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023868 if (
23869 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23870 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023871 (_tmp_156_var = _tmp_156_rule(p)) // ':' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023872 )
23873 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023874 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
23875 _res = _PyPegen_dummy_name(p, _literal, _tmp_156_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023876 goto done;
23877 }
23878 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023879 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023880 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')"));
23881 }
23882 _res = NULL;
23883 done:
23884 D(p->level--);
23885 return _res;
23886}
23887
Pablo Galindo4a97b152020-09-02 17:44:19 +010023888// _tmp_139: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023889static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023890_tmp_139_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023891{
23892 D(p->level++);
23893 if (p->error_indicator) {
23894 D(p->level--);
23895 return NULL;
23896 }
23897 void * _res = NULL;
23898 int _mark = p->mark;
23899 { // star_targets '='
23900 if (p->error_indicator) {
23901 D(p->level--);
23902 return NULL;
23903 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023904 D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023905 Token * _literal;
23906 expr_ty z;
23907 if (
23908 (z = star_targets_rule(p)) // star_targets
23909 &&
23910 (_literal = _PyPegen_expect_token(p, 22)) // token='='
23911 )
23912 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023913 D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023914 _res = z;
23915 if (_res == NULL && PyErr_Occurred()) {
23916 p->error_indicator = 1;
23917 D(p->level--);
23918 return NULL;
23919 }
23920 goto done;
23921 }
23922 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023923 D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023924 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
23925 }
23926 _res = NULL;
23927 done:
23928 D(p->level--);
23929 return _res;
23930}
23931
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023932// _tmp_140: '.' | '...'
23933static void *
23934_tmp_140_rule(Parser *p)
23935{
23936 D(p->level++);
23937 if (p->error_indicator) {
23938 D(p->level--);
23939 return NULL;
23940 }
23941 void * _res = NULL;
23942 int _mark = p->mark;
23943 { // '.'
23944 if (p->error_indicator) {
23945 D(p->level--);
23946 return NULL;
23947 }
23948 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
23949 Token * _literal;
23950 if (
23951 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
23952 )
23953 {
23954 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
23955 _res = _literal;
23956 goto done;
23957 }
23958 p->mark = _mark;
23959 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
23960 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
23961 }
23962 { // '...'
23963 if (p->error_indicator) {
23964 D(p->level--);
23965 return NULL;
23966 }
23967 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
23968 Token * _literal;
23969 if (
23970 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
23971 )
23972 {
23973 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
23974 _res = _literal;
23975 goto done;
23976 }
23977 p->mark = _mark;
23978 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
23979 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
23980 }
23981 _res = NULL;
23982 done:
23983 D(p->level--);
23984 return _res;
23985}
23986
Pablo Galindo4a97b152020-09-02 17:44:19 +010023987// _tmp_141: '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023988static void *
23989_tmp_141_rule(Parser *p)
23990{
23991 D(p->level++);
23992 if (p->error_indicator) {
23993 D(p->level--);
23994 return NULL;
23995 }
23996 void * _res = NULL;
23997 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023998 { // '.'
23999 if (p->error_indicator) {
24000 D(p->level--);
24001 return NULL;
24002 }
24003 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
24004 Token * _literal;
24005 if (
24006 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
24007 )
24008 {
24009 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
24010 _res = _literal;
24011 goto done;
24012 }
24013 p->mark = _mark;
24014 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
24015 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
24016 }
24017 { // '...'
24018 if (p->error_indicator) {
24019 D(p->level--);
24020 return NULL;
24021 }
24022 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
24023 Token * _literal;
24024 if (
24025 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
24026 )
24027 {
24028 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
24029 _res = _literal;
24030 goto done;
24031 }
24032 p->mark = _mark;
24033 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
24034 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
24035 }
24036 _res = NULL;
24037 done:
24038 D(p->level--);
24039 return _res;
24040}
24041
24042// _tmp_142: '@' named_expression NEWLINE
24043static void *
24044_tmp_142_rule(Parser *p)
24045{
24046 D(p->level++);
24047 if (p->error_indicator) {
24048 D(p->level--);
24049 return NULL;
24050 }
24051 void * _res = NULL;
24052 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024053 { // '@' named_expression NEWLINE
24054 if (p->error_indicator) {
24055 D(p->level--);
24056 return NULL;
24057 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024058 D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024059 Token * _literal;
24060 expr_ty f;
24061 Token * newline_var;
24062 if (
24063 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
24064 &&
24065 (f = named_expression_rule(p)) // named_expression
24066 &&
24067 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
24068 )
24069 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024070 D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024071 _res = f;
24072 if (_res == NULL && PyErr_Occurred()) {
24073 p->error_indicator = 1;
24074 D(p->level--);
24075 return NULL;
24076 }
24077 goto done;
24078 }
24079 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024080 D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024081 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE"));
24082 }
24083 _res = NULL;
24084 done:
24085 D(p->level--);
24086 return _res;
24087}
24088
Pablo Galindo4a97b152020-09-02 17:44:19 +010024089// _tmp_143: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024090static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024091_tmp_143_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024092{
24093 D(p->level++);
24094 if (p->error_indicator) {
24095 D(p->level--);
24096 return NULL;
24097 }
24098 void * _res = NULL;
24099 int _mark = p->mark;
24100 { // ',' star_expression
24101 if (p->error_indicator) {
24102 D(p->level--);
24103 return NULL;
24104 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024105 D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024106 Token * _literal;
24107 expr_ty c;
24108 if (
24109 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24110 &&
24111 (c = star_expression_rule(p)) // star_expression
24112 )
24113 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024114 D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024115 _res = c;
24116 if (_res == NULL && PyErr_Occurred()) {
24117 p->error_indicator = 1;
24118 D(p->level--);
24119 return NULL;
24120 }
24121 goto done;
24122 }
24123 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024124 D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024125 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
24126 }
24127 _res = NULL;
24128 done:
24129 D(p->level--);
24130 return _res;
24131}
24132
Pablo Galindo4a97b152020-09-02 17:44:19 +010024133// _tmp_144: ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024134static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024135_tmp_144_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024136{
24137 D(p->level++);
24138 if (p->error_indicator) {
24139 D(p->level--);
24140 return NULL;
24141 }
24142 void * _res = NULL;
24143 int _mark = p->mark;
24144 { // ',' expression
24145 if (p->error_indicator) {
24146 D(p->level--);
24147 return NULL;
24148 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024149 D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024150 Token * _literal;
24151 expr_ty c;
24152 if (
24153 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24154 &&
24155 (c = expression_rule(p)) // expression
24156 )
24157 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024158 D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024159 _res = c;
24160 if (_res == NULL && PyErr_Occurred()) {
24161 p->error_indicator = 1;
24162 D(p->level--);
24163 return NULL;
24164 }
24165 goto done;
24166 }
24167 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024168 D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024169 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
24170 }
24171 _res = NULL;
24172 done:
24173 D(p->level--);
24174 return _res;
24175}
24176
Pablo Galindo4a97b152020-09-02 17:44:19 +010024177// _tmp_145: 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024178static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024179_tmp_145_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024180{
24181 D(p->level++);
24182 if (p->error_indicator) {
24183 D(p->level--);
24184 return NULL;
24185 }
24186 void * _res = NULL;
24187 int _mark = p->mark;
24188 { // 'or' conjunction
24189 if (p->error_indicator) {
24190 D(p->level--);
24191 return NULL;
24192 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024193 D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024194 Token * _keyword;
24195 expr_ty c;
24196 if (
24197 (_keyword = _PyPegen_expect_token(p, 531)) // token='or'
24198 &&
24199 (c = conjunction_rule(p)) // conjunction
24200 )
24201 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024202 D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024203 _res = c;
24204 if (_res == NULL && PyErr_Occurred()) {
24205 p->error_indicator = 1;
24206 D(p->level--);
24207 return NULL;
24208 }
24209 goto done;
24210 }
24211 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024212 D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024213 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction"));
24214 }
24215 _res = NULL;
24216 done:
24217 D(p->level--);
24218 return _res;
24219}
24220
Pablo Galindo4a97b152020-09-02 17:44:19 +010024221// _tmp_146: 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024222static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024223_tmp_146_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024224{
24225 D(p->level++);
24226 if (p->error_indicator) {
24227 D(p->level--);
24228 return NULL;
24229 }
24230 void * _res = NULL;
24231 int _mark = p->mark;
24232 { // 'and' inversion
24233 if (p->error_indicator) {
24234 D(p->level--);
24235 return NULL;
24236 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024237 D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024238 Token * _keyword;
24239 expr_ty c;
24240 if (
24241 (_keyword = _PyPegen_expect_token(p, 532)) // token='and'
24242 &&
24243 (c = inversion_rule(p)) // inversion
24244 )
24245 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024246 D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024247 _res = c;
24248 if (_res == NULL && PyErr_Occurred()) {
24249 p->error_indicator = 1;
24250 D(p->level--);
24251 return NULL;
24252 }
24253 goto done;
24254 }
24255 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024256 D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010024257 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024258 }
24259 _res = NULL;
24260 done:
24261 D(p->level--);
24262 return _res;
24263}
24264
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024265// _tmp_147: 'if' disjunction
24266static void *
24267_tmp_147_rule(Parser *p)
24268{
24269 D(p->level++);
24270 if (p->error_indicator) {
24271 D(p->level--);
24272 return NULL;
24273 }
24274 void * _res = NULL;
24275 int _mark = p->mark;
24276 { // 'if' disjunction
24277 if (p->error_indicator) {
24278 D(p->level--);
24279 return NULL;
24280 }
24281 D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24282 Token * _keyword;
24283 expr_ty z;
24284 if (
24285 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24286 &&
24287 (z = disjunction_rule(p)) // disjunction
24288 )
24289 {
24290 D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24291 _res = z;
24292 if (_res == NULL && PyErr_Occurred()) {
24293 p->error_indicator = 1;
24294 D(p->level--);
24295 return NULL;
24296 }
24297 goto done;
24298 }
24299 p->mark = _mark;
24300 D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
24301 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24302 }
24303 _res = NULL;
24304 done:
24305 D(p->level--);
24306 return _res;
24307}
24308
Pablo Galindo4a97b152020-09-02 17:44:19 +010024309// _tmp_148: 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024310static void *
24311_tmp_148_rule(Parser *p)
24312{
24313 D(p->level++);
24314 if (p->error_indicator) {
24315 D(p->level--);
24316 return NULL;
24317 }
24318 void * _res = NULL;
24319 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024320 { // 'if' disjunction
24321 if (p->error_indicator) {
24322 D(p->level--);
24323 return NULL;
24324 }
24325 D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24326 Token * _keyword;
24327 expr_ty z;
24328 if (
24329 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24330 &&
24331 (z = disjunction_rule(p)) // disjunction
24332 )
24333 {
24334 D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24335 _res = z;
24336 if (_res == NULL && PyErr_Occurred()) {
24337 p->error_indicator = 1;
24338 D(p->level--);
24339 return NULL;
24340 }
24341 goto done;
24342 }
24343 p->mark = _mark;
24344 D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
24345 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24346 }
24347 _res = NULL;
24348 done:
24349 D(p->level--);
24350 return _res;
24351}
24352
24353// _tmp_149: starred_expression | named_expression !'='
24354static void *
24355_tmp_149_rule(Parser *p)
24356{
24357 D(p->level++);
24358 if (p->error_indicator) {
24359 D(p->level--);
24360 return NULL;
24361 }
24362 void * _res = NULL;
24363 int _mark = p->mark;
24364 { // starred_expression
24365 if (p->error_indicator) {
24366 D(p->level--);
24367 return NULL;
24368 }
24369 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
24370 expr_ty starred_expression_var;
24371 if (
24372 (starred_expression_var = starred_expression_rule(p)) // starred_expression
24373 )
24374 {
24375 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
24376 _res = starred_expression_var;
24377 goto done;
24378 }
24379 p->mark = _mark;
24380 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24381 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
24382 }
24383 { // named_expression !'='
24384 if (p->error_indicator) {
24385 D(p->level--);
24386 return NULL;
24387 }
24388 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
24389 expr_ty named_expression_var;
24390 if (
24391 (named_expression_var = named_expression_rule(p)) // named_expression
24392 &&
24393 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
24394 )
24395 {
24396 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
24397 _res = named_expression_var;
24398 goto done;
24399 }
24400 p->mark = _mark;
24401 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24402 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression !'='"));
24403 }
24404 _res = NULL;
24405 done:
24406 D(p->level--);
24407 return _res;
24408}
24409
24410// _tmp_150: ',' star_target
24411static void *
24412_tmp_150_rule(Parser *p)
24413{
24414 D(p->level++);
24415 if (p->error_indicator) {
24416 D(p->level--);
24417 return NULL;
24418 }
24419 void * _res = NULL;
24420 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024421 { // ',' star_target
24422 if (p->error_indicator) {
24423 D(p->level--);
24424 return NULL;
24425 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024426 D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024427 Token * _literal;
24428 expr_ty c;
24429 if (
24430 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24431 &&
24432 (c = star_target_rule(p)) // star_target
24433 )
24434 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024435 D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024436 _res = c;
24437 if (_res == NULL && PyErr_Occurred()) {
24438 p->error_indicator = 1;
24439 D(p->level--);
24440 return NULL;
24441 }
24442 goto done;
24443 }
24444 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024445 D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030024446 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024447 }
24448 _res = NULL;
24449 done:
24450 D(p->level--);
24451 return _res;
24452}
24453
Pablo Galindo4a97b152020-09-02 17:44:19 +010024454// _tmp_151: star_targets '='
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024455static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024456_tmp_151_rule(Parser *p)
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024457{
24458 D(p->level++);
24459 if (p->error_indicator) {
24460 D(p->level--);
24461 return NULL;
24462 }
24463 void * _res = NULL;
24464 int _mark = p->mark;
24465 { // star_targets '='
24466 if (p->error_indicator) {
24467 D(p->level--);
24468 return NULL;
24469 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024470 D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024471 Token * _literal;
24472 expr_ty star_targets_var;
24473 if (
24474 (star_targets_var = star_targets_rule(p)) // star_targets
24475 &&
24476 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24477 )
24478 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024479 D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024480 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24481 goto done;
24482 }
24483 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024484 D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024485 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24486 }
24487 _res = NULL;
24488 done:
24489 D(p->level--);
24490 return _res;
24491}
24492
Pablo Galindo4a97b152020-09-02 17:44:19 +010024493// _tmp_152: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024494static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024495_tmp_152_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024496{
24497 D(p->level++);
24498 if (p->error_indicator) {
24499 D(p->level--);
24500 return NULL;
24501 }
24502 void * _res = NULL;
24503 int _mark = p->mark;
24504 { // star_targets '='
24505 if (p->error_indicator) {
24506 D(p->level--);
24507 return NULL;
24508 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024509 D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024510 Token * _literal;
24511 expr_ty star_targets_var;
24512 if (
24513 (star_targets_var = star_targets_rule(p)) // star_targets
24514 &&
24515 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24516 )
24517 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024518 D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024519 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24520 goto done;
24521 }
24522 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024523 D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024524 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24525 }
24526 _res = NULL;
24527 done:
24528 D(p->level--);
24529 return _res;
24530}
24531
Pablo Galindo4a97b152020-09-02 17:44:19 +010024532// _loop1_153: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024533static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024534_loop1_153_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024535{
24536 D(p->level++);
24537 if (p->error_indicator) {
24538 D(p->level--);
24539 return NULL;
24540 }
24541 void *_res = NULL;
24542 int _mark = p->mark;
24543 int _start_mark = p->mark;
24544 void **_children = PyMem_Malloc(sizeof(void *));
24545 if (!_children) {
24546 p->error_indicator = 1;
24547 PyErr_NoMemory();
24548 D(p->level--);
24549 return NULL;
24550 }
24551 ssize_t _children_capacity = 1;
24552 ssize_t _n = 0;
24553 { // param_with_default
24554 if (p->error_indicator) {
24555 D(p->level--);
24556 return NULL;
24557 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024558 D(fprintf(stderr, "%*c> _loop1_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024559 NameDefaultPair* param_with_default_var;
24560 while (
24561 (param_with_default_var = param_with_default_rule(p)) // param_with_default
24562 )
24563 {
24564 _res = param_with_default_var;
24565 if (_n == _children_capacity) {
24566 _children_capacity *= 2;
24567 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24568 if (!_new_children) {
24569 p->error_indicator = 1;
24570 PyErr_NoMemory();
24571 D(p->level--);
24572 return NULL;
24573 }
24574 _children = _new_children;
24575 }
24576 _children[_n++] = _res;
24577 _mark = p->mark;
24578 }
24579 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024580 D(fprintf(stderr, "%*c%s _loop1_153[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024581 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
24582 }
24583 if (_n == 0 || p->error_indicator) {
24584 PyMem_Free(_children);
24585 D(p->level--);
24586 return NULL;
24587 }
24588 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
24589 if (!_seq) {
24590 PyMem_Free(_children);
24591 p->error_indicator = 1;
24592 PyErr_NoMemory();
24593 D(p->level--);
24594 return NULL;
24595 }
24596 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
24597 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010024598 _PyPegen_insert_memo(p, _start_mark, _loop1_153_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024599 D(p->level--);
24600 return _seq;
24601}
24602
Pablo Galindo4a97b152020-09-02 17:44:19 +010024603// _loop1_154: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024604static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024605_loop1_154_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024606{
24607 D(p->level++);
24608 if (p->error_indicator) {
24609 D(p->level--);
24610 return NULL;
24611 }
24612 void *_res = NULL;
24613 int _mark = p->mark;
24614 int _start_mark = p->mark;
24615 void **_children = PyMem_Malloc(sizeof(void *));
24616 if (!_children) {
24617 p->error_indicator = 1;
24618 PyErr_NoMemory();
24619 D(p->level--);
24620 return NULL;
24621 }
24622 ssize_t _children_capacity = 1;
24623 ssize_t _n = 0;
24624 { // lambda_param_with_default
24625 if (p->error_indicator) {
24626 D(p->level--);
24627 return NULL;
24628 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024629 D(fprintf(stderr, "%*c> _loop1_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024630 NameDefaultPair* lambda_param_with_default_var;
24631 while (
24632 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
24633 )
24634 {
24635 _res = lambda_param_with_default_var;
24636 if (_n == _children_capacity) {
24637 _children_capacity *= 2;
24638 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24639 if (!_new_children) {
24640 p->error_indicator = 1;
24641 PyErr_NoMemory();
24642 D(p->level--);
24643 return NULL;
24644 }
24645 _children = _new_children;
24646 }
24647 _children[_n++] = _res;
24648 _mark = p->mark;
24649 }
24650 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024651 D(fprintf(stderr, "%*c%s _loop1_154[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024652 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
24653 }
24654 if (_n == 0 || p->error_indicator) {
24655 PyMem_Free(_children);
24656 D(p->level--);
24657 return NULL;
24658 }
24659 asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
24660 if (!_seq) {
24661 PyMem_Free(_children);
24662 p->error_indicator = 1;
24663 PyErr_NoMemory();
24664 D(p->level--);
24665 return NULL;
24666 }
24667 for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
24668 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010024669 _PyPegen_insert_memo(p, _start_mark, _loop1_154_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024670 D(p->level--);
24671 return _seq;
24672}
24673
Pablo Galindo4a97b152020-09-02 17:44:19 +010024674// _tmp_155: ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024675static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024676_tmp_155_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024677{
24678 D(p->level++);
24679 if (p->error_indicator) {
24680 D(p->level--);
24681 return NULL;
24682 }
24683 void * _res = NULL;
24684 int _mark = p->mark;
24685 { // ')'
24686 if (p->error_indicator) {
24687 D(p->level--);
24688 return NULL;
24689 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024690 D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024691 Token * _literal;
24692 if (
24693 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
24694 )
24695 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024696 D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024697 _res = _literal;
24698 goto done;
24699 }
24700 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024701 D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024702 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
24703 }
24704 { // '**'
24705 if (p->error_indicator) {
24706 D(p->level--);
24707 return NULL;
24708 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024709 D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024710 Token * _literal;
24711 if (
24712 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24713 )
24714 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024715 D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024716 _res = _literal;
24717 goto done;
24718 }
24719 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024720 D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024721 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24722 }
24723 _res = NULL;
24724 done:
24725 D(p->level--);
24726 return _res;
24727}
24728
Pablo Galindo4a97b152020-09-02 17:44:19 +010024729// _tmp_156: ':' | '**'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024730static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024731_tmp_156_rule(Parser *p)
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024732{
24733 D(p->level++);
24734 if (p->error_indicator) {
24735 D(p->level--);
24736 return NULL;
24737 }
24738 void * _res = NULL;
24739 int _mark = p->mark;
24740 { // ':'
24741 if (p->error_indicator) {
24742 D(p->level--);
24743 return NULL;
24744 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024745 D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024746 Token * _literal;
24747 if (
24748 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
24749 )
24750 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024751 D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024752 _res = _literal;
24753 goto done;
24754 }
24755 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024756 D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024757 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024758 }
24759 { // '**'
24760 if (p->error_indicator) {
24761 D(p->level--);
24762 return NULL;
24763 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024764 D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024765 Token * _literal;
24766 if (
24767 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24768 )
24769 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024770 D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024771 _res = _literal;
24772 goto done;
24773 }
24774 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024775 D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024776 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24777 }
24778 _res = NULL;
24779 done:
24780 D(p->level--);
24781 return _res;
24782}
24783
24784void *
24785_PyPegen_parse(Parser *p)
24786{
24787 // Initialize keywords
24788 p->keywords = reserved_keywords;
24789 p->n_keyword_lists = n_keyword_lists;
24790
24791 // Run parser
24792 void *result = NULL;
24793 if (p->start_rule == Py_file_input) {
24794 result = file_rule(p);
24795 } else if (p->start_rule == Py_single_input) {
24796 result = interactive_rule(p);
24797 } else if (p->start_rule == Py_eval_input) {
24798 result = eval_rule(p);
24799 } else if (p->start_rule == Py_func_type_input) {
24800 result = func_type_rule(p);
24801 } else if (p->start_rule == Py_fstring_input) {
24802 result = fstring_rule(p);
24803 }
24804
24805 return result;
24806}
24807
24808// The end