blob: 1bd74a38fbc2bae041d7ae85b649755887dd4be6 [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);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100392static asdl_expr_seq* type_expressions_rule(Parser *p);
393static asdl_stmt_seq* statements_rule(Parser *p);
394static asdl_stmt_seq* statement_rule(Parser *p);
395static asdl_stmt_seq* statement_newline_rule(Parser *p);
396static asdl_stmt_seq* simple_stmt_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100397static 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);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100409static asdl_alias_seq* import_from_targets_rule(Parser *p);
410static asdl_alias_seq* import_from_as_names_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100411static alias_ty import_from_as_name_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100412static asdl_alias_seq* dotted_as_names_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100413static 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);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100417static asdl_stmt_seq* else_block_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100418static 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);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100424static asdl_stmt_seq* finally_block_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100425static 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);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100432static asdl_arg_seq* slash_no_default_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100433static 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);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100442static asdl_expr_seq* decorators_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100443static stmt_ty class_def_rule(Parser *p);
444static stmt_ty class_def_raw_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100445static asdl_stmt_seq* block_rule(Parser *p);
446static asdl_expr_seq* expressions_list_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100447static expr_ty star_expressions_rule(Parser *p);
448static expr_ty star_expression_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100449static asdl_expr_seq* star_named_expressions_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100450static 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);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100458static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100459static 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);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100507static asdl_comprehension_seq* for_if_clauses_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100508static 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);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100517static asdl_expr_seq* star_targets_seq_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100518static 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);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100522static asdl_expr_seq* del_targets_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100523static expr_ty del_target_rule(Parser *p);
524static expr_ty del_t_atom_rule(Parser *p);
Pablo Galindoa5634c42020-09-16 19:42:00 +0100525static asdl_expr_seq* targets_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100526static 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"));
Pablo Galindoa5634c42020-09-16 19:42:00 +0100767 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100768 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+
Pablo Galindoa5634c42020-09-16 19:42:00 +0100941static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100942type_expressions_rule(Parser *p)
943{
944 D(p->level++);
945 if (p->error_indicator) {
946 D(p->level--);
947 return NULL;
948 }
Pablo Galindoa5634c42020-09-16 19:42:00 +0100949 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100950 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"));
Pablo Galindoa5634c42020-09-16 19:42:00 +0100981 _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100982 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"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001014 _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001015 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"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001047 _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001048 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"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001083 _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001084 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"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001110 _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001111 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"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001137 _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001138 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+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001155 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001156 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01001157 (a = (asdl_expr_seq*)_gather_9_rule(p)) // ','.expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001158 )
1159 {
1160 D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001161 _res = a;
1162 if (_res == NULL && PyErr_Occurred()) {
1163 p->error_indicator = 1;
1164 D(p->level--);
1165 return NULL;
1166 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001167 goto done;
1168 }
1169 p->mark = _mark;
1170 D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
1171 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
1172 }
1173 _res = NULL;
1174 done:
1175 D(p->level--);
1176 return _res;
1177}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001178
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001179// statements: statement+
Pablo Galindoa5634c42020-09-16 19:42:00 +01001180static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001181statements_rule(Parser *p)
1182{
1183 D(p->level++);
1184 if (p->error_indicator) {
1185 D(p->level--);
1186 return NULL;
1187 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01001188 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001189 int _mark = p->mark;
1190 { // statement+
1191 if (p->error_indicator) {
1192 D(p->level--);
1193 return NULL;
1194 }
1195 D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+"));
1196 asdl_seq * a;
1197 if (
1198 (a = _loop1_11_rule(p)) // statement+
1199 )
1200 {
1201 D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001202 _res = ( asdl_stmt_seq * ) _PyPegen_seq_flatten ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001203 if (_res == NULL && PyErr_Occurred()) {
1204 p->error_indicator = 1;
1205 D(p->level--);
1206 return NULL;
1207 }
1208 goto done;
1209 }
1210 p->mark = _mark;
1211 D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ',
1212 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+"));
1213 }
1214 _res = NULL;
1215 done:
1216 D(p->level--);
1217 return _res;
1218}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +00001219
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001220// statement: compound_stmt | simple_stmt
Pablo Galindoa5634c42020-09-16 19:42:00 +01001221static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001222statement_rule(Parser *p)
1223{
1224 D(p->level++);
1225 if (p->error_indicator) {
1226 D(p->level--);
1227 return NULL;
1228 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01001229 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001230 int _mark = p->mark;
1231 { // compound_stmt
1232 if (p->error_indicator) {
1233 D(p->level--);
1234 return NULL;
1235 }
1236 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
1237 stmt_ty a;
1238 if (
1239 (a = compound_stmt_rule(p)) // compound_stmt
1240 )
1241 {
1242 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001243 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001244 if (_res == NULL && PyErr_Occurred()) {
1245 p->error_indicator = 1;
1246 D(p->level--);
1247 return NULL;
1248 }
1249 goto done;
1250 }
1251 p->mark = _mark;
1252 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1253 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt"));
1254 }
1255 { // simple_stmt
1256 if (p->error_indicator) {
1257 D(p->level--);
1258 return NULL;
1259 }
1260 D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001261 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001262 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01001263 (a = (asdl_stmt_seq*)simple_stmt_rule(p)) // simple_stmt
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001264 )
1265 {
1266 D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001267 _res = a;
1268 if (_res == NULL && PyErr_Occurred()) {
1269 p->error_indicator = 1;
1270 D(p->level--);
1271 return NULL;
1272 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001273 goto done;
1274 }
1275 p->mark = _mark;
1276 D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
1277 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1278 }
1279 _res = NULL;
1280 done:
1281 D(p->level--);
1282 return _res;
1283}
1284
1285// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
Pablo Galindoa5634c42020-09-16 19:42:00 +01001286static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001287statement_newline_rule(Parser *p)
1288{
1289 D(p->level++);
1290 if (p->error_indicator) {
1291 D(p->level--);
1292 return NULL;
1293 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01001294 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001295 int _mark = p->mark;
1296 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1297 p->error_indicator = 1;
1298 D(p->level--);
1299 return NULL;
1300 }
1301 int _start_lineno = p->tokens[_mark]->lineno;
1302 UNUSED(_start_lineno); // Only used by EXTRA macro
1303 int _start_col_offset = p->tokens[_mark]->col_offset;
1304 UNUSED(_start_col_offset); // Only used by EXTRA macro
1305 { // compound_stmt NEWLINE
1306 if (p->error_indicator) {
1307 D(p->level--);
1308 return NULL;
1309 }
1310 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
1311 stmt_ty a;
1312 Token * newline_var;
1313 if (
1314 (a = compound_stmt_rule(p)) // compound_stmt
1315 &&
1316 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1317 )
1318 {
1319 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001320 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001321 if (_res == NULL && PyErr_Occurred()) {
1322 p->error_indicator = 1;
1323 D(p->level--);
1324 return NULL;
1325 }
1326 goto done;
1327 }
1328 p->mark = _mark;
1329 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1330 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE"));
1331 }
1332 { // simple_stmt
1333 if (p->error_indicator) {
1334 D(p->level--);
1335 return NULL;
1336 }
1337 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001338 asdl_stmt_seq* simple_stmt_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001339 if (
1340 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
1341 )
1342 {
1343 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
1344 _res = simple_stmt_var;
1345 goto done;
1346 }
1347 p->mark = _mark;
1348 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1349 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
1350 }
1351 { // NEWLINE
1352 if (p->error_indicator) {
1353 D(p->level--);
1354 return NULL;
1355 }
1356 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1357 Token * newline_var;
1358 if (
1359 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1360 )
1361 {
1362 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
1363 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1364 if (_token == NULL) {
1365 D(p->level--);
1366 return NULL;
1367 }
1368 int _end_lineno = _token->end_lineno;
1369 UNUSED(_end_lineno); // Only used by EXTRA macro
1370 int _end_col_offset = _token->end_col_offset;
1371 UNUSED(_end_col_offset); // Only used by EXTRA macro
Pablo Galindoa5634c42020-09-16 19:42:00 +01001372 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001373 if (_res == NULL && PyErr_Occurred()) {
1374 p->error_indicator = 1;
1375 D(p->level--);
1376 return NULL;
1377 }
1378 goto done;
1379 }
1380 p->mark = _mark;
1381 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1382 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
1383 }
1384 { // $
1385 if (p->error_indicator) {
1386 D(p->level--);
1387 return NULL;
1388 }
1389 D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$"));
1390 Token * endmarker_var;
1391 if (
1392 (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER'
1393 )
1394 {
1395 D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$"));
1396 _res = _PyPegen_interactive_exit ( p );
1397 if (_res == NULL && PyErr_Occurred()) {
1398 p->error_indicator = 1;
1399 D(p->level--);
1400 return NULL;
1401 }
1402 goto done;
1403 }
1404 p->mark = _mark;
1405 D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
1406 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$"));
1407 }
1408 _res = NULL;
1409 done:
1410 D(p->level--);
1411 return _res;
1412}
1413
1414// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
Pablo Galindoa5634c42020-09-16 19:42:00 +01001415static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001416simple_stmt_rule(Parser *p)
1417{
1418 D(p->level++);
1419 if (p->error_indicator) {
1420 D(p->level--);
1421 return NULL;
1422 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01001423 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001424 int _mark = p->mark;
1425 { // small_stmt !';' NEWLINE
1426 if (p->error_indicator) {
1427 D(p->level--);
1428 return NULL;
1429 }
1430 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
1431 stmt_ty a;
1432 Token * newline_var;
1433 if (
1434 (a = small_stmt_rule(p)) // small_stmt
1435 &&
1436 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';'
1437 &&
1438 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1439 )
1440 {
1441 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01001442 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001443 if (_res == NULL && PyErr_Occurred()) {
1444 p->error_indicator = 1;
1445 D(p->level--);
1446 return NULL;
1447 }
1448 goto done;
1449 }
1450 p->mark = _mark;
1451 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1452 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt !';' NEWLINE"));
1453 }
1454 { // ';'.small_stmt+ ';'? NEWLINE
1455 if (p->error_indicator) {
1456 D(p->level--);
1457 return NULL;
1458 }
1459 D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1460 void *_opt_var;
1461 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01001462 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001463 Token * newline_var;
1464 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01001465 (a = (asdl_stmt_seq*)_gather_12_rule(p)) // ';'.small_stmt+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01001466 &&
1467 (_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'?
1468 &&
1469 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
1470 )
1471 {
1472 D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1473 _res = a;
1474 if (_res == NULL && PyErr_Occurred()) {
1475 p->error_indicator = 1;
1476 D(p->level--);
1477 return NULL;
1478 }
1479 goto done;
1480 }
1481 p->mark = _mark;
1482 D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1483 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
1484 }
1485 _res = NULL;
1486 done:
1487 D(p->level--);
1488 return _res;
1489}
1490
1491// small_stmt:
1492// | assignment
1493// | star_expressions
1494// | &'return' return_stmt
1495// | &('import' | 'from') import_stmt
1496// | &'raise' raise_stmt
1497// | 'pass'
1498// | &'del' del_stmt
1499// | &'yield' yield_stmt
1500// | &'assert' assert_stmt
1501// | 'break'
1502// | 'continue'
1503// | &'global' global_stmt
1504// | &'nonlocal' nonlocal_stmt
1505static stmt_ty
1506small_stmt_rule(Parser *p)
1507{
1508 D(p->level++);
1509 if (p->error_indicator) {
1510 D(p->level--);
1511 return NULL;
1512 }
1513 stmt_ty _res = NULL;
1514 if (_PyPegen_is_memoized(p, small_stmt_type, &_res)) {
1515 D(p->level--);
1516 return _res;
1517 }
1518 int _mark = p->mark;
1519 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
1520 p->error_indicator = 1;
1521 D(p->level--);
1522 return NULL;
1523 }
1524 int _start_lineno = p->tokens[_mark]->lineno;
1525 UNUSED(_start_lineno); // Only used by EXTRA macro
1526 int _start_col_offset = p->tokens[_mark]->col_offset;
1527 UNUSED(_start_col_offset); // Only used by EXTRA macro
1528 { // assignment
1529 if (p->error_indicator) {
1530 D(p->level--);
1531 return NULL;
1532 }
1533 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment"));
1534 stmt_ty assignment_var;
1535 if (
1536 (assignment_var = assignment_rule(p)) // assignment
1537 )
1538 {
1539 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment"));
1540 _res = assignment_var;
1541 goto done;
1542 }
1543 p->mark = _mark;
1544 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1545 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment"));
1546 }
1547 { // star_expressions
1548 if (p->error_indicator) {
1549 D(p->level--);
1550 return NULL;
1551 }
1552 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1553 expr_ty e;
1554 if (
1555 (e = star_expressions_rule(p)) // star_expressions
1556 )
1557 {
1558 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
1559 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1560 if (_token == NULL) {
1561 D(p->level--);
1562 return NULL;
1563 }
1564 int _end_lineno = _token->end_lineno;
1565 UNUSED(_end_lineno); // Only used by EXTRA macro
1566 int _end_col_offset = _token->end_col_offset;
1567 UNUSED(_end_col_offset); // Only used by EXTRA macro
1568 _res = _Py_Expr ( e , EXTRA );
1569 if (_res == NULL && PyErr_Occurred()) {
1570 p->error_indicator = 1;
1571 D(p->level--);
1572 return NULL;
1573 }
1574 goto done;
1575 }
1576 p->mark = _mark;
1577 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1578 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
1579 }
1580 { // &'return' return_stmt
1581 if (p->error_indicator) {
1582 D(p->level--);
1583 return NULL;
1584 }
1585 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1586 stmt_ty return_stmt_var;
1587 if (
1588 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return'
1589 &&
1590 (return_stmt_var = return_stmt_rule(p)) // return_stmt
1591 )
1592 {
1593 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
1594 _res = return_stmt_var;
1595 goto done;
1596 }
1597 p->mark = _mark;
1598 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1599 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt"));
1600 }
1601 { // &('import' | 'from') import_stmt
1602 if (p->error_indicator) {
1603 D(p->level--);
1604 return NULL;
1605 }
1606 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1607 stmt_ty import_stmt_var;
1608 if (
1609 _PyPegen_lookahead(1, _tmp_14_rule, p)
1610 &&
1611 (import_stmt_var = import_stmt_rule(p)) // import_stmt
1612 )
1613 {
1614 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
1615 _res = import_stmt_var;
1616 goto done;
1617 }
1618 p->mark = _mark;
1619 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1620 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt"));
1621 }
1622 { // &'raise' raise_stmt
1623 if (p->error_indicator) {
1624 D(p->level--);
1625 return NULL;
1626 }
1627 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1628 stmt_ty raise_stmt_var;
1629 if (
1630 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise'
1631 &&
1632 (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt
1633 )
1634 {
1635 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
1636 _res = raise_stmt_var;
1637 goto done;
1638 }
1639 p->mark = _mark;
1640 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1641 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt"));
1642 }
1643 { // 'pass'
1644 if (p->error_indicator) {
1645 D(p->level--);
1646 return NULL;
1647 }
1648 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'"));
1649 Token * _keyword;
1650 if (
1651 (_keyword = _PyPegen_expect_token(p, 502)) // token='pass'
1652 )
1653 {
1654 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'"));
1655 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1656 if (_token == NULL) {
1657 D(p->level--);
1658 return NULL;
1659 }
1660 int _end_lineno = _token->end_lineno;
1661 UNUSED(_end_lineno); // Only used by EXTRA macro
1662 int _end_col_offset = _token->end_col_offset;
1663 UNUSED(_end_col_offset); // Only used by EXTRA macro
1664 _res = _Py_Pass ( EXTRA );
1665 if (_res == NULL && PyErr_Occurred()) {
1666 p->error_indicator = 1;
1667 D(p->level--);
1668 return NULL;
1669 }
1670 goto done;
1671 }
1672 p->mark = _mark;
1673 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1674 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'"));
1675 }
1676 { // &'del' del_stmt
1677 if (p->error_indicator) {
1678 D(p->level--);
1679 return NULL;
1680 }
1681 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1682 stmt_ty del_stmt_var;
1683 if (
1684 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del'
1685 &&
1686 (del_stmt_var = del_stmt_rule(p)) // del_stmt
1687 )
1688 {
1689 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
1690 _res = del_stmt_var;
1691 goto done;
1692 }
1693 p->mark = _mark;
1694 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1695 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt"));
1696 }
1697 { // &'yield' yield_stmt
1698 if (p->error_indicator) {
1699 D(p->level--);
1700 return NULL;
1701 }
1702 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1703 stmt_ty yield_stmt_var;
1704 if (
1705 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield'
1706 &&
1707 (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt
1708 )
1709 {
1710 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
1711 _res = yield_stmt_var;
1712 goto done;
1713 }
1714 p->mark = _mark;
1715 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1716 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt"));
1717 }
1718 { // &'assert' assert_stmt
1719 if (p->error_indicator) {
1720 D(p->level--);
1721 return NULL;
1722 }
1723 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1724 stmt_ty assert_stmt_var;
1725 if (
1726 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert'
1727 &&
1728 (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt
1729 )
1730 {
1731 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
1732 _res = assert_stmt_var;
1733 goto done;
1734 }
1735 p->mark = _mark;
1736 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1737 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt"));
1738 }
1739 { // 'break'
1740 if (p->error_indicator) {
1741 D(p->level--);
1742 return NULL;
1743 }
1744 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'"));
1745 Token * _keyword;
1746 if (
1747 (_keyword = _PyPegen_expect_token(p, 506)) // token='break'
1748 )
1749 {
1750 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'"));
1751 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1752 if (_token == NULL) {
1753 D(p->level--);
1754 return NULL;
1755 }
1756 int _end_lineno = _token->end_lineno;
1757 UNUSED(_end_lineno); // Only used by EXTRA macro
1758 int _end_col_offset = _token->end_col_offset;
1759 UNUSED(_end_col_offset); // Only used by EXTRA macro
1760 _res = _Py_Break ( EXTRA );
1761 if (_res == NULL && PyErr_Occurred()) {
1762 p->error_indicator = 1;
1763 D(p->level--);
1764 return NULL;
1765 }
1766 goto done;
1767 }
1768 p->mark = _mark;
1769 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1770 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'"));
1771 }
1772 { // 'continue'
1773 if (p->error_indicator) {
1774 D(p->level--);
1775 return NULL;
1776 }
1777 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'"));
1778 Token * _keyword;
1779 if (
1780 (_keyword = _PyPegen_expect_token(p, 507)) // token='continue'
1781 )
1782 {
1783 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'"));
1784 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
1785 if (_token == NULL) {
1786 D(p->level--);
1787 return NULL;
1788 }
1789 int _end_lineno = _token->end_lineno;
1790 UNUSED(_end_lineno); // Only used by EXTRA macro
1791 int _end_col_offset = _token->end_col_offset;
1792 UNUSED(_end_col_offset); // Only used by EXTRA macro
1793 _res = _Py_Continue ( EXTRA );
1794 if (_res == NULL && PyErr_Occurred()) {
1795 p->error_indicator = 1;
1796 D(p->level--);
1797 return NULL;
1798 }
1799 goto done;
1800 }
1801 p->mark = _mark;
1802 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1803 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'"));
1804 }
1805 { // &'global' global_stmt
1806 if (p->error_indicator) {
1807 D(p->level--);
1808 return NULL;
1809 }
1810 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1811 stmt_ty global_stmt_var;
1812 if (
1813 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global'
1814 &&
1815 (global_stmt_var = global_stmt_rule(p)) // global_stmt
1816 )
1817 {
1818 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
1819 _res = global_stmt_var;
1820 goto done;
1821 }
1822 p->mark = _mark;
1823 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1824 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt"));
1825 }
1826 { // &'nonlocal' nonlocal_stmt
1827 if (p->error_indicator) {
1828 D(p->level--);
1829 return NULL;
1830 }
1831 D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1832 stmt_ty nonlocal_stmt_var;
1833 if (
1834 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal'
1835 &&
1836 (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt
1837 )
1838 {
1839 D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1840 _res = nonlocal_stmt_var;
1841 goto done;
1842 }
1843 p->mark = _mark;
1844 D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1845 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
1846 }
1847 _res = NULL;
1848 done:
1849 _PyPegen_insert_memo(p, _mark, small_stmt_type, _res);
1850 D(p->level--);
1851 return _res;
1852}
1853
1854// compound_stmt:
1855// | &('def' | '@' | ASYNC) function_def
1856// | &'if' if_stmt
1857// | &('class' | '@') class_def
1858// | &('with' | ASYNC) with_stmt
1859// | &('for' | ASYNC) for_stmt
1860// | &'try' try_stmt
1861// | &'while' while_stmt
1862static stmt_ty
1863compound_stmt_rule(Parser *p)
1864{
1865 D(p->level++);
1866 if (p->error_indicator) {
1867 D(p->level--);
1868 return NULL;
1869 }
1870 stmt_ty _res = NULL;
1871 int _mark = p->mark;
1872 { // &('def' | '@' | ASYNC) function_def
1873 if (p->error_indicator) {
1874 D(p->level--);
1875 return NULL;
1876 }
1877 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1878 stmt_ty function_def_var;
1879 if (
1880 _PyPegen_lookahead(1, _tmp_15_rule, p)
1881 &&
1882 (function_def_var = function_def_rule(p)) // function_def
1883 )
1884 {
1885 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1886 _res = function_def_var;
1887 goto done;
1888 }
1889 p->mark = _mark;
1890 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1891 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
1892 }
1893 { // &'if' if_stmt
1894 if (p->error_indicator) {
1895 D(p->level--);
1896 return NULL;
1897 }
1898 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1899 stmt_ty if_stmt_var;
1900 if (
1901 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if'
1902 &&
1903 (if_stmt_var = if_stmt_rule(p)) // if_stmt
1904 )
1905 {
1906 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
1907 _res = if_stmt_var;
1908 goto done;
1909 }
1910 p->mark = _mark;
1911 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1912 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt"));
1913 }
1914 { // &('class' | '@') class_def
1915 if (p->error_indicator) {
1916 D(p->level--);
1917 return NULL;
1918 }
1919 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1920 stmt_ty class_def_var;
1921 if (
1922 _PyPegen_lookahead(1, _tmp_16_rule, p)
1923 &&
1924 (class_def_var = class_def_rule(p)) // class_def
1925 )
1926 {
1927 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
1928 _res = class_def_var;
1929 goto done;
1930 }
1931 p->mark = _mark;
1932 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1933 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def"));
1934 }
1935 { // &('with' | ASYNC) with_stmt
1936 if (p->error_indicator) {
1937 D(p->level--);
1938 return NULL;
1939 }
1940 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1941 stmt_ty with_stmt_var;
1942 if (
1943 _PyPegen_lookahead(1, _tmp_17_rule, p)
1944 &&
1945 (with_stmt_var = with_stmt_rule(p)) // with_stmt
1946 )
1947 {
1948 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1949 _res = with_stmt_var;
1950 goto done;
1951 }
1952 p->mark = _mark;
1953 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1954 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt"));
1955 }
1956 { // &('for' | ASYNC) for_stmt
1957 if (p->error_indicator) {
1958 D(p->level--);
1959 return NULL;
1960 }
1961 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1962 stmt_ty for_stmt_var;
1963 if (
1964 _PyPegen_lookahead(1, _tmp_18_rule, p)
1965 &&
1966 (for_stmt_var = for_stmt_rule(p)) // for_stmt
1967 )
1968 {
1969 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1970 _res = for_stmt_var;
1971 goto done;
1972 }
1973 p->mark = _mark;
1974 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1975 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt"));
1976 }
1977 { // &'try' try_stmt
1978 if (p->error_indicator) {
1979 D(p->level--);
1980 return NULL;
1981 }
1982 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1983 stmt_ty try_stmt_var;
1984 if (
1985 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try'
1986 &&
1987 (try_stmt_var = try_stmt_rule(p)) // try_stmt
1988 )
1989 {
1990 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
1991 _res = try_stmt_var;
1992 goto done;
1993 }
1994 p->mark = _mark;
1995 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
1996 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt"));
1997 }
1998 { // &'while' while_stmt
1999 if (p->error_indicator) {
2000 D(p->level--);
2001 return NULL;
2002 }
2003 D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
2004 stmt_ty while_stmt_var;
2005 if (
2006 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while'
2007 &&
2008 (while_stmt_var = while_stmt_rule(p)) // while_stmt
2009 )
2010 {
2011 D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
2012 _res = while_stmt_var;
2013 goto done;
2014 }
2015 p->mark = _mark;
2016 D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2017 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt"));
2018 }
2019 _res = NULL;
2020 done:
2021 D(p->level--);
2022 return _res;
2023}
2024
2025// assignment:
2026// | NAME ':' expression ['=' annotated_rhs]
2027// | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2028// | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002029// | single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002030// | invalid_assignment
2031static stmt_ty
2032assignment_rule(Parser *p)
2033{
2034 D(p->level++);
2035 if (p->error_indicator) {
2036 D(p->level--);
2037 return NULL;
2038 }
2039 stmt_ty _res = NULL;
2040 int _mark = p->mark;
2041 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2042 p->error_indicator = 1;
2043 D(p->level--);
2044 return NULL;
2045 }
2046 int _start_lineno = p->tokens[_mark]->lineno;
2047 UNUSED(_start_lineno); // Only used by EXTRA macro
2048 int _start_col_offset = p->tokens[_mark]->col_offset;
2049 UNUSED(_start_col_offset); // Only used by EXTRA macro
2050 { // NAME ':' expression ['=' annotated_rhs]
2051 if (p->error_indicator) {
2052 D(p->level--);
2053 return NULL;
2054 }
2055 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2056 Token * _literal;
2057 expr_ty a;
2058 expr_ty b;
2059 void *c;
2060 if (
2061 (a = _PyPegen_name_token(p)) // NAME
2062 &&
2063 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2064 &&
2065 (b = expression_rule(p)) // expression
2066 &&
2067 (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs]
2068 )
2069 {
2070 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2071 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2072 if (_token == NULL) {
2073 D(p->level--);
2074 return NULL;
2075 }
2076 int _end_lineno = _token->end_lineno;
2077 UNUSED(_end_lineno); // Only used by EXTRA macro
2078 int _end_col_offset = _token->end_col_offset;
2079 UNUSED(_end_col_offset); // Only used by EXTRA macro
2080 _res = CHECK_VERSION ( 6 , "Variable annotation syntax is" , _Py_AnnAssign ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
2081 if (_res == NULL && PyErr_Occurred()) {
2082 p->error_indicator = 1;
2083 D(p->level--);
2084 return NULL;
2085 }
2086 goto done;
2087 }
2088 p->mark = _mark;
2089 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2090 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
2091 }
2092 { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
2093 if (p->error_indicator) {
2094 D(p->level--);
2095 return NULL;
2096 }
2097 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2098 Token * _literal;
2099 void *a;
2100 expr_ty b;
2101 void *c;
2102 if (
2103 (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target
2104 &&
2105 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
2106 &&
2107 (b = expression_rule(p)) // expression
2108 &&
2109 (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs]
2110 )
2111 {
2112 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2113 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2114 if (_token == NULL) {
2115 D(p->level--);
2116 return NULL;
2117 }
2118 int _end_lineno = _token->end_lineno;
2119 UNUSED(_end_lineno); // Only used by EXTRA macro
2120 int _end_col_offset = _token->end_col_offset;
2121 UNUSED(_end_col_offset); // Only used by EXTRA macro
2122 _res = CHECK_VERSION ( 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) );
2123 if (_res == NULL && PyErr_Occurred()) {
2124 p->error_indicator = 1;
2125 D(p->level--);
2126 return NULL;
2127 }
2128 goto done;
2129 }
2130 p->mark = _mark;
2131 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2132 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
2133 }
2134 { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
2135 if (p->error_indicator) {
2136 D(p->level--);
2137 return NULL;
2138 }
2139 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01002140 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002141 void *b;
2142 void *tc;
2143 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01002144 (a = (asdl_expr_seq*)_loop1_22_rule(p)) // ((star_targets '='))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002145 &&
2146 (b = _tmp_23_rule(p)) // yield_expr | star_expressions
2147 &&
2148 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
2149 &&
2150 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
2151 )
2152 {
2153 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2154 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2155 if (_token == NULL) {
2156 D(p->level--);
2157 return NULL;
2158 }
2159 int _end_lineno = _token->end_lineno;
2160 UNUSED(_end_lineno); // Only used by EXTRA macro
2161 int _end_col_offset = _token->end_col_offset;
2162 UNUSED(_end_col_offset); // Only used by EXTRA macro
2163 _res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
2164 if (_res == NULL && PyErr_Occurred()) {
2165 p->error_indicator = 1;
2166 D(p->level--);
2167 return NULL;
2168 }
2169 goto done;
2170 }
2171 p->mark = _mark;
2172 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2173 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
2174 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002175 { // single_target augassign ~ (yield_expr | star_expressions)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002176 if (p->error_indicator) {
2177 D(p->level--);
2178 return NULL;
2179 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002180 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2181 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002182 expr_ty a;
2183 AugOperator* b;
2184 void *c;
2185 if (
2186 (a = single_target_rule(p)) // single_target
2187 &&
2188 (b = augassign_rule(p)) // augassign
2189 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002190 (_cut_var = 1)
2191 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002192 (c = _tmp_24_rule(p)) // yield_expr | star_expressions
2193 )
2194 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002195 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 +01002196 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2197 if (_token == NULL) {
2198 D(p->level--);
2199 return NULL;
2200 }
2201 int _end_lineno = _token->end_lineno;
2202 UNUSED(_end_lineno); // Only used by EXTRA macro
2203 int _end_col_offset = _token->end_col_offset;
2204 UNUSED(_end_col_offset); // Only used by EXTRA macro
2205 _res = _Py_AugAssign ( a , b -> kind , c , EXTRA );
2206 if (_res == NULL && PyErr_Occurred()) {
2207 p->error_indicator = 1;
2208 D(p->level--);
2209 return NULL;
2210 }
2211 goto done;
2212 }
2213 p->mark = _mark;
2214 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002215 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
2216 if (_cut_var) {
2217 D(p->level--);
2218 return NULL;
2219 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002220 }
2221 { // invalid_assignment
2222 if (p->error_indicator) {
2223 D(p->level--);
2224 return NULL;
2225 }
2226 D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2227 void *invalid_assignment_var;
2228 if (
2229 (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment
2230 )
2231 {
2232 D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
2233 _res = invalid_assignment_var;
2234 goto done;
2235 }
2236 p->mark = _mark;
2237 D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
2238 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment"));
2239 }
2240 _res = NULL;
2241 done:
2242 D(p->level--);
2243 return _res;
2244}
2245
2246// augassign:
2247// | '+='
2248// | '-='
2249// | '*='
2250// | '@='
2251// | '/='
2252// | '%='
2253// | '&='
2254// | '|='
2255// | '^='
2256// | '<<='
2257// | '>>='
2258// | '**='
2259// | '//='
2260static AugOperator*
2261augassign_rule(Parser *p)
2262{
2263 D(p->level++);
2264 if (p->error_indicator) {
2265 D(p->level--);
2266 return NULL;
2267 }
2268 AugOperator* _res = NULL;
2269 int _mark = p->mark;
2270 { // '+='
2271 if (p->error_indicator) {
2272 D(p->level--);
2273 return NULL;
2274 }
2275 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='"));
2276 Token * _literal;
2277 if (
2278 (_literal = _PyPegen_expect_token(p, 36)) // token='+='
2279 )
2280 {
2281 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='"));
2282 _res = _PyPegen_augoperator ( p , Add );
2283 if (_res == NULL && PyErr_Occurred()) {
2284 p->error_indicator = 1;
2285 D(p->level--);
2286 return NULL;
2287 }
2288 goto done;
2289 }
2290 p->mark = _mark;
2291 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2292 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='"));
2293 }
2294 { // '-='
2295 if (p->error_indicator) {
2296 D(p->level--);
2297 return NULL;
2298 }
2299 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='"));
2300 Token * _literal;
2301 if (
2302 (_literal = _PyPegen_expect_token(p, 37)) // token='-='
2303 )
2304 {
2305 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='"));
2306 _res = _PyPegen_augoperator ( p , Sub );
2307 if (_res == NULL && PyErr_Occurred()) {
2308 p->error_indicator = 1;
2309 D(p->level--);
2310 return NULL;
2311 }
2312 goto done;
2313 }
2314 p->mark = _mark;
2315 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2316 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='"));
2317 }
2318 { // '*='
2319 if (p->error_indicator) {
2320 D(p->level--);
2321 return NULL;
2322 }
2323 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='"));
2324 Token * _literal;
2325 if (
2326 (_literal = _PyPegen_expect_token(p, 38)) // token='*='
2327 )
2328 {
2329 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='"));
2330 _res = _PyPegen_augoperator ( p , Mult );
2331 if (_res == NULL && PyErr_Occurred()) {
2332 p->error_indicator = 1;
2333 D(p->level--);
2334 return NULL;
2335 }
2336 goto done;
2337 }
2338 p->mark = _mark;
2339 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2340 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='"));
2341 }
2342 { // '@='
2343 if (p->error_indicator) {
2344 D(p->level--);
2345 return NULL;
2346 }
2347 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='"));
2348 Token * _literal;
2349 if (
2350 (_literal = _PyPegen_expect_token(p, 50)) // token='@='
2351 )
2352 {
2353 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='"));
2354 _res = CHECK_VERSION ( 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
2355 if (_res == NULL && PyErr_Occurred()) {
2356 p->error_indicator = 1;
2357 D(p->level--);
2358 return NULL;
2359 }
2360 goto done;
2361 }
2362 p->mark = _mark;
2363 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2364 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='"));
2365 }
2366 { // '/='
2367 if (p->error_indicator) {
2368 D(p->level--);
2369 return NULL;
2370 }
2371 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='"));
2372 Token * _literal;
2373 if (
2374 (_literal = _PyPegen_expect_token(p, 39)) // token='/='
2375 )
2376 {
2377 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='"));
2378 _res = _PyPegen_augoperator ( p , Div );
2379 if (_res == NULL && PyErr_Occurred()) {
2380 p->error_indicator = 1;
2381 D(p->level--);
2382 return NULL;
2383 }
2384 goto done;
2385 }
2386 p->mark = _mark;
2387 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2388 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='"));
2389 }
2390 { // '%='
2391 if (p->error_indicator) {
2392 D(p->level--);
2393 return NULL;
2394 }
2395 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='"));
2396 Token * _literal;
2397 if (
2398 (_literal = _PyPegen_expect_token(p, 40)) // token='%='
2399 )
2400 {
2401 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='"));
2402 _res = _PyPegen_augoperator ( p , Mod );
2403 if (_res == NULL && PyErr_Occurred()) {
2404 p->error_indicator = 1;
2405 D(p->level--);
2406 return NULL;
2407 }
2408 goto done;
2409 }
2410 p->mark = _mark;
2411 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2412 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='"));
2413 }
2414 { // '&='
2415 if (p->error_indicator) {
2416 D(p->level--);
2417 return NULL;
2418 }
2419 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='"));
2420 Token * _literal;
2421 if (
2422 (_literal = _PyPegen_expect_token(p, 41)) // token='&='
2423 )
2424 {
2425 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='"));
2426 _res = _PyPegen_augoperator ( p , BitAnd );
2427 if (_res == NULL && PyErr_Occurred()) {
2428 p->error_indicator = 1;
2429 D(p->level--);
2430 return NULL;
2431 }
2432 goto done;
2433 }
2434 p->mark = _mark;
2435 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2436 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='"));
2437 }
2438 { // '|='
2439 if (p->error_indicator) {
2440 D(p->level--);
2441 return NULL;
2442 }
2443 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='"));
2444 Token * _literal;
2445 if (
2446 (_literal = _PyPegen_expect_token(p, 42)) // token='|='
2447 )
2448 {
2449 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='"));
2450 _res = _PyPegen_augoperator ( p , BitOr );
2451 if (_res == NULL && PyErr_Occurred()) {
2452 p->error_indicator = 1;
2453 D(p->level--);
2454 return NULL;
2455 }
2456 goto done;
2457 }
2458 p->mark = _mark;
2459 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2460 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='"));
2461 }
2462 { // '^='
2463 if (p->error_indicator) {
2464 D(p->level--);
2465 return NULL;
2466 }
2467 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='"));
2468 Token * _literal;
2469 if (
2470 (_literal = _PyPegen_expect_token(p, 43)) // token='^='
2471 )
2472 {
2473 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='"));
2474 _res = _PyPegen_augoperator ( p , BitXor );
2475 if (_res == NULL && PyErr_Occurred()) {
2476 p->error_indicator = 1;
2477 D(p->level--);
2478 return NULL;
2479 }
2480 goto done;
2481 }
2482 p->mark = _mark;
2483 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2484 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='"));
2485 }
2486 { // '<<='
2487 if (p->error_indicator) {
2488 D(p->level--);
2489 return NULL;
2490 }
2491 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='"));
2492 Token * _literal;
2493 if (
2494 (_literal = _PyPegen_expect_token(p, 44)) // token='<<='
2495 )
2496 {
2497 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='"));
2498 _res = _PyPegen_augoperator ( p , LShift );
2499 if (_res == NULL && PyErr_Occurred()) {
2500 p->error_indicator = 1;
2501 D(p->level--);
2502 return NULL;
2503 }
2504 goto done;
2505 }
2506 p->mark = _mark;
2507 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2508 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='"));
2509 }
2510 { // '>>='
2511 if (p->error_indicator) {
2512 D(p->level--);
2513 return NULL;
2514 }
2515 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='"));
2516 Token * _literal;
2517 if (
2518 (_literal = _PyPegen_expect_token(p, 45)) // token='>>='
2519 )
2520 {
2521 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='"));
2522 _res = _PyPegen_augoperator ( p , RShift );
2523 if (_res == NULL && PyErr_Occurred()) {
2524 p->error_indicator = 1;
2525 D(p->level--);
2526 return NULL;
2527 }
2528 goto done;
2529 }
2530 p->mark = _mark;
2531 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2532 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='"));
2533 }
2534 { // '**='
2535 if (p->error_indicator) {
2536 D(p->level--);
2537 return NULL;
2538 }
2539 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='"));
2540 Token * _literal;
2541 if (
2542 (_literal = _PyPegen_expect_token(p, 46)) // token='**='
2543 )
2544 {
2545 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='"));
2546 _res = _PyPegen_augoperator ( p , Pow );
2547 if (_res == NULL && PyErr_Occurred()) {
2548 p->error_indicator = 1;
2549 D(p->level--);
2550 return NULL;
2551 }
2552 goto done;
2553 }
2554 p->mark = _mark;
2555 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2556 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='"));
2557 }
2558 { // '//='
2559 if (p->error_indicator) {
2560 D(p->level--);
2561 return NULL;
2562 }
2563 D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='"));
2564 Token * _literal;
2565 if (
2566 (_literal = _PyPegen_expect_token(p, 48)) // token='//='
2567 )
2568 {
2569 D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='"));
2570 _res = _PyPegen_augoperator ( p , FloorDiv );
2571 if (_res == NULL && PyErr_Occurred()) {
2572 p->error_indicator = 1;
2573 D(p->level--);
2574 return NULL;
2575 }
2576 goto done;
2577 }
2578 p->mark = _mark;
2579 D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
2580 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='"));
2581 }
2582 _res = NULL;
2583 done:
2584 D(p->level--);
2585 return _res;
2586}
2587
2588// global_stmt: 'global' ','.NAME+
2589static stmt_ty
2590global_stmt_rule(Parser *p)
2591{
2592 D(p->level++);
2593 if (p->error_indicator) {
2594 D(p->level--);
2595 return NULL;
2596 }
2597 stmt_ty _res = NULL;
2598 int _mark = p->mark;
2599 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2600 p->error_indicator = 1;
2601 D(p->level--);
2602 return NULL;
2603 }
2604 int _start_lineno = p->tokens[_mark]->lineno;
2605 UNUSED(_start_lineno); // Only used by EXTRA macro
2606 int _start_col_offset = p->tokens[_mark]->col_offset;
2607 UNUSED(_start_col_offset); // Only used by EXTRA macro
2608 { // 'global' ','.NAME+
2609 if (p->error_indicator) {
2610 D(p->level--);
2611 return NULL;
2612 }
2613 D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2614 Token * _keyword;
Pablo Galindoa5634c42020-09-16 19:42:00 +01002615 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002616 if (
2617 (_keyword = _PyPegen_expect_token(p, 508)) // token='global'
2618 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01002619 (a = (asdl_expr_seq*)_gather_25_rule(p)) // ','.NAME+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002620 )
2621 {
2622 D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
2623 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2624 if (_token == NULL) {
2625 D(p->level--);
2626 return NULL;
2627 }
2628 int _end_lineno = _token->end_lineno;
2629 UNUSED(_end_lineno); // Only used by EXTRA macro
2630 int _end_col_offset = _token->end_col_offset;
2631 UNUSED(_end_col_offset); // Only used by EXTRA macro
2632 _res = _Py_Global ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
2633 if (_res == NULL && PyErr_Occurred()) {
2634 p->error_indicator = 1;
2635 D(p->level--);
2636 return NULL;
2637 }
2638 goto done;
2639 }
2640 p->mark = _mark;
2641 D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2642 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
2643 }
2644 _res = NULL;
2645 done:
2646 D(p->level--);
2647 return _res;
2648}
2649
2650// nonlocal_stmt: 'nonlocal' ','.NAME+
2651static stmt_ty
2652nonlocal_stmt_rule(Parser *p)
2653{
2654 D(p->level++);
2655 if (p->error_indicator) {
2656 D(p->level--);
2657 return NULL;
2658 }
2659 stmt_ty _res = NULL;
2660 int _mark = p->mark;
2661 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2662 p->error_indicator = 1;
2663 D(p->level--);
2664 return NULL;
2665 }
2666 int _start_lineno = p->tokens[_mark]->lineno;
2667 UNUSED(_start_lineno); // Only used by EXTRA macro
2668 int _start_col_offset = p->tokens[_mark]->col_offset;
2669 UNUSED(_start_col_offset); // Only used by EXTRA macro
2670 { // 'nonlocal' ','.NAME+
2671 if (p->error_indicator) {
2672 D(p->level--);
2673 return NULL;
2674 }
2675 D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2676 Token * _keyword;
Pablo Galindoa5634c42020-09-16 19:42:00 +01002677 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002678 if (
2679 (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal'
2680 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01002681 (a = (asdl_expr_seq*)_gather_27_rule(p)) // ','.NAME+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002682 )
2683 {
2684 D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
2685 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2686 if (_token == NULL) {
2687 D(p->level--);
2688 return NULL;
2689 }
2690 int _end_lineno = _token->end_lineno;
2691 UNUSED(_end_lineno); // Only used by EXTRA macro
2692 int _end_col_offset = _token->end_col_offset;
2693 UNUSED(_end_col_offset); // Only used by EXTRA macro
2694 _res = _Py_Nonlocal ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
2695 if (_res == NULL && PyErr_Occurred()) {
2696 p->error_indicator = 1;
2697 D(p->level--);
2698 return NULL;
2699 }
2700 goto done;
2701 }
2702 p->mark = _mark;
2703 D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2704 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
2705 }
2706 _res = NULL;
2707 done:
2708 D(p->level--);
2709 return _res;
2710}
2711
2712// yield_stmt: yield_expr
2713static stmt_ty
2714yield_stmt_rule(Parser *p)
2715{
2716 D(p->level++);
2717 if (p->error_indicator) {
2718 D(p->level--);
2719 return NULL;
2720 }
2721 stmt_ty _res = NULL;
2722 int _mark = p->mark;
2723 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2724 p->error_indicator = 1;
2725 D(p->level--);
2726 return NULL;
2727 }
2728 int _start_lineno = p->tokens[_mark]->lineno;
2729 UNUSED(_start_lineno); // Only used by EXTRA macro
2730 int _start_col_offset = p->tokens[_mark]->col_offset;
2731 UNUSED(_start_col_offset); // Only used by EXTRA macro
2732 { // yield_expr
2733 if (p->error_indicator) {
2734 D(p->level--);
2735 return NULL;
2736 }
2737 D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2738 expr_ty y;
2739 if (
2740 (y = yield_expr_rule(p)) // yield_expr
2741 )
2742 {
2743 D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
2744 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2745 if (_token == NULL) {
2746 D(p->level--);
2747 return NULL;
2748 }
2749 int _end_lineno = _token->end_lineno;
2750 UNUSED(_end_lineno); // Only used by EXTRA macro
2751 int _end_col_offset = _token->end_col_offset;
2752 UNUSED(_end_col_offset); // Only used by EXTRA macro
2753 _res = _Py_Expr ( y , EXTRA );
2754 if (_res == NULL && PyErr_Occurred()) {
2755 p->error_indicator = 1;
2756 D(p->level--);
2757 return NULL;
2758 }
2759 goto done;
2760 }
2761 p->mark = _mark;
2762 D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2763 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
2764 }
2765 _res = NULL;
2766 done:
2767 D(p->level--);
2768 return _res;
2769}
2770
2771// assert_stmt: 'assert' expression [',' expression]
2772static stmt_ty
2773assert_stmt_rule(Parser *p)
2774{
2775 D(p->level++);
2776 if (p->error_indicator) {
2777 D(p->level--);
2778 return NULL;
2779 }
2780 stmt_ty _res = NULL;
2781 int _mark = p->mark;
2782 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2783 p->error_indicator = 1;
2784 D(p->level--);
2785 return NULL;
2786 }
2787 int _start_lineno = p->tokens[_mark]->lineno;
2788 UNUSED(_start_lineno); // Only used by EXTRA macro
2789 int _start_col_offset = p->tokens[_mark]->col_offset;
2790 UNUSED(_start_col_offset); // Only used by EXTRA macro
2791 { // 'assert' expression [',' expression]
2792 if (p->error_indicator) {
2793 D(p->level--);
2794 return NULL;
2795 }
2796 D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2797 Token * _keyword;
2798 expr_ty a;
2799 void *b;
2800 if (
2801 (_keyword = _PyPegen_expect_token(p, 505)) // token='assert'
2802 &&
2803 (a = expression_rule(p)) // expression
2804 &&
2805 (b = _tmp_29_rule(p), 1) // [',' expression]
2806 )
2807 {
2808 D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
2809 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2810 if (_token == NULL) {
2811 D(p->level--);
2812 return NULL;
2813 }
2814 int _end_lineno = _token->end_lineno;
2815 UNUSED(_end_lineno); // Only used by EXTRA macro
2816 int _end_col_offset = _token->end_col_offset;
2817 UNUSED(_end_col_offset); // Only used by EXTRA macro
2818 _res = _Py_Assert ( a , b , EXTRA );
2819 if (_res == NULL && PyErr_Occurred()) {
2820 p->error_indicator = 1;
2821 D(p->level--);
2822 return NULL;
2823 }
2824 goto done;
2825 }
2826 p->mark = _mark;
2827 D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2828 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
2829 }
2830 _res = NULL;
2831 done:
2832 D(p->level--);
2833 return _res;
2834}
2835
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002836// del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002837static stmt_ty
2838del_stmt_rule(Parser *p)
2839{
2840 D(p->level++);
2841 if (p->error_indicator) {
2842 D(p->level--);
2843 return NULL;
2844 }
2845 stmt_ty _res = NULL;
2846 int _mark = p->mark;
2847 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2848 p->error_indicator = 1;
2849 D(p->level--);
2850 return NULL;
2851 }
2852 int _start_lineno = p->tokens[_mark]->lineno;
2853 UNUSED(_start_lineno); // Only used by EXTRA macro
2854 int _start_col_offset = p->tokens[_mark]->col_offset;
2855 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002856 { // 'del' del_targets &(';' | NEWLINE)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002857 if (p->error_indicator) {
2858 D(p->level--);
2859 return NULL;
2860 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002861 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 +01002862 Token * _keyword;
Pablo Galindoa5634c42020-09-16 19:42:00 +01002863 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002864 if (
2865 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
2866 &&
2867 (a = del_targets_rule(p)) // del_targets
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002868 &&
2869 _PyPegen_lookahead(1, _tmp_30_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002870 )
2871 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002872 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 +01002873 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
2874 if (_token == NULL) {
2875 D(p->level--);
2876 return NULL;
2877 }
2878 int _end_lineno = _token->end_lineno;
2879 UNUSED(_end_lineno); // Only used by EXTRA macro
2880 int _end_col_offset = _token->end_col_offset;
2881 UNUSED(_end_col_offset); // Only used by EXTRA macro
2882 _res = _Py_Delete ( a , EXTRA );
2883 if (_res == NULL && PyErr_Occurred()) {
2884 p->error_indicator = 1;
2885 D(p->level--);
2886 return NULL;
2887 }
2888 goto done;
2889 }
2890 p->mark = _mark;
2891 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002892 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
2893 }
2894 { // invalid_del_stmt
2895 if (p->error_indicator) {
2896 D(p->level--);
2897 return NULL;
2898 }
2899 D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2900 void *invalid_del_stmt_var;
2901 if (
2902 (invalid_del_stmt_var = invalid_del_stmt_rule(p)) // invalid_del_stmt
2903 )
2904 {
2905 D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
2906 _res = invalid_del_stmt_var;
2907 goto done;
2908 }
2909 p->mark = _mark;
2910 D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2911 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002912 }
2913 _res = NULL;
2914 done:
2915 D(p->level--);
2916 return _res;
2917}
2918
2919// import_stmt: import_name | import_from
2920static stmt_ty
2921import_stmt_rule(Parser *p)
2922{
2923 D(p->level++);
2924 if (p->error_indicator) {
2925 D(p->level--);
2926 return NULL;
2927 }
2928 stmt_ty _res = NULL;
2929 int _mark = p->mark;
2930 { // import_name
2931 if (p->error_indicator) {
2932 D(p->level--);
2933 return NULL;
2934 }
2935 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name"));
2936 stmt_ty import_name_var;
2937 if (
2938 (import_name_var = import_name_rule(p)) // import_name
2939 )
2940 {
2941 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name"));
2942 _res = import_name_var;
2943 goto done;
2944 }
2945 p->mark = _mark;
2946 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2947 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name"));
2948 }
2949 { // import_from
2950 if (p->error_indicator) {
2951 D(p->level--);
2952 return NULL;
2953 }
2954 D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from"));
2955 stmt_ty import_from_var;
2956 if (
2957 (import_from_var = import_from_rule(p)) // import_from
2958 )
2959 {
2960 D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from"));
2961 _res = import_from_var;
2962 goto done;
2963 }
2964 p->mark = _mark;
2965 D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
2966 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from"));
2967 }
2968 _res = NULL;
2969 done:
2970 D(p->level--);
2971 return _res;
2972}
2973
2974// import_name: 'import' dotted_as_names
2975static stmt_ty
2976import_name_rule(Parser *p)
2977{
2978 D(p->level++);
2979 if (p->error_indicator) {
2980 D(p->level--);
2981 return NULL;
2982 }
2983 stmt_ty _res = NULL;
2984 int _mark = p->mark;
2985 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
2986 p->error_indicator = 1;
2987 D(p->level--);
2988 return NULL;
2989 }
2990 int _start_lineno = p->tokens[_mark]->lineno;
2991 UNUSED(_start_lineno); // Only used by EXTRA macro
2992 int _start_col_offset = p->tokens[_mark]->col_offset;
2993 UNUSED(_start_col_offset); // Only used by EXTRA macro
2994 { // 'import' dotted_as_names
2995 if (p->error_indicator) {
2996 D(p->level--);
2997 return NULL;
2998 }
2999 D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
3000 Token * _keyword;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003001 asdl_alias_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003002 if (
3003 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
3004 &&
3005 (a = dotted_as_names_rule(p)) // dotted_as_names
3006 )
3007 {
3008 D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
3009 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3010 if (_token == NULL) {
3011 D(p->level--);
3012 return NULL;
3013 }
3014 int _end_lineno = _token->end_lineno;
3015 UNUSED(_end_lineno); // Only used by EXTRA macro
3016 int _end_col_offset = _token->end_col_offset;
3017 UNUSED(_end_col_offset); // Only used by EXTRA macro
3018 _res = _Py_Import ( a , EXTRA );
3019 if (_res == NULL && PyErr_Occurred()) {
3020 p->error_indicator = 1;
3021 D(p->level--);
3022 return NULL;
3023 }
3024 goto done;
3025 }
3026 p->mark = _mark;
3027 D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ',
3028 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names"));
3029 }
3030 _res = NULL;
3031 done:
3032 D(p->level--);
3033 return _res;
3034}
3035
3036// import_from:
3037// | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3038// | 'from' (('.' | '...'))+ 'import' import_from_targets
3039static stmt_ty
3040import_from_rule(Parser *p)
3041{
3042 D(p->level++);
3043 if (p->error_indicator) {
3044 D(p->level--);
3045 return NULL;
3046 }
3047 stmt_ty _res = NULL;
3048 int _mark = p->mark;
3049 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3050 p->error_indicator = 1;
3051 D(p->level--);
3052 return NULL;
3053 }
3054 int _start_lineno = p->tokens[_mark]->lineno;
3055 UNUSED(_start_lineno); // Only used by EXTRA macro
3056 int _start_col_offset = p->tokens[_mark]->col_offset;
3057 UNUSED(_start_col_offset); // Only used by EXTRA macro
3058 { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
3059 if (p->error_indicator) {
3060 D(p->level--);
3061 return NULL;
3062 }
3063 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3064 Token * _keyword;
3065 Token * _keyword_1;
3066 asdl_seq * a;
3067 expr_ty b;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003068 asdl_alias_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003069 if (
3070 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3071 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003072 (a = _loop0_31_rule(p)) // (('.' | '...'))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003073 &&
3074 (b = dotted_name_rule(p)) // dotted_name
3075 &&
3076 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3077 &&
3078 (c = import_from_targets_rule(p)) // import_from_targets
3079 )
3080 {
3081 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3082 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3083 if (_token == NULL) {
3084 D(p->level--);
3085 return NULL;
3086 }
3087 int _end_lineno = _token->end_lineno;
3088 UNUSED(_end_lineno); // Only used by EXTRA macro
3089 int _end_col_offset = _token->end_col_offset;
3090 UNUSED(_end_col_offset); // Only used by EXTRA macro
3091 _res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
3092 if (_res == NULL && PyErr_Occurred()) {
3093 p->error_indicator = 1;
3094 D(p->level--);
3095 return NULL;
3096 }
3097 goto done;
3098 }
3099 p->mark = _mark;
3100 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3101 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
3102 }
3103 { // 'from' (('.' | '...'))+ 'import' import_from_targets
3104 if (p->error_indicator) {
3105 D(p->level--);
3106 return NULL;
3107 }
3108 D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3109 Token * _keyword;
3110 Token * _keyword_1;
3111 asdl_seq * a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003112 asdl_alias_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003113 if (
3114 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
3115 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003116 (a = _loop1_32_rule(p)) // (('.' | '...'))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003117 &&
3118 (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
3119 &&
3120 (b = import_from_targets_rule(p)) // import_from_targets
3121 )
3122 {
3123 D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3124 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3125 if (_token == NULL) {
3126 D(p->level--);
3127 return NULL;
3128 }
3129 int _end_lineno = _token->end_lineno;
3130 UNUSED(_end_lineno); // Only used by EXTRA macro
3131 int _end_col_offset = _token->end_col_offset;
3132 UNUSED(_end_col_offset); // Only used by EXTRA macro
3133 _res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
3134 if (_res == NULL && PyErr_Occurred()) {
3135 p->error_indicator = 1;
3136 D(p->level--);
3137 return NULL;
3138 }
3139 goto done;
3140 }
3141 p->mark = _mark;
3142 D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
3143 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
3144 }
3145 _res = NULL;
3146 done:
3147 D(p->level--);
3148 return _res;
3149}
3150
3151// import_from_targets:
3152// | '(' import_from_as_names ','? ')'
3153// | import_from_as_names !','
3154// | '*'
3155// | invalid_import_from_targets
Pablo Galindoa5634c42020-09-16 19:42:00 +01003156static asdl_alias_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003157import_from_targets_rule(Parser *p)
3158{
3159 D(p->level++);
3160 if (p->error_indicator) {
3161 D(p->level--);
3162 return NULL;
3163 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01003164 asdl_alias_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003165 int _mark = p->mark;
3166 { // '(' import_from_as_names ','? ')'
3167 if (p->error_indicator) {
3168 D(p->level--);
3169 return NULL;
3170 }
3171 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3172 Token * _literal;
3173 Token * _literal_1;
3174 void *_opt_var;
3175 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01003176 asdl_alias_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003177 if (
3178 (_literal = _PyPegen_expect_token(p, 7)) // token='('
3179 &&
3180 (a = import_from_as_names_rule(p)) // import_from_as_names
3181 &&
3182 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
3183 &&
3184 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
3185 )
3186 {
3187 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3188 _res = a;
3189 if (_res == NULL && PyErr_Occurred()) {
3190 p->error_indicator = 1;
3191 D(p->level--);
3192 return NULL;
3193 }
3194 goto done;
3195 }
3196 p->mark = _mark;
3197 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3198 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'"));
3199 }
3200 { // import_from_as_names !','
3201 if (p->error_indicator) {
3202 D(p->level--);
3203 return NULL;
3204 }
3205 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01003206 asdl_alias_seq* import_from_as_names_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003207 if (
3208 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
3209 &&
3210 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
3211 )
3212 {
3213 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
3214 _res = import_from_as_names_var;
3215 goto done;
3216 }
3217 p->mark = _mark;
3218 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3219 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','"));
3220 }
3221 { // '*'
3222 if (p->error_indicator) {
3223 D(p->level--);
3224 return NULL;
3225 }
3226 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
3227 Token * _literal;
3228 if (
3229 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
3230 )
3231 {
3232 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01003233 _res = ( asdl_alias_seq * ) _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003234 if (_res == NULL && PyErr_Occurred()) {
3235 p->error_indicator = 1;
3236 D(p->level--);
3237 return NULL;
3238 }
3239 goto done;
3240 }
3241 p->mark = _mark;
3242 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3243 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
3244 }
3245 { // invalid_import_from_targets
3246 if (p->error_indicator) {
3247 D(p->level--);
3248 return NULL;
3249 }
3250 D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3251 void *invalid_import_from_targets_var;
3252 if (
3253 (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets
3254 )
3255 {
3256 D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
3257 _res = invalid_import_from_targets_var;
3258 goto done;
3259 }
3260 p->mark = _mark;
3261 D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
3262 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets"));
3263 }
3264 _res = NULL;
3265 done:
3266 D(p->level--);
3267 return _res;
3268}
3269
3270// import_from_as_names: ','.import_from_as_name+
Pablo Galindoa5634c42020-09-16 19:42:00 +01003271static asdl_alias_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003272import_from_as_names_rule(Parser *p)
3273{
3274 D(p->level++);
3275 if (p->error_indicator) {
3276 D(p->level--);
3277 return NULL;
3278 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01003279 asdl_alias_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003280 int _mark = p->mark;
3281 { // ','.import_from_as_name+
3282 if (p->error_indicator) {
3283 D(p->level--);
3284 return NULL;
3285 }
3286 D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01003287 asdl_alias_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003288 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01003289 (a = (asdl_alias_seq*)_gather_33_rule(p)) // ','.import_from_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003290 )
3291 {
3292 D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
3293 _res = a;
3294 if (_res == NULL && PyErr_Occurred()) {
3295 p->error_indicator = 1;
3296 D(p->level--);
3297 return NULL;
3298 }
3299 goto done;
3300 }
3301 p->mark = _mark;
3302 D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3303 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+"));
3304 }
3305 _res = NULL;
3306 done:
3307 D(p->level--);
3308 return _res;
3309}
3310
3311// import_from_as_name: NAME ['as' NAME]
3312static alias_ty
3313import_from_as_name_rule(Parser *p)
3314{
3315 D(p->level++);
3316 if (p->error_indicator) {
3317 D(p->level--);
3318 return NULL;
3319 }
3320 alias_ty _res = NULL;
3321 int _mark = p->mark;
3322 { // NAME ['as' NAME]
3323 if (p->error_indicator) {
3324 D(p->level--);
3325 return NULL;
3326 }
3327 D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3328 expr_ty a;
3329 void *b;
3330 if (
3331 (a = _PyPegen_name_token(p)) // NAME
3332 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003333 (b = _tmp_35_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003334 )
3335 {
3336 D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
3337 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3338 if (_res == NULL && PyErr_Occurred()) {
3339 p->error_indicator = 1;
3340 D(p->level--);
3341 return NULL;
3342 }
3343 goto done;
3344 }
3345 p->mark = _mark;
3346 D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3347 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]"));
3348 }
3349 _res = NULL;
3350 done:
3351 D(p->level--);
3352 return _res;
3353}
3354
3355// dotted_as_names: ','.dotted_as_name+
Pablo Galindoa5634c42020-09-16 19:42:00 +01003356static asdl_alias_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003357dotted_as_names_rule(Parser *p)
3358{
3359 D(p->level++);
3360 if (p->error_indicator) {
3361 D(p->level--);
3362 return NULL;
3363 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01003364 asdl_alias_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003365 int _mark = p->mark;
3366 { // ','.dotted_as_name+
3367 if (p->error_indicator) {
3368 D(p->level--);
3369 return NULL;
3370 }
3371 D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01003372 asdl_alias_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003373 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01003374 (a = (asdl_alias_seq*)_gather_36_rule(p)) // ','.dotted_as_name+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003375 )
3376 {
3377 D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
3378 _res = a;
3379 if (_res == NULL && PyErr_Occurred()) {
3380 p->error_indicator = 1;
3381 D(p->level--);
3382 return NULL;
3383 }
3384 goto done;
3385 }
3386 p->mark = _mark;
3387 D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ',
3388 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+"));
3389 }
3390 _res = NULL;
3391 done:
3392 D(p->level--);
3393 return _res;
3394}
3395
3396// dotted_as_name: dotted_name ['as' NAME]
3397static alias_ty
3398dotted_as_name_rule(Parser *p)
3399{
3400 D(p->level++);
3401 if (p->error_indicator) {
3402 D(p->level--);
3403 return NULL;
3404 }
3405 alias_ty _res = NULL;
3406 int _mark = p->mark;
3407 { // dotted_name ['as' NAME]
3408 if (p->error_indicator) {
3409 D(p->level--);
3410 return NULL;
3411 }
3412 D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3413 expr_ty a;
3414 void *b;
3415 if (
3416 (a = dotted_name_rule(p)) // dotted_name
3417 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003418 (b = _tmp_38_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003419 )
3420 {
3421 D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
3422 _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
3423 if (_res == NULL && PyErr_Occurred()) {
3424 p->error_indicator = 1;
3425 D(p->level--);
3426 return NULL;
3427 }
3428 goto done;
3429 }
3430 p->mark = _mark;
3431 D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ',
3432 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]"));
3433 }
3434 _res = NULL;
3435 done:
3436 D(p->level--);
3437 return _res;
3438}
3439
3440// Left-recursive
3441// dotted_name: dotted_name '.' NAME | NAME
3442static expr_ty dotted_name_raw(Parser *);
3443static expr_ty
3444dotted_name_rule(Parser *p)
3445{
3446 D(p->level++);
3447 expr_ty _res = NULL;
3448 if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) {
3449 D(p->level--);
3450 return _res;
3451 }
3452 int _mark = p->mark;
3453 int _resmark = p->mark;
3454 while (1) {
3455 int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res);
3456 if (tmpvar_0) {
3457 D(p->level--);
3458 return _res;
3459 }
3460 p->mark = _mark;
3461 void *_raw = dotted_name_raw(p);
3462 if (_raw == NULL || p->mark <= _resmark)
3463 break;
3464 _resmark = p->mark;
3465 _res = _raw;
3466 }
3467 p->mark = _resmark;
3468 D(p->level--);
3469 return _res;
3470}
3471static expr_ty
3472dotted_name_raw(Parser *p)
3473{
3474 D(p->level++);
3475 if (p->error_indicator) {
3476 D(p->level--);
3477 return NULL;
3478 }
3479 expr_ty _res = NULL;
3480 int _mark = p->mark;
3481 { // dotted_name '.' NAME
3482 if (p->error_indicator) {
3483 D(p->level--);
3484 return NULL;
3485 }
3486 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3487 Token * _literal;
3488 expr_ty a;
3489 expr_ty b;
3490 if (
3491 (a = dotted_name_rule(p)) // dotted_name
3492 &&
3493 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
3494 &&
3495 (b = _PyPegen_name_token(p)) // NAME
3496 )
3497 {
3498 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
3499 _res = _PyPegen_join_names_with_dot ( p , a , b );
3500 if (_res == NULL && PyErr_Occurred()) {
3501 p->error_indicator = 1;
3502 D(p->level--);
3503 return NULL;
3504 }
3505 goto done;
3506 }
3507 p->mark = _mark;
3508 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3509 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME"));
3510 }
3511 { // NAME
3512 if (p->error_indicator) {
3513 D(p->level--);
3514 return NULL;
3515 }
3516 D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
3517 expr_ty name_var;
3518 if (
3519 (name_var = _PyPegen_name_token(p)) // NAME
3520 )
3521 {
3522 D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
3523 _res = name_var;
3524 goto done;
3525 }
3526 p->mark = _mark;
3527 D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
3528 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
3529 }
3530 _res = NULL;
3531 done:
3532 D(p->level--);
3533 return _res;
3534}
3535
3536// if_stmt:
3537// | 'if' named_expression ':' block elif_stmt
3538// | 'if' named_expression ':' block else_block?
3539static stmt_ty
3540if_stmt_rule(Parser *p)
3541{
3542 D(p->level++);
3543 if (p->error_indicator) {
3544 D(p->level--);
3545 return NULL;
3546 }
3547 stmt_ty _res = NULL;
3548 int _mark = p->mark;
3549 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3550 p->error_indicator = 1;
3551 D(p->level--);
3552 return NULL;
3553 }
3554 int _start_lineno = p->tokens[_mark]->lineno;
3555 UNUSED(_start_lineno); // Only used by EXTRA macro
3556 int _start_col_offset = p->tokens[_mark]->col_offset;
3557 UNUSED(_start_col_offset); // Only used by EXTRA macro
3558 { // 'if' named_expression ':' block elif_stmt
3559 if (p->error_indicator) {
3560 D(p->level--);
3561 return NULL;
3562 }
3563 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3564 Token * _keyword;
3565 Token * _literal;
3566 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003567 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003568 stmt_ty c;
3569 if (
3570 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3571 &&
3572 (a = named_expression_rule(p)) // named_expression
3573 &&
3574 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3575 &&
3576 (b = block_rule(p)) // block
3577 &&
3578 (c = elif_stmt_rule(p)) // elif_stmt
3579 )
3580 {
3581 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3582 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3583 if (_token == NULL) {
3584 D(p->level--);
3585 return NULL;
3586 }
3587 int _end_lineno = _token->end_lineno;
3588 UNUSED(_end_lineno); // Only used by EXTRA macro
3589 int _end_col_offset = _token->end_col_offset;
3590 UNUSED(_end_col_offset); // Only used by EXTRA macro
Pablo Galindoa5634c42020-09-16 19:42:00 +01003591 _res = _Py_If ( a , b , CHECK ( ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003592 if (_res == NULL && PyErr_Occurred()) {
3593 p->error_indicator = 1;
3594 D(p->level--);
3595 return NULL;
3596 }
3597 goto done;
3598 }
3599 p->mark = _mark;
3600 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3601 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
3602 }
3603 { // 'if' named_expression ':' block else_block?
3604 if (p->error_indicator) {
3605 D(p->level--);
3606 return NULL;
3607 }
3608 D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3609 Token * _keyword;
3610 Token * _literal;
3611 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003612 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003613 void *c;
3614 if (
3615 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
3616 &&
3617 (a = named_expression_rule(p)) // named_expression
3618 &&
3619 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3620 &&
3621 (b = block_rule(p)) // block
3622 &&
3623 (c = else_block_rule(p), 1) // else_block?
3624 )
3625 {
3626 D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
3627 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3628 if (_token == NULL) {
3629 D(p->level--);
3630 return NULL;
3631 }
3632 int _end_lineno = _token->end_lineno;
3633 UNUSED(_end_lineno); // Only used by EXTRA macro
3634 int _end_col_offset = _token->end_col_offset;
3635 UNUSED(_end_col_offset); // Only used by EXTRA macro
3636 _res = _Py_If ( a , b , c , EXTRA );
3637 if (_res == NULL && PyErr_Occurred()) {
3638 p->error_indicator = 1;
3639 D(p->level--);
3640 return NULL;
3641 }
3642 goto done;
3643 }
3644 p->mark = _mark;
3645 D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3646 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?"));
3647 }
3648 _res = NULL;
3649 done:
3650 D(p->level--);
3651 return _res;
3652}
3653
3654// elif_stmt:
3655// | 'elif' named_expression ':' block elif_stmt
3656// | 'elif' named_expression ':' block else_block?
3657static stmt_ty
3658elif_stmt_rule(Parser *p)
3659{
3660 D(p->level++);
3661 if (p->error_indicator) {
3662 D(p->level--);
3663 return NULL;
3664 }
3665 stmt_ty _res = NULL;
3666 int _mark = p->mark;
3667 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3668 p->error_indicator = 1;
3669 D(p->level--);
3670 return NULL;
3671 }
3672 int _start_lineno = p->tokens[_mark]->lineno;
3673 UNUSED(_start_lineno); // Only used by EXTRA macro
3674 int _start_col_offset = p->tokens[_mark]->col_offset;
3675 UNUSED(_start_col_offset); // Only used by EXTRA macro
3676 { // 'elif' named_expression ':' block elif_stmt
3677 if (p->error_indicator) {
3678 D(p->level--);
3679 return NULL;
3680 }
3681 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3682 Token * _keyword;
3683 Token * _literal;
3684 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003685 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003686 stmt_ty c;
3687 if (
3688 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3689 &&
3690 (a = named_expression_rule(p)) // named_expression
3691 &&
3692 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3693 &&
3694 (b = block_rule(p)) // block
3695 &&
3696 (c = elif_stmt_rule(p)) // elif_stmt
3697 )
3698 {
3699 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3700 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3701 if (_token == NULL) {
3702 D(p->level--);
3703 return NULL;
3704 }
3705 int _end_lineno = _token->end_lineno;
3706 UNUSED(_end_lineno); // Only used by EXTRA macro
3707 int _end_col_offset = _token->end_col_offset;
3708 UNUSED(_end_col_offset); // Only used by EXTRA macro
3709 _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
3710 if (_res == NULL && PyErr_Occurred()) {
3711 p->error_indicator = 1;
3712 D(p->level--);
3713 return NULL;
3714 }
3715 goto done;
3716 }
3717 p->mark = _mark;
3718 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3719 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
3720 }
3721 { // 'elif' named_expression ':' block else_block?
3722 if (p->error_indicator) {
3723 D(p->level--);
3724 return NULL;
3725 }
3726 D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3727 Token * _keyword;
3728 Token * _literal;
3729 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003730 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003731 void *c;
3732 if (
3733 (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
3734 &&
3735 (a = named_expression_rule(p)) // named_expression
3736 &&
3737 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3738 &&
3739 (b = block_rule(p)) // block
3740 &&
3741 (c = else_block_rule(p), 1) // else_block?
3742 )
3743 {
3744 D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3745 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3746 if (_token == NULL) {
3747 D(p->level--);
3748 return NULL;
3749 }
3750 int _end_lineno = _token->end_lineno;
3751 UNUSED(_end_lineno); // Only used by EXTRA macro
3752 int _end_col_offset = _token->end_col_offset;
3753 UNUSED(_end_col_offset); // Only used by EXTRA macro
3754 _res = _Py_If ( a , b , c , EXTRA );
3755 if (_res == NULL && PyErr_Occurred()) {
3756 p->error_indicator = 1;
3757 D(p->level--);
3758 return NULL;
3759 }
3760 goto done;
3761 }
3762 p->mark = _mark;
3763 D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3764 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?"));
3765 }
3766 _res = NULL;
3767 done:
3768 D(p->level--);
3769 return _res;
3770}
3771
3772// else_block: 'else' ':' block
Pablo Galindoa5634c42020-09-16 19:42:00 +01003773static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003774else_block_rule(Parser *p)
3775{
3776 D(p->level++);
3777 if (p->error_indicator) {
3778 D(p->level--);
3779 return NULL;
3780 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01003781 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003782 int _mark = p->mark;
3783 { // 'else' ':' block
3784 if (p->error_indicator) {
3785 D(p->level--);
3786 return NULL;
3787 }
3788 D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3789 Token * _keyword;
3790 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003791 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003792 if (
3793 (_keyword = _PyPegen_expect_token(p, 516)) // token='else'
3794 &&
3795 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3796 &&
3797 (b = block_rule(p)) // block
3798 )
3799 {
3800 D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
3801 _res = b;
3802 if (_res == NULL && PyErr_Occurred()) {
3803 p->error_indicator = 1;
3804 D(p->level--);
3805 return NULL;
3806 }
3807 goto done;
3808 }
3809 p->mark = _mark;
3810 D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
3811 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' block"));
3812 }
3813 _res = NULL;
3814 done:
3815 D(p->level--);
3816 return _res;
3817}
3818
3819// while_stmt: 'while' named_expression ':' block else_block?
3820static stmt_ty
3821while_stmt_rule(Parser *p)
3822{
3823 D(p->level++);
3824 if (p->error_indicator) {
3825 D(p->level--);
3826 return NULL;
3827 }
3828 stmt_ty _res = NULL;
3829 int _mark = p->mark;
3830 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3831 p->error_indicator = 1;
3832 D(p->level--);
3833 return NULL;
3834 }
3835 int _start_lineno = p->tokens[_mark]->lineno;
3836 UNUSED(_start_lineno); // Only used by EXTRA macro
3837 int _start_col_offset = p->tokens[_mark]->col_offset;
3838 UNUSED(_start_col_offset); // Only used by EXTRA macro
3839 { // 'while' named_expression ':' block else_block?
3840 if (p->error_indicator) {
3841 D(p->level--);
3842 return NULL;
3843 }
3844 D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3845 Token * _keyword;
3846 Token * _literal;
3847 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003848 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003849 void *c;
3850 if (
3851 (_keyword = _PyPegen_expect_token(p, 512)) // token='while'
3852 &&
3853 (a = named_expression_rule(p)) // named_expression
3854 &&
3855 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3856 &&
3857 (b = block_rule(p)) // block
3858 &&
3859 (c = else_block_rule(p), 1) // else_block?
3860 )
3861 {
3862 D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
3863 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3864 if (_token == NULL) {
3865 D(p->level--);
3866 return NULL;
3867 }
3868 int _end_lineno = _token->end_lineno;
3869 UNUSED(_end_lineno); // Only used by EXTRA macro
3870 int _end_col_offset = _token->end_col_offset;
3871 UNUSED(_end_col_offset); // Only used by EXTRA macro
3872 _res = _Py_While ( a , b , c , EXTRA );
3873 if (_res == NULL && PyErr_Occurred()) {
3874 p->error_indicator = 1;
3875 D(p->level--);
3876 return NULL;
3877 }
3878 goto done;
3879 }
3880 p->mark = _mark;
3881 D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
3882 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?"));
3883 }
3884 _res = NULL;
3885 done:
3886 D(p->level--);
3887 return _res;
3888}
3889
3890// for_stmt:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003891// | 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3892// | ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
3893// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003894static stmt_ty
3895for_stmt_rule(Parser *p)
3896{
3897 D(p->level++);
3898 if (p->error_indicator) {
3899 D(p->level--);
3900 return NULL;
3901 }
3902 stmt_ty _res = NULL;
3903 int _mark = p->mark;
3904 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
3905 p->error_indicator = 1;
3906 D(p->level--);
3907 return NULL;
3908 }
3909 int _start_lineno = p->tokens[_mark]->lineno;
3910 UNUSED(_start_lineno); // Only used by EXTRA macro
3911 int _start_col_offset = p->tokens[_mark]->col_offset;
3912 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003913 { // 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003914 if (p->error_indicator) {
3915 D(p->level--);
3916 return NULL;
3917 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003918 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?"));
3919 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003920 Token * _keyword;
3921 Token * _keyword_1;
3922 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003923 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003924 void *el;
3925 expr_ty ex;
3926 expr_ty t;
3927 void *tc;
3928 if (
3929 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3930 &&
3931 (t = star_targets_rule(p)) // star_targets
3932 &&
3933 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
3934 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003935 (_cut_var = 1)
3936 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003937 (ex = star_expressions_rule(p)) // star_expressions
3938 &&
3939 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
3940 &&
3941 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
3942 &&
3943 (b = block_rule(p)) // block
3944 &&
3945 (el = else_block_rule(p), 1) // else_block?
3946 )
3947 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003948 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 +01003949 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
3950 if (_token == NULL) {
3951 D(p->level--);
3952 return NULL;
3953 }
3954 int _end_lineno = _token->end_lineno;
3955 UNUSED(_end_lineno); // Only used by EXTRA macro
3956 int _end_col_offset = _token->end_col_offset;
3957 UNUSED(_end_col_offset); // Only used by EXTRA macro
3958 _res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
3959 if (_res == NULL && PyErr_Occurred()) {
3960 p->error_indicator = 1;
3961 D(p->level--);
3962 return NULL;
3963 }
3964 goto done;
3965 }
3966 p->mark = _mark;
3967 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003968 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
3969 if (_cut_var) {
3970 D(p->level--);
3971 return NULL;
3972 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003973 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003974 { // ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003975 if (p->error_indicator) {
3976 D(p->level--);
3977 return NULL;
3978 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003979 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?"));
3980 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003981 Token * _keyword;
3982 Token * _keyword_1;
3983 Token * _literal;
3984 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01003985 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003986 void *el;
3987 expr_ty ex;
3988 expr_ty t;
3989 void *tc;
3990 if (
3991 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
3992 &&
3993 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
3994 &&
3995 (t = star_targets_rule(p)) // star_targets
3996 &&
3997 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
3998 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03003999 (_cut_var = 1)
4000 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004001 (ex = star_expressions_rule(p)) // star_expressions
4002 &&
4003 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4004 &&
4005 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4006 &&
4007 (b = block_rule(p)) // block
4008 &&
4009 (el = else_block_rule(p), 1) // else_block?
4010 )
4011 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004012 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 +01004013 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4014 if (_token == NULL) {
4015 D(p->level--);
4016 return NULL;
4017 }
4018 int _end_lineno = _token->end_lineno;
4019 UNUSED(_end_lineno); // Only used by EXTRA macro
4020 int _end_col_offset = _token->end_col_offset;
4021 UNUSED(_end_col_offset); // Only used by EXTRA macro
4022 _res = CHECK_VERSION ( 5 , "Async for loops are" , _Py_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
4023 if (_res == NULL && PyErr_Occurred()) {
4024 p->error_indicator = 1;
4025 D(p->level--);
4026 return NULL;
4027 }
4028 goto done;
4029 }
4030 p->mark = _mark;
4031 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004032 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
4033 if (_cut_var) {
4034 D(p->level--);
4035 return NULL;
4036 }
4037 }
4038 { // invalid_for_target
4039 if (p->error_indicator) {
4040 D(p->level--);
4041 return NULL;
4042 }
4043 D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4044 void *invalid_for_target_var;
4045 if (
4046 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
4047 )
4048 {
4049 D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
4050 _res = invalid_for_target_var;
4051 goto done;
4052 }
4053 p->mark = _mark;
4054 D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4055 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004056 }
4057 _res = NULL;
4058 done:
4059 D(p->level--);
4060 return _res;
4061}
4062
4063// with_stmt:
4064// | 'with' '(' ','.with_item+ ','? ')' ':' block
4065// | 'with' ','.with_item+ ':' TYPE_COMMENT? block
4066// | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4067// | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4068static stmt_ty
4069with_stmt_rule(Parser *p)
4070{
4071 D(p->level++);
4072 if (p->error_indicator) {
4073 D(p->level--);
4074 return NULL;
4075 }
4076 stmt_ty _res = NULL;
4077 int _mark = p->mark;
4078 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4079 p->error_indicator = 1;
4080 D(p->level--);
4081 return NULL;
4082 }
4083 int _start_lineno = p->tokens[_mark]->lineno;
4084 UNUSED(_start_lineno); // Only used by EXTRA macro
4085 int _start_col_offset = p->tokens[_mark]->col_offset;
4086 UNUSED(_start_col_offset); // Only used by EXTRA macro
4087 { // 'with' '(' ','.with_item+ ','? ')' ':' block
4088 if (p->error_indicator) {
4089 D(p->level--);
4090 return NULL;
4091 }
4092 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4093 Token * _keyword;
4094 Token * _literal;
4095 Token * _literal_1;
4096 Token * _literal_2;
4097 void *_opt_var;
4098 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01004099 asdl_withitem_seq* a;
4100 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004101 if (
4102 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4103 &&
4104 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4105 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004106 (a = (asdl_withitem_seq*)_gather_39_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004107 &&
4108 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4109 &&
4110 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4111 &&
4112 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4113 &&
4114 (b = block_rule(p)) // block
4115 )
4116 {
4117 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4118 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4119 if (_token == NULL) {
4120 D(p->level--);
4121 return NULL;
4122 }
4123 int _end_lineno = _token->end_lineno;
4124 UNUSED(_end_lineno); // Only used by EXTRA macro
4125 int _end_col_offset = _token->end_col_offset;
4126 UNUSED(_end_col_offset); // Only used by EXTRA macro
4127 _res = _Py_With ( a , b , NULL , EXTRA );
4128 if (_res == NULL && PyErr_Occurred()) {
4129 p->error_indicator = 1;
4130 D(p->level--);
4131 return NULL;
4132 }
4133 goto done;
4134 }
4135 p->mark = _mark;
4136 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4137 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
4138 }
4139 { // 'with' ','.with_item+ ':' TYPE_COMMENT? block
4140 if (p->error_indicator) {
4141 D(p->level--);
4142 return NULL;
4143 }
4144 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4145 Token * _keyword;
4146 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004147 asdl_withitem_seq* a;
4148 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004149 void *tc;
4150 if (
4151 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4152 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004153 (a = (asdl_withitem_seq*)_gather_41_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004154 &&
4155 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4156 &&
4157 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4158 &&
4159 (b = block_rule(p)) // block
4160 )
4161 {
4162 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4163 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4164 if (_token == NULL) {
4165 D(p->level--);
4166 return NULL;
4167 }
4168 int _end_lineno = _token->end_lineno;
4169 UNUSED(_end_lineno); // Only used by EXTRA macro
4170 int _end_col_offset = _token->end_col_offset;
4171 UNUSED(_end_col_offset); // Only used by EXTRA macro
4172 _res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
4173 if (_res == NULL && PyErr_Occurred()) {
4174 p->error_indicator = 1;
4175 D(p->level--);
4176 return NULL;
4177 }
4178 goto done;
4179 }
4180 p->mark = _mark;
4181 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4182 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4183 }
4184 { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
4185 if (p->error_indicator) {
4186 D(p->level--);
4187 return NULL;
4188 }
4189 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4190 Token * _keyword;
4191 Token * _literal;
4192 Token * _literal_1;
4193 Token * _literal_2;
4194 void *_opt_var;
4195 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01004196 asdl_withitem_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004197 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004198 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004199 if (
4200 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4201 &&
4202 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4203 &&
4204 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4205 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004206 (a = (asdl_withitem_seq*)_gather_43_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004207 &&
4208 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
4209 &&
4210 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4211 &&
4212 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4213 &&
4214 (b = block_rule(p)) // block
4215 )
4216 {
4217 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4218 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4219 if (_token == NULL) {
4220 D(p->level--);
4221 return NULL;
4222 }
4223 int _end_lineno = _token->end_lineno;
4224 UNUSED(_end_lineno); // Only used by EXTRA macro
4225 int _end_col_offset = _token->end_col_offset;
4226 UNUSED(_end_col_offset); // Only used by EXTRA macro
4227 _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) );
4228 if (_res == NULL && PyErr_Occurred()) {
4229 p->error_indicator = 1;
4230 D(p->level--);
4231 return NULL;
4232 }
4233 goto done;
4234 }
4235 p->mark = _mark;
4236 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4237 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
4238 }
4239 { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
4240 if (p->error_indicator) {
4241 D(p->level--);
4242 return NULL;
4243 }
4244 D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4245 Token * _keyword;
4246 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004247 asdl_withitem_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004248 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004249 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004250 void *tc;
4251 if (
4252 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4253 &&
4254 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
4255 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004256 (a = (asdl_withitem_seq*)_gather_45_rule(p)) // ','.with_item+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004257 &&
4258 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4259 &&
4260 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
4261 &&
4262 (b = block_rule(p)) // block
4263 )
4264 {
4265 D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4266 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4267 if (_token == NULL) {
4268 D(p->level--);
4269 return NULL;
4270 }
4271 int _end_lineno = _token->end_lineno;
4272 UNUSED(_end_lineno); // Only used by EXTRA macro
4273 int _end_col_offset = _token->end_col_offset;
4274 UNUSED(_end_col_offset); // Only used by EXTRA macro
4275 _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
4276 if (_res == NULL && PyErr_Occurred()) {
4277 p->error_indicator = 1;
4278 D(p->level--);
4279 return NULL;
4280 }
4281 goto done;
4282 }
4283 p->mark = _mark;
4284 D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4285 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
4286 }
4287 _res = NULL;
4288 done:
4289 D(p->level--);
4290 return _res;
4291}
4292
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004293// with_item: expression 'as' target &(',' | ')' | ':') | invalid_with_item | expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004294static withitem_ty
4295with_item_rule(Parser *p)
4296{
4297 D(p->level++);
4298 if (p->error_indicator) {
4299 D(p->level--);
4300 return NULL;
4301 }
4302 withitem_ty _res = NULL;
4303 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004304 { // expression 'as' target &(',' | ')' | ':')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004305 if (p->error_indicator) {
4306 D(p->level--);
4307 return NULL;
4308 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004309 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4310 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004311 expr_ty e;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004312 expr_ty t;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004313 if (
4314 (e = expression_rule(p)) // expression
4315 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004316 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
4317 &&
4318 (t = target_rule(p)) // target
4319 &&
4320 _PyPegen_lookahead(1, _tmp_47_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004321 )
4322 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004323 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4324 _res = _Py_withitem ( e , t , p -> arena );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004325 if (_res == NULL && PyErr_Occurred()) {
4326 p->error_indicator = 1;
4327 D(p->level--);
4328 return NULL;
4329 }
4330 goto done;
4331 }
4332 p->mark = _mark;
4333 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004334 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' target &(',' | ')' | ':')"));
4335 }
4336 { // invalid_with_item
4337 if (p->error_indicator) {
4338 D(p->level--);
4339 return NULL;
4340 }
4341 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4342 void *invalid_with_item_var;
4343 if (
4344 (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item
4345 )
4346 {
4347 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4348 _res = invalid_with_item_var;
4349 goto done;
4350 }
4351 p->mark = _mark;
4352 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4353 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item"));
4354 }
4355 { // expression
4356 if (p->error_indicator) {
4357 D(p->level--);
4358 return NULL;
4359 }
4360 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
4361 expr_ty e;
4362 if (
4363 (e = expression_rule(p)) // expression
4364 )
4365 {
4366 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
4367 _res = _Py_withitem ( e , NULL , p -> arena );
4368 if (_res == NULL && PyErr_Occurred()) {
4369 p->error_indicator = 1;
4370 D(p->level--);
4371 return NULL;
4372 }
4373 goto done;
4374 }
4375 p->mark = _mark;
4376 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4377 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004378 }
4379 _res = NULL;
4380 done:
4381 D(p->level--);
4382 return _res;
4383}
4384
4385// try_stmt:
4386// | 'try' ':' block finally_block
4387// | 'try' ':' block except_block+ else_block? finally_block?
4388static stmt_ty
4389try_stmt_rule(Parser *p)
4390{
4391 D(p->level++);
4392 if (p->error_indicator) {
4393 D(p->level--);
4394 return NULL;
4395 }
4396 stmt_ty _res = NULL;
4397 int _mark = p->mark;
4398 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4399 p->error_indicator = 1;
4400 D(p->level--);
4401 return NULL;
4402 }
4403 int _start_lineno = p->tokens[_mark]->lineno;
4404 UNUSED(_start_lineno); // Only used by EXTRA macro
4405 int _start_col_offset = p->tokens[_mark]->col_offset;
4406 UNUSED(_start_col_offset); // Only used by EXTRA macro
4407 { // 'try' ':' block finally_block
4408 if (p->error_indicator) {
4409 D(p->level--);
4410 return NULL;
4411 }
4412 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4413 Token * _keyword;
4414 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004415 asdl_stmt_seq* b;
4416 asdl_stmt_seq* f;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004417 if (
4418 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4419 &&
4420 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4421 &&
4422 (b = block_rule(p)) // block
4423 &&
4424 (f = finally_block_rule(p)) // finally_block
4425 )
4426 {
4427 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4428 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4429 if (_token == NULL) {
4430 D(p->level--);
4431 return NULL;
4432 }
4433 int _end_lineno = _token->end_lineno;
4434 UNUSED(_end_lineno); // Only used by EXTRA macro
4435 int _end_col_offset = _token->end_col_offset;
4436 UNUSED(_end_col_offset); // Only used by EXTRA macro
4437 _res = _Py_Try ( b , NULL , NULL , f , EXTRA );
4438 if (_res == NULL && PyErr_Occurred()) {
4439 p->error_indicator = 1;
4440 D(p->level--);
4441 return NULL;
4442 }
4443 goto done;
4444 }
4445 p->mark = _mark;
4446 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4447 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block finally_block"));
4448 }
4449 { // 'try' ':' block except_block+ else_block? finally_block?
4450 if (p->error_indicator) {
4451 D(p->level--);
4452 return NULL;
4453 }
4454 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4455 Token * _keyword;
4456 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004457 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004458 void *el;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004459 asdl_excepthandler_seq* ex;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004460 void *f;
4461 if (
4462 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4463 &&
4464 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4465 &&
4466 (b = block_rule(p)) // block
4467 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004468 (ex = (asdl_excepthandler_seq*)_loop1_48_rule(p)) // except_block+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004469 &&
4470 (el = else_block_rule(p), 1) // else_block?
4471 &&
4472 (f = finally_block_rule(p), 1) // finally_block?
4473 )
4474 {
4475 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4476 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4477 if (_token == NULL) {
4478 D(p->level--);
4479 return NULL;
4480 }
4481 int _end_lineno = _token->end_lineno;
4482 UNUSED(_end_lineno); // Only used by EXTRA macro
4483 int _end_col_offset = _token->end_col_offset;
4484 UNUSED(_end_col_offset); // Only used by EXTRA macro
4485 _res = _Py_Try ( b , ex , el , f , EXTRA );
4486 if (_res == NULL && PyErr_Occurred()) {
4487 p->error_indicator = 1;
4488 D(p->level--);
4489 return NULL;
4490 }
4491 goto done;
4492 }
4493 p->mark = _mark;
4494 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4495 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4496 }
4497 _res = NULL;
4498 done:
4499 D(p->level--);
4500 return _res;
4501}
4502
4503// except_block: 'except' expression ['as' NAME] ':' block | 'except' ':' block
4504static excepthandler_ty
4505except_block_rule(Parser *p)
4506{
4507 D(p->level++);
4508 if (p->error_indicator) {
4509 D(p->level--);
4510 return NULL;
4511 }
4512 excepthandler_ty _res = NULL;
4513 int _mark = p->mark;
4514 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4515 p->error_indicator = 1;
4516 D(p->level--);
4517 return NULL;
4518 }
4519 int _start_lineno = p->tokens[_mark]->lineno;
4520 UNUSED(_start_lineno); // Only used by EXTRA macro
4521 int _start_col_offset = p->tokens[_mark]->col_offset;
4522 UNUSED(_start_col_offset); // Only used by EXTRA macro
4523 { // 'except' expression ['as' NAME] ':' block
4524 if (p->error_indicator) {
4525 D(p->level--);
4526 return NULL;
4527 }
4528 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4529 Token * _keyword;
4530 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004531 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004532 expr_ty e;
4533 void *t;
4534 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004535 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004536 &&
4537 (e = expression_rule(p)) // expression
4538 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004539 (t = _tmp_49_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004540 &&
4541 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4542 &&
4543 (b = block_rule(p)) // block
4544 )
4545 {
4546 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4547 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4548 if (_token == NULL) {
4549 D(p->level--);
4550 return NULL;
4551 }
4552 int _end_lineno = _token->end_lineno;
4553 UNUSED(_end_lineno); // Only used by EXTRA macro
4554 int _end_col_offset = _token->end_col_offset;
4555 UNUSED(_end_col_offset); // Only used by EXTRA macro
4556 _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
4557 if (_res == NULL && PyErr_Occurred()) {
4558 p->error_indicator = 1;
4559 D(p->level--);
4560 return NULL;
4561 }
4562 goto done;
4563 }
4564 p->mark = _mark;
4565 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4566 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4567 }
4568 { // 'except' ':' block
4569 if (p->error_indicator) {
4570 D(p->level--);
4571 return NULL;
4572 }
4573 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4574 Token * _keyword;
4575 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004576 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004577 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004578 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004579 &&
4580 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4581 &&
4582 (b = block_rule(p)) // block
4583 )
4584 {
4585 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4586 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4587 if (_token == NULL) {
4588 D(p->level--);
4589 return NULL;
4590 }
4591 int _end_lineno = _token->end_lineno;
4592 UNUSED(_end_lineno); // Only used by EXTRA macro
4593 int _end_col_offset = _token->end_col_offset;
4594 UNUSED(_end_col_offset); // Only used by EXTRA macro
4595 _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
4596 if (_res == NULL && PyErr_Occurred()) {
4597 p->error_indicator = 1;
4598 D(p->level--);
4599 return NULL;
4600 }
4601 goto done;
4602 }
4603 p->mark = _mark;
4604 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4605 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block"));
4606 }
4607 _res = NULL;
4608 done:
4609 D(p->level--);
4610 return _res;
4611}
4612
4613// finally_block: 'finally' ':' block
Pablo Galindoa5634c42020-09-16 19:42:00 +01004614static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004615finally_block_rule(Parser *p)
4616{
4617 D(p->level++);
4618 if (p->error_indicator) {
4619 D(p->level--);
4620 return NULL;
4621 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01004622 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004623 int _mark = p->mark;
4624 { // 'finally' ':' block
4625 if (p->error_indicator) {
4626 D(p->level--);
4627 return NULL;
4628 }
4629 D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4630 Token * _keyword;
4631 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004632 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004633 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004634 (_keyword = _PyPegen_expect_token(p, 522)) // token='finally'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004635 &&
4636 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4637 &&
4638 (a = block_rule(p)) // block
4639 )
4640 {
4641 D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4642 _res = a;
4643 if (_res == NULL && PyErr_Occurred()) {
4644 p->error_indicator = 1;
4645 D(p->level--);
4646 return NULL;
4647 }
4648 goto done;
4649 }
4650 p->mark = _mark;
4651 D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
4652 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block"));
4653 }
4654 _res = NULL;
4655 done:
4656 D(p->level--);
4657 return _res;
4658}
4659
4660// return_stmt: 'return' star_expressions?
4661static stmt_ty
4662return_stmt_rule(Parser *p)
4663{
4664 D(p->level++);
4665 if (p->error_indicator) {
4666 D(p->level--);
4667 return NULL;
4668 }
4669 stmt_ty _res = NULL;
4670 int _mark = p->mark;
4671 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4672 p->error_indicator = 1;
4673 D(p->level--);
4674 return NULL;
4675 }
4676 int _start_lineno = p->tokens[_mark]->lineno;
4677 UNUSED(_start_lineno); // Only used by EXTRA macro
4678 int _start_col_offset = p->tokens[_mark]->col_offset;
4679 UNUSED(_start_col_offset); // Only used by EXTRA macro
4680 { // 'return' star_expressions?
4681 if (p->error_indicator) {
4682 D(p->level--);
4683 return NULL;
4684 }
4685 D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4686 Token * _keyword;
4687 void *a;
4688 if (
4689 (_keyword = _PyPegen_expect_token(p, 500)) // token='return'
4690 &&
4691 (a = star_expressions_rule(p), 1) // star_expressions?
4692 )
4693 {
4694 D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4695 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4696 if (_token == NULL) {
4697 D(p->level--);
4698 return NULL;
4699 }
4700 int _end_lineno = _token->end_lineno;
4701 UNUSED(_end_lineno); // Only used by EXTRA macro
4702 int _end_col_offset = _token->end_col_offset;
4703 UNUSED(_end_col_offset); // Only used by EXTRA macro
4704 _res = _Py_Return ( a , EXTRA );
4705 if (_res == NULL && PyErr_Occurred()) {
4706 p->error_indicator = 1;
4707 D(p->level--);
4708 return NULL;
4709 }
4710 goto done;
4711 }
4712 p->mark = _mark;
4713 D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4714 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
4715 }
4716 _res = NULL;
4717 done:
4718 D(p->level--);
4719 return _res;
4720}
4721
4722// raise_stmt: 'raise' expression ['from' expression] | 'raise'
4723static stmt_ty
4724raise_stmt_rule(Parser *p)
4725{
4726 D(p->level++);
4727 if (p->error_indicator) {
4728 D(p->level--);
4729 return NULL;
4730 }
4731 stmt_ty _res = NULL;
4732 int _mark = p->mark;
4733 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4734 p->error_indicator = 1;
4735 D(p->level--);
4736 return NULL;
4737 }
4738 int _start_lineno = p->tokens[_mark]->lineno;
4739 UNUSED(_start_lineno); // Only used by EXTRA macro
4740 int _start_col_offset = p->tokens[_mark]->col_offset;
4741 UNUSED(_start_col_offset); // Only used by EXTRA macro
4742 { // 'raise' expression ['from' expression]
4743 if (p->error_indicator) {
4744 D(p->level--);
4745 return NULL;
4746 }
4747 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4748 Token * _keyword;
4749 expr_ty a;
4750 void *b;
4751 if (
4752 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4753 &&
4754 (a = expression_rule(p)) // expression
4755 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004756 (b = _tmp_50_rule(p), 1) // ['from' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004757 )
4758 {
4759 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4760 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4761 if (_token == NULL) {
4762 D(p->level--);
4763 return NULL;
4764 }
4765 int _end_lineno = _token->end_lineno;
4766 UNUSED(_end_lineno); // Only used by EXTRA macro
4767 int _end_col_offset = _token->end_col_offset;
4768 UNUSED(_end_col_offset); // Only used by EXTRA macro
4769 _res = _Py_Raise ( a , b , EXTRA );
4770 if (_res == NULL && PyErr_Occurred()) {
4771 p->error_indicator = 1;
4772 D(p->level--);
4773 return NULL;
4774 }
4775 goto done;
4776 }
4777 p->mark = _mark;
4778 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4779 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
4780 }
4781 { // 'raise'
4782 if (p->error_indicator) {
4783 D(p->level--);
4784 return NULL;
4785 }
4786 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
4787 Token * _keyword;
4788 if (
4789 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4790 )
4791 {
4792 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
4793 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4794 if (_token == NULL) {
4795 D(p->level--);
4796 return NULL;
4797 }
4798 int _end_lineno = _token->end_lineno;
4799 UNUSED(_end_lineno); // Only used by EXTRA macro
4800 int _end_col_offset = _token->end_col_offset;
4801 UNUSED(_end_col_offset); // Only used by EXTRA macro
4802 _res = _Py_Raise ( NULL , NULL , EXTRA );
4803 if (_res == NULL && PyErr_Occurred()) {
4804 p->error_indicator = 1;
4805 D(p->level--);
4806 return NULL;
4807 }
4808 goto done;
4809 }
4810 p->mark = _mark;
4811 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4812 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
4813 }
4814 _res = NULL;
4815 done:
4816 D(p->level--);
4817 return _res;
4818}
4819
4820// function_def: decorators function_def_raw | function_def_raw
4821static stmt_ty
4822function_def_rule(Parser *p)
4823{
4824 D(p->level++);
4825 if (p->error_indicator) {
4826 D(p->level--);
4827 return NULL;
4828 }
4829 stmt_ty _res = NULL;
4830 int _mark = p->mark;
4831 { // decorators function_def_raw
4832 if (p->error_indicator) {
4833 D(p->level--);
4834 return NULL;
4835 }
4836 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01004837 asdl_expr_seq* d;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004838 stmt_ty f;
4839 if (
4840 (d = decorators_rule(p)) // decorators
4841 &&
4842 (f = function_def_raw_rule(p)) // function_def_raw
4843 )
4844 {
4845 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
4846 _res = _PyPegen_function_def_decorators ( p , d , f );
4847 if (_res == NULL && PyErr_Occurred()) {
4848 p->error_indicator = 1;
4849 D(p->level--);
4850 return NULL;
4851 }
4852 goto done;
4853 }
4854 p->mark = _mark;
4855 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4856 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
4857 }
4858 { // function_def_raw
4859 if (p->error_indicator) {
4860 D(p->level--);
4861 return NULL;
4862 }
4863 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4864 stmt_ty function_def_raw_var;
4865 if (
4866 (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw
4867 )
4868 {
4869 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4870 _res = function_def_raw_var;
4871 goto done;
4872 }
4873 p->mark = _mark;
4874 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4875 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
4876 }
4877 _res = NULL;
4878 done:
4879 D(p->level--);
4880 return _res;
4881}
4882
4883// function_def_raw:
4884// | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4885// | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4886static stmt_ty
4887function_def_raw_rule(Parser *p)
4888{
4889 D(p->level++);
4890 if (p->error_indicator) {
4891 D(p->level--);
4892 return NULL;
4893 }
4894 stmt_ty _res = NULL;
4895 int _mark = p->mark;
4896 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4897 p->error_indicator = 1;
4898 D(p->level--);
4899 return NULL;
4900 }
4901 int _start_lineno = p->tokens[_mark]->lineno;
4902 UNUSED(_start_lineno); // Only used by EXTRA macro
4903 int _start_col_offset = p->tokens[_mark]->col_offset;
4904 UNUSED(_start_col_offset); // Only used by EXTRA macro
4905 { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4906 if (p->error_indicator) {
4907 D(p->level--);
4908 return NULL;
4909 }
4910 D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4911 Token * _keyword;
4912 Token * _literal;
4913 Token * _literal_1;
4914 Token * _literal_2;
4915 void *a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004916 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004917 expr_ty n;
4918 void *params;
4919 void *tc;
4920 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004921 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004922 &&
4923 (n = _PyPegen_name_token(p)) // NAME
4924 &&
4925 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4926 &&
4927 (params = params_rule(p), 1) // params?
4928 &&
4929 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4930 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004931 (a = _tmp_51_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004932 &&
4933 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4934 &&
4935 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4936 &&
4937 (b = block_rule(p)) // block
4938 )
4939 {
4940 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"));
4941 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4942 if (_token == NULL) {
4943 D(p->level--);
4944 return NULL;
4945 }
4946 int _end_lineno = _token->end_lineno;
4947 UNUSED(_end_lineno); // Only used by EXTRA macro
4948 int _end_col_offset = _token->end_col_offset;
4949 UNUSED(_end_col_offset); // Only used by EXTRA macro
4950 _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
4951 if (_res == NULL && PyErr_Occurred()) {
4952 p->error_indicator = 1;
4953 D(p->level--);
4954 return NULL;
4955 }
4956 goto done;
4957 }
4958 p->mark = _mark;
4959 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
4960 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4961 }
4962 { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4963 if (p->error_indicator) {
4964 D(p->level--);
4965 return NULL;
4966 }
4967 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"));
4968 Token * _keyword;
4969 Token * _literal;
4970 Token * _literal_1;
4971 Token * _literal_2;
4972 void *a;
4973 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004974 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004975 expr_ty n;
4976 void *params;
4977 void *tc;
4978 if (
4979 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4980 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004981 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004982 &&
4983 (n = _PyPegen_name_token(p)) // NAME
4984 &&
4985 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4986 &&
4987 (params = params_rule(p), 1) // params?
4988 &&
4989 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4990 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004991 (a = _tmp_52_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004992 &&
4993 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4994 &&
4995 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4996 &&
4997 (b = block_rule(p)) // block
4998 )
4999 {
5000 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"));
5001 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
5002 if (_token == NULL) {
5003 D(p->level--);
5004 return NULL;
5005 }
5006 int _end_lineno = _token->end_lineno;
5007 UNUSED(_end_lineno); // Only used by EXTRA macro
5008 int _end_col_offset = _token->end_col_offset;
5009 UNUSED(_end_col_offset); // Only used by EXTRA macro
5010 _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 ) );
5011 if (_res == NULL && PyErr_Occurred()) {
5012 p->error_indicator = 1;
5013 D(p->level--);
5014 return NULL;
5015 }
5016 goto done;
5017 }
5018 p->mark = _mark;
5019 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
5020 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
5021 }
5022 _res = NULL;
5023 done:
5024 D(p->level--);
5025 return _res;
5026}
5027
5028// func_type_comment:
5029// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5030// | invalid_double_type_comments
5031// | TYPE_COMMENT
5032static Token*
5033func_type_comment_rule(Parser *p)
5034{
5035 D(p->level++);
5036 if (p->error_indicator) {
5037 D(p->level--);
5038 return NULL;
5039 }
5040 Token* _res = NULL;
5041 int _mark = p->mark;
5042 { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5043 if (p->error_indicator) {
5044 D(p->level--);
5045 return NULL;
5046 }
5047 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5048 Token * newline_var;
5049 Token * t;
5050 if (
5051 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
5052 &&
5053 (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5054 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005055 _PyPegen_lookahead(1, _tmp_53_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005056 )
5057 {
5058 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5059 _res = t;
5060 if (_res == NULL && PyErr_Occurred()) {
5061 p->error_indicator = 1;
5062 D(p->level--);
5063 return NULL;
5064 }
5065 goto done;
5066 }
5067 p->mark = _mark;
5068 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5069 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5070 }
5071 { // invalid_double_type_comments
5072 if (p->error_indicator) {
5073 D(p->level--);
5074 return NULL;
5075 }
5076 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5077 void *invalid_double_type_comments_var;
5078 if (
5079 (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments
5080 )
5081 {
5082 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5083 _res = invalid_double_type_comments_var;
5084 goto done;
5085 }
5086 p->mark = _mark;
5087 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5088 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
5089 }
5090 { // TYPE_COMMENT
5091 if (p->error_indicator) {
5092 D(p->level--);
5093 return NULL;
5094 }
5095 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5096 Token * type_comment_var;
5097 if (
5098 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5099 )
5100 {
5101 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5102 _res = type_comment_var;
5103 goto done;
5104 }
5105 p->mark = _mark;
5106 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5107 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
5108 }
5109 _res = NULL;
5110 done:
5111 D(p->level--);
5112 return _res;
5113}
5114
5115// params: invalid_parameters | parameters
5116static arguments_ty
5117params_rule(Parser *p)
5118{
5119 D(p->level++);
5120 if (p->error_indicator) {
5121 D(p->level--);
5122 return NULL;
5123 }
5124 arguments_ty _res = NULL;
5125 int _mark = p->mark;
5126 { // invalid_parameters
5127 if (p->error_indicator) {
5128 D(p->level--);
5129 return NULL;
5130 }
5131 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5132 void *invalid_parameters_var;
5133 if (
5134 (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters
5135 )
5136 {
5137 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5138 _res = invalid_parameters_var;
5139 goto done;
5140 }
5141 p->mark = _mark;
5142 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5143 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
5144 }
5145 { // parameters
5146 if (p->error_indicator) {
5147 D(p->level--);
5148 return NULL;
5149 }
5150 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
5151 arguments_ty parameters_var;
5152 if (
5153 (parameters_var = parameters_rule(p)) // parameters
5154 )
5155 {
5156 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
5157 _res = parameters_var;
5158 goto done;
5159 }
5160 p->mark = _mark;
5161 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5162 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
5163 }
5164 _res = NULL;
5165 done:
5166 D(p->level--);
5167 return _res;
5168}
5169
5170// parameters:
5171// | slash_no_default param_no_default* param_with_default* star_etc?
5172// | slash_with_default param_with_default* star_etc?
5173// | param_no_default+ param_with_default* star_etc?
5174// | param_with_default+ star_etc?
5175// | star_etc
5176static arguments_ty
5177parameters_rule(Parser *p)
5178{
5179 D(p->level++);
5180 if (p->error_indicator) {
5181 D(p->level--);
5182 return NULL;
5183 }
5184 arguments_ty _res = NULL;
5185 int _mark = p->mark;
5186 { // slash_no_default param_no_default* param_with_default* star_etc?
5187 if (p->error_indicator) {
5188 D(p->level--);
5189 return NULL;
5190 }
5191 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?"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01005192 asdl_arg_seq* a;
5193 asdl_arg_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005194 asdl_seq * c;
5195 void *d;
5196 if (
5197 (a = slash_no_default_rule(p)) // slash_no_default
5198 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01005199 (b = (asdl_arg_seq*)_loop0_54_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005200 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005201 (c = _loop0_55_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005202 &&
5203 (d = star_etc_rule(p), 1) // star_etc?
5204 )
5205 {
5206 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?"));
5207 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
5208 if (_res == NULL && PyErr_Occurred()) {
5209 p->error_indicator = 1;
5210 D(p->level--);
5211 return NULL;
5212 }
5213 goto done;
5214 }
5215 p->mark = _mark;
5216 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5217 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
5218 }
5219 { // slash_with_default param_with_default* star_etc?
5220 if (p->error_indicator) {
5221 D(p->level--);
5222 return NULL;
5223 }
5224 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5225 SlashWithDefault* a;
5226 asdl_seq * b;
5227 void *c;
5228 if (
5229 (a = slash_with_default_rule(p)) // slash_with_default
5230 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005231 (b = _loop0_56_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005232 &&
5233 (c = star_etc_rule(p), 1) // star_etc?
5234 )
5235 {
5236 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5237 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
5238 if (_res == NULL && PyErr_Occurred()) {
5239 p->error_indicator = 1;
5240 D(p->level--);
5241 return NULL;
5242 }
5243 goto done;
5244 }
5245 p->mark = _mark;
5246 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5247 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5248 }
5249 { // param_no_default+ param_with_default* star_etc?
5250 if (p->error_indicator) {
5251 D(p->level--);
5252 return NULL;
5253 }
5254 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01005255 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005256 asdl_seq * b;
5257 void *c;
5258 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01005259 (a = (asdl_arg_seq*)_loop1_57_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005260 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005261 (b = _loop0_58_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005262 &&
5263 (c = star_etc_rule(p), 1) // star_etc?
5264 )
5265 {
5266 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5267 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
5268 if (_res == NULL && PyErr_Occurred()) {
5269 p->error_indicator = 1;
5270 D(p->level--);
5271 return NULL;
5272 }
5273 goto done;
5274 }
5275 p->mark = _mark;
5276 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5277 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5278 }
5279 { // param_with_default+ star_etc?
5280 if (p->error_indicator) {
5281 D(p->level--);
5282 return NULL;
5283 }
5284 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5285 asdl_seq * a;
5286 void *b;
5287 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005288 (a = _loop1_59_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005289 &&
5290 (b = star_etc_rule(p), 1) // star_etc?
5291 )
5292 {
5293 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5294 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
5295 if (_res == NULL && PyErr_Occurred()) {
5296 p->error_indicator = 1;
5297 D(p->level--);
5298 return NULL;
5299 }
5300 goto done;
5301 }
5302 p->mark = _mark;
5303 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5304 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
5305 }
5306 { // star_etc
5307 if (p->error_indicator) {
5308 D(p->level--);
5309 return NULL;
5310 }
5311 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
5312 StarEtc* a;
5313 if (
5314 (a = star_etc_rule(p)) // star_etc
5315 )
5316 {
5317 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
5318 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
5319 if (_res == NULL && PyErr_Occurred()) {
5320 p->error_indicator = 1;
5321 D(p->level--);
5322 return NULL;
5323 }
5324 goto done;
5325 }
5326 p->mark = _mark;
5327 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5328 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
5329 }
5330 _res = NULL;
5331 done:
5332 D(p->level--);
5333 return _res;
5334}
5335
5336// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
Pablo Galindoa5634c42020-09-16 19:42:00 +01005337static asdl_arg_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005338slash_no_default_rule(Parser *p)
5339{
5340 D(p->level++);
5341 if (p->error_indicator) {
5342 D(p->level--);
5343 return NULL;
5344 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01005345 asdl_arg_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005346 int _mark = p->mark;
5347 { // param_no_default+ '/' ','
5348 if (p->error_indicator) {
5349 D(p->level--);
5350 return NULL;
5351 }
5352 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5353 Token * _literal;
5354 Token * _literal_1;
Pablo Galindoa5634c42020-09-16 19:42:00 +01005355 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005356 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01005357 (a = (asdl_arg_seq*)_loop1_60_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005358 &&
5359 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5360 &&
5361 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5362 )
5363 {
5364 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5365 _res = a;
5366 if (_res == NULL && PyErr_Occurred()) {
5367 p->error_indicator = 1;
5368 D(p->level--);
5369 return NULL;
5370 }
5371 goto done;
5372 }
5373 p->mark = _mark;
5374 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5375 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
5376 }
5377 { // param_no_default+ '/' &')'
5378 if (p->error_indicator) {
5379 D(p->level--);
5380 return NULL;
5381 }
5382 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5383 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01005384 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005385 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01005386 (a = (asdl_arg_seq*)_loop1_61_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005387 &&
5388 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5389 &&
5390 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5391 )
5392 {
5393 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5394 _res = a;
5395 if (_res == NULL && PyErr_Occurred()) {
5396 p->error_indicator = 1;
5397 D(p->level--);
5398 return NULL;
5399 }
5400 goto done;
5401 }
5402 p->mark = _mark;
5403 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5404 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
5405 }
5406 _res = NULL;
5407 done:
5408 D(p->level--);
5409 return _res;
5410}
5411
5412// slash_with_default:
5413// | param_no_default* param_with_default+ '/' ','
5414// | param_no_default* param_with_default+ '/' &')'
5415static SlashWithDefault*
5416slash_with_default_rule(Parser *p)
5417{
5418 D(p->level++);
5419 if (p->error_indicator) {
5420 D(p->level--);
5421 return NULL;
5422 }
5423 SlashWithDefault* _res = NULL;
5424 int _mark = p->mark;
5425 { // param_no_default* param_with_default+ '/' ','
5426 if (p->error_indicator) {
5427 D(p->level--);
5428 return NULL;
5429 }
5430 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5431 Token * _literal;
5432 Token * _literal_1;
5433 asdl_seq * a;
5434 asdl_seq * b;
5435 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005436 (a = _loop0_62_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005437 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005438 (b = _loop1_63_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005439 &&
5440 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5441 &&
5442 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5443 )
5444 {
5445 D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01005446 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005447 if (_res == NULL && PyErr_Occurred()) {
5448 p->error_indicator = 1;
5449 D(p->level--);
5450 return NULL;
5451 }
5452 goto done;
5453 }
5454 p->mark = _mark;
5455 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5456 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5457 }
5458 { // param_no_default* param_with_default+ '/' &')'
5459 if (p->error_indicator) {
5460 D(p->level--);
5461 return NULL;
5462 }
5463 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5464 Token * _literal;
5465 asdl_seq * a;
5466 asdl_seq * b;
5467 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005468 (a = _loop0_64_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005469 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005470 (b = _loop1_65_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005471 &&
5472 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5473 &&
5474 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5475 )
5476 {
5477 D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01005478 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005479 if (_res == NULL && PyErr_Occurred()) {
5480 p->error_indicator = 1;
5481 D(p->level--);
5482 return NULL;
5483 }
5484 goto done;
5485 }
5486 p->mark = _mark;
5487 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5488 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5489 }
5490 _res = NULL;
5491 done:
5492 D(p->level--);
5493 return _res;
5494}
5495
5496// star_etc:
5497// | '*' param_no_default param_maybe_default* kwds?
5498// | '*' ',' param_maybe_default+ kwds?
5499// | kwds
5500// | invalid_star_etc
5501static StarEtc*
5502star_etc_rule(Parser *p)
5503{
5504 D(p->level++);
5505 if (p->error_indicator) {
5506 D(p->level--);
5507 return NULL;
5508 }
5509 StarEtc* _res = NULL;
5510 int _mark = p->mark;
5511 { // '*' param_no_default param_maybe_default* kwds?
5512 if (p->error_indicator) {
5513 D(p->level--);
5514 return NULL;
5515 }
5516 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5517 Token * _literal;
5518 arg_ty a;
5519 asdl_seq * b;
5520 void *c;
5521 if (
5522 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5523 &&
5524 (a = param_no_default_rule(p)) // param_no_default
5525 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005526 (b = _loop0_66_rule(p)) // param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005527 &&
5528 (c = kwds_rule(p), 1) // kwds?
5529 )
5530 {
5531 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5532 _res = _PyPegen_star_etc ( p , a , b , c );
5533 if (_res == NULL && PyErr_Occurred()) {
5534 p->error_indicator = 1;
5535 D(p->level--);
5536 return NULL;
5537 }
5538 goto done;
5539 }
5540 p->mark = _mark;
5541 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5542 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5543 }
5544 { // '*' ',' param_maybe_default+ kwds?
5545 if (p->error_indicator) {
5546 D(p->level--);
5547 return NULL;
5548 }
5549 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5550 Token * _literal;
5551 Token * _literal_1;
5552 asdl_seq * b;
5553 void *c;
5554 if (
5555 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5556 &&
5557 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5558 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005559 (b = _loop1_67_rule(p)) // param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005560 &&
5561 (c = kwds_rule(p), 1) // kwds?
5562 )
5563 {
5564 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5565 _res = _PyPegen_star_etc ( p , NULL , b , c );
5566 if (_res == NULL && PyErr_Occurred()) {
5567 p->error_indicator = 1;
5568 D(p->level--);
5569 return NULL;
5570 }
5571 goto done;
5572 }
5573 p->mark = _mark;
5574 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5575 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5576 }
5577 { // kwds
5578 if (p->error_indicator) {
5579 D(p->level--);
5580 return NULL;
5581 }
5582 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
5583 arg_ty a;
5584 if (
5585 (a = kwds_rule(p)) // kwds
5586 )
5587 {
5588 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
5589 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
5590 if (_res == NULL && PyErr_Occurred()) {
5591 p->error_indicator = 1;
5592 D(p->level--);
5593 return NULL;
5594 }
5595 goto done;
5596 }
5597 p->mark = _mark;
5598 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5599 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
5600 }
5601 { // invalid_star_etc
5602 if (p->error_indicator) {
5603 D(p->level--);
5604 return NULL;
5605 }
5606 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5607 void *invalid_star_etc_var;
5608 if (
5609 (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc
5610 )
5611 {
5612 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5613 _res = invalid_star_etc_var;
5614 goto done;
5615 }
5616 p->mark = _mark;
5617 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5618 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
5619 }
5620 _res = NULL;
5621 done:
5622 D(p->level--);
5623 return _res;
5624}
5625
5626// kwds: '**' param_no_default
5627static arg_ty
5628kwds_rule(Parser *p)
5629{
5630 D(p->level++);
5631 if (p->error_indicator) {
5632 D(p->level--);
5633 return NULL;
5634 }
5635 arg_ty _res = NULL;
5636 int _mark = p->mark;
5637 { // '**' param_no_default
5638 if (p->error_indicator) {
5639 D(p->level--);
5640 return NULL;
5641 }
5642 D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5643 Token * _literal;
5644 arg_ty a;
5645 if (
5646 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
5647 &&
5648 (a = param_no_default_rule(p)) // param_no_default
5649 )
5650 {
5651 D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5652 _res = a;
5653 if (_res == NULL && PyErr_Occurred()) {
5654 p->error_indicator = 1;
5655 D(p->level--);
5656 return NULL;
5657 }
5658 goto done;
5659 }
5660 p->mark = _mark;
5661 D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
5662 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
5663 }
5664 _res = NULL;
5665 done:
5666 D(p->level--);
5667 return _res;
5668}
5669
5670// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
5671static arg_ty
5672param_no_default_rule(Parser *p)
5673{
5674 D(p->level++);
5675 if (p->error_indicator) {
5676 D(p->level--);
5677 return NULL;
5678 }
5679 arg_ty _res = NULL;
5680 int _mark = p->mark;
5681 { // param ',' TYPE_COMMENT?
5682 if (p->error_indicator) {
5683 D(p->level--);
5684 return NULL;
5685 }
5686 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5687 Token * _literal;
5688 arg_ty a;
5689 void *tc;
5690 if (
5691 (a = param_rule(p)) // param
5692 &&
5693 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5694 &&
5695 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5696 )
5697 {
5698 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5699 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5700 if (_res == NULL && PyErr_Occurred()) {
5701 p->error_indicator = 1;
5702 D(p->level--);
5703 return NULL;
5704 }
5705 goto done;
5706 }
5707 p->mark = _mark;
5708 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5709 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
5710 }
5711 { // param TYPE_COMMENT? &')'
5712 if (p->error_indicator) {
5713 D(p->level--);
5714 return NULL;
5715 }
5716 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5717 arg_ty a;
5718 void *tc;
5719 if (
5720 (a = param_rule(p)) // param
5721 &&
5722 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5723 &&
5724 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5725 )
5726 {
5727 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5728 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5729 if (_res == NULL && PyErr_Occurred()) {
5730 p->error_indicator = 1;
5731 D(p->level--);
5732 return NULL;
5733 }
5734 goto done;
5735 }
5736 p->mark = _mark;
5737 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5738 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
5739 }
5740 _res = NULL;
5741 done:
5742 D(p->level--);
5743 return _res;
5744}
5745
5746// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
5747static NameDefaultPair*
5748param_with_default_rule(Parser *p)
5749{
5750 D(p->level++);
5751 if (p->error_indicator) {
5752 D(p->level--);
5753 return NULL;
5754 }
5755 NameDefaultPair* _res = NULL;
5756 int _mark = p->mark;
5757 { // param default ',' TYPE_COMMENT?
5758 if (p->error_indicator) {
5759 D(p->level--);
5760 return NULL;
5761 }
5762 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5763 Token * _literal;
5764 arg_ty a;
5765 expr_ty c;
5766 void *tc;
5767 if (
5768 (a = param_rule(p)) // param
5769 &&
5770 (c = default_rule(p)) // default
5771 &&
5772 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5773 &&
5774 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5775 )
5776 {
5777 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5778 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5779 if (_res == NULL && PyErr_Occurred()) {
5780 p->error_indicator = 1;
5781 D(p->level--);
5782 return NULL;
5783 }
5784 goto done;
5785 }
5786 p->mark = _mark;
5787 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5788 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5789 }
5790 { // param default TYPE_COMMENT? &')'
5791 if (p->error_indicator) {
5792 D(p->level--);
5793 return NULL;
5794 }
5795 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5796 arg_ty a;
5797 expr_ty c;
5798 void *tc;
5799 if (
5800 (a = param_rule(p)) // param
5801 &&
5802 (c = default_rule(p)) // default
5803 &&
5804 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5805 &&
5806 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5807 )
5808 {
5809 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5810 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5811 if (_res == NULL && PyErr_Occurred()) {
5812 p->error_indicator = 1;
5813 D(p->level--);
5814 return NULL;
5815 }
5816 goto done;
5817 }
5818 p->mark = _mark;
5819 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5820 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5821 }
5822 _res = NULL;
5823 done:
5824 D(p->level--);
5825 return _res;
5826}
5827
5828// param_maybe_default:
5829// | param default? ',' TYPE_COMMENT?
5830// | param default? TYPE_COMMENT? &')'
5831static NameDefaultPair*
5832param_maybe_default_rule(Parser *p)
5833{
5834 D(p->level++);
5835 if (p->error_indicator) {
5836 D(p->level--);
5837 return NULL;
5838 }
5839 NameDefaultPair* _res = NULL;
5840 int _mark = p->mark;
5841 { // param default? ',' TYPE_COMMENT?
5842 if (p->error_indicator) {
5843 D(p->level--);
5844 return NULL;
5845 }
5846 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5847 Token * _literal;
5848 arg_ty a;
5849 void *c;
5850 void *tc;
5851 if (
5852 (a = param_rule(p)) // param
5853 &&
5854 (c = default_rule(p), 1) // default?
5855 &&
5856 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5857 &&
5858 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5859 )
5860 {
5861 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5862 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5863 if (_res == NULL && PyErr_Occurred()) {
5864 p->error_indicator = 1;
5865 D(p->level--);
5866 return NULL;
5867 }
5868 goto done;
5869 }
5870 p->mark = _mark;
5871 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5872 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5873 }
5874 { // param default? TYPE_COMMENT? &')'
5875 if (p->error_indicator) {
5876 D(p->level--);
5877 return NULL;
5878 }
5879 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5880 arg_ty a;
5881 void *c;
5882 void *tc;
5883 if (
5884 (a = param_rule(p)) // param
5885 &&
5886 (c = default_rule(p), 1) // default?
5887 &&
5888 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5889 &&
5890 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5891 )
5892 {
5893 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5894 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5895 if (_res == NULL && PyErr_Occurred()) {
5896 p->error_indicator = 1;
5897 D(p->level--);
5898 return NULL;
5899 }
5900 goto done;
5901 }
5902 p->mark = _mark;
5903 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5904 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5905 }
5906 _res = NULL;
5907 done:
5908 D(p->level--);
5909 return _res;
5910}
5911
5912// param: NAME annotation?
5913static arg_ty
5914param_rule(Parser *p)
5915{
5916 D(p->level++);
5917 if (p->error_indicator) {
5918 D(p->level--);
5919 return NULL;
5920 }
5921 arg_ty _res = NULL;
5922 int _mark = p->mark;
5923 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5924 p->error_indicator = 1;
5925 D(p->level--);
5926 return NULL;
5927 }
5928 int _start_lineno = p->tokens[_mark]->lineno;
5929 UNUSED(_start_lineno); // Only used by EXTRA macro
5930 int _start_col_offset = p->tokens[_mark]->col_offset;
5931 UNUSED(_start_col_offset); // Only used by EXTRA macro
5932 { // NAME annotation?
5933 if (p->error_indicator) {
5934 D(p->level--);
5935 return NULL;
5936 }
5937 D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5938 expr_ty a;
5939 void *b;
5940 if (
5941 (a = _PyPegen_name_token(p)) // NAME
5942 &&
5943 (b = annotation_rule(p), 1) // annotation?
5944 )
5945 {
5946 D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5947 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
5948 if (_token == NULL) {
5949 D(p->level--);
5950 return NULL;
5951 }
5952 int _end_lineno = _token->end_lineno;
5953 UNUSED(_end_lineno); // Only used by EXTRA macro
5954 int _end_col_offset = _token->end_col_offset;
5955 UNUSED(_end_col_offset); // Only used by EXTRA macro
5956 _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
5957 if (_res == NULL && PyErr_Occurred()) {
5958 p->error_indicator = 1;
5959 D(p->level--);
5960 return NULL;
5961 }
5962 goto done;
5963 }
5964 p->mark = _mark;
5965 D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
5966 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
5967 }
5968 _res = NULL;
5969 done:
5970 D(p->level--);
5971 return _res;
5972}
5973
5974// annotation: ':' expression
5975static expr_ty
5976annotation_rule(Parser *p)
5977{
5978 D(p->level++);
5979 if (p->error_indicator) {
5980 D(p->level--);
5981 return NULL;
5982 }
5983 expr_ty _res = NULL;
5984 int _mark = p->mark;
5985 { // ':' expression
5986 if (p->error_indicator) {
5987 D(p->level--);
5988 return NULL;
5989 }
5990 D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
5991 Token * _literal;
5992 expr_ty a;
5993 if (
5994 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
5995 &&
5996 (a = expression_rule(p)) // expression
5997 )
5998 {
5999 D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
6000 _res = a;
6001 if (_res == NULL && PyErr_Occurred()) {
6002 p->error_indicator = 1;
6003 D(p->level--);
6004 return NULL;
6005 }
6006 goto done;
6007 }
6008 p->mark = _mark;
6009 D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
6010 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
6011 }
6012 _res = NULL;
6013 done:
6014 D(p->level--);
6015 return _res;
6016}
6017
6018// default: '=' expression
6019static expr_ty
6020default_rule(Parser *p)
6021{
6022 D(p->level++);
6023 if (p->error_indicator) {
6024 D(p->level--);
6025 return NULL;
6026 }
6027 expr_ty _res = NULL;
6028 int _mark = p->mark;
6029 { // '=' expression
6030 if (p->error_indicator) {
6031 D(p->level--);
6032 return NULL;
6033 }
6034 D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6035 Token * _literal;
6036 expr_ty a;
6037 if (
6038 (_literal = _PyPegen_expect_token(p, 22)) // token='='
6039 &&
6040 (a = expression_rule(p)) // expression
6041 )
6042 {
6043 D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6044 _res = a;
6045 if (_res == NULL && PyErr_Occurred()) {
6046 p->error_indicator = 1;
6047 D(p->level--);
6048 return NULL;
6049 }
6050 goto done;
6051 }
6052 p->mark = _mark;
6053 D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
6054 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
6055 }
6056 _res = NULL;
6057 done:
6058 D(p->level--);
6059 return _res;
6060}
6061
6062// decorators: (('@' named_expression NEWLINE))+
Pablo Galindoa5634c42020-09-16 19:42:00 +01006063static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006064decorators_rule(Parser *p)
6065{
6066 D(p->level++);
6067 if (p->error_indicator) {
6068 D(p->level--);
6069 return NULL;
6070 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006071 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006072 int _mark = p->mark;
6073 { // (('@' named_expression NEWLINE))+
6074 if (p->error_indicator) {
6075 D(p->level--);
6076 return NULL;
6077 }
6078 D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01006079 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006080 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01006081 (a = (asdl_expr_seq*)_loop1_68_rule(p)) // (('@' named_expression NEWLINE))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006082 )
6083 {
6084 D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6085 _res = a;
6086 if (_res == NULL && PyErr_Occurred()) {
6087 p->error_indicator = 1;
6088 D(p->level--);
6089 return NULL;
6090 }
6091 goto done;
6092 }
6093 p->mark = _mark;
6094 D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
6095 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6096 }
6097 _res = NULL;
6098 done:
6099 D(p->level--);
6100 return _res;
6101}
6102
6103// class_def: decorators class_def_raw | class_def_raw
6104static stmt_ty
6105class_def_rule(Parser *p)
6106{
6107 D(p->level++);
6108 if (p->error_indicator) {
6109 D(p->level--);
6110 return NULL;
6111 }
6112 stmt_ty _res = NULL;
6113 int _mark = p->mark;
6114 { // decorators class_def_raw
6115 if (p->error_indicator) {
6116 D(p->level--);
6117 return NULL;
6118 }
6119 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01006120 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006121 stmt_ty b;
6122 if (
6123 (a = decorators_rule(p)) // decorators
6124 &&
6125 (b = class_def_raw_rule(p)) // class_def_raw
6126 )
6127 {
6128 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
6129 _res = _PyPegen_class_def_decorators ( p , a , b );
6130 if (_res == NULL && PyErr_Occurred()) {
6131 p->error_indicator = 1;
6132 D(p->level--);
6133 return NULL;
6134 }
6135 goto done;
6136 }
6137 p->mark = _mark;
6138 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6139 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
6140 }
6141 { // class_def_raw
6142 if (p->error_indicator) {
6143 D(p->level--);
6144 return NULL;
6145 }
6146 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6147 stmt_ty class_def_raw_var;
6148 if (
6149 (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw
6150 )
6151 {
6152 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6153 _res = class_def_raw_var;
6154 goto done;
6155 }
6156 p->mark = _mark;
6157 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6158 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
6159 }
6160 _res = NULL;
6161 done:
6162 D(p->level--);
6163 return _res;
6164}
6165
6166// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
6167static stmt_ty
6168class_def_raw_rule(Parser *p)
6169{
6170 D(p->level++);
6171 if (p->error_indicator) {
6172 D(p->level--);
6173 return NULL;
6174 }
6175 stmt_ty _res = NULL;
6176 int _mark = p->mark;
6177 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6178 p->error_indicator = 1;
6179 D(p->level--);
6180 return NULL;
6181 }
6182 int _start_lineno = p->tokens[_mark]->lineno;
6183 UNUSED(_start_lineno); // Only used by EXTRA macro
6184 int _start_col_offset = p->tokens[_mark]->col_offset;
6185 UNUSED(_start_col_offset); // Only used by EXTRA macro
6186 { // 'class' NAME ['(' arguments? ')'] ':' block
6187 if (p->error_indicator) {
6188 D(p->level--);
6189 return NULL;
6190 }
6191 D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6192 Token * _keyword;
6193 Token * _literal;
6194 expr_ty a;
6195 void *b;
Pablo Galindoa5634c42020-09-16 19:42:00 +01006196 asdl_stmt_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006197 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006198 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006199 &&
6200 (a = _PyPegen_name_token(p)) // NAME
6201 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006202 (b = _tmp_69_rule(p), 1) // ['(' arguments? ')']
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006203 &&
6204 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
6205 &&
6206 (c = block_rule(p)) // block
6207 )
6208 {
6209 D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6210 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6211 if (_token == NULL) {
6212 D(p->level--);
6213 return NULL;
6214 }
6215 int _end_lineno = _token->end_lineno;
6216 UNUSED(_end_lineno); // Only used by EXTRA macro
6217 int _end_col_offset = _token->end_col_offset;
6218 UNUSED(_end_col_offset); // Only used by EXTRA macro
6219 _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 );
6220 if (_res == NULL && PyErr_Occurred()) {
6221 p->error_indicator = 1;
6222 D(p->level--);
6223 return NULL;
6224 }
6225 goto done;
6226 }
6227 p->mark = _mark;
6228 D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
6229 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6230 }
6231 _res = NULL;
6232 done:
6233 D(p->level--);
6234 return _res;
6235}
6236
6237// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
Pablo Galindoa5634c42020-09-16 19:42:00 +01006238static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006239block_rule(Parser *p)
6240{
6241 D(p->level++);
6242 if (p->error_indicator) {
6243 D(p->level--);
6244 return NULL;
6245 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006246 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006247 if (_PyPegen_is_memoized(p, block_type, &_res)) {
6248 D(p->level--);
6249 return _res;
6250 }
6251 int _mark = p->mark;
6252 { // NEWLINE INDENT statements DEDENT
6253 if (p->error_indicator) {
6254 D(p->level--);
6255 return NULL;
6256 }
6257 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01006258 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006259 Token * dedent_var;
6260 Token * indent_var;
6261 Token * newline_var;
6262 if (
6263 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
6264 &&
6265 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
6266 &&
6267 (a = statements_rule(p)) // statements
6268 &&
6269 (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
6270 )
6271 {
6272 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6273 _res = a;
6274 if (_res == NULL && PyErr_Occurred()) {
6275 p->error_indicator = 1;
6276 D(p->level--);
6277 return NULL;
6278 }
6279 goto done;
6280 }
6281 p->mark = _mark;
6282 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6283 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6284 }
6285 { // simple_stmt
6286 if (p->error_indicator) {
6287 D(p->level--);
6288 return NULL;
6289 }
6290 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01006291 asdl_stmt_seq* simple_stmt_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006292 if (
6293 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
6294 )
6295 {
6296 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
6297 _res = simple_stmt_var;
6298 goto done;
6299 }
6300 p->mark = _mark;
6301 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6302 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
6303 }
6304 { // invalid_block
6305 if (p->error_indicator) {
6306 D(p->level--);
6307 return NULL;
6308 }
6309 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6310 void *invalid_block_var;
6311 if (
6312 (invalid_block_var = invalid_block_rule(p)) // invalid_block
6313 )
6314 {
6315 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6316 _res = invalid_block_var;
6317 goto done;
6318 }
6319 p->mark = _mark;
6320 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6321 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
6322 }
6323 _res = NULL;
6324 done:
6325 _PyPegen_insert_memo(p, _mark, block_type, _res);
6326 D(p->level--);
6327 return _res;
6328}
6329
6330// expressions_list: ','.star_expression+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +01006331static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006332expressions_list_rule(Parser *p)
6333{
6334 D(p->level++);
6335 if (p->error_indicator) {
6336 D(p->level--);
6337 return NULL;
6338 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006339 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006340 int _mark = p->mark;
6341 { // ','.star_expression+ ','?
6342 if (p->error_indicator) {
6343 D(p->level--);
6344 return NULL;
6345 }
6346 D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6347 void *_opt_var;
6348 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01006349 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006350 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01006351 (a = (asdl_expr_seq*)_gather_70_rule(p)) // ','.star_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006352 &&
6353 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6354 )
6355 {
6356 D(fprintf(stderr, "%*c+ expressions_list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6357 _res = a;
6358 if (_res == NULL && PyErr_Occurred()) {
6359 p->error_indicator = 1;
6360 D(p->level--);
6361 return NULL;
6362 }
6363 goto done;
6364 }
6365 p->mark = _mark;
6366 D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ',
6367 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?"));
6368 }
6369 _res = NULL;
6370 done:
6371 D(p->level--);
6372 return _res;
6373}
6374
6375// star_expressions:
6376// | star_expression ((',' star_expression))+ ','?
6377// | star_expression ','
6378// | star_expression
6379static expr_ty
6380star_expressions_rule(Parser *p)
6381{
6382 D(p->level++);
6383 if (p->error_indicator) {
6384 D(p->level--);
6385 return NULL;
6386 }
6387 expr_ty _res = NULL;
6388 int _mark = p->mark;
6389 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6390 p->error_indicator = 1;
6391 D(p->level--);
6392 return NULL;
6393 }
6394 int _start_lineno = p->tokens[_mark]->lineno;
6395 UNUSED(_start_lineno); // Only used by EXTRA macro
6396 int _start_col_offset = p->tokens[_mark]->col_offset;
6397 UNUSED(_start_col_offset); // Only used by EXTRA macro
6398 { // star_expression ((',' star_expression))+ ','?
6399 if (p->error_indicator) {
6400 D(p->level--);
6401 return NULL;
6402 }
6403 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6404 void *_opt_var;
6405 UNUSED(_opt_var); // Silence compiler warnings
6406 expr_ty a;
6407 asdl_seq * b;
6408 if (
6409 (a = star_expression_rule(p)) // star_expression
6410 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006411 (b = _loop1_72_rule(p)) // ((',' star_expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006412 &&
6413 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6414 )
6415 {
6416 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6417 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6418 if (_token == NULL) {
6419 D(p->level--);
6420 return NULL;
6421 }
6422 int _end_lineno = _token->end_lineno;
6423 UNUSED(_end_lineno); // Only used by EXTRA macro
6424 int _end_col_offset = _token->end_col_offset;
6425 UNUSED(_end_col_offset); // Only used by EXTRA macro
6426 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
6427 if (_res == NULL && PyErr_Occurred()) {
6428 p->error_indicator = 1;
6429 D(p->level--);
6430 return NULL;
6431 }
6432 goto done;
6433 }
6434 p->mark = _mark;
6435 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6436 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6437 }
6438 { // star_expression ','
6439 if (p->error_indicator) {
6440 D(p->level--);
6441 return NULL;
6442 }
6443 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6444 Token * _literal;
6445 expr_ty a;
6446 if (
6447 (a = star_expression_rule(p)) // star_expression
6448 &&
6449 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6450 )
6451 {
6452 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6453 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6454 if (_token == NULL) {
6455 D(p->level--);
6456 return NULL;
6457 }
6458 int _end_lineno = _token->end_lineno;
6459 UNUSED(_end_lineno); // Only used by EXTRA macro
6460 int _end_col_offset = _token->end_col_offset;
6461 UNUSED(_end_col_offset); // Only used by EXTRA macro
6462 _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
6463 if (_res == NULL && PyErr_Occurred()) {
6464 p->error_indicator = 1;
6465 D(p->level--);
6466 return NULL;
6467 }
6468 goto done;
6469 }
6470 p->mark = _mark;
6471 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6472 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','"));
6473 }
6474 { // star_expression
6475 if (p->error_indicator) {
6476 D(p->level--);
6477 return NULL;
6478 }
6479 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression"));
6480 expr_ty star_expression_var;
6481 if (
6482 (star_expression_var = star_expression_rule(p)) // star_expression
6483 )
6484 {
6485 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression"));
6486 _res = star_expression_var;
6487 goto done;
6488 }
6489 p->mark = _mark;
6490 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6491 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression"));
6492 }
6493 _res = NULL;
6494 done:
6495 D(p->level--);
6496 return _res;
6497}
6498
6499// star_expression: '*' bitwise_or | expression
6500static expr_ty
6501star_expression_rule(Parser *p)
6502{
6503 D(p->level++);
6504 if (p->error_indicator) {
6505 D(p->level--);
6506 return NULL;
6507 }
6508 expr_ty _res = NULL;
6509 if (_PyPegen_is_memoized(p, star_expression_type, &_res)) {
6510 D(p->level--);
6511 return _res;
6512 }
6513 int _mark = p->mark;
6514 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6515 p->error_indicator = 1;
6516 D(p->level--);
6517 return NULL;
6518 }
6519 int _start_lineno = p->tokens[_mark]->lineno;
6520 UNUSED(_start_lineno); // Only used by EXTRA macro
6521 int _start_col_offset = p->tokens[_mark]->col_offset;
6522 UNUSED(_start_col_offset); // Only used by EXTRA macro
6523 { // '*' bitwise_or
6524 if (p->error_indicator) {
6525 D(p->level--);
6526 return NULL;
6527 }
6528 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6529 Token * _literal;
6530 expr_ty a;
6531 if (
6532 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6533 &&
6534 (a = bitwise_or_rule(p)) // bitwise_or
6535 )
6536 {
6537 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6538 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6539 if (_token == NULL) {
6540 D(p->level--);
6541 return NULL;
6542 }
6543 int _end_lineno = _token->end_lineno;
6544 UNUSED(_end_lineno); // Only used by EXTRA macro
6545 int _end_col_offset = _token->end_col_offset;
6546 UNUSED(_end_col_offset); // Only used by EXTRA macro
6547 _res = _Py_Starred ( a , Load , EXTRA );
6548 if (_res == NULL && PyErr_Occurred()) {
6549 p->error_indicator = 1;
6550 D(p->level--);
6551 return NULL;
6552 }
6553 goto done;
6554 }
6555 p->mark = _mark;
6556 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6557 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6558 }
6559 { // expression
6560 if (p->error_indicator) {
6561 D(p->level--);
6562 return NULL;
6563 }
6564 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6565 expr_ty expression_var;
6566 if (
6567 (expression_var = expression_rule(p)) // expression
6568 )
6569 {
6570 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6571 _res = expression_var;
6572 goto done;
6573 }
6574 p->mark = _mark;
6575 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6576 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6577 }
6578 _res = NULL;
6579 done:
6580 _PyPegen_insert_memo(p, _mark, star_expression_type, _res);
6581 D(p->level--);
6582 return _res;
6583}
6584
6585// star_named_expressions: ','.star_named_expression+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +01006586static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006587star_named_expressions_rule(Parser *p)
6588{
6589 D(p->level++);
6590 if (p->error_indicator) {
6591 D(p->level--);
6592 return NULL;
6593 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006594 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006595 int _mark = p->mark;
6596 { // ','.star_named_expression+ ','?
6597 if (p->error_indicator) {
6598 D(p->level--);
6599 return NULL;
6600 }
6601 D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6602 void *_opt_var;
6603 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01006604 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006605 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01006606 (a = (asdl_expr_seq*)_gather_73_rule(p)) // ','.star_named_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006607 &&
6608 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6609 )
6610 {
6611 D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6612 _res = a;
6613 if (_res == NULL && PyErr_Occurred()) {
6614 p->error_indicator = 1;
6615 D(p->level--);
6616 return NULL;
6617 }
6618 goto done;
6619 }
6620 p->mark = _mark;
6621 D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6622 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?"));
6623 }
6624 _res = NULL;
6625 done:
6626 D(p->level--);
6627 return _res;
6628}
6629
6630// star_named_expression: '*' bitwise_or | named_expression
6631static expr_ty
6632star_named_expression_rule(Parser *p)
6633{
6634 D(p->level++);
6635 if (p->error_indicator) {
6636 D(p->level--);
6637 return NULL;
6638 }
6639 expr_ty _res = NULL;
6640 int _mark = p->mark;
6641 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6642 p->error_indicator = 1;
6643 D(p->level--);
6644 return NULL;
6645 }
6646 int _start_lineno = p->tokens[_mark]->lineno;
6647 UNUSED(_start_lineno); // Only used by EXTRA macro
6648 int _start_col_offset = p->tokens[_mark]->col_offset;
6649 UNUSED(_start_col_offset); // Only used by EXTRA macro
6650 { // '*' bitwise_or
6651 if (p->error_indicator) {
6652 D(p->level--);
6653 return NULL;
6654 }
6655 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6656 Token * _literal;
6657 expr_ty a;
6658 if (
6659 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6660 &&
6661 (a = bitwise_or_rule(p)) // bitwise_or
6662 )
6663 {
6664 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6665 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6666 if (_token == NULL) {
6667 D(p->level--);
6668 return NULL;
6669 }
6670 int _end_lineno = _token->end_lineno;
6671 UNUSED(_end_lineno); // Only used by EXTRA macro
6672 int _end_col_offset = _token->end_col_offset;
6673 UNUSED(_end_col_offset); // Only used by EXTRA macro
6674 _res = _Py_Starred ( a , Load , EXTRA );
6675 if (_res == NULL && PyErr_Occurred()) {
6676 p->error_indicator = 1;
6677 D(p->level--);
6678 return NULL;
6679 }
6680 goto done;
6681 }
6682 p->mark = _mark;
6683 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6684 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6685 }
6686 { // named_expression
6687 if (p->error_indicator) {
6688 D(p->level--);
6689 return NULL;
6690 }
6691 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
6692 expr_ty named_expression_var;
6693 if (
6694 (named_expression_var = named_expression_rule(p)) // named_expression
6695 )
6696 {
6697 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
6698 _res = named_expression_var;
6699 goto done;
6700 }
6701 p->mark = _mark;
6702 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6703 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
6704 }
6705 _res = NULL;
6706 done:
6707 D(p->level--);
6708 return _res;
6709}
6710
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006711// named_expression: NAME ':=' ~ expression | expression !':=' | invalid_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006712static expr_ty
6713named_expression_rule(Parser *p)
6714{
6715 D(p->level++);
6716 if (p->error_indicator) {
6717 D(p->level--);
6718 return NULL;
6719 }
6720 expr_ty _res = NULL;
6721 int _mark = p->mark;
6722 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6723 p->error_indicator = 1;
6724 D(p->level--);
6725 return NULL;
6726 }
6727 int _start_lineno = p->tokens[_mark]->lineno;
6728 UNUSED(_start_lineno); // Only used by EXTRA macro
6729 int _start_col_offset = p->tokens[_mark]->col_offset;
6730 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006731 { // NAME ':=' ~ expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006732 if (p->error_indicator) {
6733 D(p->level--);
6734 return NULL;
6735 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006736 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
6737 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006738 Token * _literal;
6739 expr_ty a;
6740 expr_ty b;
6741 if (
6742 (a = _PyPegen_name_token(p)) // NAME
6743 &&
6744 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
6745 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006746 (_cut_var = 1)
6747 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006748 (b = expression_rule(p)) // expression
6749 )
6750 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006751 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 +01006752 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6753 if (_token == NULL) {
6754 D(p->level--);
6755 return NULL;
6756 }
6757 int _end_lineno = _token->end_lineno;
6758 UNUSED(_end_lineno); // Only used by EXTRA macro
6759 int _end_col_offset = _token->end_col_offset;
6760 UNUSED(_end_col_offset); // Only used by EXTRA macro
6761 _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
6762 if (_res == NULL && PyErr_Occurred()) {
6763 p->error_indicator = 1;
6764 D(p->level--);
6765 return NULL;
6766 }
6767 goto done;
6768 }
6769 p->mark = _mark;
6770 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006771 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression"));
6772 if (_cut_var) {
6773 D(p->level--);
6774 return NULL;
6775 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006776 }
6777 { // expression !':='
6778 if (p->error_indicator) {
6779 D(p->level--);
6780 return NULL;
6781 }
6782 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6783 expr_ty expression_var;
6784 if (
6785 (expression_var = expression_rule(p)) // expression
6786 &&
6787 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
6788 )
6789 {
6790 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6791 _res = expression_var;
6792 goto done;
6793 }
6794 p->mark = _mark;
6795 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6796 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
6797 }
6798 { // invalid_named_expression
6799 if (p->error_indicator) {
6800 D(p->level--);
6801 return NULL;
6802 }
6803 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6804 void *invalid_named_expression_var;
6805 if (
6806 (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression
6807 )
6808 {
6809 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6810 _res = invalid_named_expression_var;
6811 goto done;
6812 }
6813 p->mark = _mark;
6814 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6815 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression"));
6816 }
6817 _res = NULL;
6818 done:
6819 D(p->level--);
6820 return _res;
6821}
6822
6823// annotated_rhs: yield_expr | star_expressions
6824static expr_ty
6825annotated_rhs_rule(Parser *p)
6826{
6827 D(p->level++);
6828 if (p->error_indicator) {
6829 D(p->level--);
6830 return NULL;
6831 }
6832 expr_ty _res = NULL;
6833 int _mark = p->mark;
6834 { // yield_expr
6835 if (p->error_indicator) {
6836 D(p->level--);
6837 return NULL;
6838 }
6839 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6840 expr_ty yield_expr_var;
6841 if (
6842 (yield_expr_var = yield_expr_rule(p)) // yield_expr
6843 )
6844 {
6845 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6846 _res = yield_expr_var;
6847 goto done;
6848 }
6849 p->mark = _mark;
6850 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6851 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
6852 }
6853 { // star_expressions
6854 if (p->error_indicator) {
6855 D(p->level--);
6856 return NULL;
6857 }
6858 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6859 expr_ty star_expressions_var;
6860 if (
6861 (star_expressions_var = star_expressions_rule(p)) // star_expressions
6862 )
6863 {
6864 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6865 _res = star_expressions_var;
6866 goto done;
6867 }
6868 p->mark = _mark;
6869 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6870 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
6871 }
6872 _res = NULL;
6873 done:
6874 D(p->level--);
6875 return _res;
6876}
6877
6878// expressions: expression ((',' expression))+ ','? | expression ',' | expression
6879static expr_ty
6880expressions_rule(Parser *p)
6881{
6882 D(p->level++);
6883 if (p->error_indicator) {
6884 D(p->level--);
6885 return NULL;
6886 }
6887 expr_ty _res = NULL;
6888 int _mark = p->mark;
6889 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6890 p->error_indicator = 1;
6891 D(p->level--);
6892 return NULL;
6893 }
6894 int _start_lineno = p->tokens[_mark]->lineno;
6895 UNUSED(_start_lineno); // Only used by EXTRA macro
6896 int _start_col_offset = p->tokens[_mark]->col_offset;
6897 UNUSED(_start_col_offset); // Only used by EXTRA macro
6898 { // expression ((',' expression))+ ','?
6899 if (p->error_indicator) {
6900 D(p->level--);
6901 return NULL;
6902 }
6903 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6904 void *_opt_var;
6905 UNUSED(_opt_var); // Silence compiler warnings
6906 expr_ty a;
6907 asdl_seq * b;
6908 if (
6909 (a = expression_rule(p)) // expression
6910 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006911 (b = _loop1_75_rule(p)) // ((',' expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006912 &&
6913 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6914 )
6915 {
6916 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6917 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6918 if (_token == NULL) {
6919 D(p->level--);
6920 return NULL;
6921 }
6922 int _end_lineno = _token->end_lineno;
6923 UNUSED(_end_lineno); // Only used by EXTRA macro
6924 int _end_col_offset = _token->end_col_offset;
6925 UNUSED(_end_col_offset); // Only used by EXTRA macro
6926 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
6927 if (_res == NULL && PyErr_Occurred()) {
6928 p->error_indicator = 1;
6929 D(p->level--);
6930 return NULL;
6931 }
6932 goto done;
6933 }
6934 p->mark = _mark;
6935 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6936 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
6937 }
6938 { // expression ','
6939 if (p->error_indicator) {
6940 D(p->level--);
6941 return NULL;
6942 }
6943 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
6944 Token * _literal;
6945 expr_ty a;
6946 if (
6947 (a = expression_rule(p)) // expression
6948 &&
6949 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6950 )
6951 {
6952 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
6953 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6954 if (_token == NULL) {
6955 D(p->level--);
6956 return NULL;
6957 }
6958 int _end_lineno = _token->end_lineno;
6959 UNUSED(_end_lineno); // Only used by EXTRA macro
6960 int _end_col_offset = _token->end_col_offset;
6961 UNUSED(_end_col_offset); // Only used by EXTRA macro
6962 _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
6963 if (_res == NULL && PyErr_Occurred()) {
6964 p->error_indicator = 1;
6965 D(p->level--);
6966 return NULL;
6967 }
6968 goto done;
6969 }
6970 p->mark = _mark;
6971 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6972 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
6973 }
6974 { // expression
6975 if (p->error_indicator) {
6976 D(p->level--);
6977 return NULL;
6978 }
6979 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6980 expr_ty expression_var;
6981 if (
6982 (expression_var = expression_rule(p)) // expression
6983 )
6984 {
6985 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6986 _res = expression_var;
6987 goto done;
6988 }
6989 p->mark = _mark;
6990 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6991 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6992 }
6993 _res = NULL;
6994 done:
6995 D(p->level--);
6996 return _res;
6997}
6998
6999// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
7000static expr_ty
7001expression_rule(Parser *p)
7002{
7003 D(p->level++);
7004 if (p->error_indicator) {
7005 D(p->level--);
7006 return NULL;
7007 }
7008 expr_ty _res = NULL;
7009 if (_PyPegen_is_memoized(p, expression_type, &_res)) {
7010 D(p->level--);
7011 return _res;
7012 }
7013 int _mark = p->mark;
7014 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7015 p->error_indicator = 1;
7016 D(p->level--);
7017 return NULL;
7018 }
7019 int _start_lineno = p->tokens[_mark]->lineno;
7020 UNUSED(_start_lineno); // Only used by EXTRA macro
7021 int _start_col_offset = p->tokens[_mark]->col_offset;
7022 UNUSED(_start_col_offset); // Only used by EXTRA macro
7023 { // disjunction 'if' disjunction 'else' expression
7024 if (p->error_indicator) {
7025 D(p->level--);
7026 return NULL;
7027 }
7028 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7029 Token * _keyword;
7030 Token * _keyword_1;
7031 expr_ty a;
7032 expr_ty b;
7033 expr_ty c;
7034 if (
7035 (a = disjunction_rule(p)) // disjunction
7036 &&
7037 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
7038 &&
7039 (b = disjunction_rule(p)) // disjunction
7040 &&
7041 (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else'
7042 &&
7043 (c = expression_rule(p)) // expression
7044 )
7045 {
7046 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7047 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7048 if (_token == NULL) {
7049 D(p->level--);
7050 return NULL;
7051 }
7052 int _end_lineno = _token->end_lineno;
7053 UNUSED(_end_lineno); // Only used by EXTRA macro
7054 int _end_col_offset = _token->end_col_offset;
7055 UNUSED(_end_col_offset); // Only used by EXTRA macro
7056 _res = _Py_IfExp ( b , a , c , EXTRA );
7057 if (_res == NULL && PyErr_Occurred()) {
7058 p->error_indicator = 1;
7059 D(p->level--);
7060 return NULL;
7061 }
7062 goto done;
7063 }
7064 p->mark = _mark;
7065 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7066 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7067 }
7068 { // disjunction
7069 if (p->error_indicator) {
7070 D(p->level--);
7071 return NULL;
7072 }
7073 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
7074 expr_ty disjunction_var;
7075 if (
7076 (disjunction_var = disjunction_rule(p)) // disjunction
7077 )
7078 {
7079 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
7080 _res = disjunction_var;
7081 goto done;
7082 }
7083 p->mark = _mark;
7084 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7085 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
7086 }
7087 { // lambdef
7088 if (p->error_indicator) {
7089 D(p->level--);
7090 return NULL;
7091 }
7092 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
7093 expr_ty lambdef_var;
7094 if (
7095 (lambdef_var = lambdef_rule(p)) // lambdef
7096 )
7097 {
7098 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
7099 _res = lambdef_var;
7100 goto done;
7101 }
7102 p->mark = _mark;
7103 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7104 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
7105 }
7106 _res = NULL;
7107 done:
7108 _PyPegen_insert_memo(p, _mark, expression_type, _res);
7109 D(p->level--);
7110 return _res;
7111}
7112
7113// lambdef: 'lambda' lambda_params? ':' expression
7114static expr_ty
7115lambdef_rule(Parser *p)
7116{
7117 D(p->level++);
7118 if (p->error_indicator) {
7119 D(p->level--);
7120 return NULL;
7121 }
7122 expr_ty _res = NULL;
7123 int _mark = p->mark;
7124 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7125 p->error_indicator = 1;
7126 D(p->level--);
7127 return NULL;
7128 }
7129 int _start_lineno = p->tokens[_mark]->lineno;
7130 UNUSED(_start_lineno); // Only used by EXTRA macro
7131 int _start_col_offset = p->tokens[_mark]->col_offset;
7132 UNUSED(_start_col_offset); // Only used by EXTRA macro
7133 { // 'lambda' lambda_params? ':' expression
7134 if (p->error_indicator) {
7135 D(p->level--);
7136 return NULL;
7137 }
7138 D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7139 Token * _keyword;
7140 Token * _literal;
7141 void *a;
7142 expr_ty b;
7143 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007144 (_keyword = _PyPegen_expect_token(p, 525)) // token='lambda'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007145 &&
7146 (a = lambda_params_rule(p), 1) // lambda_params?
7147 &&
7148 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
7149 &&
7150 (b = expression_rule(p)) // expression
7151 )
7152 {
7153 D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7154 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7155 if (_token == NULL) {
7156 D(p->level--);
7157 return NULL;
7158 }
7159 int _end_lineno = _token->end_lineno;
7160 UNUSED(_end_lineno); // Only used by EXTRA macro
7161 int _end_col_offset = _token->end_col_offset;
7162 UNUSED(_end_col_offset); // Only used by EXTRA macro
7163 _res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
7164 if (_res == NULL && PyErr_Occurred()) {
7165 p->error_indicator = 1;
7166 D(p->level--);
7167 return NULL;
7168 }
7169 goto done;
7170 }
7171 p->mark = _mark;
7172 D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
7173 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7174 }
7175 _res = NULL;
7176 done:
7177 D(p->level--);
7178 return _res;
7179}
7180
7181// lambda_params: invalid_lambda_parameters | lambda_parameters
7182static arguments_ty
7183lambda_params_rule(Parser *p)
7184{
7185 D(p->level++);
7186 if (p->error_indicator) {
7187 D(p->level--);
7188 return NULL;
7189 }
7190 arguments_ty _res = NULL;
7191 int _mark = p->mark;
7192 { // invalid_lambda_parameters
7193 if (p->error_indicator) {
7194 D(p->level--);
7195 return NULL;
7196 }
7197 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7198 void *invalid_lambda_parameters_var;
7199 if (
7200 (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters
7201 )
7202 {
7203 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7204 _res = invalid_lambda_parameters_var;
7205 goto done;
7206 }
7207 p->mark = _mark;
7208 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7209 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
7210 }
7211 { // lambda_parameters
7212 if (p->error_indicator) {
7213 D(p->level--);
7214 return NULL;
7215 }
7216 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7217 arguments_ty lambda_parameters_var;
7218 if (
7219 (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters
7220 )
7221 {
7222 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7223 _res = lambda_parameters_var;
7224 goto done;
7225 }
7226 p->mark = _mark;
7227 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7228 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
7229 }
7230 _res = NULL;
7231 done:
7232 D(p->level--);
7233 return _res;
7234}
7235
7236// lambda_parameters:
7237// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7238// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7239// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7240// | lambda_param_with_default+ lambda_star_etc?
7241// | lambda_star_etc
7242static arguments_ty
7243lambda_parameters_rule(Parser *p)
7244{
7245 D(p->level++);
7246 if (p->error_indicator) {
7247 D(p->level--);
7248 return NULL;
7249 }
7250 arguments_ty _res = NULL;
7251 int _mark = p->mark;
7252 { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7253 if (p->error_indicator) {
7254 D(p->level--);
7255 return NULL;
7256 }
7257 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?"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01007258 asdl_arg_seq* a;
7259 asdl_arg_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007260 asdl_seq * c;
7261 void *d;
7262 if (
7263 (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
7264 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01007265 (b = (asdl_arg_seq*)_loop0_76_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007266 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007267 (c = _loop0_77_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007268 &&
7269 (d = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7270 )
7271 {
7272 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?"));
7273 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
7274 if (_res == NULL && PyErr_Occurred()) {
7275 p->error_indicator = 1;
7276 D(p->level--);
7277 return NULL;
7278 }
7279 goto done;
7280 }
7281 p->mark = _mark;
7282 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7283 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
7284 }
7285 { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7286 if (p->error_indicator) {
7287 D(p->level--);
7288 return NULL;
7289 }
7290 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?"));
7291 SlashWithDefault* a;
7292 asdl_seq * b;
7293 void *c;
7294 if (
7295 (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
7296 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007297 (b = _loop0_78_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007298 &&
7299 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7300 )
7301 {
7302 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?"));
7303 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
7304 if (_res == NULL && PyErr_Occurred()) {
7305 p->error_indicator = 1;
7306 D(p->level--);
7307 return NULL;
7308 }
7309 goto done;
7310 }
7311 p->mark = _mark;
7312 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7313 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
7314 }
7315 { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7316 if (p->error_indicator) {
7317 D(p->level--);
7318 return NULL;
7319 }
7320 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?"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01007321 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007322 asdl_seq * b;
7323 void *c;
7324 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01007325 (a = (asdl_arg_seq*)_loop1_79_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007326 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007327 (b = _loop0_80_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007328 &&
7329 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7330 )
7331 {
7332 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?"));
7333 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
7334 if (_res == NULL && PyErr_Occurred()) {
7335 p->error_indicator = 1;
7336 D(p->level--);
7337 return NULL;
7338 }
7339 goto done;
7340 }
7341 p->mark = _mark;
7342 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7343 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
7344 }
7345 { // lambda_param_with_default+ lambda_star_etc?
7346 if (p->error_indicator) {
7347 D(p->level--);
7348 return NULL;
7349 }
7350 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7351 asdl_seq * a;
7352 void *b;
7353 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007354 (a = _loop1_81_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007355 &&
7356 (b = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7357 )
7358 {
7359 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7360 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
7361 if (_res == NULL && PyErr_Occurred()) {
7362 p->error_indicator = 1;
7363 D(p->level--);
7364 return NULL;
7365 }
7366 goto done;
7367 }
7368 p->mark = _mark;
7369 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7370 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7371 }
7372 { // lambda_star_etc
7373 if (p->error_indicator) {
7374 D(p->level--);
7375 return NULL;
7376 }
7377 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7378 StarEtc* a;
7379 if (
7380 (a = lambda_star_etc_rule(p)) // lambda_star_etc
7381 )
7382 {
7383 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7384 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
7385 if (_res == NULL && PyErr_Occurred()) {
7386 p->error_indicator = 1;
7387 D(p->level--);
7388 return NULL;
7389 }
7390 goto done;
7391 }
7392 p->mark = _mark;
7393 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7394 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
7395 }
7396 _res = NULL;
7397 done:
7398 D(p->level--);
7399 return _res;
7400}
7401
7402// lambda_slash_no_default:
7403// | lambda_param_no_default+ '/' ','
7404// | lambda_param_no_default+ '/' &':'
Pablo Galindoa5634c42020-09-16 19:42:00 +01007405static asdl_arg_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007406lambda_slash_no_default_rule(Parser *p)
7407{
7408 D(p->level++);
7409 if (p->error_indicator) {
7410 D(p->level--);
7411 return NULL;
7412 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01007413 asdl_arg_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007414 int _mark = p->mark;
7415 { // lambda_param_no_default+ '/' ','
7416 if (p->error_indicator) {
7417 D(p->level--);
7418 return NULL;
7419 }
7420 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7421 Token * _literal;
7422 Token * _literal_1;
Pablo Galindoa5634c42020-09-16 19:42:00 +01007423 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007424 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01007425 (a = (asdl_arg_seq*)_loop1_82_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007426 &&
7427 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7428 &&
7429 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7430 )
7431 {
7432 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7433 _res = a;
7434 if (_res == NULL && PyErr_Occurred()) {
7435 p->error_indicator = 1;
7436 D(p->level--);
7437 return NULL;
7438 }
7439 goto done;
7440 }
7441 p->mark = _mark;
7442 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7443 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7444 }
7445 { // lambda_param_no_default+ '/' &':'
7446 if (p->error_indicator) {
7447 D(p->level--);
7448 return NULL;
7449 }
7450 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7451 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01007452 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007453 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01007454 (a = (asdl_arg_seq*)_loop1_83_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007455 &&
7456 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7457 &&
7458 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7459 )
7460 {
7461 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7462 _res = a;
7463 if (_res == NULL && PyErr_Occurred()) {
7464 p->error_indicator = 1;
7465 D(p->level--);
7466 return NULL;
7467 }
7468 goto done;
7469 }
7470 p->mark = _mark;
7471 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7472 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7473 }
7474 _res = NULL;
7475 done:
7476 D(p->level--);
7477 return _res;
7478}
7479
7480// lambda_slash_with_default:
7481// | lambda_param_no_default* lambda_param_with_default+ '/' ','
7482// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
7483static SlashWithDefault*
7484lambda_slash_with_default_rule(Parser *p)
7485{
7486 D(p->level++);
7487 if (p->error_indicator) {
7488 D(p->level--);
7489 return NULL;
7490 }
7491 SlashWithDefault* _res = NULL;
7492 int _mark = p->mark;
7493 { // lambda_param_no_default* lambda_param_with_default+ '/' ','
7494 if (p->error_indicator) {
7495 D(p->level--);
7496 return NULL;
7497 }
7498 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+ '/' ','"));
7499 Token * _literal;
7500 Token * _literal_1;
7501 asdl_seq * a;
7502 asdl_seq * b;
7503 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007504 (a = _loop0_84_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007505 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007506 (b = _loop1_85_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007507 &&
7508 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7509 &&
7510 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7511 )
7512 {
7513 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+ '/' ','"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01007514 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007515 if (_res == NULL && PyErr_Occurred()) {
7516 p->error_indicator = 1;
7517 D(p->level--);
7518 return NULL;
7519 }
7520 goto done;
7521 }
7522 p->mark = _mark;
7523 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7524 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
7525 }
7526 { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
7527 if (p->error_indicator) {
7528 D(p->level--);
7529 return NULL;
7530 }
7531 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+ '/' &':'"));
7532 Token * _literal;
7533 asdl_seq * a;
7534 asdl_seq * b;
7535 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007536 (a = _loop0_86_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007537 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007538 (b = _loop1_87_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007539 &&
7540 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7541 &&
7542 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7543 )
7544 {
7545 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+ '/' &':'"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01007546 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007547 if (_res == NULL && PyErr_Occurred()) {
7548 p->error_indicator = 1;
7549 D(p->level--);
7550 return NULL;
7551 }
7552 goto done;
7553 }
7554 p->mark = _mark;
7555 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7556 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
7557 }
7558 _res = NULL;
7559 done:
7560 D(p->level--);
7561 return _res;
7562}
7563
7564// lambda_star_etc:
7565// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7566// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
7567// | lambda_kwds
7568// | invalid_lambda_star_etc
7569static StarEtc*
7570lambda_star_etc_rule(Parser *p)
7571{
7572 D(p->level++);
7573 if (p->error_indicator) {
7574 D(p->level--);
7575 return NULL;
7576 }
7577 StarEtc* _res = NULL;
7578 int _mark = p->mark;
7579 { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7580 if (p->error_indicator) {
7581 D(p->level--);
7582 return NULL;
7583 }
7584 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?"));
7585 Token * _literal;
7586 arg_ty a;
7587 asdl_seq * b;
7588 void *c;
7589 if (
7590 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7591 &&
7592 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7593 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007594 (b = _loop0_88_rule(p)) // lambda_param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007595 &&
7596 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7597 )
7598 {
7599 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?"));
7600 _res = _PyPegen_star_etc ( p , a , b , c );
7601 if (_res == NULL && PyErr_Occurred()) {
7602 p->error_indicator = 1;
7603 D(p->level--);
7604 return NULL;
7605 }
7606 goto done;
7607 }
7608 p->mark = _mark;
7609 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7610 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
7611 }
7612 { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
7613 if (p->error_indicator) {
7614 D(p->level--);
7615 return NULL;
7616 }
7617 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7618 Token * _literal;
7619 Token * _literal_1;
7620 asdl_seq * b;
7621 void *c;
7622 if (
7623 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7624 &&
7625 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7626 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007627 (b = _loop1_89_rule(p)) // lambda_param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007628 &&
7629 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7630 )
7631 {
7632 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7633 _res = _PyPegen_star_etc ( p , NULL , b , c );
7634 if (_res == NULL && PyErr_Occurred()) {
7635 p->error_indicator = 1;
7636 D(p->level--);
7637 return NULL;
7638 }
7639 goto done;
7640 }
7641 p->mark = _mark;
7642 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7643 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7644 }
7645 { // lambda_kwds
7646 if (p->error_indicator) {
7647 D(p->level--);
7648 return NULL;
7649 }
7650 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7651 arg_ty a;
7652 if (
7653 (a = lambda_kwds_rule(p)) // lambda_kwds
7654 )
7655 {
7656 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7657 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
7658 if (_res == NULL && PyErr_Occurred()) {
7659 p->error_indicator = 1;
7660 D(p->level--);
7661 return NULL;
7662 }
7663 goto done;
7664 }
7665 p->mark = _mark;
7666 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7667 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
7668 }
7669 { // invalid_lambda_star_etc
7670 if (p->error_indicator) {
7671 D(p->level--);
7672 return NULL;
7673 }
7674 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7675 void *invalid_lambda_star_etc_var;
7676 if (
7677 (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc
7678 )
7679 {
7680 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7681 _res = invalid_lambda_star_etc_var;
7682 goto done;
7683 }
7684 p->mark = _mark;
7685 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7686 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
7687 }
7688 _res = NULL;
7689 done:
7690 D(p->level--);
7691 return _res;
7692}
7693
7694// lambda_kwds: '**' lambda_param_no_default
7695static arg_ty
7696lambda_kwds_rule(Parser *p)
7697{
7698 D(p->level++);
7699 if (p->error_indicator) {
7700 D(p->level--);
7701 return NULL;
7702 }
7703 arg_ty _res = NULL;
7704 int _mark = p->mark;
7705 { // '**' lambda_param_no_default
7706 if (p->error_indicator) {
7707 D(p->level--);
7708 return NULL;
7709 }
7710 D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7711 Token * _literal;
7712 arg_ty a;
7713 if (
7714 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
7715 &&
7716 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7717 )
7718 {
7719 D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7720 _res = a;
7721 if (_res == NULL && PyErr_Occurred()) {
7722 p->error_indicator = 1;
7723 D(p->level--);
7724 return NULL;
7725 }
7726 goto done;
7727 }
7728 p->mark = _mark;
7729 D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
7730 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
7731 }
7732 _res = NULL;
7733 done:
7734 D(p->level--);
7735 return _res;
7736}
7737
7738// lambda_param_no_default: lambda_param ',' | lambda_param &':'
7739static arg_ty
7740lambda_param_no_default_rule(Parser *p)
7741{
7742 D(p->level++);
7743 if (p->error_indicator) {
7744 D(p->level--);
7745 return NULL;
7746 }
7747 arg_ty _res = NULL;
7748 int _mark = p->mark;
7749 { // lambda_param ','
7750 if (p->error_indicator) {
7751 D(p->level--);
7752 return NULL;
7753 }
7754 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7755 Token * _literal;
7756 arg_ty a;
7757 if (
7758 (a = lambda_param_rule(p)) // lambda_param
7759 &&
7760 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7761 )
7762 {
7763 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7764 _res = a;
7765 if (_res == NULL && PyErr_Occurred()) {
7766 p->error_indicator = 1;
7767 D(p->level--);
7768 return NULL;
7769 }
7770 goto done;
7771 }
7772 p->mark = _mark;
7773 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7774 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
7775 }
7776 { // lambda_param &':'
7777 if (p->error_indicator) {
7778 D(p->level--);
7779 return NULL;
7780 }
7781 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7782 arg_ty a;
7783 if (
7784 (a = lambda_param_rule(p)) // lambda_param
7785 &&
7786 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7787 )
7788 {
7789 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7790 _res = a;
7791 if (_res == NULL && PyErr_Occurred()) {
7792 p->error_indicator = 1;
7793 D(p->level--);
7794 return NULL;
7795 }
7796 goto done;
7797 }
7798 p->mark = _mark;
7799 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7800 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
7801 }
7802 _res = NULL;
7803 done:
7804 D(p->level--);
7805 return _res;
7806}
7807
7808// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
7809static NameDefaultPair*
7810lambda_param_with_default_rule(Parser *p)
7811{
7812 D(p->level++);
7813 if (p->error_indicator) {
7814 D(p->level--);
7815 return NULL;
7816 }
7817 NameDefaultPair* _res = NULL;
7818 int _mark = p->mark;
7819 { // lambda_param default ','
7820 if (p->error_indicator) {
7821 D(p->level--);
7822 return NULL;
7823 }
7824 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7825 Token * _literal;
7826 arg_ty a;
7827 expr_ty c;
7828 if (
7829 (a = lambda_param_rule(p)) // lambda_param
7830 &&
7831 (c = default_rule(p)) // default
7832 &&
7833 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7834 )
7835 {
7836 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7837 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7838 if (_res == NULL && PyErr_Occurred()) {
7839 p->error_indicator = 1;
7840 D(p->level--);
7841 return NULL;
7842 }
7843 goto done;
7844 }
7845 p->mark = _mark;
7846 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7847 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
7848 }
7849 { // lambda_param default &':'
7850 if (p->error_indicator) {
7851 D(p->level--);
7852 return NULL;
7853 }
7854 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7855 arg_ty a;
7856 expr_ty c;
7857 if (
7858 (a = lambda_param_rule(p)) // lambda_param
7859 &&
7860 (c = default_rule(p)) // default
7861 &&
7862 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7863 )
7864 {
7865 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7866 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7867 if (_res == NULL && PyErr_Occurred()) {
7868 p->error_indicator = 1;
7869 D(p->level--);
7870 return NULL;
7871 }
7872 goto done;
7873 }
7874 p->mark = _mark;
7875 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7876 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
7877 }
7878 _res = NULL;
7879 done:
7880 D(p->level--);
7881 return _res;
7882}
7883
7884// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
7885static NameDefaultPair*
7886lambda_param_maybe_default_rule(Parser *p)
7887{
7888 D(p->level++);
7889 if (p->error_indicator) {
7890 D(p->level--);
7891 return NULL;
7892 }
7893 NameDefaultPair* _res = NULL;
7894 int _mark = p->mark;
7895 { // lambda_param default? ','
7896 if (p->error_indicator) {
7897 D(p->level--);
7898 return NULL;
7899 }
7900 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7901 Token * _literal;
7902 arg_ty a;
7903 void *c;
7904 if (
7905 (a = lambda_param_rule(p)) // lambda_param
7906 &&
7907 (c = default_rule(p), 1) // default?
7908 &&
7909 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7910 )
7911 {
7912 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7913 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7914 if (_res == NULL && PyErr_Occurred()) {
7915 p->error_indicator = 1;
7916 D(p->level--);
7917 return NULL;
7918 }
7919 goto done;
7920 }
7921 p->mark = _mark;
7922 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7923 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
7924 }
7925 { // lambda_param default? &':'
7926 if (p->error_indicator) {
7927 D(p->level--);
7928 return NULL;
7929 }
7930 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7931 arg_ty a;
7932 void *c;
7933 if (
7934 (a = lambda_param_rule(p)) // lambda_param
7935 &&
7936 (c = default_rule(p), 1) // default?
7937 &&
7938 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7939 )
7940 {
7941 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7942 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7943 if (_res == NULL && PyErr_Occurred()) {
7944 p->error_indicator = 1;
7945 D(p->level--);
7946 return NULL;
7947 }
7948 goto done;
7949 }
7950 p->mark = _mark;
7951 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7952 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
7953 }
7954 _res = NULL;
7955 done:
7956 D(p->level--);
7957 return _res;
7958}
7959
7960// lambda_param: NAME
7961static arg_ty
7962lambda_param_rule(Parser *p)
7963{
7964 D(p->level++);
7965 if (p->error_indicator) {
7966 D(p->level--);
7967 return NULL;
7968 }
7969 arg_ty _res = NULL;
7970 int _mark = p->mark;
7971 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7972 p->error_indicator = 1;
7973 D(p->level--);
7974 return NULL;
7975 }
7976 int _start_lineno = p->tokens[_mark]->lineno;
7977 UNUSED(_start_lineno); // Only used by EXTRA macro
7978 int _start_col_offset = p->tokens[_mark]->col_offset;
7979 UNUSED(_start_col_offset); // Only used by EXTRA macro
7980 { // NAME
7981 if (p->error_indicator) {
7982 D(p->level--);
7983 return NULL;
7984 }
7985 D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
7986 expr_ty a;
7987 if (
7988 (a = _PyPegen_name_token(p)) // NAME
7989 )
7990 {
7991 D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
7992 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7993 if (_token == NULL) {
7994 D(p->level--);
7995 return NULL;
7996 }
7997 int _end_lineno = _token->end_lineno;
7998 UNUSED(_end_lineno); // Only used by EXTRA macro
7999 int _end_col_offset = _token->end_col_offset;
8000 UNUSED(_end_col_offset); // Only used by EXTRA macro
8001 _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
8002 if (_res == NULL && PyErr_Occurred()) {
8003 p->error_indicator = 1;
8004 D(p->level--);
8005 return NULL;
8006 }
8007 goto done;
8008 }
8009 p->mark = _mark;
8010 D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
8011 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
8012 }
8013 _res = NULL;
8014 done:
8015 D(p->level--);
8016 return _res;
8017}
8018
8019// disjunction: conjunction (('or' conjunction))+ | conjunction
8020static expr_ty
8021disjunction_rule(Parser *p)
8022{
8023 D(p->level++);
8024 if (p->error_indicator) {
8025 D(p->level--);
8026 return NULL;
8027 }
8028 expr_ty _res = NULL;
8029 if (_PyPegen_is_memoized(p, disjunction_type, &_res)) {
8030 D(p->level--);
8031 return _res;
8032 }
8033 int _mark = p->mark;
8034 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8035 p->error_indicator = 1;
8036 D(p->level--);
8037 return NULL;
8038 }
8039 int _start_lineno = p->tokens[_mark]->lineno;
8040 UNUSED(_start_lineno); // Only used by EXTRA macro
8041 int _start_col_offset = p->tokens[_mark]->col_offset;
8042 UNUSED(_start_col_offset); // Only used by EXTRA macro
8043 { // conjunction (('or' conjunction))+
8044 if (p->error_indicator) {
8045 D(p->level--);
8046 return NULL;
8047 }
8048 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8049 expr_ty a;
8050 asdl_seq * b;
8051 if (
8052 (a = conjunction_rule(p)) // conjunction
8053 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008054 (b = _loop1_90_rule(p)) // (('or' conjunction))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008055 )
8056 {
8057 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8058 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8059 if (_token == NULL) {
8060 D(p->level--);
8061 return NULL;
8062 }
8063 int _end_lineno = _token->end_lineno;
8064 UNUSED(_end_lineno); // Only used by EXTRA macro
8065 int _end_col_offset = _token->end_col_offset;
8066 UNUSED(_end_col_offset); // Only used by EXTRA macro
8067 _res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
8068 if (_res == NULL && PyErr_Occurred()) {
8069 p->error_indicator = 1;
8070 D(p->level--);
8071 return NULL;
8072 }
8073 goto done;
8074 }
8075 p->mark = _mark;
8076 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8077 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+"));
8078 }
8079 { // conjunction
8080 if (p->error_indicator) {
8081 D(p->level--);
8082 return NULL;
8083 }
8084 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction"));
8085 expr_ty conjunction_var;
8086 if (
8087 (conjunction_var = conjunction_rule(p)) // conjunction
8088 )
8089 {
8090 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction"));
8091 _res = conjunction_var;
8092 goto done;
8093 }
8094 p->mark = _mark;
8095 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8096 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction"));
8097 }
8098 _res = NULL;
8099 done:
8100 _PyPegen_insert_memo(p, _mark, disjunction_type, _res);
8101 D(p->level--);
8102 return _res;
8103}
8104
8105// conjunction: inversion (('and' inversion))+ | inversion
8106static expr_ty
8107conjunction_rule(Parser *p)
8108{
8109 D(p->level++);
8110 if (p->error_indicator) {
8111 D(p->level--);
8112 return NULL;
8113 }
8114 expr_ty _res = NULL;
8115 if (_PyPegen_is_memoized(p, conjunction_type, &_res)) {
8116 D(p->level--);
8117 return _res;
8118 }
8119 int _mark = p->mark;
8120 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8121 p->error_indicator = 1;
8122 D(p->level--);
8123 return NULL;
8124 }
8125 int _start_lineno = p->tokens[_mark]->lineno;
8126 UNUSED(_start_lineno); // Only used by EXTRA macro
8127 int _start_col_offset = p->tokens[_mark]->col_offset;
8128 UNUSED(_start_col_offset); // Only used by EXTRA macro
8129 { // inversion (('and' inversion))+
8130 if (p->error_indicator) {
8131 D(p->level--);
8132 return NULL;
8133 }
8134 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8135 expr_ty a;
8136 asdl_seq * b;
8137 if (
8138 (a = inversion_rule(p)) // inversion
8139 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008140 (b = _loop1_91_rule(p)) // (('and' inversion))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008141 )
8142 {
8143 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8144 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8145 if (_token == NULL) {
8146 D(p->level--);
8147 return NULL;
8148 }
8149 int _end_lineno = _token->end_lineno;
8150 UNUSED(_end_lineno); // Only used by EXTRA macro
8151 int _end_col_offset = _token->end_col_offset;
8152 UNUSED(_end_col_offset); // Only used by EXTRA macro
8153 _res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
8154 if (_res == NULL && PyErr_Occurred()) {
8155 p->error_indicator = 1;
8156 D(p->level--);
8157 return NULL;
8158 }
8159 goto done;
8160 }
8161 p->mark = _mark;
8162 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8163 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+"));
8164 }
8165 { // inversion
8166 if (p->error_indicator) {
8167 D(p->level--);
8168 return NULL;
8169 }
8170 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion"));
8171 expr_ty inversion_var;
8172 if (
8173 (inversion_var = inversion_rule(p)) // inversion
8174 )
8175 {
8176 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion"));
8177 _res = inversion_var;
8178 goto done;
8179 }
8180 p->mark = _mark;
8181 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8182 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion"));
8183 }
8184 _res = NULL;
8185 done:
8186 _PyPegen_insert_memo(p, _mark, conjunction_type, _res);
8187 D(p->level--);
8188 return _res;
8189}
8190
8191// inversion: 'not' inversion | comparison
8192static expr_ty
8193inversion_rule(Parser *p)
8194{
8195 D(p->level++);
8196 if (p->error_indicator) {
8197 D(p->level--);
8198 return NULL;
8199 }
8200 expr_ty _res = NULL;
8201 if (_PyPegen_is_memoized(p, inversion_type, &_res)) {
8202 D(p->level--);
8203 return _res;
8204 }
8205 int _mark = p->mark;
8206 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8207 p->error_indicator = 1;
8208 D(p->level--);
8209 return NULL;
8210 }
8211 int _start_lineno = p->tokens[_mark]->lineno;
8212 UNUSED(_start_lineno); // Only used by EXTRA macro
8213 int _start_col_offset = p->tokens[_mark]->col_offset;
8214 UNUSED(_start_col_offset); // Only used by EXTRA macro
8215 { // 'not' inversion
8216 if (p->error_indicator) {
8217 D(p->level--);
8218 return NULL;
8219 }
8220 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8221 Token * _keyword;
8222 expr_ty a;
8223 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008224 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008225 &&
8226 (a = inversion_rule(p)) // inversion
8227 )
8228 {
8229 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8230 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8231 if (_token == NULL) {
8232 D(p->level--);
8233 return NULL;
8234 }
8235 int _end_lineno = _token->end_lineno;
8236 UNUSED(_end_lineno); // Only used by EXTRA macro
8237 int _end_col_offset = _token->end_col_offset;
8238 UNUSED(_end_col_offset); // Only used by EXTRA macro
8239 _res = _Py_UnaryOp ( Not , a , EXTRA );
8240 if (_res == NULL && PyErr_Occurred()) {
8241 p->error_indicator = 1;
8242 D(p->level--);
8243 return NULL;
8244 }
8245 goto done;
8246 }
8247 p->mark = _mark;
8248 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8249 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion"));
8250 }
8251 { // comparison
8252 if (p->error_indicator) {
8253 D(p->level--);
8254 return NULL;
8255 }
8256 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison"));
8257 expr_ty comparison_var;
8258 if (
8259 (comparison_var = comparison_rule(p)) // comparison
8260 )
8261 {
8262 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison"));
8263 _res = comparison_var;
8264 goto done;
8265 }
8266 p->mark = _mark;
8267 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8268 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison"));
8269 }
8270 _res = NULL;
8271 done:
8272 _PyPegen_insert_memo(p, _mark, inversion_type, _res);
8273 D(p->level--);
8274 return _res;
8275}
8276
8277// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
8278static expr_ty
8279comparison_rule(Parser *p)
8280{
8281 D(p->level++);
8282 if (p->error_indicator) {
8283 D(p->level--);
8284 return NULL;
8285 }
8286 expr_ty _res = NULL;
8287 int _mark = p->mark;
8288 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8289 p->error_indicator = 1;
8290 D(p->level--);
8291 return NULL;
8292 }
8293 int _start_lineno = p->tokens[_mark]->lineno;
8294 UNUSED(_start_lineno); // Only used by EXTRA macro
8295 int _start_col_offset = p->tokens[_mark]->col_offset;
8296 UNUSED(_start_col_offset); // Only used by EXTRA macro
8297 { // bitwise_or compare_op_bitwise_or_pair+
8298 if (p->error_indicator) {
8299 D(p->level--);
8300 return NULL;
8301 }
8302 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8303 expr_ty a;
8304 asdl_seq * b;
8305 if (
8306 (a = bitwise_or_rule(p)) // bitwise_or
8307 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008308 (b = _loop1_92_rule(p)) // compare_op_bitwise_or_pair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008309 )
8310 {
8311 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8312 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8313 if (_token == NULL) {
8314 D(p->level--);
8315 return NULL;
8316 }
8317 int _end_lineno = _token->end_lineno;
8318 UNUSED(_end_lineno); // Only used by EXTRA macro
8319 int _end_col_offset = _token->end_col_offset;
8320 UNUSED(_end_col_offset); // Only used by EXTRA macro
8321 _res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA );
8322 if (_res == NULL && PyErr_Occurred()) {
8323 p->error_indicator = 1;
8324 D(p->level--);
8325 return NULL;
8326 }
8327 goto done;
8328 }
8329 p->mark = _mark;
8330 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8331 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8332 }
8333 { // bitwise_or
8334 if (p->error_indicator) {
8335 D(p->level--);
8336 return NULL;
8337 }
8338 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8339 expr_ty bitwise_or_var;
8340 if (
8341 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
8342 )
8343 {
8344 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8345 _res = bitwise_or_var;
8346 goto done;
8347 }
8348 p->mark = _mark;
8349 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8350 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or"));
8351 }
8352 _res = NULL;
8353 done:
8354 D(p->level--);
8355 return _res;
8356}
8357
8358// compare_op_bitwise_or_pair:
8359// | eq_bitwise_or
8360// | noteq_bitwise_or
8361// | lte_bitwise_or
8362// | lt_bitwise_or
8363// | gte_bitwise_or
8364// | gt_bitwise_or
8365// | notin_bitwise_or
8366// | in_bitwise_or
8367// | isnot_bitwise_or
8368// | is_bitwise_or
8369static CmpopExprPair*
8370compare_op_bitwise_or_pair_rule(Parser *p)
8371{
8372 D(p->level++);
8373 if (p->error_indicator) {
8374 D(p->level--);
8375 return NULL;
8376 }
8377 CmpopExprPair* _res = NULL;
8378 int _mark = p->mark;
8379 { // eq_bitwise_or
8380 if (p->error_indicator) {
8381 D(p->level--);
8382 return NULL;
8383 }
8384 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8385 CmpopExprPair* eq_bitwise_or_var;
8386 if (
8387 (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or
8388 )
8389 {
8390 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8391 _res = eq_bitwise_or_var;
8392 goto done;
8393 }
8394 p->mark = _mark;
8395 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8396 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or"));
8397 }
8398 { // noteq_bitwise_or
8399 if (p->error_indicator) {
8400 D(p->level--);
8401 return NULL;
8402 }
8403 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8404 CmpopExprPair* noteq_bitwise_or_var;
8405 if (
8406 (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or
8407 )
8408 {
8409 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8410 _res = noteq_bitwise_or_var;
8411 goto done;
8412 }
8413 p->mark = _mark;
8414 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8415 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or"));
8416 }
8417 { // lte_bitwise_or
8418 if (p->error_indicator) {
8419 D(p->level--);
8420 return NULL;
8421 }
8422 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8423 CmpopExprPair* lte_bitwise_or_var;
8424 if (
8425 (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or
8426 )
8427 {
8428 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8429 _res = lte_bitwise_or_var;
8430 goto done;
8431 }
8432 p->mark = _mark;
8433 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8434 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or"));
8435 }
8436 { // lt_bitwise_or
8437 if (p->error_indicator) {
8438 D(p->level--);
8439 return NULL;
8440 }
8441 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8442 CmpopExprPair* lt_bitwise_or_var;
8443 if (
8444 (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or
8445 )
8446 {
8447 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8448 _res = lt_bitwise_or_var;
8449 goto done;
8450 }
8451 p->mark = _mark;
8452 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8453 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or"));
8454 }
8455 { // gte_bitwise_or
8456 if (p->error_indicator) {
8457 D(p->level--);
8458 return NULL;
8459 }
8460 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8461 CmpopExprPair* gte_bitwise_or_var;
8462 if (
8463 (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or
8464 )
8465 {
8466 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8467 _res = gte_bitwise_or_var;
8468 goto done;
8469 }
8470 p->mark = _mark;
8471 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8472 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or"));
8473 }
8474 { // gt_bitwise_or
8475 if (p->error_indicator) {
8476 D(p->level--);
8477 return NULL;
8478 }
8479 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8480 CmpopExprPair* gt_bitwise_or_var;
8481 if (
8482 (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or
8483 )
8484 {
8485 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8486 _res = gt_bitwise_or_var;
8487 goto done;
8488 }
8489 p->mark = _mark;
8490 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8491 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or"));
8492 }
8493 { // notin_bitwise_or
8494 if (p->error_indicator) {
8495 D(p->level--);
8496 return NULL;
8497 }
8498 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8499 CmpopExprPair* notin_bitwise_or_var;
8500 if (
8501 (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or
8502 )
8503 {
8504 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8505 _res = notin_bitwise_or_var;
8506 goto done;
8507 }
8508 p->mark = _mark;
8509 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8510 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or"));
8511 }
8512 { // in_bitwise_or
8513 if (p->error_indicator) {
8514 D(p->level--);
8515 return NULL;
8516 }
8517 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8518 CmpopExprPair* in_bitwise_or_var;
8519 if (
8520 (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or
8521 )
8522 {
8523 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8524 _res = in_bitwise_or_var;
8525 goto done;
8526 }
8527 p->mark = _mark;
8528 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8529 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or"));
8530 }
8531 { // isnot_bitwise_or
8532 if (p->error_indicator) {
8533 D(p->level--);
8534 return NULL;
8535 }
8536 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8537 CmpopExprPair* isnot_bitwise_or_var;
8538 if (
8539 (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or
8540 )
8541 {
8542 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8543 _res = isnot_bitwise_or_var;
8544 goto done;
8545 }
8546 p->mark = _mark;
8547 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8548 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or"));
8549 }
8550 { // is_bitwise_or
8551 if (p->error_indicator) {
8552 D(p->level--);
8553 return NULL;
8554 }
8555 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8556 CmpopExprPair* is_bitwise_or_var;
8557 if (
8558 (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or
8559 )
8560 {
8561 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8562 _res = is_bitwise_or_var;
8563 goto done;
8564 }
8565 p->mark = _mark;
8566 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8567 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or"));
8568 }
8569 _res = NULL;
8570 done:
8571 D(p->level--);
8572 return _res;
8573}
8574
8575// eq_bitwise_or: '==' bitwise_or
8576static CmpopExprPair*
8577eq_bitwise_or_rule(Parser *p)
8578{
8579 D(p->level++);
8580 if (p->error_indicator) {
8581 D(p->level--);
8582 return NULL;
8583 }
8584 CmpopExprPair* _res = NULL;
8585 int _mark = p->mark;
8586 { // '==' bitwise_or
8587 if (p->error_indicator) {
8588 D(p->level--);
8589 return NULL;
8590 }
8591 D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8592 Token * _literal;
8593 expr_ty a;
8594 if (
8595 (_literal = _PyPegen_expect_token(p, 27)) // token='=='
8596 &&
8597 (a = bitwise_or_rule(p)) // bitwise_or
8598 )
8599 {
8600 D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8601 _res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
8602 if (_res == NULL && PyErr_Occurred()) {
8603 p->error_indicator = 1;
8604 D(p->level--);
8605 return NULL;
8606 }
8607 goto done;
8608 }
8609 p->mark = _mark;
8610 D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8611 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or"));
8612 }
8613 _res = NULL;
8614 done:
8615 D(p->level--);
8616 return _res;
8617}
8618
8619// noteq_bitwise_or: ('!=') bitwise_or
8620static CmpopExprPair*
8621noteq_bitwise_or_rule(Parser *p)
8622{
8623 D(p->level++);
8624 if (p->error_indicator) {
8625 D(p->level--);
8626 return NULL;
8627 }
8628 CmpopExprPair* _res = NULL;
8629 int _mark = p->mark;
8630 { // ('!=') bitwise_or
8631 if (p->error_indicator) {
8632 D(p->level--);
8633 return NULL;
8634 }
8635 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 +03008636 void *_tmp_93_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008637 expr_ty a;
8638 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008639 (_tmp_93_var = _tmp_93_rule(p)) // '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008640 &&
8641 (a = bitwise_or_rule(p)) // bitwise_or
8642 )
8643 {
8644 D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
8645 _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
8646 if (_res == NULL && PyErr_Occurred()) {
8647 p->error_indicator = 1;
8648 D(p->level--);
8649 return NULL;
8650 }
8651 goto done;
8652 }
8653 p->mark = _mark;
8654 D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8655 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or"));
8656 }
8657 _res = NULL;
8658 done:
8659 D(p->level--);
8660 return _res;
8661}
8662
8663// lte_bitwise_or: '<=' bitwise_or
8664static CmpopExprPair*
8665lte_bitwise_or_rule(Parser *p)
8666{
8667 D(p->level++);
8668 if (p->error_indicator) {
8669 D(p->level--);
8670 return NULL;
8671 }
8672 CmpopExprPair* _res = NULL;
8673 int _mark = p->mark;
8674 { // '<=' bitwise_or
8675 if (p->error_indicator) {
8676 D(p->level--);
8677 return NULL;
8678 }
8679 D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8680 Token * _literal;
8681 expr_ty a;
8682 if (
8683 (_literal = _PyPegen_expect_token(p, 29)) // token='<='
8684 &&
8685 (a = bitwise_or_rule(p)) // bitwise_or
8686 )
8687 {
8688 D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8689 _res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
8690 if (_res == NULL && PyErr_Occurred()) {
8691 p->error_indicator = 1;
8692 D(p->level--);
8693 return NULL;
8694 }
8695 goto done;
8696 }
8697 p->mark = _mark;
8698 D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8699 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or"));
8700 }
8701 _res = NULL;
8702 done:
8703 D(p->level--);
8704 return _res;
8705}
8706
8707// lt_bitwise_or: '<' bitwise_or
8708static CmpopExprPair*
8709lt_bitwise_or_rule(Parser *p)
8710{
8711 D(p->level++);
8712 if (p->error_indicator) {
8713 D(p->level--);
8714 return NULL;
8715 }
8716 CmpopExprPair* _res = NULL;
8717 int _mark = p->mark;
8718 { // '<' bitwise_or
8719 if (p->error_indicator) {
8720 D(p->level--);
8721 return NULL;
8722 }
8723 D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8724 Token * _literal;
8725 expr_ty a;
8726 if (
8727 (_literal = _PyPegen_expect_token(p, 20)) // token='<'
8728 &&
8729 (a = bitwise_or_rule(p)) // bitwise_or
8730 )
8731 {
8732 D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8733 _res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
8734 if (_res == NULL && PyErr_Occurred()) {
8735 p->error_indicator = 1;
8736 D(p->level--);
8737 return NULL;
8738 }
8739 goto done;
8740 }
8741 p->mark = _mark;
8742 D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8743 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or"));
8744 }
8745 _res = NULL;
8746 done:
8747 D(p->level--);
8748 return _res;
8749}
8750
8751// gte_bitwise_or: '>=' bitwise_or
8752static CmpopExprPair*
8753gte_bitwise_or_rule(Parser *p)
8754{
8755 D(p->level++);
8756 if (p->error_indicator) {
8757 D(p->level--);
8758 return NULL;
8759 }
8760 CmpopExprPair* _res = NULL;
8761 int _mark = p->mark;
8762 { // '>=' bitwise_or
8763 if (p->error_indicator) {
8764 D(p->level--);
8765 return NULL;
8766 }
8767 D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8768 Token * _literal;
8769 expr_ty a;
8770 if (
8771 (_literal = _PyPegen_expect_token(p, 30)) // token='>='
8772 &&
8773 (a = bitwise_or_rule(p)) // bitwise_or
8774 )
8775 {
8776 D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8777 _res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
8778 if (_res == NULL && PyErr_Occurred()) {
8779 p->error_indicator = 1;
8780 D(p->level--);
8781 return NULL;
8782 }
8783 goto done;
8784 }
8785 p->mark = _mark;
8786 D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8787 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or"));
8788 }
8789 _res = NULL;
8790 done:
8791 D(p->level--);
8792 return _res;
8793}
8794
8795// gt_bitwise_or: '>' bitwise_or
8796static CmpopExprPair*
8797gt_bitwise_or_rule(Parser *p)
8798{
8799 D(p->level++);
8800 if (p->error_indicator) {
8801 D(p->level--);
8802 return NULL;
8803 }
8804 CmpopExprPair* _res = NULL;
8805 int _mark = p->mark;
8806 { // '>' bitwise_or
8807 if (p->error_indicator) {
8808 D(p->level--);
8809 return NULL;
8810 }
8811 D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8812 Token * _literal;
8813 expr_ty a;
8814 if (
8815 (_literal = _PyPegen_expect_token(p, 21)) // token='>'
8816 &&
8817 (a = bitwise_or_rule(p)) // bitwise_or
8818 )
8819 {
8820 D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8821 _res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
8822 if (_res == NULL && PyErr_Occurred()) {
8823 p->error_indicator = 1;
8824 D(p->level--);
8825 return NULL;
8826 }
8827 goto done;
8828 }
8829 p->mark = _mark;
8830 D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8831 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or"));
8832 }
8833 _res = NULL;
8834 done:
8835 D(p->level--);
8836 return _res;
8837}
8838
8839// notin_bitwise_or: 'not' 'in' bitwise_or
8840static CmpopExprPair*
8841notin_bitwise_or_rule(Parser *p)
8842{
8843 D(p->level++);
8844 if (p->error_indicator) {
8845 D(p->level--);
8846 return NULL;
8847 }
8848 CmpopExprPair* _res = NULL;
8849 int _mark = p->mark;
8850 { // 'not' 'in' bitwise_or
8851 if (p->error_indicator) {
8852 D(p->level--);
8853 return NULL;
8854 }
8855 D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8856 Token * _keyword;
8857 Token * _keyword_1;
8858 expr_ty a;
8859 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008860 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008861 &&
8862 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
8863 &&
8864 (a = bitwise_or_rule(p)) // bitwise_or
8865 )
8866 {
8867 D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8868 _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
8869 if (_res == NULL && PyErr_Occurred()) {
8870 p->error_indicator = 1;
8871 D(p->level--);
8872 return NULL;
8873 }
8874 goto done;
8875 }
8876 p->mark = _mark;
8877 D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8878 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or"));
8879 }
8880 _res = NULL;
8881 done:
8882 D(p->level--);
8883 return _res;
8884}
8885
8886// in_bitwise_or: 'in' bitwise_or
8887static CmpopExprPair*
8888in_bitwise_or_rule(Parser *p)
8889{
8890 D(p->level++);
8891 if (p->error_indicator) {
8892 D(p->level--);
8893 return NULL;
8894 }
8895 CmpopExprPair* _res = NULL;
8896 int _mark = p->mark;
8897 { // 'in' bitwise_or
8898 if (p->error_indicator) {
8899 D(p->level--);
8900 return NULL;
8901 }
8902 D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8903 Token * _keyword;
8904 expr_ty a;
8905 if (
8906 (_keyword = _PyPegen_expect_token(p, 518)) // token='in'
8907 &&
8908 (a = bitwise_or_rule(p)) // bitwise_or
8909 )
8910 {
8911 D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8912 _res = _PyPegen_cmpop_expr_pair ( p , In , a );
8913 if (_res == NULL && PyErr_Occurred()) {
8914 p->error_indicator = 1;
8915 D(p->level--);
8916 return NULL;
8917 }
8918 goto done;
8919 }
8920 p->mark = _mark;
8921 D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8922 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or"));
8923 }
8924 _res = NULL;
8925 done:
8926 D(p->level--);
8927 return _res;
8928}
8929
8930// isnot_bitwise_or: 'is' 'not' bitwise_or
8931static CmpopExprPair*
8932isnot_bitwise_or_rule(Parser *p)
8933{
8934 D(p->level++);
8935 if (p->error_indicator) {
8936 D(p->level--);
8937 return NULL;
8938 }
8939 CmpopExprPair* _res = NULL;
8940 int _mark = p->mark;
8941 { // 'is' 'not' bitwise_or
8942 if (p->error_indicator) {
8943 D(p->level--);
8944 return NULL;
8945 }
8946 D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8947 Token * _keyword;
8948 Token * _keyword_1;
8949 expr_ty a;
8950 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008951 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008952 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008953 (_keyword_1 = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008954 &&
8955 (a = bitwise_or_rule(p)) // bitwise_or
8956 )
8957 {
8958 D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8959 _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
8960 if (_res == NULL && PyErr_Occurred()) {
8961 p->error_indicator = 1;
8962 D(p->level--);
8963 return NULL;
8964 }
8965 goto done;
8966 }
8967 p->mark = _mark;
8968 D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8969 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or"));
8970 }
8971 _res = NULL;
8972 done:
8973 D(p->level--);
8974 return _res;
8975}
8976
8977// is_bitwise_or: 'is' bitwise_or
8978static CmpopExprPair*
8979is_bitwise_or_rule(Parser *p)
8980{
8981 D(p->level++);
8982 if (p->error_indicator) {
8983 D(p->level--);
8984 return NULL;
8985 }
8986 CmpopExprPair* _res = NULL;
8987 int _mark = p->mark;
8988 { // 'is' bitwise_or
8989 if (p->error_indicator) {
8990 D(p->level--);
8991 return NULL;
8992 }
8993 D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
8994 Token * _keyword;
8995 expr_ty a;
8996 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008997 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008998 &&
8999 (a = bitwise_or_rule(p)) // bitwise_or
9000 )
9001 {
9002 D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
9003 _res = _PyPegen_cmpop_expr_pair ( p , Is , a );
9004 if (_res == NULL && PyErr_Occurred()) {
9005 p->error_indicator = 1;
9006 D(p->level--);
9007 return NULL;
9008 }
9009 goto done;
9010 }
9011 p->mark = _mark;
9012 D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9013 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or"));
9014 }
9015 _res = NULL;
9016 done:
9017 D(p->level--);
9018 return _res;
9019}
9020
9021// Left-recursive
9022// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
9023static expr_ty bitwise_or_raw(Parser *);
9024static expr_ty
9025bitwise_or_rule(Parser *p)
9026{
9027 D(p->level++);
9028 expr_ty _res = NULL;
9029 if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) {
9030 D(p->level--);
9031 return _res;
9032 }
9033 int _mark = p->mark;
9034 int _resmark = p->mark;
9035 while (1) {
9036 int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res);
9037 if (tmpvar_1) {
9038 D(p->level--);
9039 return _res;
9040 }
9041 p->mark = _mark;
9042 void *_raw = bitwise_or_raw(p);
9043 if (_raw == NULL || p->mark <= _resmark)
9044 break;
9045 _resmark = p->mark;
9046 _res = _raw;
9047 }
9048 p->mark = _resmark;
9049 D(p->level--);
9050 return _res;
9051}
9052static expr_ty
9053bitwise_or_raw(Parser *p)
9054{
9055 D(p->level++);
9056 if (p->error_indicator) {
9057 D(p->level--);
9058 return NULL;
9059 }
9060 expr_ty _res = NULL;
9061 int _mark = p->mark;
9062 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9063 p->error_indicator = 1;
9064 D(p->level--);
9065 return NULL;
9066 }
9067 int _start_lineno = p->tokens[_mark]->lineno;
9068 UNUSED(_start_lineno); // Only used by EXTRA macro
9069 int _start_col_offset = p->tokens[_mark]->col_offset;
9070 UNUSED(_start_col_offset); // Only used by EXTRA macro
9071 { // bitwise_or '|' bitwise_xor
9072 if (p->error_indicator) {
9073 D(p->level--);
9074 return NULL;
9075 }
9076 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9077 Token * _literal;
9078 expr_ty a;
9079 expr_ty b;
9080 if (
9081 (a = bitwise_or_rule(p)) // bitwise_or
9082 &&
9083 (_literal = _PyPegen_expect_token(p, 18)) // token='|'
9084 &&
9085 (b = bitwise_xor_rule(p)) // bitwise_xor
9086 )
9087 {
9088 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9089 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9090 if (_token == NULL) {
9091 D(p->level--);
9092 return NULL;
9093 }
9094 int _end_lineno = _token->end_lineno;
9095 UNUSED(_end_lineno); // Only used by EXTRA macro
9096 int _end_col_offset = _token->end_col_offset;
9097 UNUSED(_end_col_offset); // Only used by EXTRA macro
9098 _res = _Py_BinOp ( a , BitOr , b , EXTRA );
9099 if (_res == NULL && PyErr_Occurred()) {
9100 p->error_indicator = 1;
9101 D(p->level--);
9102 return NULL;
9103 }
9104 goto done;
9105 }
9106 p->mark = _mark;
9107 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9108 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9109 }
9110 { // bitwise_xor
9111 if (p->error_indicator) {
9112 D(p->level--);
9113 return NULL;
9114 }
9115 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9116 expr_ty bitwise_xor_var;
9117 if (
9118 (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor
9119 )
9120 {
9121 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9122 _res = bitwise_xor_var;
9123 goto done;
9124 }
9125 p->mark = _mark;
9126 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9127 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor"));
9128 }
9129 _res = NULL;
9130 done:
9131 D(p->level--);
9132 return _res;
9133}
9134
9135// Left-recursive
9136// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
9137static expr_ty bitwise_xor_raw(Parser *);
9138static expr_ty
9139bitwise_xor_rule(Parser *p)
9140{
9141 D(p->level++);
9142 expr_ty _res = NULL;
9143 if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) {
9144 D(p->level--);
9145 return _res;
9146 }
9147 int _mark = p->mark;
9148 int _resmark = p->mark;
9149 while (1) {
9150 int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res);
9151 if (tmpvar_2) {
9152 D(p->level--);
9153 return _res;
9154 }
9155 p->mark = _mark;
9156 void *_raw = bitwise_xor_raw(p);
9157 if (_raw == NULL || p->mark <= _resmark)
9158 break;
9159 _resmark = p->mark;
9160 _res = _raw;
9161 }
9162 p->mark = _resmark;
9163 D(p->level--);
9164 return _res;
9165}
9166static expr_ty
9167bitwise_xor_raw(Parser *p)
9168{
9169 D(p->level++);
9170 if (p->error_indicator) {
9171 D(p->level--);
9172 return NULL;
9173 }
9174 expr_ty _res = NULL;
9175 int _mark = p->mark;
9176 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9177 p->error_indicator = 1;
9178 D(p->level--);
9179 return NULL;
9180 }
9181 int _start_lineno = p->tokens[_mark]->lineno;
9182 UNUSED(_start_lineno); // Only used by EXTRA macro
9183 int _start_col_offset = p->tokens[_mark]->col_offset;
9184 UNUSED(_start_col_offset); // Only used by EXTRA macro
9185 { // bitwise_xor '^' bitwise_and
9186 if (p->error_indicator) {
9187 D(p->level--);
9188 return NULL;
9189 }
9190 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9191 Token * _literal;
9192 expr_ty a;
9193 expr_ty b;
9194 if (
9195 (a = bitwise_xor_rule(p)) // bitwise_xor
9196 &&
9197 (_literal = _PyPegen_expect_token(p, 32)) // token='^'
9198 &&
9199 (b = bitwise_and_rule(p)) // bitwise_and
9200 )
9201 {
9202 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9203 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9204 if (_token == NULL) {
9205 D(p->level--);
9206 return NULL;
9207 }
9208 int _end_lineno = _token->end_lineno;
9209 UNUSED(_end_lineno); // Only used by EXTRA macro
9210 int _end_col_offset = _token->end_col_offset;
9211 UNUSED(_end_col_offset); // Only used by EXTRA macro
9212 _res = _Py_BinOp ( a , BitXor , b , EXTRA );
9213 if (_res == NULL && PyErr_Occurred()) {
9214 p->error_indicator = 1;
9215 D(p->level--);
9216 return NULL;
9217 }
9218 goto done;
9219 }
9220 p->mark = _mark;
9221 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9222 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9223 }
9224 { // bitwise_and
9225 if (p->error_indicator) {
9226 D(p->level--);
9227 return NULL;
9228 }
9229 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9230 expr_ty bitwise_and_var;
9231 if (
9232 (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and
9233 )
9234 {
9235 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9236 _res = bitwise_and_var;
9237 goto done;
9238 }
9239 p->mark = _mark;
9240 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9241 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and"));
9242 }
9243 _res = NULL;
9244 done:
9245 D(p->level--);
9246 return _res;
9247}
9248
9249// Left-recursive
9250// bitwise_and: bitwise_and '&' shift_expr | shift_expr
9251static expr_ty bitwise_and_raw(Parser *);
9252static expr_ty
9253bitwise_and_rule(Parser *p)
9254{
9255 D(p->level++);
9256 expr_ty _res = NULL;
9257 if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) {
9258 D(p->level--);
9259 return _res;
9260 }
9261 int _mark = p->mark;
9262 int _resmark = p->mark;
9263 while (1) {
9264 int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res);
9265 if (tmpvar_3) {
9266 D(p->level--);
9267 return _res;
9268 }
9269 p->mark = _mark;
9270 void *_raw = bitwise_and_raw(p);
9271 if (_raw == NULL || p->mark <= _resmark)
9272 break;
9273 _resmark = p->mark;
9274 _res = _raw;
9275 }
9276 p->mark = _resmark;
9277 D(p->level--);
9278 return _res;
9279}
9280static expr_ty
9281bitwise_and_raw(Parser *p)
9282{
9283 D(p->level++);
9284 if (p->error_indicator) {
9285 D(p->level--);
9286 return NULL;
9287 }
9288 expr_ty _res = NULL;
9289 int _mark = p->mark;
9290 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9291 p->error_indicator = 1;
9292 D(p->level--);
9293 return NULL;
9294 }
9295 int _start_lineno = p->tokens[_mark]->lineno;
9296 UNUSED(_start_lineno); // Only used by EXTRA macro
9297 int _start_col_offset = p->tokens[_mark]->col_offset;
9298 UNUSED(_start_col_offset); // Only used by EXTRA macro
9299 { // bitwise_and '&' shift_expr
9300 if (p->error_indicator) {
9301 D(p->level--);
9302 return NULL;
9303 }
9304 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9305 Token * _literal;
9306 expr_ty a;
9307 expr_ty b;
9308 if (
9309 (a = bitwise_and_rule(p)) // bitwise_and
9310 &&
9311 (_literal = _PyPegen_expect_token(p, 19)) // token='&'
9312 &&
9313 (b = shift_expr_rule(p)) // shift_expr
9314 )
9315 {
9316 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9317 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9318 if (_token == NULL) {
9319 D(p->level--);
9320 return NULL;
9321 }
9322 int _end_lineno = _token->end_lineno;
9323 UNUSED(_end_lineno); // Only used by EXTRA macro
9324 int _end_col_offset = _token->end_col_offset;
9325 UNUSED(_end_col_offset); // Only used by EXTRA macro
9326 _res = _Py_BinOp ( a , BitAnd , b , EXTRA );
9327 if (_res == NULL && PyErr_Occurred()) {
9328 p->error_indicator = 1;
9329 D(p->level--);
9330 return NULL;
9331 }
9332 goto done;
9333 }
9334 p->mark = _mark;
9335 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9336 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr"));
9337 }
9338 { // shift_expr
9339 if (p->error_indicator) {
9340 D(p->level--);
9341 return NULL;
9342 }
9343 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9344 expr_ty shift_expr_var;
9345 if (
9346 (shift_expr_var = shift_expr_rule(p)) // shift_expr
9347 )
9348 {
9349 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9350 _res = shift_expr_var;
9351 goto done;
9352 }
9353 p->mark = _mark;
9354 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9355 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr"));
9356 }
9357 _res = NULL;
9358 done:
9359 D(p->level--);
9360 return _res;
9361}
9362
9363// Left-recursive
9364// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
9365static expr_ty shift_expr_raw(Parser *);
9366static expr_ty
9367shift_expr_rule(Parser *p)
9368{
9369 D(p->level++);
9370 expr_ty _res = NULL;
9371 if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) {
9372 D(p->level--);
9373 return _res;
9374 }
9375 int _mark = p->mark;
9376 int _resmark = p->mark;
9377 while (1) {
9378 int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res);
9379 if (tmpvar_4) {
9380 D(p->level--);
9381 return _res;
9382 }
9383 p->mark = _mark;
9384 void *_raw = shift_expr_raw(p);
9385 if (_raw == NULL || p->mark <= _resmark)
9386 break;
9387 _resmark = p->mark;
9388 _res = _raw;
9389 }
9390 p->mark = _resmark;
9391 D(p->level--);
9392 return _res;
9393}
9394static expr_ty
9395shift_expr_raw(Parser *p)
9396{
9397 D(p->level++);
9398 if (p->error_indicator) {
9399 D(p->level--);
9400 return NULL;
9401 }
9402 expr_ty _res = NULL;
9403 int _mark = p->mark;
9404 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9405 p->error_indicator = 1;
9406 D(p->level--);
9407 return NULL;
9408 }
9409 int _start_lineno = p->tokens[_mark]->lineno;
9410 UNUSED(_start_lineno); // Only used by EXTRA macro
9411 int _start_col_offset = p->tokens[_mark]->col_offset;
9412 UNUSED(_start_col_offset); // Only used by EXTRA macro
9413 { // shift_expr '<<' sum
9414 if (p->error_indicator) {
9415 D(p->level--);
9416 return NULL;
9417 }
9418 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9419 Token * _literal;
9420 expr_ty a;
9421 expr_ty b;
9422 if (
9423 (a = shift_expr_rule(p)) // shift_expr
9424 &&
9425 (_literal = _PyPegen_expect_token(p, 33)) // token='<<'
9426 &&
9427 (b = sum_rule(p)) // sum
9428 )
9429 {
9430 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9431 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9432 if (_token == NULL) {
9433 D(p->level--);
9434 return NULL;
9435 }
9436 int _end_lineno = _token->end_lineno;
9437 UNUSED(_end_lineno); // Only used by EXTRA macro
9438 int _end_col_offset = _token->end_col_offset;
9439 UNUSED(_end_col_offset); // Only used by EXTRA macro
9440 _res = _Py_BinOp ( a , LShift , b , EXTRA );
9441 if (_res == NULL && PyErr_Occurred()) {
9442 p->error_indicator = 1;
9443 D(p->level--);
9444 return NULL;
9445 }
9446 goto done;
9447 }
9448 p->mark = _mark;
9449 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9450 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum"));
9451 }
9452 { // shift_expr '>>' sum
9453 if (p->error_indicator) {
9454 D(p->level--);
9455 return NULL;
9456 }
9457 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9458 Token * _literal;
9459 expr_ty a;
9460 expr_ty b;
9461 if (
9462 (a = shift_expr_rule(p)) // shift_expr
9463 &&
9464 (_literal = _PyPegen_expect_token(p, 34)) // token='>>'
9465 &&
9466 (b = sum_rule(p)) // sum
9467 )
9468 {
9469 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9470 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9471 if (_token == NULL) {
9472 D(p->level--);
9473 return NULL;
9474 }
9475 int _end_lineno = _token->end_lineno;
9476 UNUSED(_end_lineno); // Only used by EXTRA macro
9477 int _end_col_offset = _token->end_col_offset;
9478 UNUSED(_end_col_offset); // Only used by EXTRA macro
9479 _res = _Py_BinOp ( a , RShift , b , EXTRA );
9480 if (_res == NULL && PyErr_Occurred()) {
9481 p->error_indicator = 1;
9482 D(p->level--);
9483 return NULL;
9484 }
9485 goto done;
9486 }
9487 p->mark = _mark;
9488 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9489 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum"));
9490 }
9491 { // sum
9492 if (p->error_indicator) {
9493 D(p->level--);
9494 return NULL;
9495 }
9496 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum"));
9497 expr_ty sum_var;
9498 if (
9499 (sum_var = sum_rule(p)) // sum
9500 )
9501 {
9502 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum"));
9503 _res = sum_var;
9504 goto done;
9505 }
9506 p->mark = _mark;
9507 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9508 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum"));
9509 }
9510 _res = NULL;
9511 done:
9512 D(p->level--);
9513 return _res;
9514}
9515
9516// Left-recursive
9517// sum: sum '+' term | sum '-' term | term
9518static expr_ty sum_raw(Parser *);
9519static expr_ty
9520sum_rule(Parser *p)
9521{
9522 D(p->level++);
9523 expr_ty _res = NULL;
9524 if (_PyPegen_is_memoized(p, sum_type, &_res)) {
9525 D(p->level--);
9526 return _res;
9527 }
9528 int _mark = p->mark;
9529 int _resmark = p->mark;
9530 while (1) {
9531 int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res);
9532 if (tmpvar_5) {
9533 D(p->level--);
9534 return _res;
9535 }
9536 p->mark = _mark;
9537 void *_raw = sum_raw(p);
9538 if (_raw == NULL || p->mark <= _resmark)
9539 break;
9540 _resmark = p->mark;
9541 _res = _raw;
9542 }
9543 p->mark = _resmark;
9544 D(p->level--);
9545 return _res;
9546}
9547static expr_ty
9548sum_raw(Parser *p)
9549{
9550 D(p->level++);
9551 if (p->error_indicator) {
9552 D(p->level--);
9553 return NULL;
9554 }
9555 expr_ty _res = NULL;
9556 int _mark = p->mark;
9557 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9558 p->error_indicator = 1;
9559 D(p->level--);
9560 return NULL;
9561 }
9562 int _start_lineno = p->tokens[_mark]->lineno;
9563 UNUSED(_start_lineno); // Only used by EXTRA macro
9564 int _start_col_offset = p->tokens[_mark]->col_offset;
9565 UNUSED(_start_col_offset); // Only used by EXTRA macro
9566 { // sum '+' term
9567 if (p->error_indicator) {
9568 D(p->level--);
9569 return NULL;
9570 }
9571 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9572 Token * _literal;
9573 expr_ty a;
9574 expr_ty b;
9575 if (
9576 (a = sum_rule(p)) // sum
9577 &&
9578 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9579 &&
9580 (b = term_rule(p)) // term
9581 )
9582 {
9583 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9584 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9585 if (_token == NULL) {
9586 D(p->level--);
9587 return NULL;
9588 }
9589 int _end_lineno = _token->end_lineno;
9590 UNUSED(_end_lineno); // Only used by EXTRA macro
9591 int _end_col_offset = _token->end_col_offset;
9592 UNUSED(_end_col_offset); // Only used by EXTRA macro
9593 _res = _Py_BinOp ( a , Add , b , EXTRA );
9594 if (_res == NULL && PyErr_Occurred()) {
9595 p->error_indicator = 1;
9596 D(p->level--);
9597 return NULL;
9598 }
9599 goto done;
9600 }
9601 p->mark = _mark;
9602 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9603 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term"));
9604 }
9605 { // sum '-' term
9606 if (p->error_indicator) {
9607 D(p->level--);
9608 return NULL;
9609 }
9610 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9611 Token * _literal;
9612 expr_ty a;
9613 expr_ty b;
9614 if (
9615 (a = sum_rule(p)) // sum
9616 &&
9617 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
9618 &&
9619 (b = term_rule(p)) // term
9620 )
9621 {
9622 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9623 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9624 if (_token == NULL) {
9625 D(p->level--);
9626 return NULL;
9627 }
9628 int _end_lineno = _token->end_lineno;
9629 UNUSED(_end_lineno); // Only used by EXTRA macro
9630 int _end_col_offset = _token->end_col_offset;
9631 UNUSED(_end_col_offset); // Only used by EXTRA macro
9632 _res = _Py_BinOp ( a , Sub , b , EXTRA );
9633 if (_res == NULL && PyErr_Occurred()) {
9634 p->error_indicator = 1;
9635 D(p->level--);
9636 return NULL;
9637 }
9638 goto done;
9639 }
9640 p->mark = _mark;
9641 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9642 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term"));
9643 }
9644 { // term
9645 if (p->error_indicator) {
9646 D(p->level--);
9647 return NULL;
9648 }
9649 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term"));
9650 expr_ty term_var;
9651 if (
9652 (term_var = term_rule(p)) // term
9653 )
9654 {
9655 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term"));
9656 _res = term_var;
9657 goto done;
9658 }
9659 p->mark = _mark;
9660 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9661 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term"));
9662 }
9663 _res = NULL;
9664 done:
9665 D(p->level--);
9666 return _res;
9667}
9668
9669// Left-recursive
9670// term:
9671// | term '*' factor
9672// | term '/' factor
9673// | term '//' factor
9674// | term '%' factor
9675// | term '@' factor
9676// | factor
9677static expr_ty term_raw(Parser *);
9678static expr_ty
9679term_rule(Parser *p)
9680{
9681 D(p->level++);
9682 expr_ty _res = NULL;
9683 if (_PyPegen_is_memoized(p, term_type, &_res)) {
9684 D(p->level--);
9685 return _res;
9686 }
9687 int _mark = p->mark;
9688 int _resmark = p->mark;
9689 while (1) {
9690 int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res);
9691 if (tmpvar_6) {
9692 D(p->level--);
9693 return _res;
9694 }
9695 p->mark = _mark;
9696 void *_raw = term_raw(p);
9697 if (_raw == NULL || p->mark <= _resmark)
9698 break;
9699 _resmark = p->mark;
9700 _res = _raw;
9701 }
9702 p->mark = _resmark;
9703 D(p->level--);
9704 return _res;
9705}
9706static expr_ty
9707term_raw(Parser *p)
9708{
9709 D(p->level++);
9710 if (p->error_indicator) {
9711 D(p->level--);
9712 return NULL;
9713 }
9714 expr_ty _res = NULL;
9715 int _mark = p->mark;
9716 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9717 p->error_indicator = 1;
9718 D(p->level--);
9719 return NULL;
9720 }
9721 int _start_lineno = p->tokens[_mark]->lineno;
9722 UNUSED(_start_lineno); // Only used by EXTRA macro
9723 int _start_col_offset = p->tokens[_mark]->col_offset;
9724 UNUSED(_start_col_offset); // Only used by EXTRA macro
9725 { // term '*' factor
9726 if (p->error_indicator) {
9727 D(p->level--);
9728 return NULL;
9729 }
9730 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9731 Token * _literal;
9732 expr_ty a;
9733 expr_ty b;
9734 if (
9735 (a = term_rule(p)) // term
9736 &&
9737 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
9738 &&
9739 (b = factor_rule(p)) // factor
9740 )
9741 {
9742 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9743 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9744 if (_token == NULL) {
9745 D(p->level--);
9746 return NULL;
9747 }
9748 int _end_lineno = _token->end_lineno;
9749 UNUSED(_end_lineno); // Only used by EXTRA macro
9750 int _end_col_offset = _token->end_col_offset;
9751 UNUSED(_end_col_offset); // Only used by EXTRA macro
9752 _res = _Py_BinOp ( a , Mult , b , EXTRA );
9753 if (_res == NULL && PyErr_Occurred()) {
9754 p->error_indicator = 1;
9755 D(p->level--);
9756 return NULL;
9757 }
9758 goto done;
9759 }
9760 p->mark = _mark;
9761 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9762 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor"));
9763 }
9764 { // term '/' factor
9765 if (p->error_indicator) {
9766 D(p->level--);
9767 return NULL;
9768 }
9769 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9770 Token * _literal;
9771 expr_ty a;
9772 expr_ty b;
9773 if (
9774 (a = term_rule(p)) // term
9775 &&
9776 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
9777 &&
9778 (b = factor_rule(p)) // factor
9779 )
9780 {
9781 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9782 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9783 if (_token == NULL) {
9784 D(p->level--);
9785 return NULL;
9786 }
9787 int _end_lineno = _token->end_lineno;
9788 UNUSED(_end_lineno); // Only used by EXTRA macro
9789 int _end_col_offset = _token->end_col_offset;
9790 UNUSED(_end_col_offset); // Only used by EXTRA macro
9791 _res = _Py_BinOp ( a , Div , b , EXTRA );
9792 if (_res == NULL && PyErr_Occurred()) {
9793 p->error_indicator = 1;
9794 D(p->level--);
9795 return NULL;
9796 }
9797 goto done;
9798 }
9799 p->mark = _mark;
9800 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9801 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor"));
9802 }
9803 { // term '//' factor
9804 if (p->error_indicator) {
9805 D(p->level--);
9806 return NULL;
9807 }
9808 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9809 Token * _literal;
9810 expr_ty a;
9811 expr_ty b;
9812 if (
9813 (a = term_rule(p)) // term
9814 &&
9815 (_literal = _PyPegen_expect_token(p, 47)) // token='//'
9816 &&
9817 (b = factor_rule(p)) // factor
9818 )
9819 {
9820 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9821 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9822 if (_token == NULL) {
9823 D(p->level--);
9824 return NULL;
9825 }
9826 int _end_lineno = _token->end_lineno;
9827 UNUSED(_end_lineno); // Only used by EXTRA macro
9828 int _end_col_offset = _token->end_col_offset;
9829 UNUSED(_end_col_offset); // Only used by EXTRA macro
9830 _res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
9831 if (_res == NULL && PyErr_Occurred()) {
9832 p->error_indicator = 1;
9833 D(p->level--);
9834 return NULL;
9835 }
9836 goto done;
9837 }
9838 p->mark = _mark;
9839 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9840 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor"));
9841 }
9842 { // term '%' factor
9843 if (p->error_indicator) {
9844 D(p->level--);
9845 return NULL;
9846 }
9847 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9848 Token * _literal;
9849 expr_ty a;
9850 expr_ty b;
9851 if (
9852 (a = term_rule(p)) // term
9853 &&
9854 (_literal = _PyPegen_expect_token(p, 24)) // token='%'
9855 &&
9856 (b = factor_rule(p)) // factor
9857 )
9858 {
9859 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9860 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9861 if (_token == NULL) {
9862 D(p->level--);
9863 return NULL;
9864 }
9865 int _end_lineno = _token->end_lineno;
9866 UNUSED(_end_lineno); // Only used by EXTRA macro
9867 int _end_col_offset = _token->end_col_offset;
9868 UNUSED(_end_col_offset); // Only used by EXTRA macro
9869 _res = _Py_BinOp ( a , Mod , b , EXTRA );
9870 if (_res == NULL && PyErr_Occurred()) {
9871 p->error_indicator = 1;
9872 D(p->level--);
9873 return NULL;
9874 }
9875 goto done;
9876 }
9877 p->mark = _mark;
9878 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9879 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor"));
9880 }
9881 { // term '@' factor
9882 if (p->error_indicator) {
9883 D(p->level--);
9884 return NULL;
9885 }
9886 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9887 Token * _literal;
9888 expr_ty a;
9889 expr_ty b;
9890 if (
9891 (a = term_rule(p)) // term
9892 &&
9893 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
9894 &&
9895 (b = factor_rule(p)) // factor
9896 )
9897 {
9898 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9899 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9900 if (_token == NULL) {
9901 D(p->level--);
9902 return NULL;
9903 }
9904 int _end_lineno = _token->end_lineno;
9905 UNUSED(_end_lineno); // Only used by EXTRA macro
9906 int _end_col_offset = _token->end_col_offset;
9907 UNUSED(_end_col_offset); // Only used by EXTRA macro
9908 _res = CHECK_VERSION ( 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) );
9909 if (_res == NULL && PyErr_Occurred()) {
9910 p->error_indicator = 1;
9911 D(p->level--);
9912 return NULL;
9913 }
9914 goto done;
9915 }
9916 p->mark = _mark;
9917 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9918 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor"));
9919 }
9920 { // factor
9921 if (p->error_indicator) {
9922 D(p->level--);
9923 return NULL;
9924 }
9925 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor"));
9926 expr_ty factor_var;
9927 if (
9928 (factor_var = factor_rule(p)) // factor
9929 )
9930 {
9931 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor"));
9932 _res = factor_var;
9933 goto done;
9934 }
9935 p->mark = _mark;
9936 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9937 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor"));
9938 }
9939 _res = NULL;
9940 done:
9941 D(p->level--);
9942 return _res;
9943}
9944
9945// factor: '+' factor | '-' factor | '~' factor | power
9946static expr_ty
9947factor_rule(Parser *p)
9948{
9949 D(p->level++);
9950 if (p->error_indicator) {
9951 D(p->level--);
9952 return NULL;
9953 }
9954 expr_ty _res = NULL;
9955 if (_PyPegen_is_memoized(p, factor_type, &_res)) {
9956 D(p->level--);
9957 return _res;
9958 }
9959 int _mark = p->mark;
9960 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9961 p->error_indicator = 1;
9962 D(p->level--);
9963 return NULL;
9964 }
9965 int _start_lineno = p->tokens[_mark]->lineno;
9966 UNUSED(_start_lineno); // Only used by EXTRA macro
9967 int _start_col_offset = p->tokens[_mark]->col_offset;
9968 UNUSED(_start_col_offset); // Only used by EXTRA macro
9969 { // '+' factor
9970 if (p->error_indicator) {
9971 D(p->level--);
9972 return NULL;
9973 }
9974 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9975 Token * _literal;
9976 expr_ty a;
9977 if (
9978 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9979 &&
9980 (a = factor_rule(p)) // factor
9981 )
9982 {
9983 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9984 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9985 if (_token == NULL) {
9986 D(p->level--);
9987 return NULL;
9988 }
9989 int _end_lineno = _token->end_lineno;
9990 UNUSED(_end_lineno); // Only used by EXTRA macro
9991 int _end_col_offset = _token->end_col_offset;
9992 UNUSED(_end_col_offset); // Only used by EXTRA macro
9993 _res = _Py_UnaryOp ( UAdd , a , EXTRA );
9994 if (_res == NULL && PyErr_Occurred()) {
9995 p->error_indicator = 1;
9996 D(p->level--);
9997 return NULL;
9998 }
9999 goto done;
10000 }
10001 p->mark = _mark;
10002 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10003 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor"));
10004 }
10005 { // '-' factor
10006 if (p->error_indicator) {
10007 D(p->level--);
10008 return NULL;
10009 }
10010 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10011 Token * _literal;
10012 expr_ty a;
10013 if (
10014 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
10015 &&
10016 (a = factor_rule(p)) // factor
10017 )
10018 {
10019 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10020 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10021 if (_token == NULL) {
10022 D(p->level--);
10023 return NULL;
10024 }
10025 int _end_lineno = _token->end_lineno;
10026 UNUSED(_end_lineno); // Only used by EXTRA macro
10027 int _end_col_offset = _token->end_col_offset;
10028 UNUSED(_end_col_offset); // Only used by EXTRA macro
10029 _res = _Py_UnaryOp ( USub , a , EXTRA );
10030 if (_res == NULL && PyErr_Occurred()) {
10031 p->error_indicator = 1;
10032 D(p->level--);
10033 return NULL;
10034 }
10035 goto done;
10036 }
10037 p->mark = _mark;
10038 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10039 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor"));
10040 }
10041 { // '~' factor
10042 if (p->error_indicator) {
10043 D(p->level--);
10044 return NULL;
10045 }
10046 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10047 Token * _literal;
10048 expr_ty a;
10049 if (
10050 (_literal = _PyPegen_expect_token(p, 31)) // token='~'
10051 &&
10052 (a = factor_rule(p)) // factor
10053 )
10054 {
10055 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10056 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10057 if (_token == NULL) {
10058 D(p->level--);
10059 return NULL;
10060 }
10061 int _end_lineno = _token->end_lineno;
10062 UNUSED(_end_lineno); // Only used by EXTRA macro
10063 int _end_col_offset = _token->end_col_offset;
10064 UNUSED(_end_col_offset); // Only used by EXTRA macro
10065 _res = _Py_UnaryOp ( Invert , a , EXTRA );
10066 if (_res == NULL && PyErr_Occurred()) {
10067 p->error_indicator = 1;
10068 D(p->level--);
10069 return NULL;
10070 }
10071 goto done;
10072 }
10073 p->mark = _mark;
10074 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10075 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor"));
10076 }
10077 { // power
10078 if (p->error_indicator) {
10079 D(p->level--);
10080 return NULL;
10081 }
10082 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power"));
10083 expr_ty power_var;
10084 if (
10085 (power_var = power_rule(p)) // power
10086 )
10087 {
10088 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power"));
10089 _res = power_var;
10090 goto done;
10091 }
10092 p->mark = _mark;
10093 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10094 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power"));
10095 }
10096 _res = NULL;
10097 done:
10098 _PyPegen_insert_memo(p, _mark, factor_type, _res);
10099 D(p->level--);
10100 return _res;
10101}
10102
10103// power: await_primary '**' factor | await_primary
10104static expr_ty
10105power_rule(Parser *p)
10106{
10107 D(p->level++);
10108 if (p->error_indicator) {
10109 D(p->level--);
10110 return NULL;
10111 }
10112 expr_ty _res = NULL;
10113 int _mark = p->mark;
10114 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10115 p->error_indicator = 1;
10116 D(p->level--);
10117 return NULL;
10118 }
10119 int _start_lineno = p->tokens[_mark]->lineno;
10120 UNUSED(_start_lineno); // Only used by EXTRA macro
10121 int _start_col_offset = p->tokens[_mark]->col_offset;
10122 UNUSED(_start_col_offset); // Only used by EXTRA macro
10123 { // await_primary '**' factor
10124 if (p->error_indicator) {
10125 D(p->level--);
10126 return NULL;
10127 }
10128 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10129 Token * _literal;
10130 expr_ty a;
10131 expr_ty b;
10132 if (
10133 (a = await_primary_rule(p)) // await_primary
10134 &&
10135 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
10136 &&
10137 (b = factor_rule(p)) // factor
10138 )
10139 {
10140 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10141 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10142 if (_token == NULL) {
10143 D(p->level--);
10144 return NULL;
10145 }
10146 int _end_lineno = _token->end_lineno;
10147 UNUSED(_end_lineno); // Only used by EXTRA macro
10148 int _end_col_offset = _token->end_col_offset;
10149 UNUSED(_end_col_offset); // Only used by EXTRA macro
10150 _res = _Py_BinOp ( a , Pow , b , EXTRA );
10151 if (_res == NULL && PyErr_Occurred()) {
10152 p->error_indicator = 1;
10153 D(p->level--);
10154 return NULL;
10155 }
10156 goto done;
10157 }
10158 p->mark = _mark;
10159 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10160 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor"));
10161 }
10162 { // await_primary
10163 if (p->error_indicator) {
10164 D(p->level--);
10165 return NULL;
10166 }
10167 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary"));
10168 expr_ty await_primary_var;
10169 if (
10170 (await_primary_var = await_primary_rule(p)) // await_primary
10171 )
10172 {
10173 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary"));
10174 _res = await_primary_var;
10175 goto done;
10176 }
10177 p->mark = _mark;
10178 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10179 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary"));
10180 }
10181 _res = NULL;
10182 done:
10183 D(p->level--);
10184 return _res;
10185}
10186
10187// await_primary: AWAIT primary | primary
10188static expr_ty
10189await_primary_rule(Parser *p)
10190{
10191 D(p->level++);
10192 if (p->error_indicator) {
10193 D(p->level--);
10194 return NULL;
10195 }
10196 expr_ty _res = NULL;
10197 if (_PyPegen_is_memoized(p, await_primary_type, &_res)) {
10198 D(p->level--);
10199 return _res;
10200 }
10201 int _mark = p->mark;
10202 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10203 p->error_indicator = 1;
10204 D(p->level--);
10205 return NULL;
10206 }
10207 int _start_lineno = p->tokens[_mark]->lineno;
10208 UNUSED(_start_lineno); // Only used by EXTRA macro
10209 int _start_col_offset = p->tokens[_mark]->col_offset;
10210 UNUSED(_start_col_offset); // Only used by EXTRA macro
10211 { // AWAIT primary
10212 if (p->error_indicator) {
10213 D(p->level--);
10214 return NULL;
10215 }
10216 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10217 expr_ty a;
10218 Token * await_var;
10219 if (
10220 (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT'
10221 &&
10222 (a = primary_rule(p)) // primary
10223 )
10224 {
10225 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10226 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10227 if (_token == NULL) {
10228 D(p->level--);
10229 return NULL;
10230 }
10231 int _end_lineno = _token->end_lineno;
10232 UNUSED(_end_lineno); // Only used by EXTRA macro
10233 int _end_col_offset = _token->end_col_offset;
10234 UNUSED(_end_col_offset); // Only used by EXTRA macro
10235 _res = CHECK_VERSION ( 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) );
10236 if (_res == NULL && PyErr_Occurred()) {
10237 p->error_indicator = 1;
10238 D(p->level--);
10239 return NULL;
10240 }
10241 goto done;
10242 }
10243 p->mark = _mark;
10244 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10245 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary"));
10246 }
10247 { // primary
10248 if (p->error_indicator) {
10249 D(p->level--);
10250 return NULL;
10251 }
10252 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary"));
10253 expr_ty primary_var;
10254 if (
10255 (primary_var = primary_rule(p)) // primary
10256 )
10257 {
10258 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary"));
10259 _res = primary_var;
10260 goto done;
10261 }
10262 p->mark = _mark;
10263 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10264 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary"));
10265 }
10266 _res = NULL;
10267 done:
10268 _PyPegen_insert_memo(p, _mark, await_primary_type, _res);
10269 D(p->level--);
10270 return _res;
10271}
10272
10273// Left-recursive
10274// primary:
10275// | primary '.' NAME
10276// | primary genexp
10277// | primary '(' arguments? ')'
10278// | primary '[' slices ']'
10279// | atom
10280static expr_ty primary_raw(Parser *);
10281static expr_ty
10282primary_rule(Parser *p)
10283{
10284 D(p->level++);
10285 expr_ty _res = NULL;
10286 if (_PyPegen_is_memoized(p, primary_type, &_res)) {
10287 D(p->level--);
10288 return _res;
10289 }
10290 int _mark = p->mark;
10291 int _resmark = p->mark;
10292 while (1) {
10293 int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res);
10294 if (tmpvar_7) {
10295 D(p->level--);
10296 return _res;
10297 }
10298 p->mark = _mark;
10299 void *_raw = primary_raw(p);
10300 if (_raw == NULL || p->mark <= _resmark)
10301 break;
10302 _resmark = p->mark;
10303 _res = _raw;
10304 }
10305 p->mark = _resmark;
10306 D(p->level--);
10307 return _res;
10308}
10309static expr_ty
10310primary_raw(Parser *p)
10311{
10312 D(p->level++);
10313 if (p->error_indicator) {
10314 D(p->level--);
10315 return NULL;
10316 }
10317 expr_ty _res = NULL;
10318 int _mark = p->mark;
10319 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10320 p->error_indicator = 1;
10321 D(p->level--);
10322 return NULL;
10323 }
10324 int _start_lineno = p->tokens[_mark]->lineno;
10325 UNUSED(_start_lineno); // Only used by EXTRA macro
10326 int _start_col_offset = p->tokens[_mark]->col_offset;
10327 UNUSED(_start_col_offset); // Only used by EXTRA macro
10328 { // primary '.' NAME
10329 if (p->error_indicator) {
10330 D(p->level--);
10331 return NULL;
10332 }
10333 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10334 Token * _literal;
10335 expr_ty a;
10336 expr_ty b;
10337 if (
10338 (a = primary_rule(p)) // primary
10339 &&
10340 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
10341 &&
10342 (b = _PyPegen_name_token(p)) // NAME
10343 )
10344 {
10345 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10346 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10347 if (_token == NULL) {
10348 D(p->level--);
10349 return NULL;
10350 }
10351 int _end_lineno = _token->end_lineno;
10352 UNUSED(_end_lineno); // Only used by EXTRA macro
10353 int _end_col_offset = _token->end_col_offset;
10354 UNUSED(_end_col_offset); // Only used by EXTRA macro
10355 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
10356 if (_res == NULL && PyErr_Occurred()) {
10357 p->error_indicator = 1;
10358 D(p->level--);
10359 return NULL;
10360 }
10361 goto done;
10362 }
10363 p->mark = _mark;
10364 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10365 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME"));
10366 }
10367 { // primary genexp
10368 if (p->error_indicator) {
10369 D(p->level--);
10370 return NULL;
10371 }
10372 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10373 expr_ty a;
10374 expr_ty b;
10375 if (
10376 (a = primary_rule(p)) // primary
10377 &&
10378 (b = genexp_rule(p)) // genexp
10379 )
10380 {
10381 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10382 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10383 if (_token == NULL) {
10384 D(p->level--);
10385 return NULL;
10386 }
10387 int _end_lineno = _token->end_lineno;
10388 UNUSED(_end_lineno); // Only used by EXTRA macro
10389 int _end_col_offset = _token->end_col_offset;
10390 UNUSED(_end_col_offset); // Only used by EXTRA macro
10391 _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
10392 if (_res == NULL && PyErr_Occurred()) {
10393 p->error_indicator = 1;
10394 D(p->level--);
10395 return NULL;
10396 }
10397 goto done;
10398 }
10399 p->mark = _mark;
10400 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10401 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp"));
10402 }
10403 { // primary '(' arguments? ')'
10404 if (p->error_indicator) {
10405 D(p->level--);
10406 return NULL;
10407 }
10408 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10409 Token * _literal;
10410 Token * _literal_1;
10411 expr_ty a;
10412 void *b;
10413 if (
10414 (a = primary_rule(p)) // primary
10415 &&
10416 (_literal = _PyPegen_expect_token(p, 7)) // token='('
10417 &&
10418 (b = arguments_rule(p), 1) // arguments?
10419 &&
10420 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
10421 )
10422 {
10423 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10424 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10425 if (_token == NULL) {
10426 D(p->level--);
10427 return NULL;
10428 }
10429 int _end_lineno = _token->end_lineno;
10430 UNUSED(_end_lineno); // Only used by EXTRA macro
10431 int _end_col_offset = _token->end_col_offset;
10432 UNUSED(_end_col_offset); // Only used by EXTRA macro
10433 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
10434 if (_res == NULL && PyErr_Occurred()) {
10435 p->error_indicator = 1;
10436 D(p->level--);
10437 return NULL;
10438 }
10439 goto done;
10440 }
10441 p->mark = _mark;
10442 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10443 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'"));
10444 }
10445 { // primary '[' slices ']'
10446 if (p->error_indicator) {
10447 D(p->level--);
10448 return NULL;
10449 }
10450 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10451 Token * _literal;
10452 Token * _literal_1;
10453 expr_ty a;
10454 expr_ty b;
10455 if (
10456 (a = primary_rule(p)) // primary
10457 &&
10458 (_literal = _PyPegen_expect_token(p, 9)) // token='['
10459 &&
10460 (b = slices_rule(p)) // slices
10461 &&
10462 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
10463 )
10464 {
10465 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10466 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10467 if (_token == NULL) {
10468 D(p->level--);
10469 return NULL;
10470 }
10471 int _end_lineno = _token->end_lineno;
10472 UNUSED(_end_lineno); // Only used by EXTRA macro
10473 int _end_col_offset = _token->end_col_offset;
10474 UNUSED(_end_col_offset); // Only used by EXTRA macro
10475 _res = _Py_Subscript ( a , b , Load , EXTRA );
10476 if (_res == NULL && PyErr_Occurred()) {
10477 p->error_indicator = 1;
10478 D(p->level--);
10479 return NULL;
10480 }
10481 goto done;
10482 }
10483 p->mark = _mark;
10484 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10485 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'"));
10486 }
10487 { // atom
10488 if (p->error_indicator) {
10489 D(p->level--);
10490 return NULL;
10491 }
10492 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom"));
10493 expr_ty atom_var;
10494 if (
10495 (atom_var = atom_rule(p)) // atom
10496 )
10497 {
10498 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom"));
10499 _res = atom_var;
10500 goto done;
10501 }
10502 p->mark = _mark;
10503 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10504 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom"));
10505 }
10506 _res = NULL;
10507 done:
10508 D(p->level--);
10509 return _res;
10510}
10511
10512// slices: slice !',' | ','.slice+ ','?
10513static expr_ty
10514slices_rule(Parser *p)
10515{
10516 D(p->level++);
10517 if (p->error_indicator) {
10518 D(p->level--);
10519 return NULL;
10520 }
10521 expr_ty _res = NULL;
10522 int _mark = p->mark;
10523 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10524 p->error_indicator = 1;
10525 D(p->level--);
10526 return NULL;
10527 }
10528 int _start_lineno = p->tokens[_mark]->lineno;
10529 UNUSED(_start_lineno); // Only used by EXTRA macro
10530 int _start_col_offset = p->tokens[_mark]->col_offset;
10531 UNUSED(_start_col_offset); // Only used by EXTRA macro
10532 { // slice !','
10533 if (p->error_indicator) {
10534 D(p->level--);
10535 return NULL;
10536 }
10537 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','"));
10538 expr_ty a;
10539 if (
10540 (a = slice_rule(p)) // slice
10541 &&
10542 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
10543 )
10544 {
10545 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
10546 _res = a;
10547 if (_res == NULL && PyErr_Occurred()) {
10548 p->error_indicator = 1;
10549 D(p->level--);
10550 return NULL;
10551 }
10552 goto done;
10553 }
10554 p->mark = _mark;
10555 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10556 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','"));
10557 }
10558 { // ','.slice+ ','?
10559 if (p->error_indicator) {
10560 D(p->level--);
10561 return NULL;
10562 }
10563 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10564 void *_opt_var;
10565 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010010566 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010567 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010010568 (a = (asdl_expr_seq*)_gather_94_rule(p)) // ','.slice+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010569 &&
10570 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
10571 )
10572 {
10573 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10574 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10575 if (_token == NULL) {
10576 D(p->level--);
10577 return NULL;
10578 }
10579 int _end_lineno = _token->end_lineno;
10580 UNUSED(_end_lineno); // Only used by EXTRA macro
10581 int _end_col_offset = _token->end_col_offset;
10582 UNUSED(_end_col_offset); // Only used by EXTRA macro
10583 _res = _Py_Tuple ( a , Load , EXTRA );
10584 if (_res == NULL && PyErr_Occurred()) {
10585 p->error_indicator = 1;
10586 D(p->level--);
10587 return NULL;
10588 }
10589 goto done;
10590 }
10591 p->mark = _mark;
10592 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10593 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?"));
10594 }
10595 _res = NULL;
10596 done:
10597 D(p->level--);
10598 return _res;
10599}
10600
10601// slice: expression? ':' expression? [':' expression?] | expression
10602static expr_ty
10603slice_rule(Parser *p)
10604{
10605 D(p->level++);
10606 if (p->error_indicator) {
10607 D(p->level--);
10608 return NULL;
10609 }
10610 expr_ty _res = NULL;
10611 int _mark = p->mark;
10612 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10613 p->error_indicator = 1;
10614 D(p->level--);
10615 return NULL;
10616 }
10617 int _start_lineno = p->tokens[_mark]->lineno;
10618 UNUSED(_start_lineno); // Only used by EXTRA macro
10619 int _start_col_offset = p->tokens[_mark]->col_offset;
10620 UNUSED(_start_col_offset); // Only used by EXTRA macro
10621 { // expression? ':' expression? [':' expression?]
10622 if (p->error_indicator) {
10623 D(p->level--);
10624 return NULL;
10625 }
10626 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10627 Token * _literal;
10628 void *a;
10629 void *b;
10630 void *c;
10631 if (
10632 (a = expression_rule(p), 1) // expression?
10633 &&
10634 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
10635 &&
10636 (b = expression_rule(p), 1) // expression?
10637 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010638 (c = _tmp_96_rule(p), 1) // [':' expression?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010639 )
10640 {
10641 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10642 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10643 if (_token == NULL) {
10644 D(p->level--);
10645 return NULL;
10646 }
10647 int _end_lineno = _token->end_lineno;
10648 UNUSED(_end_lineno); // Only used by EXTRA macro
10649 int _end_col_offset = _token->end_col_offset;
10650 UNUSED(_end_col_offset); // Only used by EXTRA macro
10651 _res = _Py_Slice ( a , b , c , EXTRA );
10652 if (_res == NULL && PyErr_Occurred()) {
10653 p->error_indicator = 1;
10654 D(p->level--);
10655 return NULL;
10656 }
10657 goto done;
10658 }
10659 p->mark = _mark;
10660 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10661 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10662 }
10663 { // expression
10664 if (p->error_indicator) {
10665 D(p->level--);
10666 return NULL;
10667 }
10668 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
10669 expr_ty a;
10670 if (
10671 (a = expression_rule(p)) // expression
10672 )
10673 {
10674 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
10675 _res = a;
10676 if (_res == NULL && PyErr_Occurred()) {
10677 p->error_indicator = 1;
10678 D(p->level--);
10679 return NULL;
10680 }
10681 goto done;
10682 }
10683 p->mark = _mark;
10684 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10685 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
10686 }
10687 _res = NULL;
10688 done:
10689 D(p->level--);
10690 return _res;
10691}
10692
10693// atom:
10694// | NAME
10695// | 'True'
10696// | 'False'
10697// | 'None'
10698// | &STRING strings
10699// | NUMBER
10700// | &'(' (tuple | group | genexp)
10701// | &'[' (list | listcomp)
10702// | &'{' (dict | set | dictcomp | setcomp)
10703// | '...'
10704static expr_ty
10705atom_rule(Parser *p)
10706{
10707 D(p->level++);
10708 if (p->error_indicator) {
10709 D(p->level--);
10710 return NULL;
10711 }
10712 expr_ty _res = NULL;
10713 int _mark = p->mark;
10714 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10715 p->error_indicator = 1;
10716 D(p->level--);
10717 return NULL;
10718 }
10719 int _start_lineno = p->tokens[_mark]->lineno;
10720 UNUSED(_start_lineno); // Only used by EXTRA macro
10721 int _start_col_offset = p->tokens[_mark]->col_offset;
10722 UNUSED(_start_col_offset); // Only used by EXTRA macro
10723 { // NAME
10724 if (p->error_indicator) {
10725 D(p->level--);
10726 return NULL;
10727 }
10728 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
10729 expr_ty name_var;
10730 if (
10731 (name_var = _PyPegen_name_token(p)) // NAME
10732 )
10733 {
10734 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
10735 _res = name_var;
10736 goto done;
10737 }
10738 p->mark = _mark;
10739 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10740 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
10741 }
10742 { // 'True'
10743 if (p->error_indicator) {
10744 D(p->level--);
10745 return NULL;
10746 }
10747 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
10748 Token * _keyword;
10749 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010750 (_keyword = _PyPegen_expect_token(p, 528)) // token='True'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010751 )
10752 {
10753 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
10754 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10755 if (_token == NULL) {
10756 D(p->level--);
10757 return NULL;
10758 }
10759 int _end_lineno = _token->end_lineno;
10760 UNUSED(_end_lineno); // Only used by EXTRA macro
10761 int _end_col_offset = _token->end_col_offset;
10762 UNUSED(_end_col_offset); // Only used by EXTRA macro
10763 _res = _Py_Constant ( Py_True , NULL , EXTRA );
10764 if (_res == NULL && PyErr_Occurred()) {
10765 p->error_indicator = 1;
10766 D(p->level--);
10767 return NULL;
10768 }
10769 goto done;
10770 }
10771 p->mark = _mark;
10772 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10773 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
10774 }
10775 { // 'False'
10776 if (p->error_indicator) {
10777 D(p->level--);
10778 return NULL;
10779 }
10780 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
10781 Token * _keyword;
10782 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010783 (_keyword = _PyPegen_expect_token(p, 529)) // token='False'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010784 )
10785 {
10786 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
10787 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10788 if (_token == NULL) {
10789 D(p->level--);
10790 return NULL;
10791 }
10792 int _end_lineno = _token->end_lineno;
10793 UNUSED(_end_lineno); // Only used by EXTRA macro
10794 int _end_col_offset = _token->end_col_offset;
10795 UNUSED(_end_col_offset); // Only used by EXTRA macro
10796 _res = _Py_Constant ( Py_False , NULL , EXTRA );
10797 if (_res == NULL && PyErr_Occurred()) {
10798 p->error_indicator = 1;
10799 D(p->level--);
10800 return NULL;
10801 }
10802 goto done;
10803 }
10804 p->mark = _mark;
10805 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10806 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
10807 }
10808 { // 'None'
10809 if (p->error_indicator) {
10810 D(p->level--);
10811 return NULL;
10812 }
10813 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
10814 Token * _keyword;
10815 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010816 (_keyword = _PyPegen_expect_token(p, 530)) // token='None'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010817 )
10818 {
10819 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
10820 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10821 if (_token == NULL) {
10822 D(p->level--);
10823 return NULL;
10824 }
10825 int _end_lineno = _token->end_lineno;
10826 UNUSED(_end_lineno); // Only used by EXTRA macro
10827 int _end_col_offset = _token->end_col_offset;
10828 UNUSED(_end_col_offset); // Only used by EXTRA macro
10829 _res = _Py_Constant ( Py_None , NULL , EXTRA );
10830 if (_res == NULL && PyErr_Occurred()) {
10831 p->error_indicator = 1;
10832 D(p->level--);
10833 return NULL;
10834 }
10835 goto done;
10836 }
10837 p->mark = _mark;
10838 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10839 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
10840 }
10841 { // &STRING strings
10842 if (p->error_indicator) {
10843 D(p->level--);
10844 return NULL;
10845 }
10846 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10847 expr_ty strings_var;
10848 if (
10849 _PyPegen_lookahead(1, _PyPegen_string_token, p)
10850 &&
10851 (strings_var = strings_rule(p)) // strings
10852 )
10853 {
10854 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10855 _res = strings_var;
10856 goto done;
10857 }
10858 p->mark = _mark;
10859 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10860 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings"));
10861 }
10862 { // NUMBER
10863 if (p->error_indicator) {
10864 D(p->level--);
10865 return NULL;
10866 }
10867 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10868 expr_ty number_var;
10869 if (
10870 (number_var = _PyPegen_number_token(p)) // NUMBER
10871 )
10872 {
10873 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10874 _res = number_var;
10875 goto done;
10876 }
10877 p->mark = _mark;
10878 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10879 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
10880 }
10881 { // &'(' (tuple | group | genexp)
10882 if (p->error_indicator) {
10883 D(p->level--);
10884 return NULL;
10885 }
10886 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010887 void *_tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010888 if (
10889 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='('
10890 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010891 (_tmp_97_var = _tmp_97_rule(p)) // tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010892 )
10893 {
10894 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 +030010895 _res = _tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010896 goto done;
10897 }
10898 p->mark = _mark;
10899 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10900 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)"));
10901 }
10902 { // &'[' (list | listcomp)
10903 if (p->error_indicator) {
10904 D(p->level--);
10905 return NULL;
10906 }
10907 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010908 void *_tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010909 if (
10910 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='['
10911 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010912 (_tmp_98_var = _tmp_98_rule(p)) // list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010913 )
10914 {
10915 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010916 _res = _tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010917 goto done;
10918 }
10919 p->mark = _mark;
10920 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10921 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)"));
10922 }
10923 { // &'{' (dict | set | dictcomp | setcomp)
10924 if (p->error_indicator) {
10925 D(p->level--);
10926 return NULL;
10927 }
10928 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 +030010929 void *_tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010930 if (
10931 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{'
10932 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010933 (_tmp_99_var = _tmp_99_rule(p)) // dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010934 )
10935 {
10936 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 +030010937 _res = _tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010938 goto done;
10939 }
10940 p->mark = _mark;
10941 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10942 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
10943 }
10944 { // '...'
10945 if (p->error_indicator) {
10946 D(p->level--);
10947 return NULL;
10948 }
10949 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
10950 Token * _literal;
10951 if (
10952 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
10953 )
10954 {
10955 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
10956 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10957 if (_token == NULL) {
10958 D(p->level--);
10959 return NULL;
10960 }
10961 int _end_lineno = _token->end_lineno;
10962 UNUSED(_end_lineno); // Only used by EXTRA macro
10963 int _end_col_offset = _token->end_col_offset;
10964 UNUSED(_end_col_offset); // Only used by EXTRA macro
10965 _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
10966 if (_res == NULL && PyErr_Occurred()) {
10967 p->error_indicator = 1;
10968 D(p->level--);
10969 return NULL;
10970 }
10971 goto done;
10972 }
10973 p->mark = _mark;
10974 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10975 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
10976 }
10977 _res = NULL;
10978 done:
10979 D(p->level--);
10980 return _res;
10981}
10982
10983// strings: STRING+
10984static expr_ty
10985strings_rule(Parser *p)
10986{
10987 D(p->level++);
10988 if (p->error_indicator) {
10989 D(p->level--);
10990 return NULL;
10991 }
10992 expr_ty _res = NULL;
10993 if (_PyPegen_is_memoized(p, strings_type, &_res)) {
10994 D(p->level--);
10995 return _res;
10996 }
10997 int _mark = p->mark;
10998 { // STRING+
10999 if (p->error_indicator) {
11000 D(p->level--);
11001 return NULL;
11002 }
11003 D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+"));
11004 asdl_seq * a;
11005 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011006 (a = _loop1_100_rule(p)) // STRING+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011007 )
11008 {
11009 D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+"));
11010 _res = _PyPegen_concatenate_strings ( p , a );
11011 if (_res == NULL && PyErr_Occurred()) {
11012 p->error_indicator = 1;
11013 D(p->level--);
11014 return NULL;
11015 }
11016 goto done;
11017 }
11018 p->mark = _mark;
11019 D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
11020 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+"));
11021 }
11022 _res = NULL;
11023 done:
11024 _PyPegen_insert_memo(p, _mark, strings_type, _res);
11025 D(p->level--);
11026 return _res;
11027}
11028
11029// list: '[' star_named_expressions? ']'
11030static expr_ty
11031list_rule(Parser *p)
11032{
11033 D(p->level++);
11034 if (p->error_indicator) {
11035 D(p->level--);
11036 return NULL;
11037 }
11038 expr_ty _res = NULL;
11039 int _mark = p->mark;
11040 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11041 p->error_indicator = 1;
11042 D(p->level--);
11043 return NULL;
11044 }
11045 int _start_lineno = p->tokens[_mark]->lineno;
11046 UNUSED(_start_lineno); // Only used by EXTRA macro
11047 int _start_col_offset = p->tokens[_mark]->col_offset;
11048 UNUSED(_start_col_offset); // Only used by EXTRA macro
11049 { // '[' star_named_expressions? ']'
11050 if (p->error_indicator) {
11051 D(p->level--);
11052 return NULL;
11053 }
11054 D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11055 Token * _literal;
11056 Token * _literal_1;
11057 void *a;
11058 if (
11059 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11060 &&
11061 (a = star_named_expressions_rule(p), 1) // star_named_expressions?
11062 &&
11063 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11064 )
11065 {
11066 D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11067 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11068 if (_token == NULL) {
11069 D(p->level--);
11070 return NULL;
11071 }
11072 int _end_lineno = _token->end_lineno;
11073 UNUSED(_end_lineno); // Only used by EXTRA macro
11074 int _end_col_offset = _token->end_col_offset;
11075 UNUSED(_end_col_offset); // Only used by EXTRA macro
11076 _res = _Py_List ( a , Load , EXTRA );
11077 if (_res == NULL && PyErr_Occurred()) {
11078 p->error_indicator = 1;
11079 D(p->level--);
11080 return NULL;
11081 }
11082 goto done;
11083 }
11084 p->mark = _mark;
11085 D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
11086 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
11087 }
11088 _res = NULL;
11089 done:
11090 D(p->level--);
11091 return _res;
11092}
11093
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011094// listcomp: '[' named_expression ~ for_if_clauses ']' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011095static expr_ty
11096listcomp_rule(Parser *p)
11097{
11098 D(p->level++);
11099 if (p->error_indicator) {
11100 D(p->level--);
11101 return NULL;
11102 }
11103 expr_ty _res = NULL;
11104 int _mark = p->mark;
11105 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11106 p->error_indicator = 1;
11107 D(p->level--);
11108 return NULL;
11109 }
11110 int _start_lineno = p->tokens[_mark]->lineno;
11111 UNUSED(_start_lineno); // Only used by EXTRA macro
11112 int _start_col_offset = p->tokens[_mark]->col_offset;
11113 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011114 { // '[' named_expression ~ for_if_clauses ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011115 if (p->error_indicator) {
11116 D(p->level--);
11117 return NULL;
11118 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011119 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11120 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011121 Token * _literal;
11122 Token * _literal_1;
11123 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011124 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011125 if (
11126 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11127 &&
11128 (a = named_expression_rule(p)) // named_expression
11129 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011130 (_cut_var = 1)
11131 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011132 (b = for_if_clauses_rule(p)) // for_if_clauses
11133 &&
11134 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11135 )
11136 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011137 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 +010011138 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11139 if (_token == NULL) {
11140 D(p->level--);
11141 return NULL;
11142 }
11143 int _end_lineno = _token->end_lineno;
11144 UNUSED(_end_lineno); // Only used by EXTRA macro
11145 int _end_col_offset = _token->end_col_offset;
11146 UNUSED(_end_col_offset); // Only used by EXTRA macro
11147 _res = _Py_ListComp ( a , b , EXTRA );
11148 if (_res == NULL && PyErr_Occurred()) {
11149 p->error_indicator = 1;
11150 D(p->level--);
11151 return NULL;
11152 }
11153 goto done;
11154 }
11155 p->mark = _mark;
11156 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011157 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11158 if (_cut_var) {
11159 D(p->level--);
11160 return NULL;
11161 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011162 }
11163 { // invalid_comprehension
11164 if (p->error_indicator) {
11165 D(p->level--);
11166 return NULL;
11167 }
11168 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11169 void *invalid_comprehension_var;
11170 if (
11171 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11172 )
11173 {
11174 D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11175 _res = invalid_comprehension_var;
11176 goto done;
11177 }
11178 p->mark = _mark;
11179 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
11180 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11181 }
11182 _res = NULL;
11183 done:
11184 D(p->level--);
11185 return _res;
11186}
11187
11188// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
11189static expr_ty
11190tuple_rule(Parser *p)
11191{
11192 D(p->level++);
11193 if (p->error_indicator) {
11194 D(p->level--);
11195 return NULL;
11196 }
11197 expr_ty _res = NULL;
11198 int _mark = p->mark;
11199 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11200 p->error_indicator = 1;
11201 D(p->level--);
11202 return NULL;
11203 }
11204 int _start_lineno = p->tokens[_mark]->lineno;
11205 UNUSED(_start_lineno); // Only used by EXTRA macro
11206 int _start_col_offset = p->tokens[_mark]->col_offset;
11207 UNUSED(_start_col_offset); // Only used by EXTRA macro
11208 { // '(' [star_named_expression ',' star_named_expressions?] ')'
11209 if (p->error_indicator) {
11210 D(p->level--);
11211 return NULL;
11212 }
11213 D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11214 Token * _literal;
11215 Token * _literal_1;
11216 void *a;
11217 if (
11218 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11219 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011220 (a = _tmp_101_rule(p), 1) // [star_named_expression ',' star_named_expressions?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011221 &&
11222 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11223 )
11224 {
11225 D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11226 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11227 if (_token == NULL) {
11228 D(p->level--);
11229 return NULL;
11230 }
11231 int _end_lineno = _token->end_lineno;
11232 UNUSED(_end_lineno); // Only used by EXTRA macro
11233 int _end_col_offset = _token->end_col_offset;
11234 UNUSED(_end_col_offset); // Only used by EXTRA macro
11235 _res = _Py_Tuple ( a , Load , EXTRA );
11236 if (_res == NULL && PyErr_Occurred()) {
11237 p->error_indicator = 1;
11238 D(p->level--);
11239 return NULL;
11240 }
11241 goto done;
11242 }
11243 p->mark = _mark;
11244 D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
11245 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11246 }
11247 _res = NULL;
11248 done:
11249 D(p->level--);
11250 return _res;
11251}
11252
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011253// group: '(' (yield_expr | named_expression) ')' | invalid_group
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011254static expr_ty
11255group_rule(Parser *p)
11256{
11257 D(p->level++);
11258 if (p->error_indicator) {
11259 D(p->level--);
11260 return NULL;
11261 }
11262 expr_ty _res = NULL;
11263 int _mark = p->mark;
11264 { // '(' (yield_expr | named_expression) ')'
11265 if (p->error_indicator) {
11266 D(p->level--);
11267 return NULL;
11268 }
11269 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11270 Token * _literal;
11271 Token * _literal_1;
11272 void *a;
11273 if (
11274 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11275 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011276 (a = _tmp_102_rule(p)) // yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011277 &&
11278 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11279 )
11280 {
11281 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11282 _res = a;
11283 if (_res == NULL && PyErr_Occurred()) {
11284 p->error_indicator = 1;
11285 D(p->level--);
11286 return NULL;
11287 }
11288 goto done;
11289 }
11290 p->mark = _mark;
11291 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11292 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11293 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011294 { // invalid_group
11295 if (p->error_indicator) {
11296 D(p->level--);
11297 return NULL;
11298 }
11299 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11300 void *invalid_group_var;
11301 if (
11302 (invalid_group_var = invalid_group_rule(p)) // invalid_group
11303 )
11304 {
11305 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11306 _res = invalid_group_var;
11307 goto done;
11308 }
11309 p->mark = _mark;
11310 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11311 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
11312 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011313 _res = NULL;
11314 done:
11315 D(p->level--);
11316 return _res;
11317}
11318
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011319// genexp: '(' expression ~ for_if_clauses ')' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011320static expr_ty
11321genexp_rule(Parser *p)
11322{
11323 D(p->level++);
11324 if (p->error_indicator) {
11325 D(p->level--);
11326 return NULL;
11327 }
11328 expr_ty _res = NULL;
11329 int _mark = p->mark;
11330 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11331 p->error_indicator = 1;
11332 D(p->level--);
11333 return NULL;
11334 }
11335 int _start_lineno = p->tokens[_mark]->lineno;
11336 UNUSED(_start_lineno); // Only used by EXTRA macro
11337 int _start_col_offset = p->tokens[_mark]->col_offset;
11338 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011339 { // '(' expression ~ for_if_clauses ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011340 if (p->error_indicator) {
11341 D(p->level--);
11342 return NULL;
11343 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011344 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11345 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011346 Token * _literal;
11347 Token * _literal_1;
11348 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011349 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011350 if (
11351 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11352 &&
11353 (a = expression_rule(p)) // expression
11354 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011355 (_cut_var = 1)
11356 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011357 (b = for_if_clauses_rule(p)) // for_if_clauses
11358 &&
11359 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11360 )
11361 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011362 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 +010011363 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11364 if (_token == NULL) {
11365 D(p->level--);
11366 return NULL;
11367 }
11368 int _end_lineno = _token->end_lineno;
11369 UNUSED(_end_lineno); // Only used by EXTRA macro
11370 int _end_col_offset = _token->end_col_offset;
11371 UNUSED(_end_col_offset); // Only used by EXTRA macro
11372 _res = _Py_GeneratorExp ( a , b , EXTRA );
11373 if (_res == NULL && PyErr_Occurred()) {
11374 p->error_indicator = 1;
11375 D(p->level--);
11376 return NULL;
11377 }
11378 goto done;
11379 }
11380 p->mark = _mark;
11381 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011382 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11383 if (_cut_var) {
11384 D(p->level--);
11385 return NULL;
11386 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011387 }
11388 { // invalid_comprehension
11389 if (p->error_indicator) {
11390 D(p->level--);
11391 return NULL;
11392 }
11393 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11394 void *invalid_comprehension_var;
11395 if (
11396 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11397 )
11398 {
11399 D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11400 _res = invalid_comprehension_var;
11401 goto done;
11402 }
11403 p->mark = _mark;
11404 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
11405 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11406 }
11407 _res = NULL;
11408 done:
11409 D(p->level--);
11410 return _res;
11411}
11412
11413// set: '{' expressions_list '}'
11414static expr_ty
11415set_rule(Parser *p)
11416{
11417 D(p->level++);
11418 if (p->error_indicator) {
11419 D(p->level--);
11420 return NULL;
11421 }
11422 expr_ty _res = NULL;
11423 int _mark = p->mark;
11424 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11425 p->error_indicator = 1;
11426 D(p->level--);
11427 return NULL;
11428 }
11429 int _start_lineno = p->tokens[_mark]->lineno;
11430 UNUSED(_start_lineno); // Only used by EXTRA macro
11431 int _start_col_offset = p->tokens[_mark]->col_offset;
11432 UNUSED(_start_col_offset); // Only used by EXTRA macro
11433 { // '{' expressions_list '}'
11434 if (p->error_indicator) {
11435 D(p->level--);
11436 return NULL;
11437 }
11438 D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11439 Token * _literal;
11440 Token * _literal_1;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011441 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011442 if (
11443 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11444 &&
11445 (a = expressions_list_rule(p)) // expressions_list
11446 &&
11447 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11448 )
11449 {
11450 D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11451 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11452 if (_token == NULL) {
11453 D(p->level--);
11454 return NULL;
11455 }
11456 int _end_lineno = _token->end_lineno;
11457 UNUSED(_end_lineno); // Only used by EXTRA macro
11458 int _end_col_offset = _token->end_col_offset;
11459 UNUSED(_end_col_offset); // Only used by EXTRA macro
11460 _res = _Py_Set ( a , EXTRA );
11461 if (_res == NULL && PyErr_Occurred()) {
11462 p->error_indicator = 1;
11463 D(p->level--);
11464 return NULL;
11465 }
11466 goto done;
11467 }
11468 p->mark = _mark;
11469 D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
11470 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'"));
11471 }
11472 _res = NULL;
11473 done:
11474 D(p->level--);
11475 return _res;
11476}
11477
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011478// setcomp: '{' expression ~ for_if_clauses '}' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011479static expr_ty
11480setcomp_rule(Parser *p)
11481{
11482 D(p->level++);
11483 if (p->error_indicator) {
11484 D(p->level--);
11485 return NULL;
11486 }
11487 expr_ty _res = NULL;
11488 int _mark = p->mark;
11489 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11490 p->error_indicator = 1;
11491 D(p->level--);
11492 return NULL;
11493 }
11494 int _start_lineno = p->tokens[_mark]->lineno;
11495 UNUSED(_start_lineno); // Only used by EXTRA macro
11496 int _start_col_offset = p->tokens[_mark]->col_offset;
11497 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011498 { // '{' expression ~ for_if_clauses '}'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011499 if (p->error_indicator) {
11500 D(p->level--);
11501 return NULL;
11502 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011503 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11504 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011505 Token * _literal;
11506 Token * _literal_1;
11507 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011508 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011509 if (
11510 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11511 &&
11512 (a = expression_rule(p)) // expression
11513 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011514 (_cut_var = 1)
11515 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011516 (b = for_if_clauses_rule(p)) // for_if_clauses
11517 &&
11518 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11519 )
11520 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011521 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 +010011522 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11523 if (_token == NULL) {
11524 D(p->level--);
11525 return NULL;
11526 }
11527 int _end_lineno = _token->end_lineno;
11528 UNUSED(_end_lineno); // Only used by EXTRA macro
11529 int _end_col_offset = _token->end_col_offset;
11530 UNUSED(_end_col_offset); // Only used by EXTRA macro
11531 _res = _Py_SetComp ( a , b , EXTRA );
11532 if (_res == NULL && PyErr_Occurred()) {
11533 p->error_indicator = 1;
11534 D(p->level--);
11535 return NULL;
11536 }
11537 goto done;
11538 }
11539 p->mark = _mark;
11540 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011541 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11542 if (_cut_var) {
11543 D(p->level--);
11544 return NULL;
11545 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011546 }
11547 { // invalid_comprehension
11548 if (p->error_indicator) {
11549 D(p->level--);
11550 return NULL;
11551 }
11552 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11553 void *invalid_comprehension_var;
11554 if (
11555 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11556 )
11557 {
11558 D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11559 _res = invalid_comprehension_var;
11560 goto done;
11561 }
11562 p->mark = _mark;
11563 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
11564 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11565 }
11566 _res = NULL;
11567 done:
11568 D(p->level--);
11569 return _res;
11570}
11571
11572// dict: '{' double_starred_kvpairs? '}'
11573static expr_ty
11574dict_rule(Parser *p)
11575{
11576 D(p->level++);
11577 if (p->error_indicator) {
11578 D(p->level--);
11579 return NULL;
11580 }
11581 expr_ty _res = NULL;
11582 int _mark = p->mark;
11583 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11584 p->error_indicator = 1;
11585 D(p->level--);
11586 return NULL;
11587 }
11588 int _start_lineno = p->tokens[_mark]->lineno;
11589 UNUSED(_start_lineno); // Only used by EXTRA macro
11590 int _start_col_offset = p->tokens[_mark]->col_offset;
11591 UNUSED(_start_col_offset); // Only used by EXTRA macro
11592 { // '{' double_starred_kvpairs? '}'
11593 if (p->error_indicator) {
11594 D(p->level--);
11595 return NULL;
11596 }
11597 D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11598 Token * _literal;
11599 Token * _literal_1;
11600 void *a;
11601 if (
11602 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11603 &&
11604 (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs?
11605 &&
11606 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11607 )
11608 {
11609 D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11610 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11611 if (_token == NULL) {
11612 D(p->level--);
11613 return NULL;
11614 }
11615 int _end_lineno = _token->end_lineno;
11616 UNUSED(_end_lineno); // Only used by EXTRA macro
11617 int _end_col_offset = _token->end_col_offset;
11618 UNUSED(_end_col_offset); // Only used by EXTRA macro
11619 _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA );
11620 if (_res == NULL && PyErr_Occurred()) {
11621 p->error_indicator = 1;
11622 D(p->level--);
11623 return NULL;
11624 }
11625 goto done;
11626 }
11627 p->mark = _mark;
11628 D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
11629 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11630 }
11631 _res = NULL;
11632 done:
11633 D(p->level--);
11634 return _res;
11635}
11636
11637// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
11638static expr_ty
11639dictcomp_rule(Parser *p)
11640{
11641 D(p->level++);
11642 if (p->error_indicator) {
11643 D(p->level--);
11644 return NULL;
11645 }
11646 expr_ty _res = NULL;
11647 int _mark = p->mark;
11648 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11649 p->error_indicator = 1;
11650 D(p->level--);
11651 return NULL;
11652 }
11653 int _start_lineno = p->tokens[_mark]->lineno;
11654 UNUSED(_start_lineno); // Only used by EXTRA macro
11655 int _start_col_offset = p->tokens[_mark]->col_offset;
11656 UNUSED(_start_col_offset); // Only used by EXTRA macro
11657 { // '{' kvpair for_if_clauses '}'
11658 if (p->error_indicator) {
11659 D(p->level--);
11660 return NULL;
11661 }
11662 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11663 Token * _literal;
11664 Token * _literal_1;
11665 KeyValuePair* a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011666 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011667 if (
11668 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11669 &&
11670 (a = kvpair_rule(p)) // kvpair
11671 &&
11672 (b = for_if_clauses_rule(p)) // for_if_clauses
11673 &&
11674 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11675 )
11676 {
11677 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11678 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11679 if (_token == NULL) {
11680 D(p->level--);
11681 return NULL;
11682 }
11683 int _end_lineno = _token->end_lineno;
11684 UNUSED(_end_lineno); // Only used by EXTRA macro
11685 int _end_col_offset = _token->end_col_offset;
11686 UNUSED(_end_col_offset); // Only used by EXTRA macro
11687 _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
11688 if (_res == NULL && PyErr_Occurred()) {
11689 p->error_indicator = 1;
11690 D(p->level--);
11691 return NULL;
11692 }
11693 goto done;
11694 }
11695 p->mark = _mark;
11696 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11697 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11698 }
11699 { // invalid_dict_comprehension
11700 if (p->error_indicator) {
11701 D(p->level--);
11702 return NULL;
11703 }
11704 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11705 void *invalid_dict_comprehension_var;
11706 if (
11707 (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension
11708 )
11709 {
11710 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11711 _res = invalid_dict_comprehension_var;
11712 goto done;
11713 }
11714 p->mark = _mark;
11715 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11716 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
11717 }
11718 _res = NULL;
11719 done:
11720 D(p->level--);
11721 return _res;
11722}
11723
11724// double_starred_kvpairs: ','.double_starred_kvpair+ ','?
11725static asdl_seq*
11726double_starred_kvpairs_rule(Parser *p)
11727{
11728 D(p->level++);
11729 if (p->error_indicator) {
11730 D(p->level--);
11731 return NULL;
11732 }
11733 asdl_seq* _res = NULL;
11734 int _mark = p->mark;
11735 { // ','.double_starred_kvpair+ ','?
11736 if (p->error_indicator) {
11737 D(p->level--);
11738 return NULL;
11739 }
11740 D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11741 void *_opt_var;
11742 UNUSED(_opt_var); // Silence compiler warnings
11743 asdl_seq * a;
11744 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011745 (a = _gather_103_rule(p)) // ','.double_starred_kvpair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011746 &&
11747 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
11748 )
11749 {
11750 D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11751 _res = a;
11752 if (_res == NULL && PyErr_Occurred()) {
11753 p->error_indicator = 1;
11754 D(p->level--);
11755 return NULL;
11756 }
11757 goto done;
11758 }
11759 p->mark = _mark;
11760 D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
11761 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11762 }
11763 _res = NULL;
11764 done:
11765 D(p->level--);
11766 return _res;
11767}
11768
11769// double_starred_kvpair: '**' bitwise_or | kvpair
11770static KeyValuePair*
11771double_starred_kvpair_rule(Parser *p)
11772{
11773 D(p->level++);
11774 if (p->error_indicator) {
11775 D(p->level--);
11776 return NULL;
11777 }
11778 KeyValuePair* _res = NULL;
11779 int _mark = p->mark;
11780 { // '**' bitwise_or
11781 if (p->error_indicator) {
11782 D(p->level--);
11783 return NULL;
11784 }
11785 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11786 Token * _literal;
11787 expr_ty a;
11788 if (
11789 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
11790 &&
11791 (a = bitwise_or_rule(p)) // bitwise_or
11792 )
11793 {
11794 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11795 _res = _PyPegen_key_value_pair ( p , NULL , a );
11796 if (_res == NULL && PyErr_Occurred()) {
11797 p->error_indicator = 1;
11798 D(p->level--);
11799 return NULL;
11800 }
11801 goto done;
11802 }
11803 p->mark = _mark;
11804 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11805 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or"));
11806 }
11807 { // kvpair
11808 if (p->error_indicator) {
11809 D(p->level--);
11810 return NULL;
11811 }
11812 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair"));
11813 KeyValuePair* kvpair_var;
11814 if (
11815 (kvpair_var = kvpair_rule(p)) // kvpair
11816 )
11817 {
11818 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair"));
11819 _res = kvpair_var;
11820 goto done;
11821 }
11822 p->mark = _mark;
11823 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11824 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair"));
11825 }
11826 _res = NULL;
11827 done:
11828 D(p->level--);
11829 return _res;
11830}
11831
11832// kvpair: expression ':' expression
11833static KeyValuePair*
11834kvpair_rule(Parser *p)
11835{
11836 D(p->level++);
11837 if (p->error_indicator) {
11838 D(p->level--);
11839 return NULL;
11840 }
11841 KeyValuePair* _res = NULL;
11842 int _mark = p->mark;
11843 { // expression ':' expression
11844 if (p->error_indicator) {
11845 D(p->level--);
11846 return NULL;
11847 }
11848 D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11849 Token * _literal;
11850 expr_ty a;
11851 expr_ty b;
11852 if (
11853 (a = expression_rule(p)) // expression
11854 &&
11855 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
11856 &&
11857 (b = expression_rule(p)) // expression
11858 )
11859 {
11860 D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11861 _res = _PyPegen_key_value_pair ( p , a , b );
11862 if (_res == NULL && PyErr_Occurred()) {
11863 p->error_indicator = 1;
11864 D(p->level--);
11865 return NULL;
11866 }
11867 goto done;
11868 }
11869 p->mark = _mark;
11870 D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11871 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
11872 }
11873 _res = NULL;
11874 done:
11875 D(p->level--);
11876 return _res;
11877}
11878
11879// for_if_clauses: for_if_clause+
Pablo Galindoa5634c42020-09-16 19:42:00 +010011880static asdl_comprehension_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011881for_if_clauses_rule(Parser *p)
11882{
11883 D(p->level++);
11884 if (p->error_indicator) {
11885 D(p->level--);
11886 return NULL;
11887 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010011888 asdl_comprehension_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011889 int _mark = p->mark;
11890 { // for_if_clause+
11891 if (p->error_indicator) {
11892 D(p->level--);
11893 return NULL;
11894 }
11895 D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +010011896 asdl_comprehension_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011897 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010011898 (a = (asdl_comprehension_seq*)_loop1_105_rule(p)) // for_if_clause+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011899 )
11900 {
11901 D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +010011902 _res = a;
11903 if (_res == NULL && PyErr_Occurred()) {
11904 p->error_indicator = 1;
11905 D(p->level--);
11906 return NULL;
11907 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011908 goto done;
11909 }
11910 p->mark = _mark;
11911 D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ',
11912 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+"));
11913 }
11914 _res = NULL;
11915 done:
11916 D(p->level--);
11917 return _res;
11918}
11919
11920// for_if_clause:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011921// | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11922// | 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11923// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011924static comprehension_ty
11925for_if_clause_rule(Parser *p)
11926{
11927 D(p->level++);
11928 if (p->error_indicator) {
11929 D(p->level--);
11930 return NULL;
11931 }
11932 comprehension_ty _res = NULL;
11933 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011934 { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011935 if (p->error_indicator) {
11936 D(p->level--);
11937 return NULL;
11938 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011939 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11940 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011941 Token * _keyword;
11942 Token * _keyword_1;
11943 expr_ty a;
11944 Token * async_var;
11945 expr_ty b;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011946 asdl_expr_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011947 if (
11948 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
11949 &&
11950 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11951 &&
11952 (a = star_targets_rule(p)) // star_targets
11953 &&
11954 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11955 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011956 (_cut_var = 1)
11957 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011958 (b = disjunction_rule(p)) // disjunction
11959 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +010011960 (c = (asdl_expr_seq*)_loop0_106_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011961 )
11962 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011963 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 +010011964 _res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) );
11965 if (_res == NULL && PyErr_Occurred()) {
11966 p->error_indicator = 1;
11967 D(p->level--);
11968 return NULL;
11969 }
11970 goto done;
11971 }
11972 p->mark = _mark;
11973 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011974 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11975 if (_cut_var) {
11976 D(p->level--);
11977 return NULL;
11978 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011979 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011980 { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011981 if (p->error_indicator) {
11982 D(p->level--);
11983 return NULL;
11984 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011985 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11986 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011987 Token * _keyword;
11988 Token * _keyword_1;
11989 expr_ty a;
11990 expr_ty b;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011991 asdl_expr_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011992 if (
11993 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11994 &&
11995 (a = star_targets_rule(p)) // star_targets
11996 &&
11997 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11998 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011999 (_cut_var = 1)
12000 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012001 (b = disjunction_rule(p)) // disjunction
12002 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +010012003 (c = (asdl_expr_seq*)_loop0_107_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012004 )
12005 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012006 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 +010012007 _res = _Py_comprehension ( a , b , c , 0 , p -> arena );
12008 if (_res == NULL && PyErr_Occurred()) {
12009 p->error_indicator = 1;
12010 D(p->level--);
12011 return NULL;
12012 }
12013 goto done;
12014 }
12015 p->mark = _mark;
12016 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012017 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
12018 if (_cut_var) {
12019 D(p->level--);
12020 return NULL;
12021 }
12022 }
12023 { // invalid_for_target
12024 if (p->error_indicator) {
12025 D(p->level--);
12026 return NULL;
12027 }
12028 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12029 void *invalid_for_target_var;
12030 if (
12031 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
12032 )
12033 {
12034 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12035 _res = invalid_for_target_var;
12036 goto done;
12037 }
12038 p->mark = _mark;
12039 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
12040 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012041 }
12042 _res = NULL;
12043 done:
12044 D(p->level--);
12045 return _res;
12046}
12047
12048// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
12049static expr_ty
12050yield_expr_rule(Parser *p)
12051{
12052 D(p->level++);
12053 if (p->error_indicator) {
12054 D(p->level--);
12055 return NULL;
12056 }
12057 expr_ty _res = NULL;
12058 int _mark = p->mark;
12059 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12060 p->error_indicator = 1;
12061 D(p->level--);
12062 return NULL;
12063 }
12064 int _start_lineno = p->tokens[_mark]->lineno;
12065 UNUSED(_start_lineno); // Only used by EXTRA macro
12066 int _start_col_offset = p->tokens[_mark]->col_offset;
12067 UNUSED(_start_col_offset); // Only used by EXTRA macro
12068 { // 'yield' 'from' expression
12069 if (p->error_indicator) {
12070 D(p->level--);
12071 return NULL;
12072 }
12073 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12074 Token * _keyword;
12075 Token * _keyword_1;
12076 expr_ty a;
12077 if (
12078 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12079 &&
12080 (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from'
12081 &&
12082 (a = expression_rule(p)) // expression
12083 )
12084 {
12085 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12086 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12087 if (_token == NULL) {
12088 D(p->level--);
12089 return NULL;
12090 }
12091 int _end_lineno = _token->end_lineno;
12092 UNUSED(_end_lineno); // Only used by EXTRA macro
12093 int _end_col_offset = _token->end_col_offset;
12094 UNUSED(_end_col_offset); // Only used by EXTRA macro
12095 _res = _Py_YieldFrom ( a , EXTRA );
12096 if (_res == NULL && PyErr_Occurred()) {
12097 p->error_indicator = 1;
12098 D(p->level--);
12099 return NULL;
12100 }
12101 goto done;
12102 }
12103 p->mark = _mark;
12104 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12105 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
12106 }
12107 { // 'yield' star_expressions?
12108 if (p->error_indicator) {
12109 D(p->level--);
12110 return NULL;
12111 }
12112 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12113 Token * _keyword;
12114 void *a;
12115 if (
12116 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12117 &&
12118 (a = star_expressions_rule(p), 1) // star_expressions?
12119 )
12120 {
12121 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12122 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12123 if (_token == NULL) {
12124 D(p->level--);
12125 return NULL;
12126 }
12127 int _end_lineno = _token->end_lineno;
12128 UNUSED(_end_lineno); // Only used by EXTRA macro
12129 int _end_col_offset = _token->end_col_offset;
12130 UNUSED(_end_col_offset); // Only used by EXTRA macro
12131 _res = _Py_Yield ( a , EXTRA );
12132 if (_res == NULL && PyErr_Occurred()) {
12133 p->error_indicator = 1;
12134 D(p->level--);
12135 return NULL;
12136 }
12137 goto done;
12138 }
12139 p->mark = _mark;
12140 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12141 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
12142 }
12143 _res = NULL;
12144 done:
12145 D(p->level--);
12146 return _res;
12147}
12148
12149// arguments: args ','? &')' | incorrect_arguments
12150static expr_ty
12151arguments_rule(Parser *p)
12152{
12153 D(p->level++);
12154 if (p->error_indicator) {
12155 D(p->level--);
12156 return NULL;
12157 }
12158 expr_ty _res = NULL;
12159 if (_PyPegen_is_memoized(p, arguments_type, &_res)) {
12160 D(p->level--);
12161 return _res;
12162 }
12163 int _mark = p->mark;
12164 { // args ','? &')'
12165 if (p->error_indicator) {
12166 D(p->level--);
12167 return NULL;
12168 }
12169 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12170 void *_opt_var;
12171 UNUSED(_opt_var); // Silence compiler warnings
12172 expr_ty a;
12173 if (
12174 (a = args_rule(p)) // args
12175 &&
12176 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12177 &&
12178 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
12179 )
12180 {
12181 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12182 _res = a;
12183 if (_res == NULL && PyErr_Occurred()) {
12184 p->error_indicator = 1;
12185 D(p->level--);
12186 return NULL;
12187 }
12188 goto done;
12189 }
12190 p->mark = _mark;
12191 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12192 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'"));
12193 }
12194 { // incorrect_arguments
12195 if (p->error_indicator) {
12196 D(p->level--);
12197 return NULL;
12198 }
12199 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "incorrect_arguments"));
12200 void *incorrect_arguments_var;
12201 if (
12202 (incorrect_arguments_var = incorrect_arguments_rule(p)) // incorrect_arguments
12203 )
12204 {
12205 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "incorrect_arguments"));
12206 _res = incorrect_arguments_var;
12207 goto done;
12208 }
12209 p->mark = _mark;
12210 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12211 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "incorrect_arguments"));
12212 }
12213 _res = NULL;
12214 done:
12215 _PyPegen_insert_memo(p, _mark, arguments_type, _res);
12216 D(p->level--);
12217 return _res;
12218}
12219
Pablo Galindo4a97b152020-09-02 17:44:19 +010012220// args: ','.(starred_expression | named_expression !'=')+ [',' kwargs] | kwargs
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012221static expr_ty
12222args_rule(Parser *p)
12223{
12224 D(p->level++);
12225 if (p->error_indicator) {
12226 D(p->level--);
12227 return NULL;
12228 }
12229 expr_ty _res = NULL;
12230 int _mark = p->mark;
12231 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12232 p->error_indicator = 1;
12233 D(p->level--);
12234 return NULL;
12235 }
12236 int _start_lineno = p->tokens[_mark]->lineno;
12237 UNUSED(_start_lineno); // Only used by EXTRA macro
12238 int _start_col_offset = p->tokens[_mark]->col_offset;
12239 UNUSED(_start_col_offset); // Only used by EXTRA macro
Pablo Galindo4a97b152020-09-02 17:44:19 +010012240 { // ','.(starred_expression | named_expression !'=')+ [',' kwargs]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012241 if (p->error_indicator) {
12242 D(p->level--);
12243 return NULL;
12244 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010012245 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
Pablo Galindoa5634c42020-09-16 19:42:00 +010012246 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012247 void *b;
12248 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010012249 (a = (asdl_expr_seq*)_gather_108_rule(p)) // ','.(starred_expression | named_expression !'=')+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012250 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012251 (b = _tmp_110_rule(p), 1) // [',' kwargs]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012252 )
12253 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010012254 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
Pablo Galindo315a61f2020-09-03 15:29:32 +010012255 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12256 if (_token == NULL) {
12257 D(p->level--);
12258 return NULL;
12259 }
12260 int _end_lineno = _token->end_lineno;
12261 UNUSED(_end_lineno); // Only used by EXTRA macro
12262 int _end_col_offset = _token->end_col_offset;
12263 UNUSED(_end_col_offset); // Only used by EXTRA macro
12264 _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012265 if (_res == NULL && PyErr_Occurred()) {
12266 p->error_indicator = 1;
12267 D(p->level--);
12268 return NULL;
12269 }
12270 goto done;
12271 }
12272 p->mark = _mark;
12273 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010012274 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012275 }
12276 { // kwargs
12277 if (p->error_indicator) {
12278 D(p->level--);
12279 return NULL;
12280 }
12281 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
12282 asdl_seq* a;
12283 if (
12284 (a = kwargs_rule(p)) // kwargs
12285 )
12286 {
12287 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
12288 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12289 if (_token == NULL) {
12290 D(p->level--);
12291 return NULL;
12292 }
12293 int _end_lineno = _token->end_lineno;
12294 UNUSED(_end_lineno); // Only used by EXTRA macro
12295 int _end_col_offset = _token->end_col_offset;
12296 UNUSED(_end_col_offset); // Only used by EXTRA macro
12297 _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 );
12298 if (_res == NULL && PyErr_Occurred()) {
12299 p->error_indicator = 1;
12300 D(p->level--);
12301 return NULL;
12302 }
12303 goto done;
12304 }
12305 p->mark = _mark;
12306 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
12307 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
12308 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012309 _res = NULL;
12310 done:
12311 D(p->level--);
12312 return _res;
12313}
12314
12315// kwargs:
12316// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12317// | ','.kwarg_or_starred+
12318// | ','.kwarg_or_double_starred+
12319static asdl_seq*
12320kwargs_rule(Parser *p)
12321{
12322 D(p->level++);
12323 if (p->error_indicator) {
12324 D(p->level--);
12325 return NULL;
12326 }
12327 asdl_seq* _res = NULL;
12328 int _mark = p->mark;
12329 { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12330 if (p->error_indicator) {
12331 D(p->level--);
12332 return NULL;
12333 }
12334 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12335 Token * _literal;
12336 asdl_seq * a;
12337 asdl_seq * b;
12338 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012339 (a = _gather_111_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012340 &&
12341 (_literal = _PyPegen_expect_token(p, 12)) // token=','
12342 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012343 (b = _gather_113_rule(p)) // ','.kwarg_or_double_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+ ',' ','.kwarg_or_double_starred+"));
12347 _res = _PyPegen_join_sequences ( p , a , b );
12348 if (_res == NULL && PyErr_Occurred()) {
12349 p->error_indicator = 1;
12350 D(p->level--);
12351 return NULL;
12352 }
12353 goto done;
12354 }
12355 p->mark = _mark;
12356 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12357 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12358 }
12359 { // ','.kwarg_or_starred+
12360 if (p->error_indicator) {
12361 D(p->level--);
12362 return NULL;
12363 }
12364 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010012365 asdl_seq * _gather_115_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012366 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012367 (_gather_115_var = _gather_115_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012368 )
12369 {
12370 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 +010012371 _res = _gather_115_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012372 goto done;
12373 }
12374 p->mark = _mark;
12375 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12376 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+"));
12377 }
12378 { // ','.kwarg_or_double_starred+
12379 if (p->error_indicator) {
12380 D(p->level--);
12381 return NULL;
12382 }
12383 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 +010012384 asdl_seq * _gather_117_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012385 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012386 (_gather_117_var = _gather_117_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012387 )
12388 {
12389 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 +010012390 _res = _gather_117_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012391 goto done;
12392 }
12393 p->mark = _mark;
12394 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12395 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+"));
12396 }
12397 _res = NULL;
12398 done:
12399 D(p->level--);
12400 return _res;
12401}
12402
12403// starred_expression: '*' expression
12404static expr_ty
12405starred_expression_rule(Parser *p)
12406{
12407 D(p->level++);
12408 if (p->error_indicator) {
12409 D(p->level--);
12410 return NULL;
12411 }
12412 expr_ty _res = NULL;
12413 int _mark = p->mark;
12414 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12415 p->error_indicator = 1;
12416 D(p->level--);
12417 return NULL;
12418 }
12419 int _start_lineno = p->tokens[_mark]->lineno;
12420 UNUSED(_start_lineno); // Only used by EXTRA macro
12421 int _start_col_offset = p->tokens[_mark]->col_offset;
12422 UNUSED(_start_col_offset); // Only used by EXTRA macro
12423 { // '*' expression
12424 if (p->error_indicator) {
12425 D(p->level--);
12426 return NULL;
12427 }
12428 D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12429 Token * _literal;
12430 expr_ty a;
12431 if (
12432 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12433 &&
12434 (a = expression_rule(p)) // expression
12435 )
12436 {
12437 D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12438 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12439 if (_token == NULL) {
12440 D(p->level--);
12441 return NULL;
12442 }
12443 int _end_lineno = _token->end_lineno;
12444 UNUSED(_end_lineno); // Only used by EXTRA macro
12445 int _end_col_offset = _token->end_col_offset;
12446 UNUSED(_end_col_offset); // Only used by EXTRA macro
12447 _res = _Py_Starred ( a , Load , EXTRA );
12448 if (_res == NULL && PyErr_Occurred()) {
12449 p->error_indicator = 1;
12450 D(p->level--);
12451 return NULL;
12452 }
12453 goto done;
12454 }
12455 p->mark = _mark;
12456 D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
12457 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
12458 }
12459 _res = NULL;
12460 done:
12461 D(p->level--);
12462 return _res;
12463}
12464
12465// kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg
12466static KeywordOrStarred*
12467kwarg_or_starred_rule(Parser *p)
12468{
12469 D(p->level++);
12470 if (p->error_indicator) {
12471 D(p->level--);
12472 return NULL;
12473 }
12474 KeywordOrStarred* _res = NULL;
12475 int _mark = p->mark;
12476 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12477 p->error_indicator = 1;
12478 D(p->level--);
12479 return NULL;
12480 }
12481 int _start_lineno = p->tokens[_mark]->lineno;
12482 UNUSED(_start_lineno); // Only used by EXTRA macro
12483 int _start_col_offset = p->tokens[_mark]->col_offset;
12484 UNUSED(_start_col_offset); // Only used by EXTRA macro
12485 { // NAME '=' expression
12486 if (p->error_indicator) {
12487 D(p->level--);
12488 return NULL;
12489 }
12490 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12491 Token * _literal;
12492 expr_ty a;
12493 expr_ty b;
12494 if (
12495 (a = _PyPegen_name_token(p)) // NAME
12496 &&
12497 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12498 &&
12499 (b = expression_rule(p)) // expression
12500 )
12501 {
12502 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12503 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12504 if (_token == NULL) {
12505 D(p->level--);
12506 return NULL;
12507 }
12508 int _end_lineno = _token->end_lineno;
12509 UNUSED(_end_lineno); // Only used by EXTRA macro
12510 int _end_col_offset = _token->end_col_offset;
12511 UNUSED(_end_col_offset); // Only used by EXTRA macro
12512 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
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, "NAME '=' expression"));
12523 }
12524 { // starred_expression
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, "starred_expression"));
12530 expr_ty a;
12531 if (
12532 (a = starred_expression_rule(p)) // starred_expression
12533 )
12534 {
12535 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12536 _res = _PyPegen_keyword_or_starred ( p , a , 0 );
12537 if (_res == NULL && PyErr_Occurred()) {
12538 p->error_indicator = 1;
12539 D(p->level--);
12540 return NULL;
12541 }
12542 goto done;
12543 }
12544 p->mark = _mark;
12545 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12546 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
12547 }
12548 { // invalid_kwarg
12549 if (p->error_indicator) {
12550 D(p->level--);
12551 return NULL;
12552 }
12553 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12554 void *invalid_kwarg_var;
12555 if (
12556 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12557 )
12558 {
12559 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12560 _res = invalid_kwarg_var;
12561 goto done;
12562 }
12563 p->mark = _mark;
12564 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12565 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12566 }
12567 _res = NULL;
12568 done:
12569 D(p->level--);
12570 return _res;
12571}
12572
12573// kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg
12574static KeywordOrStarred*
12575kwarg_or_double_starred_rule(Parser *p)
12576{
12577 D(p->level++);
12578 if (p->error_indicator) {
12579 D(p->level--);
12580 return NULL;
12581 }
12582 KeywordOrStarred* _res = NULL;
12583 int _mark = p->mark;
12584 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12585 p->error_indicator = 1;
12586 D(p->level--);
12587 return NULL;
12588 }
12589 int _start_lineno = p->tokens[_mark]->lineno;
12590 UNUSED(_start_lineno); // Only used by EXTRA macro
12591 int _start_col_offset = p->tokens[_mark]->col_offset;
12592 UNUSED(_start_col_offset); // Only used by EXTRA macro
12593 { // NAME '=' expression
12594 if (p->error_indicator) {
12595 D(p->level--);
12596 return NULL;
12597 }
12598 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12599 Token * _literal;
12600 expr_ty a;
12601 expr_ty b;
12602 if (
12603 (a = _PyPegen_name_token(p)) // NAME
12604 &&
12605 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12606 &&
12607 (b = expression_rule(p)) // expression
12608 )
12609 {
12610 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12611 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12612 if (_token == NULL) {
12613 D(p->level--);
12614 return NULL;
12615 }
12616 int _end_lineno = _token->end_lineno;
12617 UNUSED(_end_lineno); // Only used by EXTRA macro
12618 int _end_col_offset = _token->end_col_offset;
12619 UNUSED(_end_col_offset); // Only used by EXTRA macro
12620 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
12621 if (_res == NULL && PyErr_Occurred()) {
12622 p->error_indicator = 1;
12623 D(p->level--);
12624 return NULL;
12625 }
12626 goto done;
12627 }
12628 p->mark = _mark;
12629 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12630 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12631 }
12632 { // '**' expression
12633 if (p->error_indicator) {
12634 D(p->level--);
12635 return NULL;
12636 }
12637 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12638 Token * _literal;
12639 expr_ty a;
12640 if (
12641 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
12642 &&
12643 (a = expression_rule(p)) // expression
12644 )
12645 {
12646 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12647 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12648 if (_token == NULL) {
12649 D(p->level--);
12650 return NULL;
12651 }
12652 int _end_lineno = _token->end_lineno;
12653 UNUSED(_end_lineno); // Only used by EXTRA macro
12654 int _end_col_offset = _token->end_col_offset;
12655 UNUSED(_end_col_offset); // Only used by EXTRA macro
12656 _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
12657 if (_res == NULL && PyErr_Occurred()) {
12658 p->error_indicator = 1;
12659 D(p->level--);
12660 return NULL;
12661 }
12662 goto done;
12663 }
12664 p->mark = _mark;
12665 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12666 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
12667 }
12668 { // invalid_kwarg
12669 if (p->error_indicator) {
12670 D(p->level--);
12671 return NULL;
12672 }
12673 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12674 void *invalid_kwarg_var;
12675 if (
12676 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12677 )
12678 {
12679 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12680 _res = invalid_kwarg_var;
12681 goto done;
12682 }
12683 p->mark = _mark;
12684 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12685 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12686 }
12687 _res = NULL;
12688 done:
12689 D(p->level--);
12690 return _res;
12691}
12692
12693// star_targets: star_target !',' | star_target ((',' star_target))* ','?
12694static expr_ty
12695star_targets_rule(Parser *p)
12696{
12697 D(p->level++);
12698 if (p->error_indicator) {
12699 D(p->level--);
12700 return NULL;
12701 }
12702 expr_ty _res = NULL;
12703 int _mark = p->mark;
12704 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12705 p->error_indicator = 1;
12706 D(p->level--);
12707 return NULL;
12708 }
12709 int _start_lineno = p->tokens[_mark]->lineno;
12710 UNUSED(_start_lineno); // Only used by EXTRA macro
12711 int _start_col_offset = p->tokens[_mark]->col_offset;
12712 UNUSED(_start_col_offset); // Only used by EXTRA macro
12713 { // star_target !','
12714 if (p->error_indicator) {
12715 D(p->level--);
12716 return NULL;
12717 }
12718 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12719 expr_ty a;
12720 if (
12721 (a = star_target_rule(p)) // star_target
12722 &&
12723 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
12724 )
12725 {
12726 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12727 _res = a;
12728 if (_res == NULL && PyErr_Occurred()) {
12729 p->error_indicator = 1;
12730 D(p->level--);
12731 return NULL;
12732 }
12733 goto done;
12734 }
12735 p->mark = _mark;
12736 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12737 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','"));
12738 }
12739 { // star_target ((',' star_target))* ','?
12740 if (p->error_indicator) {
12741 D(p->level--);
12742 return NULL;
12743 }
12744 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12745 void *_opt_var;
12746 UNUSED(_opt_var); // Silence compiler warnings
12747 expr_ty a;
12748 asdl_seq * b;
12749 if (
12750 (a = star_target_rule(p)) // star_target
12751 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012752 (b = _loop0_119_rule(p)) // ((',' star_target))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012753 &&
12754 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12755 )
12756 {
12757 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12758 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12759 if (_token == NULL) {
12760 D(p->level--);
12761 return NULL;
12762 }
12763 int _end_lineno = _token->end_lineno;
12764 UNUSED(_end_lineno); // Only used by EXTRA macro
12765 int _end_col_offset = _token->end_col_offset;
12766 UNUSED(_end_col_offset); // Only used by EXTRA macro
12767 _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
12768 if (_res == NULL && PyErr_Occurred()) {
12769 p->error_indicator = 1;
12770 D(p->level--);
12771 return NULL;
12772 }
12773 goto done;
12774 }
12775 p->mark = _mark;
12776 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12777 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?"));
12778 }
12779 _res = NULL;
12780 done:
12781 D(p->level--);
12782 return _res;
12783}
12784
12785// star_targets_seq: ','.star_target+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +010012786static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012787star_targets_seq_rule(Parser *p)
12788{
12789 D(p->level++);
12790 if (p->error_indicator) {
12791 D(p->level--);
12792 return NULL;
12793 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010012794 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012795 int _mark = p->mark;
12796 { // ','.star_target+ ','?
12797 if (p->error_indicator) {
12798 D(p->level--);
12799 return NULL;
12800 }
12801 D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12802 void *_opt_var;
12803 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010012804 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012805 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010012806 (a = (asdl_expr_seq*)_gather_120_rule(p)) // ','.star_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012807 &&
12808 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12809 )
12810 {
12811 D(fprintf(stderr, "%*c+ star_targets_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12812 _res = a;
12813 if (_res == NULL && PyErr_Occurred()) {
12814 p->error_indicator = 1;
12815 D(p->level--);
12816 return NULL;
12817 }
12818 goto done;
12819 }
12820 p->mark = _mark;
12821 D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ',
12822 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?"));
12823 }
12824 _res = NULL;
12825 done:
12826 D(p->level--);
12827 return _res;
12828}
12829
12830// star_target:
12831// | '*' (!'*' star_target)
12832// | t_primary '.' NAME !t_lookahead
12833// | t_primary '[' slices ']' !t_lookahead
12834// | star_atom
12835static expr_ty
12836star_target_rule(Parser *p)
12837{
12838 D(p->level++);
12839 if (p->error_indicator) {
12840 D(p->level--);
12841 return NULL;
12842 }
12843 expr_ty _res = NULL;
12844 if (_PyPegen_is_memoized(p, star_target_type, &_res)) {
12845 D(p->level--);
12846 return _res;
12847 }
12848 int _mark = p->mark;
12849 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12850 p->error_indicator = 1;
12851 D(p->level--);
12852 return NULL;
12853 }
12854 int _start_lineno = p->tokens[_mark]->lineno;
12855 UNUSED(_start_lineno); // Only used by EXTRA macro
12856 int _start_col_offset = p->tokens[_mark]->col_offset;
12857 UNUSED(_start_col_offset); // Only used by EXTRA macro
12858 { // '*' (!'*' star_target)
12859 if (p->error_indicator) {
12860 D(p->level--);
12861 return NULL;
12862 }
12863 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12864 Token * _literal;
12865 void *a;
12866 if (
12867 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12868 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012869 (a = _tmp_122_rule(p)) // !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012870 )
12871 {
12872 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12873 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12874 if (_token == NULL) {
12875 D(p->level--);
12876 return NULL;
12877 }
12878 int _end_lineno = _token->end_lineno;
12879 UNUSED(_end_lineno); // Only used by EXTRA macro
12880 int _end_col_offset = _token->end_col_offset;
12881 UNUSED(_end_col_offset); // Only used by EXTRA macro
12882 _res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
12883 if (_res == NULL && PyErr_Occurred()) {
12884 p->error_indicator = 1;
12885 D(p->level--);
12886 return NULL;
12887 }
12888 goto done;
12889 }
12890 p->mark = _mark;
12891 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12892 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)"));
12893 }
12894 { // t_primary '.' NAME !t_lookahead
12895 if (p->error_indicator) {
12896 D(p->level--);
12897 return NULL;
12898 }
12899 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12900 Token * _literal;
12901 expr_ty a;
12902 expr_ty b;
12903 if (
12904 (a = t_primary_rule(p)) // t_primary
12905 &&
12906 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
12907 &&
12908 (b = _PyPegen_name_token(p)) // NAME
12909 &&
12910 _PyPegen_lookahead(0, t_lookahead_rule, p)
12911 )
12912 {
12913 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12914 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12915 if (_token == NULL) {
12916 D(p->level--);
12917 return NULL;
12918 }
12919 int _end_lineno = _token->end_lineno;
12920 UNUSED(_end_lineno); // Only used by EXTRA macro
12921 int _end_col_offset = _token->end_col_offset;
12922 UNUSED(_end_col_offset); // Only used by EXTRA macro
12923 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
12924 if (_res == NULL && PyErr_Occurred()) {
12925 p->error_indicator = 1;
12926 D(p->level--);
12927 return NULL;
12928 }
12929 goto done;
12930 }
12931 p->mark = _mark;
12932 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12933 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12934 }
12935 { // t_primary '[' slices ']' !t_lookahead
12936 if (p->error_indicator) {
12937 D(p->level--);
12938 return NULL;
12939 }
12940 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12941 Token * _literal;
12942 Token * _literal_1;
12943 expr_ty a;
12944 expr_ty b;
12945 if (
12946 (a = t_primary_rule(p)) // t_primary
12947 &&
12948 (_literal = _PyPegen_expect_token(p, 9)) // token='['
12949 &&
12950 (b = slices_rule(p)) // slices
12951 &&
12952 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
12953 &&
12954 _PyPegen_lookahead(0, t_lookahead_rule, p)
12955 )
12956 {
12957 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12958 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12959 if (_token == NULL) {
12960 D(p->level--);
12961 return NULL;
12962 }
12963 int _end_lineno = _token->end_lineno;
12964 UNUSED(_end_lineno); // Only used by EXTRA macro
12965 int _end_col_offset = _token->end_col_offset;
12966 UNUSED(_end_col_offset); // Only used by EXTRA macro
12967 _res = _Py_Subscript ( a , b , Store , EXTRA );
12968 if (_res == NULL && PyErr_Occurred()) {
12969 p->error_indicator = 1;
12970 D(p->level--);
12971 return NULL;
12972 }
12973 goto done;
12974 }
12975 p->mark = _mark;
12976 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12977 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12978 }
12979 { // star_atom
12980 if (p->error_indicator) {
12981 D(p->level--);
12982 return NULL;
12983 }
12984 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom"));
12985 expr_ty star_atom_var;
12986 if (
12987 (star_atom_var = star_atom_rule(p)) // star_atom
12988 )
12989 {
12990 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom"));
12991 _res = star_atom_var;
12992 goto done;
12993 }
12994 p->mark = _mark;
12995 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12996 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom"));
12997 }
12998 _res = NULL;
12999 done:
13000 _PyPegen_insert_memo(p, _mark, star_target_type, _res);
13001 D(p->level--);
13002 return _res;
13003}
13004
13005// star_atom:
13006// | NAME
13007// | '(' star_target ')'
13008// | '(' star_targets_seq? ')'
13009// | '[' star_targets_seq? ']'
13010static expr_ty
13011star_atom_rule(Parser *p)
13012{
13013 D(p->level++);
13014 if (p->error_indicator) {
13015 D(p->level--);
13016 return NULL;
13017 }
13018 expr_ty _res = NULL;
13019 int _mark = p->mark;
13020 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13021 p->error_indicator = 1;
13022 D(p->level--);
13023 return NULL;
13024 }
13025 int _start_lineno = p->tokens[_mark]->lineno;
13026 UNUSED(_start_lineno); // Only used by EXTRA macro
13027 int _start_col_offset = p->tokens[_mark]->col_offset;
13028 UNUSED(_start_col_offset); // Only used by EXTRA macro
13029 { // NAME
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, "NAME"));
13035 expr_ty a;
13036 if (
13037 (a = _PyPegen_name_token(p)) // NAME
13038 )
13039 {
13040 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13041 _res = _PyPegen_set_expr_context ( p , a , Store );
13042 if (_res == NULL && PyErr_Occurred()) {
13043 p->error_indicator = 1;
13044 D(p->level--);
13045 return NULL;
13046 }
13047 goto done;
13048 }
13049 p->mark = _mark;
13050 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13051 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13052 }
13053 { // '(' star_target ')'
13054 if (p->error_indicator) {
13055 D(p->level--);
13056 return NULL;
13057 }
13058 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13059 Token * _literal;
13060 Token * _literal_1;
13061 expr_ty a;
13062 if (
13063 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13064 &&
13065 (a = star_target_rule(p)) // star_target
13066 &&
13067 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13068 )
13069 {
13070 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13071 _res = _PyPegen_set_expr_context ( p , a , Store );
13072 if (_res == NULL && PyErr_Occurred()) {
13073 p->error_indicator = 1;
13074 D(p->level--);
13075 return NULL;
13076 }
13077 goto done;
13078 }
13079 p->mark = _mark;
13080 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13081 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'"));
13082 }
13083 { // '(' star_targets_seq? ')'
13084 if (p->error_indicator) {
13085 D(p->level--);
13086 return NULL;
13087 }
13088 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13089 Token * _literal;
13090 Token * _literal_1;
13091 void *a;
13092 if (
13093 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13094 &&
13095 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13096 &&
13097 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13098 )
13099 {
13100 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13101 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13102 if (_token == NULL) {
13103 D(p->level--);
13104 return NULL;
13105 }
13106 int _end_lineno = _token->end_lineno;
13107 UNUSED(_end_lineno); // Only used by EXTRA macro
13108 int _end_col_offset = _token->end_col_offset;
13109 UNUSED(_end_col_offset); // Only used by EXTRA macro
13110 _res = _Py_Tuple ( a , Store , EXTRA );
13111 if (_res == NULL && PyErr_Occurred()) {
13112 p->error_indicator = 1;
13113 D(p->level--);
13114 return NULL;
13115 }
13116 goto done;
13117 }
13118 p->mark = _mark;
13119 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13120 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'"));
13121 }
13122 { // '[' star_targets_seq? ']'
13123 if (p->error_indicator) {
13124 D(p->level--);
13125 return NULL;
13126 }
13127 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13128 Token * _literal;
13129 Token * _literal_1;
13130 void *a;
13131 if (
13132 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13133 &&
13134 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13135 &&
13136 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13137 )
13138 {
13139 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13140 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13141 if (_token == NULL) {
13142 D(p->level--);
13143 return NULL;
13144 }
13145 int _end_lineno = _token->end_lineno;
13146 UNUSED(_end_lineno); // Only used by EXTRA macro
13147 int _end_col_offset = _token->end_col_offset;
13148 UNUSED(_end_col_offset); // Only used by EXTRA macro
13149 _res = _Py_List ( a , Store , EXTRA );
13150 if (_res == NULL && PyErr_Occurred()) {
13151 p->error_indicator = 1;
13152 D(p->level--);
13153 return NULL;
13154 }
13155 goto done;
13156 }
13157 p->mark = _mark;
13158 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13159 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'"));
13160 }
13161 _res = NULL;
13162 done:
13163 D(p->level--);
13164 return _res;
13165}
13166
13167// single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
13168static expr_ty
13169single_target_rule(Parser *p)
13170{
13171 D(p->level++);
13172 if (p->error_indicator) {
13173 D(p->level--);
13174 return NULL;
13175 }
13176 expr_ty _res = NULL;
13177 int _mark = p->mark;
13178 { // single_subscript_attribute_target
13179 if (p->error_indicator) {
13180 D(p->level--);
13181 return NULL;
13182 }
13183 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13184 expr_ty single_subscript_attribute_target_var;
13185 if (
13186 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
13187 )
13188 {
13189 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13190 _res = single_subscript_attribute_target_var;
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, "single_subscript_attribute_target"));
13196 }
13197 { // NAME
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, "NAME"));
13203 expr_ty a;
13204 if (
13205 (a = _PyPegen_name_token(p)) // NAME
13206 )
13207 {
13208 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13209 _res = _PyPegen_set_expr_context ( p , a , Store );
13210 if (_res == NULL && PyErr_Occurred()) {
13211 p->error_indicator = 1;
13212 D(p->level--);
13213 return NULL;
13214 }
13215 goto done;
13216 }
13217 p->mark = _mark;
13218 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13219 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13220 }
13221 { // '(' single_target ')'
13222 if (p->error_indicator) {
13223 D(p->level--);
13224 return NULL;
13225 }
13226 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13227 Token * _literal;
13228 Token * _literal_1;
13229 expr_ty a;
13230 if (
13231 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13232 &&
13233 (a = single_target_rule(p)) // single_target
13234 &&
13235 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13236 )
13237 {
13238 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13239 _res = a;
13240 if (_res == NULL && PyErr_Occurred()) {
13241 p->error_indicator = 1;
13242 D(p->level--);
13243 return NULL;
13244 }
13245 goto done;
13246 }
13247 p->mark = _mark;
13248 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13249 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
13250 }
13251 _res = NULL;
13252 done:
13253 D(p->level--);
13254 return _res;
13255}
13256
13257// single_subscript_attribute_target:
13258// | t_primary '.' NAME !t_lookahead
13259// | t_primary '[' slices ']' !t_lookahead
13260static expr_ty
13261single_subscript_attribute_target_rule(Parser *p)
13262{
13263 D(p->level++);
13264 if (p->error_indicator) {
13265 D(p->level--);
13266 return NULL;
13267 }
13268 expr_ty _res = NULL;
13269 int _mark = p->mark;
13270 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13271 p->error_indicator = 1;
13272 D(p->level--);
13273 return NULL;
13274 }
13275 int _start_lineno = p->tokens[_mark]->lineno;
13276 UNUSED(_start_lineno); // Only used by EXTRA macro
13277 int _start_col_offset = p->tokens[_mark]->col_offset;
13278 UNUSED(_start_col_offset); // Only used by EXTRA macro
13279 { // t_primary '.' NAME !t_lookahead
13280 if (p->error_indicator) {
13281 D(p->level--);
13282 return NULL;
13283 }
13284 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13285 Token * _literal;
13286 expr_ty a;
13287 expr_ty b;
13288 if (
13289 (a = t_primary_rule(p)) // t_primary
13290 &&
13291 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13292 &&
13293 (b = _PyPegen_name_token(p)) // NAME
13294 &&
13295 _PyPegen_lookahead(0, t_lookahead_rule, p)
13296 )
13297 {
13298 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13299 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13300 if (_token == NULL) {
13301 D(p->level--);
13302 return NULL;
13303 }
13304 int _end_lineno = _token->end_lineno;
13305 UNUSED(_end_lineno); // Only used by EXTRA macro
13306 int _end_col_offset = _token->end_col_offset;
13307 UNUSED(_end_col_offset); // Only used by EXTRA macro
13308 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13309 if (_res == NULL && PyErr_Occurred()) {
13310 p->error_indicator = 1;
13311 D(p->level--);
13312 return NULL;
13313 }
13314 goto done;
13315 }
13316 p->mark = _mark;
13317 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13318 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13319 }
13320 { // t_primary '[' slices ']' !t_lookahead
13321 if (p->error_indicator) {
13322 D(p->level--);
13323 return NULL;
13324 }
13325 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13326 Token * _literal;
13327 Token * _literal_1;
13328 expr_ty a;
13329 expr_ty b;
13330 if (
13331 (a = t_primary_rule(p)) // t_primary
13332 &&
13333 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13334 &&
13335 (b = slices_rule(p)) // slices
13336 &&
13337 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13338 &&
13339 _PyPegen_lookahead(0, t_lookahead_rule, p)
13340 )
13341 {
13342 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13343 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13344 if (_token == NULL) {
13345 D(p->level--);
13346 return NULL;
13347 }
13348 int _end_lineno = _token->end_lineno;
13349 UNUSED(_end_lineno); // Only used by EXTRA macro
13350 int _end_col_offset = _token->end_col_offset;
13351 UNUSED(_end_col_offset); // Only used by EXTRA macro
13352 _res = _Py_Subscript ( a , b , Store , EXTRA );
13353 if (_res == NULL && PyErr_Occurred()) {
13354 p->error_indicator = 1;
13355 D(p->level--);
13356 return NULL;
13357 }
13358 goto done;
13359 }
13360 p->mark = _mark;
13361 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13362 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13363 }
13364 _res = NULL;
13365 done:
13366 D(p->level--);
13367 return _res;
13368}
13369
13370// del_targets: ','.del_target+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +010013371static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013372del_targets_rule(Parser *p)
13373{
13374 D(p->level++);
13375 if (p->error_indicator) {
13376 D(p->level--);
13377 return NULL;
13378 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010013379 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013380 int _mark = p->mark;
13381 { // ','.del_target+ ','?
13382 if (p->error_indicator) {
13383 D(p->level--);
13384 return NULL;
13385 }
13386 D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13387 void *_opt_var;
13388 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010013389 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013390 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010013391 (a = (asdl_expr_seq*)_gather_123_rule(p)) // ','.del_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013392 &&
13393 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13394 )
13395 {
13396 D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13397 _res = a;
13398 if (_res == NULL && PyErr_Occurred()) {
13399 p->error_indicator = 1;
13400 D(p->level--);
13401 return NULL;
13402 }
13403 goto done;
13404 }
13405 p->mark = _mark;
13406 D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ',
13407 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?"));
13408 }
13409 _res = NULL;
13410 done:
13411 D(p->level--);
13412 return _res;
13413}
13414
13415// del_target:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013416// | t_primary '.' NAME !t_lookahead
13417// | t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013418// | del_t_atom
13419static expr_ty
13420del_target_rule(Parser *p)
13421{
13422 D(p->level++);
13423 if (p->error_indicator) {
13424 D(p->level--);
13425 return NULL;
13426 }
13427 expr_ty _res = NULL;
13428 if (_PyPegen_is_memoized(p, del_target_type, &_res)) {
13429 D(p->level--);
13430 return _res;
13431 }
13432 int _mark = p->mark;
13433 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13434 p->error_indicator = 1;
13435 D(p->level--);
13436 return NULL;
13437 }
13438 int _start_lineno = p->tokens[_mark]->lineno;
13439 UNUSED(_start_lineno); // Only used by EXTRA macro
13440 int _start_col_offset = p->tokens[_mark]->col_offset;
13441 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013442 { // t_primary '.' NAME !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013443 if (p->error_indicator) {
13444 D(p->level--);
13445 return NULL;
13446 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013447 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 +010013448 Token * _literal;
13449 expr_ty a;
13450 expr_ty b;
13451 if (
13452 (a = t_primary_rule(p)) // t_primary
13453 &&
13454 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13455 &&
13456 (b = _PyPegen_name_token(p)) // NAME
13457 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013458 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013459 )
13460 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013461 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 +010013462 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13463 if (_token == NULL) {
13464 D(p->level--);
13465 return NULL;
13466 }
13467 int _end_lineno = _token->end_lineno;
13468 UNUSED(_end_lineno); // Only used by EXTRA macro
13469 int _end_col_offset = _token->end_col_offset;
13470 UNUSED(_end_col_offset); // Only used by EXTRA macro
13471 _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
13472 if (_res == NULL && PyErr_Occurred()) {
13473 p->error_indicator = 1;
13474 D(p->level--);
13475 return NULL;
13476 }
13477 goto done;
13478 }
13479 p->mark = _mark;
13480 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013481 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013482 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013483 { // t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013484 if (p->error_indicator) {
13485 D(p->level--);
13486 return NULL;
13487 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013488 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 +010013489 Token * _literal;
13490 Token * _literal_1;
13491 expr_ty a;
13492 expr_ty b;
13493 if (
13494 (a = t_primary_rule(p)) // t_primary
13495 &&
13496 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13497 &&
13498 (b = slices_rule(p)) // slices
13499 &&
13500 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13501 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013502 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013503 )
13504 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013505 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 +010013506 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13507 if (_token == NULL) {
13508 D(p->level--);
13509 return NULL;
13510 }
13511 int _end_lineno = _token->end_lineno;
13512 UNUSED(_end_lineno); // Only used by EXTRA macro
13513 int _end_col_offset = _token->end_col_offset;
13514 UNUSED(_end_col_offset); // Only used by EXTRA macro
13515 _res = _Py_Subscript ( a , b , Del , EXTRA );
13516 if (_res == NULL && PyErr_Occurred()) {
13517 p->error_indicator = 1;
13518 D(p->level--);
13519 return NULL;
13520 }
13521 goto done;
13522 }
13523 p->mark = _mark;
13524 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013525 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013526 }
13527 { // del_t_atom
13528 if (p->error_indicator) {
13529 D(p->level--);
13530 return NULL;
13531 }
13532 D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13533 expr_ty del_t_atom_var;
13534 if (
13535 (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom
13536 )
13537 {
13538 D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13539 _res = del_t_atom_var;
13540 goto done;
13541 }
13542 p->mark = _mark;
13543 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
13544 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom"));
13545 }
13546 _res = NULL;
13547 done:
13548 _PyPegen_insert_memo(p, _mark, del_target_type, _res);
13549 D(p->level--);
13550 return _res;
13551}
13552
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013553// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013554static expr_ty
13555del_t_atom_rule(Parser *p)
13556{
13557 D(p->level++);
13558 if (p->error_indicator) {
13559 D(p->level--);
13560 return NULL;
13561 }
13562 expr_ty _res = NULL;
13563 int _mark = p->mark;
13564 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13565 p->error_indicator = 1;
13566 D(p->level--);
13567 return NULL;
13568 }
13569 int _start_lineno = p->tokens[_mark]->lineno;
13570 UNUSED(_start_lineno); // Only used by EXTRA macro
13571 int _start_col_offset = p->tokens[_mark]->col_offset;
13572 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013573 { // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013574 if (p->error_indicator) {
13575 D(p->level--);
13576 return NULL;
13577 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013578 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013579 expr_ty a;
13580 if (
13581 (a = _PyPegen_name_token(p)) // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013582 )
13583 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013584 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 +010013585 _res = _PyPegen_set_expr_context ( p , a , Del );
13586 if (_res == NULL && PyErr_Occurred()) {
13587 p->error_indicator = 1;
13588 D(p->level--);
13589 return NULL;
13590 }
13591 goto done;
13592 }
13593 p->mark = _mark;
13594 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013595 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013596 }
13597 { // '(' del_target ')'
13598 if (p->error_indicator) {
13599 D(p->level--);
13600 return NULL;
13601 }
13602 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13603 Token * _literal;
13604 Token * _literal_1;
13605 expr_ty a;
13606 if (
13607 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13608 &&
13609 (a = del_target_rule(p)) // del_target
13610 &&
13611 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13612 )
13613 {
13614 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13615 _res = _PyPegen_set_expr_context ( p , a , Del );
13616 if (_res == NULL && PyErr_Occurred()) {
13617 p->error_indicator = 1;
13618 D(p->level--);
13619 return NULL;
13620 }
13621 goto done;
13622 }
13623 p->mark = _mark;
13624 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13625 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'"));
13626 }
13627 { // '(' del_targets? ')'
13628 if (p->error_indicator) {
13629 D(p->level--);
13630 return NULL;
13631 }
13632 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13633 Token * _literal;
13634 Token * _literal_1;
13635 void *a;
13636 if (
13637 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13638 &&
13639 (a = del_targets_rule(p), 1) // del_targets?
13640 &&
13641 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13642 )
13643 {
13644 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13645 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13646 if (_token == NULL) {
13647 D(p->level--);
13648 return NULL;
13649 }
13650 int _end_lineno = _token->end_lineno;
13651 UNUSED(_end_lineno); // Only used by EXTRA macro
13652 int _end_col_offset = _token->end_col_offset;
13653 UNUSED(_end_col_offset); // Only used by EXTRA macro
13654 _res = _Py_Tuple ( a , Del , EXTRA );
13655 if (_res == NULL && PyErr_Occurred()) {
13656 p->error_indicator = 1;
13657 D(p->level--);
13658 return NULL;
13659 }
13660 goto done;
13661 }
13662 p->mark = _mark;
13663 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13664 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'"));
13665 }
13666 { // '[' del_targets? ']'
13667 if (p->error_indicator) {
13668 D(p->level--);
13669 return NULL;
13670 }
13671 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13672 Token * _literal;
13673 Token * _literal_1;
13674 void *a;
13675 if (
13676 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13677 &&
13678 (a = del_targets_rule(p), 1) // del_targets?
13679 &&
13680 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13681 )
13682 {
13683 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13684 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13685 if (_token == NULL) {
13686 D(p->level--);
13687 return NULL;
13688 }
13689 int _end_lineno = _token->end_lineno;
13690 UNUSED(_end_lineno); // Only used by EXTRA macro
13691 int _end_col_offset = _token->end_col_offset;
13692 UNUSED(_end_col_offset); // Only used by EXTRA macro
13693 _res = _Py_List ( a , Del , EXTRA );
13694 if (_res == NULL && PyErr_Occurred()) {
13695 p->error_indicator = 1;
13696 D(p->level--);
13697 return NULL;
13698 }
13699 goto done;
13700 }
13701 p->mark = _mark;
13702 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13703 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'"));
13704 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013705 _res = NULL;
13706 done:
13707 D(p->level--);
13708 return _res;
13709}
13710
13711// targets: ','.target+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +010013712static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013713targets_rule(Parser *p)
13714{
13715 D(p->level++);
13716 if (p->error_indicator) {
13717 D(p->level--);
13718 return NULL;
13719 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010013720 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013721 int _mark = p->mark;
13722 { // ','.target+ ','?
13723 if (p->error_indicator) {
13724 D(p->level--);
13725 return NULL;
13726 }
13727 D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13728 void *_opt_var;
13729 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010013730 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013731 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010013732 (a = (asdl_expr_seq*)_gather_125_rule(p)) // ','.target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013733 &&
13734 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13735 )
13736 {
13737 D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13738 _res = a;
13739 if (_res == NULL && PyErr_Occurred()) {
13740 p->error_indicator = 1;
13741 D(p->level--);
13742 return NULL;
13743 }
13744 goto done;
13745 }
13746 p->mark = _mark;
13747 D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ',
13748 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?"));
13749 }
13750 _res = NULL;
13751 done:
13752 D(p->level--);
13753 return _res;
13754}
13755
13756// target:
13757// | t_primary '.' NAME !t_lookahead
13758// | t_primary '[' slices ']' !t_lookahead
13759// | t_atom
13760static expr_ty
13761target_rule(Parser *p)
13762{
13763 D(p->level++);
13764 if (p->error_indicator) {
13765 D(p->level--);
13766 return NULL;
13767 }
13768 expr_ty _res = NULL;
13769 if (_PyPegen_is_memoized(p, target_type, &_res)) {
13770 D(p->level--);
13771 return _res;
13772 }
13773 int _mark = p->mark;
13774 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13775 p->error_indicator = 1;
13776 D(p->level--);
13777 return NULL;
13778 }
13779 int _start_lineno = p->tokens[_mark]->lineno;
13780 UNUSED(_start_lineno); // Only used by EXTRA macro
13781 int _start_col_offset = p->tokens[_mark]->col_offset;
13782 UNUSED(_start_col_offset); // Only used by EXTRA macro
13783 { // t_primary '.' NAME !t_lookahead
13784 if (p->error_indicator) {
13785 D(p->level--);
13786 return NULL;
13787 }
13788 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13789 Token * _literal;
13790 expr_ty a;
13791 expr_ty b;
13792 if (
13793 (a = t_primary_rule(p)) // t_primary
13794 &&
13795 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13796 &&
13797 (b = _PyPegen_name_token(p)) // NAME
13798 &&
13799 _PyPegen_lookahead(0, t_lookahead_rule, p)
13800 )
13801 {
13802 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13803 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13804 if (_token == NULL) {
13805 D(p->level--);
13806 return NULL;
13807 }
13808 int _end_lineno = _token->end_lineno;
13809 UNUSED(_end_lineno); // Only used by EXTRA macro
13810 int _end_col_offset = _token->end_col_offset;
13811 UNUSED(_end_col_offset); // Only used by EXTRA macro
13812 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13813 if (_res == NULL && PyErr_Occurred()) {
13814 p->error_indicator = 1;
13815 D(p->level--);
13816 return NULL;
13817 }
13818 goto done;
13819 }
13820 p->mark = _mark;
13821 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13822 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13823 }
13824 { // t_primary '[' slices ']' !t_lookahead
13825 if (p->error_indicator) {
13826 D(p->level--);
13827 return NULL;
13828 }
13829 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13830 Token * _literal;
13831 Token * _literal_1;
13832 expr_ty a;
13833 expr_ty b;
13834 if (
13835 (a = t_primary_rule(p)) // t_primary
13836 &&
13837 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13838 &&
13839 (b = slices_rule(p)) // slices
13840 &&
13841 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13842 &&
13843 _PyPegen_lookahead(0, t_lookahead_rule, p)
13844 )
13845 {
13846 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13847 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13848 if (_token == NULL) {
13849 D(p->level--);
13850 return NULL;
13851 }
13852 int _end_lineno = _token->end_lineno;
13853 UNUSED(_end_lineno); // Only used by EXTRA macro
13854 int _end_col_offset = _token->end_col_offset;
13855 UNUSED(_end_col_offset); // Only used by EXTRA macro
13856 _res = _Py_Subscript ( a , b , Store , EXTRA );
13857 if (_res == NULL && PyErr_Occurred()) {
13858 p->error_indicator = 1;
13859 D(p->level--);
13860 return NULL;
13861 }
13862 goto done;
13863 }
13864 p->mark = _mark;
13865 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13866 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13867 }
13868 { // t_atom
13869 if (p->error_indicator) {
13870 D(p->level--);
13871 return NULL;
13872 }
13873 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom"));
13874 expr_ty t_atom_var;
13875 if (
13876 (t_atom_var = t_atom_rule(p)) // t_atom
13877 )
13878 {
13879 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom"));
13880 _res = t_atom_var;
13881 goto done;
13882 }
13883 p->mark = _mark;
13884 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13885 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom"));
13886 }
13887 _res = NULL;
13888 done:
13889 _PyPegen_insert_memo(p, _mark, target_type, _res);
13890 D(p->level--);
13891 return _res;
13892}
13893
13894// Left-recursive
13895// t_primary:
13896// | t_primary '.' NAME &t_lookahead
13897// | t_primary '[' slices ']' &t_lookahead
13898// | t_primary genexp &t_lookahead
13899// | t_primary '(' arguments? ')' &t_lookahead
13900// | atom &t_lookahead
13901static expr_ty t_primary_raw(Parser *);
13902static expr_ty
13903t_primary_rule(Parser *p)
13904{
13905 D(p->level++);
13906 expr_ty _res = NULL;
13907 if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
13908 D(p->level--);
13909 return _res;
13910 }
13911 int _mark = p->mark;
13912 int _resmark = p->mark;
13913 while (1) {
13914 int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
13915 if (tmpvar_8) {
13916 D(p->level--);
13917 return _res;
13918 }
13919 p->mark = _mark;
13920 void *_raw = t_primary_raw(p);
13921 if (_raw == NULL || p->mark <= _resmark)
13922 break;
13923 _resmark = p->mark;
13924 _res = _raw;
13925 }
13926 p->mark = _resmark;
13927 D(p->level--);
13928 return _res;
13929}
13930static expr_ty
13931t_primary_raw(Parser *p)
13932{
13933 D(p->level++);
13934 if (p->error_indicator) {
13935 D(p->level--);
13936 return NULL;
13937 }
13938 expr_ty _res = NULL;
13939 int _mark = p->mark;
13940 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13941 p->error_indicator = 1;
13942 D(p->level--);
13943 return NULL;
13944 }
13945 int _start_lineno = p->tokens[_mark]->lineno;
13946 UNUSED(_start_lineno); // Only used by EXTRA macro
13947 int _start_col_offset = p->tokens[_mark]->col_offset;
13948 UNUSED(_start_col_offset); // Only used by EXTRA macro
13949 { // t_primary '.' NAME &t_lookahead
13950 if (p->error_indicator) {
13951 D(p->level--);
13952 return NULL;
13953 }
13954 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13955 Token * _literal;
13956 expr_ty a;
13957 expr_ty b;
13958 if (
13959 (a = t_primary_rule(p)) // t_primary
13960 &&
13961 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13962 &&
13963 (b = _PyPegen_name_token(p)) // NAME
13964 &&
13965 _PyPegen_lookahead(1, t_lookahead_rule, p)
13966 )
13967 {
13968 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13969 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13970 if (_token == NULL) {
13971 D(p->level--);
13972 return NULL;
13973 }
13974 int _end_lineno = _token->end_lineno;
13975 UNUSED(_end_lineno); // Only used by EXTRA macro
13976 int _end_col_offset = _token->end_col_offset;
13977 UNUSED(_end_col_offset); // Only used by EXTRA macro
13978 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
13979 if (_res == NULL && PyErr_Occurred()) {
13980 p->error_indicator = 1;
13981 D(p->level--);
13982 return NULL;
13983 }
13984 goto done;
13985 }
13986 p->mark = _mark;
13987 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
13988 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13989 }
13990 { // t_primary '[' slices ']' &t_lookahead
13991 if (p->error_indicator) {
13992 D(p->level--);
13993 return NULL;
13994 }
13995 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
13996 Token * _literal;
13997 Token * _literal_1;
13998 expr_ty a;
13999 expr_ty b;
14000 if (
14001 (a = t_primary_rule(p)) // t_primary
14002 &&
14003 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14004 &&
14005 (b = slices_rule(p)) // slices
14006 &&
14007 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14008 &&
14009 _PyPegen_lookahead(1, t_lookahead_rule, p)
14010 )
14011 {
14012 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14013 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14014 if (_token == NULL) {
14015 D(p->level--);
14016 return NULL;
14017 }
14018 int _end_lineno = _token->end_lineno;
14019 UNUSED(_end_lineno); // Only used by EXTRA macro
14020 int _end_col_offset = _token->end_col_offset;
14021 UNUSED(_end_col_offset); // Only used by EXTRA macro
14022 _res = _Py_Subscript ( a , b , Load , EXTRA );
14023 if (_res == NULL && PyErr_Occurred()) {
14024 p->error_indicator = 1;
14025 D(p->level--);
14026 return NULL;
14027 }
14028 goto done;
14029 }
14030 p->mark = _mark;
14031 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14032 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14033 }
14034 { // t_primary genexp &t_lookahead
14035 if (p->error_indicator) {
14036 D(p->level--);
14037 return NULL;
14038 }
14039 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14040 expr_ty a;
14041 expr_ty b;
14042 if (
14043 (a = t_primary_rule(p)) // t_primary
14044 &&
14045 (b = genexp_rule(p)) // genexp
14046 &&
14047 _PyPegen_lookahead(1, t_lookahead_rule, p)
14048 )
14049 {
14050 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14051 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14052 if (_token == NULL) {
14053 D(p->level--);
14054 return NULL;
14055 }
14056 int _end_lineno = _token->end_lineno;
14057 UNUSED(_end_lineno); // Only used by EXTRA macro
14058 int _end_col_offset = _token->end_col_offset;
14059 UNUSED(_end_col_offset); // Only used by EXTRA macro
14060 _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
14061 if (_res == NULL && PyErr_Occurred()) {
14062 p->error_indicator = 1;
14063 D(p->level--);
14064 return NULL;
14065 }
14066 goto done;
14067 }
14068 p->mark = _mark;
14069 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14070 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
14071 }
14072 { // t_primary '(' arguments? ')' &t_lookahead
14073 if (p->error_indicator) {
14074 D(p->level--);
14075 return NULL;
14076 }
14077 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14078 Token * _literal;
14079 Token * _literal_1;
14080 expr_ty a;
14081 void *b;
14082 if (
14083 (a = t_primary_rule(p)) // t_primary
14084 &&
14085 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14086 &&
14087 (b = arguments_rule(p), 1) // arguments?
14088 &&
14089 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14090 &&
14091 _PyPegen_lookahead(1, t_lookahead_rule, p)
14092 )
14093 {
14094 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14095 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14096 if (_token == NULL) {
14097 D(p->level--);
14098 return NULL;
14099 }
14100 int _end_lineno = _token->end_lineno;
14101 UNUSED(_end_lineno); // Only used by EXTRA macro
14102 int _end_col_offset = _token->end_col_offset;
14103 UNUSED(_end_col_offset); // Only used by EXTRA macro
14104 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
14105 if (_res == NULL && PyErr_Occurred()) {
14106 p->error_indicator = 1;
14107 D(p->level--);
14108 return NULL;
14109 }
14110 goto done;
14111 }
14112 p->mark = _mark;
14113 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14114 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14115 }
14116 { // atom &t_lookahead
14117 if (p->error_indicator) {
14118 D(p->level--);
14119 return NULL;
14120 }
14121 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14122 expr_ty a;
14123 if (
14124 (a = atom_rule(p)) // atom
14125 &&
14126 _PyPegen_lookahead(1, t_lookahead_rule, p)
14127 )
14128 {
14129 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14130 _res = a;
14131 if (_res == NULL && PyErr_Occurred()) {
14132 p->error_indicator = 1;
14133 D(p->level--);
14134 return NULL;
14135 }
14136 goto done;
14137 }
14138 p->mark = _mark;
14139 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14140 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
14141 }
14142 _res = NULL;
14143 done:
14144 D(p->level--);
14145 return _res;
14146}
14147
14148// t_lookahead: '(' | '[' | '.'
14149static void *
14150t_lookahead_rule(Parser *p)
14151{
14152 D(p->level++);
14153 if (p->error_indicator) {
14154 D(p->level--);
14155 return NULL;
14156 }
14157 void * _res = NULL;
14158 int _mark = p->mark;
14159 { // '('
14160 if (p->error_indicator) {
14161 D(p->level--);
14162 return NULL;
14163 }
14164 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
14165 Token * _literal;
14166 if (
14167 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14168 )
14169 {
14170 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
14171 _res = _literal;
14172 goto done;
14173 }
14174 p->mark = _mark;
14175 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14176 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
14177 }
14178 { // '['
14179 if (p->error_indicator) {
14180 D(p->level--);
14181 return NULL;
14182 }
14183 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
14184 Token * _literal;
14185 if (
14186 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14187 )
14188 {
14189 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
14190 _res = _literal;
14191 goto done;
14192 }
14193 p->mark = _mark;
14194 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14195 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
14196 }
14197 { // '.'
14198 if (p->error_indicator) {
14199 D(p->level--);
14200 return NULL;
14201 }
14202 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
14203 Token * _literal;
14204 if (
14205 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
14206 )
14207 {
14208 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
14209 _res = _literal;
14210 goto done;
14211 }
14212 p->mark = _mark;
14213 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14214 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
14215 }
14216 _res = NULL;
14217 done:
14218 D(p->level--);
14219 return _res;
14220}
14221
14222// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
14223static expr_ty
14224t_atom_rule(Parser *p)
14225{
14226 D(p->level++);
14227 if (p->error_indicator) {
14228 D(p->level--);
14229 return NULL;
14230 }
14231 expr_ty _res = NULL;
14232 int _mark = p->mark;
14233 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
14234 p->error_indicator = 1;
14235 D(p->level--);
14236 return NULL;
14237 }
14238 int _start_lineno = p->tokens[_mark]->lineno;
14239 UNUSED(_start_lineno); // Only used by EXTRA macro
14240 int _start_col_offset = p->tokens[_mark]->col_offset;
14241 UNUSED(_start_col_offset); // Only used by EXTRA macro
14242 { // NAME
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, "NAME"));
14248 expr_ty a;
14249 if (
14250 (a = _PyPegen_name_token(p)) // NAME
14251 )
14252 {
14253 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
14254 _res = _PyPegen_set_expr_context ( p , a , Store );
14255 if (_res == NULL && PyErr_Occurred()) {
14256 p->error_indicator = 1;
14257 D(p->level--);
14258 return NULL;
14259 }
14260 goto done;
14261 }
14262 p->mark = _mark;
14263 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14264 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
14265 }
14266 { // '(' target ')'
14267 if (p->error_indicator) {
14268 D(p->level--);
14269 return NULL;
14270 }
14271 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14272 Token * _literal;
14273 Token * _literal_1;
14274 expr_ty a;
14275 if (
14276 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14277 &&
14278 (a = target_rule(p)) // target
14279 &&
14280 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14281 )
14282 {
14283 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14284 _res = _PyPegen_set_expr_context ( p , a , Store );
14285 if (_res == NULL && PyErr_Occurred()) {
14286 p->error_indicator = 1;
14287 D(p->level--);
14288 return NULL;
14289 }
14290 goto done;
14291 }
14292 p->mark = _mark;
14293 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14294 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'"));
14295 }
14296 { // '(' targets? ')'
14297 if (p->error_indicator) {
14298 D(p->level--);
14299 return NULL;
14300 }
14301 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14302 Token * _literal;
14303 Token * _literal_1;
14304 void *b;
14305 if (
14306 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14307 &&
14308 (b = targets_rule(p), 1) // targets?
14309 &&
14310 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14311 )
14312 {
14313 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14314 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14315 if (_token == NULL) {
14316 D(p->level--);
14317 return NULL;
14318 }
14319 int _end_lineno = _token->end_lineno;
14320 UNUSED(_end_lineno); // Only used by EXTRA macro
14321 int _end_col_offset = _token->end_col_offset;
14322 UNUSED(_end_col_offset); // Only used by EXTRA macro
14323 _res = _Py_Tuple ( b , Store , EXTRA );
14324 if (_res == NULL && PyErr_Occurred()) {
14325 p->error_indicator = 1;
14326 D(p->level--);
14327 return NULL;
14328 }
14329 goto done;
14330 }
14331 p->mark = _mark;
14332 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14333 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'"));
14334 }
14335 { // '[' targets? ']'
14336 if (p->error_indicator) {
14337 D(p->level--);
14338 return NULL;
14339 }
14340 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14341 Token * _literal;
14342 Token * _literal_1;
14343 void *b;
14344 if (
14345 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14346 &&
14347 (b = targets_rule(p), 1) // targets?
14348 &&
14349 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14350 )
14351 {
14352 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14353 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14354 if (_token == NULL) {
14355 D(p->level--);
14356 return NULL;
14357 }
14358 int _end_lineno = _token->end_lineno;
14359 UNUSED(_end_lineno); // Only used by EXTRA macro
14360 int _end_col_offset = _token->end_col_offset;
14361 UNUSED(_end_col_offset); // Only used by EXTRA macro
14362 _res = _Py_List ( b , Store , EXTRA );
14363 if (_res == NULL && PyErr_Occurred()) {
14364 p->error_indicator = 1;
14365 D(p->level--);
14366 return NULL;
14367 }
14368 goto done;
14369 }
14370 p->mark = _mark;
14371 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14372 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'"));
14373 }
14374 _res = NULL;
14375 done:
14376 D(p->level--);
14377 return _res;
14378}
14379
14380// incorrect_arguments:
14381// | args ',' '*'
14382// | expression for_if_clauses ',' [args | expression for_if_clauses]
14383// | args for_if_clauses
14384// | args ',' expression for_if_clauses
14385// | args ',' args
14386static void *
14387incorrect_arguments_rule(Parser *p)
14388{
14389 D(p->level++);
14390 if (p->error_indicator) {
14391 D(p->level--);
14392 return NULL;
14393 }
14394 void * _res = NULL;
14395 int _mark = p->mark;
14396 { // args ',' '*'
14397 if (p->error_indicator) {
14398 D(p->level--);
14399 return NULL;
14400 }
14401 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
14402 Token * _literal;
14403 Token * _literal_1;
14404 expr_ty args_var;
14405 if (
14406 (args_var = args_rule(p)) // args
14407 &&
14408 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14409 &&
14410 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
14411 )
14412 {
14413 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
14414 _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
14415 if (_res == NULL && PyErr_Occurred()) {
14416 p->error_indicator = 1;
14417 D(p->level--);
14418 return NULL;
14419 }
14420 goto done;
14421 }
14422 p->mark = _mark;
14423 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14424 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'"));
14425 }
14426 { // expression for_if_clauses ',' [args | expression for_if_clauses]
14427 if (p->error_indicator) {
14428 D(p->level--);
14429 return NULL;
14430 }
14431 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14432 Token * _literal;
14433 void *_opt_var;
14434 UNUSED(_opt_var); // Silence compiler warnings
14435 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010014436 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014437 if (
14438 (a = expression_rule(p)) // expression
14439 &&
14440 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14441 &&
14442 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14443 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014444 (_opt_var = _tmp_127_rule(p), 1) // [args | expression for_if_clauses]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014445 )
14446 {
14447 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]"));
14448 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14449 if (_res == NULL && PyErr_Occurred()) {
14450 p->error_indicator = 1;
14451 D(p->level--);
14452 return NULL;
14453 }
14454 goto done;
14455 }
14456 p->mark = _mark;
14457 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14458 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14459 }
14460 { // args for_if_clauses
14461 if (p->error_indicator) {
14462 D(p->level--);
14463 return NULL;
14464 }
14465 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
14466 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010014467 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014468 if (
14469 (a = args_rule(p)) // args
14470 &&
14471 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14472 )
14473 {
14474 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
14475 _res = _PyPegen_nonparen_genexp_in_call ( p , a );
14476 if (_res == NULL && PyErr_Occurred()) {
14477 p->error_indicator = 1;
14478 D(p->level--);
14479 return NULL;
14480 }
14481 goto done;
14482 }
14483 p->mark = _mark;
14484 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14485 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses"));
14486 }
14487 { // args ',' expression for_if_clauses
14488 if (p->error_indicator) {
14489 D(p->level--);
14490 return NULL;
14491 }
14492 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
14493 Token * _literal;
14494 expr_ty a;
14495 expr_ty args_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +010014496 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014497 if (
14498 (args_var = args_rule(p)) // args
14499 &&
14500 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14501 &&
14502 (a = expression_rule(p)) // expression
14503 &&
14504 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14505 )
14506 {
14507 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
14508 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14509 if (_res == NULL && PyErr_Occurred()) {
14510 p->error_indicator = 1;
14511 D(p->level--);
14512 return NULL;
14513 }
14514 goto done;
14515 }
14516 p->mark = _mark;
14517 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14518 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses"));
14519 }
14520 { // args ',' args
14521 if (p->error_indicator) {
14522 D(p->level--);
14523 return NULL;
14524 }
14525 D(fprintf(stderr, "%*c> incorrect_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args"));
14526 Token * _literal;
14527 expr_ty a;
14528 expr_ty args_var;
14529 if (
14530 (a = args_rule(p)) // args
14531 &&
14532 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14533 &&
14534 (args_var = args_rule(p)) // args
14535 )
14536 {
14537 D(fprintf(stderr, "%*c+ incorrect_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args"));
14538 _res = _PyPegen_arguments_parsing_error ( p , a );
14539 if (_res == NULL && PyErr_Occurred()) {
14540 p->error_indicator = 1;
14541 D(p->level--);
14542 return NULL;
14543 }
14544 goto done;
14545 }
14546 p->mark = _mark;
14547 D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ',
14548 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args"));
14549 }
14550 _res = NULL;
14551 done:
14552 D(p->level--);
14553 return _res;
14554}
14555
14556// invalid_kwarg: expression '='
14557static void *
14558invalid_kwarg_rule(Parser *p)
14559{
14560 D(p->level++);
14561 if (p->error_indicator) {
14562 D(p->level--);
14563 return NULL;
14564 }
14565 void * _res = NULL;
14566 int _mark = p->mark;
14567 { // expression '='
14568 if (p->error_indicator) {
14569 D(p->level--);
14570 return NULL;
14571 }
14572 D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='"));
14573 Token * _literal;
14574 expr_ty a;
14575 if (
14576 (a = expression_rule(p)) // expression
14577 &&
14578 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14579 )
14580 {
14581 D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='"));
14582 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" );
14583 if (_res == NULL && PyErr_Occurred()) {
14584 p->error_indicator = 1;
14585 D(p->level--);
14586 return NULL;
14587 }
14588 goto done;
14589 }
14590 p->mark = _mark;
14591 D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
14592 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='"));
14593 }
14594 _res = NULL;
14595 done:
14596 D(p->level--);
14597 return _res;
14598}
14599
14600// invalid_named_expression: expression ':=' expression
14601static void *
14602invalid_named_expression_rule(Parser *p)
14603{
14604 D(p->level++);
14605 if (p->error_indicator) {
14606 D(p->level--);
14607 return NULL;
14608 }
14609 void * _res = NULL;
14610 int _mark = p->mark;
14611 { // expression ':=' expression
14612 if (p->error_indicator) {
14613 D(p->level--);
14614 return NULL;
14615 }
14616 D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14617 Token * _literal;
14618 expr_ty a;
14619 expr_ty expression_var;
14620 if (
14621 (a = expression_rule(p)) // expression
14622 &&
14623 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
14624 &&
14625 (expression_var = expression_rule(p)) // expression
14626 )
14627 {
14628 D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14629 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
14630 if (_res == NULL && PyErr_Occurred()) {
14631 p->error_indicator = 1;
14632 D(p->level--);
14633 return NULL;
14634 }
14635 goto done;
14636 }
14637 p->mark = _mark;
14638 D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
14639 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression"));
14640 }
14641 _res = NULL;
14642 done:
14643 D(p->level--);
14644 return _res;
14645}
14646
14647// invalid_assignment:
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014648// | invalid_ann_assign_target ':' expression
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014649// | star_named_expression ',' star_named_expressions* ':' expression
14650// | expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014651// | ((star_targets '='))* star_expressions '='
14652// | ((star_targets '='))* yield_expr '='
14653// | star_expressions augassign (yield_expr | star_expressions)
14654static void *
14655invalid_assignment_rule(Parser *p)
14656{
14657 D(p->level++);
14658 if (p->error_indicator) {
14659 D(p->level--);
14660 return NULL;
14661 }
14662 void * _res = NULL;
14663 int _mark = p->mark;
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014664 { // invalid_ann_assign_target ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014665 if (p->error_indicator) {
14666 D(p->level--);
14667 return NULL;
14668 }
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014669 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 +010014670 Token * _literal;
14671 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014672 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014673 if (
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014674 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014675 &&
14676 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014677 &&
14678 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014679 )
14680 {
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014681 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
14682 _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 +010014683 if (_res == NULL && PyErr_Occurred()) {
14684 p->error_indicator = 1;
14685 D(p->level--);
14686 return NULL;
14687 }
14688 goto done;
14689 }
14690 p->mark = _mark;
14691 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014692 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014693 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014694 { // star_named_expression ',' star_named_expressions* ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014695 if (p->error_indicator) {
14696 D(p->level--);
14697 return NULL;
14698 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014699 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 +010014700 Token * _literal;
14701 Token * _literal_1;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014702 asdl_seq * _loop0_128_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014703 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014704 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014705 if (
14706 (a = star_named_expression_rule(p)) // star_named_expression
14707 &&
14708 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14709 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014710 (_loop0_128_var = _loop0_128_rule(p)) // star_named_expressions*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014711 &&
14712 (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014713 &&
14714 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014715 )
14716 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014717 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 +010014718 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
14719 if (_res == NULL && PyErr_Occurred()) {
14720 p->error_indicator = 1;
14721 D(p->level--);
14722 return NULL;
14723 }
14724 goto done;
14725 }
14726 p->mark = _mark;
14727 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014728 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014729 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014730 { // expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014731 if (p->error_indicator) {
14732 D(p->level--);
14733 return NULL;
14734 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014735 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014736 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014737 expr_ty a;
14738 expr_ty expression_var;
14739 if (
14740 (a = expression_rule(p)) // expression
14741 &&
14742 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
14743 &&
14744 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014745 )
14746 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014747 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 +010014748 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
14749 if (_res == NULL && PyErr_Occurred()) {
14750 p->error_indicator = 1;
14751 D(p->level--);
14752 return NULL;
14753 }
14754 goto done;
14755 }
14756 p->mark = _mark;
14757 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014758 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014759 }
14760 { // ((star_targets '='))* star_expressions '='
14761 if (p->error_indicator) {
14762 D(p->level--);
14763 return NULL;
14764 }
14765 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14766 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014767 asdl_seq * _loop0_129_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014768 expr_ty a;
14769 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010014770 (_loop0_129_var = _loop0_129_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014771 &&
14772 (a = star_expressions_rule(p)) // star_expressions
14773 &&
14774 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14775 )
14776 {
14777 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 +030014778 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014779 if (_res == NULL && PyErr_Occurred()) {
14780 p->error_indicator = 1;
14781 D(p->level--);
14782 return NULL;
14783 }
14784 goto done;
14785 }
14786 p->mark = _mark;
14787 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14788 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14789 }
14790 { // ((star_targets '='))* yield_expr '='
14791 if (p->error_indicator) {
14792 D(p->level--);
14793 return NULL;
14794 }
14795 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14796 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014797 asdl_seq * _loop0_130_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014798 expr_ty a;
14799 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010014800 (_loop0_130_var = _loop0_130_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014801 &&
14802 (a = yield_expr_rule(p)) // yield_expr
14803 &&
14804 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14805 )
14806 {
14807 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14808 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
14809 if (_res == NULL && PyErr_Occurred()) {
14810 p->error_indicator = 1;
14811 D(p->level--);
14812 return NULL;
14813 }
14814 goto done;
14815 }
14816 p->mark = _mark;
14817 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14818 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14819 }
14820 { // star_expressions augassign (yield_expr | star_expressions)
14821 if (p->error_indicator) {
14822 D(p->level--);
14823 return NULL;
14824 }
14825 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 +010014826 void *_tmp_131_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014827 expr_ty a;
14828 AugOperator* augassign_var;
14829 if (
14830 (a = star_expressions_rule(p)) // star_expressions
14831 &&
14832 (augassign_var = augassign_rule(p)) // augassign
14833 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014834 (_tmp_131_var = _tmp_131_rule(p)) // yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014835 )
14836 {
14837 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14838 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
14839 if (_res == NULL && PyErr_Occurred()) {
14840 p->error_indicator = 1;
14841 D(p->level--);
14842 return NULL;
14843 }
14844 goto done;
14845 }
14846 p->mark = _mark;
14847 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14848 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14849 }
14850 _res = NULL;
14851 done:
14852 D(p->level--);
14853 return _res;
14854}
14855
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014856// invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')'
14857static expr_ty
14858invalid_ann_assign_target_rule(Parser *p)
14859{
14860 D(p->level++);
14861 if (p->error_indicator) {
14862 D(p->level--);
14863 return NULL;
14864 }
14865 expr_ty _res = NULL;
14866 int _mark = p->mark;
14867 { // list
14868 if (p->error_indicator) {
14869 D(p->level--);
14870 return NULL;
14871 }
14872 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
14873 expr_ty list_var;
14874 if (
14875 (list_var = list_rule(p)) // list
14876 )
14877 {
14878 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
14879 _res = list_var;
14880 goto done;
14881 }
14882 p->mark = _mark;
14883 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14884 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
14885 }
14886 { // tuple
14887 if (p->error_indicator) {
14888 D(p->level--);
14889 return NULL;
14890 }
14891 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
14892 expr_ty tuple_var;
14893 if (
14894 (tuple_var = tuple_rule(p)) // tuple
14895 )
14896 {
14897 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
14898 _res = tuple_var;
14899 goto done;
14900 }
14901 p->mark = _mark;
14902 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14903 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
14904 }
14905 { // '(' invalid_ann_assign_target ')'
14906 if (p->error_indicator) {
14907 D(p->level--);
14908 return NULL;
14909 }
14910 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14911 Token * _literal;
14912 Token * _literal_1;
14913 expr_ty a;
14914 if (
14915 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14916 &&
14917 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
14918 &&
14919 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14920 )
14921 {
14922 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14923 _res = a;
14924 if (_res == NULL && PyErr_Occurred()) {
14925 p->error_indicator = 1;
14926 D(p->level--);
14927 return NULL;
14928 }
14929 goto done;
14930 }
14931 p->mark = _mark;
14932 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14933 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14934 }
14935 _res = NULL;
14936 done:
14937 D(p->level--);
14938 return _res;
14939}
14940
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014941// invalid_del_stmt: 'del' star_expressions
14942static void *
14943invalid_del_stmt_rule(Parser *p)
14944{
14945 D(p->level++);
14946 if (p->error_indicator) {
14947 D(p->level--);
14948 return NULL;
14949 }
14950 void * _res = NULL;
14951 int _mark = p->mark;
14952 { // 'del' star_expressions
14953 if (p->error_indicator) {
14954 D(p->level--);
14955 return NULL;
14956 }
14957 D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
14958 Token * _keyword;
14959 expr_ty a;
14960 if (
14961 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
14962 &&
14963 (a = star_expressions_rule(p)) // star_expressions
14964 )
14965 {
14966 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 +030014967 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014968 if (_res == NULL && PyErr_Occurred()) {
14969 p->error_indicator = 1;
14970 D(p->level--);
14971 return NULL;
14972 }
14973 goto done;
14974 }
14975 p->mark = _mark;
14976 D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
14977 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions"));
14978 }
14979 _res = NULL;
14980 done:
14981 D(p->level--);
14982 return _res;
14983}
14984
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014985// invalid_block: NEWLINE !INDENT
14986static void *
14987invalid_block_rule(Parser *p)
14988{
14989 D(p->level++);
14990 if (p->error_indicator) {
14991 D(p->level--);
14992 return NULL;
14993 }
14994 void * _res = NULL;
14995 int _mark = p->mark;
14996 { // NEWLINE !INDENT
14997 if (p->error_indicator) {
14998 D(p->level--);
14999 return NULL;
15000 }
15001 D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
15002 Token * newline_var;
15003 if (
15004 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15005 &&
15006 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
15007 )
15008 {
15009 D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
15010 _res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
15011 if (_res == NULL && PyErr_Occurred()) {
15012 p->error_indicator = 1;
15013 D(p->level--);
15014 return NULL;
15015 }
15016 goto done;
15017 }
15018 p->mark = _mark;
15019 D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ',
15020 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT"));
15021 }
15022 _res = NULL;
15023 done:
15024 D(p->level--);
15025 return _res;
15026}
15027
15028// invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses
15029static void *
15030invalid_comprehension_rule(Parser *p)
15031{
15032 D(p->level++);
15033 if (p->error_indicator) {
15034 D(p->level--);
15035 return NULL;
15036 }
15037 void * _res = NULL;
15038 int _mark = p->mark;
15039 { // ('[' | '(' | '{') starred_expression for_if_clauses
15040 if (p->error_indicator) {
15041 D(p->level--);
15042 return NULL;
15043 }
15044 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 +010015045 void *_tmp_132_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015046 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010015047 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015048 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015049 (_tmp_132_var = _tmp_132_rule(p)) // '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015050 &&
15051 (a = starred_expression_rule(p)) // starred_expression
15052 &&
15053 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15054 )
15055 {
15056 D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15057 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" );
15058 if (_res == NULL && PyErr_Occurred()) {
15059 p->error_indicator = 1;
15060 D(p->level--);
15061 return NULL;
15062 }
15063 goto done;
15064 }
15065 p->mark = _mark;
15066 D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15067 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15068 }
15069 _res = NULL;
15070 done:
15071 D(p->level--);
15072 return _res;
15073}
15074
15075// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
15076static void *
15077invalid_dict_comprehension_rule(Parser *p)
15078{
15079 D(p->level++);
15080 if (p->error_indicator) {
15081 D(p->level--);
15082 return NULL;
15083 }
15084 void * _res = NULL;
15085 int _mark = p->mark;
15086 { // '{' '**' bitwise_or for_if_clauses '}'
15087 if (p->error_indicator) {
15088 D(p->level--);
15089 return NULL;
15090 }
15091 D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15092 Token * _literal;
15093 Token * _literal_1;
15094 Token * a;
15095 expr_ty bitwise_or_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +010015096 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015097 if (
15098 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
15099 &&
15100 (a = _PyPegen_expect_token(p, 35)) // token='**'
15101 &&
15102 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
15103 &&
15104 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15105 &&
15106 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
15107 )
15108 {
15109 D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15110 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
15111 if (_res == NULL && PyErr_Occurred()) {
15112 p->error_indicator = 1;
15113 D(p->level--);
15114 return NULL;
15115 }
15116 goto done;
15117 }
15118 p->mark = _mark;
15119 D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15120 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15121 }
15122 _res = NULL;
15123 done:
15124 D(p->level--);
15125 return _res;
15126}
15127
15128// invalid_parameters:
15129// | param_no_default* (slash_with_default | param_with_default+) param_no_default
15130static void *
15131invalid_parameters_rule(Parser *p)
15132{
15133 D(p->level++);
15134 if (p->error_indicator) {
15135 D(p->level--);
15136 return NULL;
15137 }
15138 void * _res = NULL;
15139 int _mark = p->mark;
15140 { // param_no_default* (slash_with_default | param_with_default+) param_no_default
15141 if (p->error_indicator) {
15142 D(p->level--);
15143 return NULL;
15144 }
15145 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 +010015146 asdl_seq * _loop0_133_var;
15147 void *_tmp_134_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015148 arg_ty param_no_default_var;
15149 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015150 (_loop0_133_var = _loop0_133_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015151 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015152 (_tmp_134_var = _tmp_134_rule(p)) // slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015153 &&
15154 (param_no_default_var = param_no_default_rule(p)) // param_no_default
15155 )
15156 {
15157 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"));
15158 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15159 if (_res == NULL && PyErr_Occurred()) {
15160 p->error_indicator = 1;
15161 D(p->level--);
15162 return NULL;
15163 }
15164 goto done;
15165 }
15166 p->mark = _mark;
15167 D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15168 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
15169 }
15170 _res = NULL;
15171 done:
15172 D(p->level--);
15173 return _res;
15174}
15175
15176// invalid_lambda_parameters:
15177// | lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15178static void *
15179invalid_lambda_parameters_rule(Parser *p)
15180{
15181 D(p->level++);
15182 if (p->error_indicator) {
15183 D(p->level--);
15184 return NULL;
15185 }
15186 void * _res = NULL;
15187 int _mark = p->mark;
15188 { // lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15189 if (p->error_indicator) {
15190 D(p->level--);
15191 return NULL;
15192 }
15193 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 +010015194 asdl_seq * _loop0_135_var;
15195 void *_tmp_136_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015196 arg_ty lambda_param_no_default_var;
15197 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015198 (_loop0_135_var = _loop0_135_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015199 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015200 (_tmp_136_var = _tmp_136_rule(p)) // lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015201 &&
15202 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
15203 )
15204 {
15205 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"));
15206 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15207 if (_res == NULL && PyErr_Occurred()) {
15208 p->error_indicator = 1;
15209 D(p->level--);
15210 return NULL;
15211 }
15212 goto done;
15213 }
15214 p->mark = _mark;
15215 D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15216 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
15217 }
15218 _res = NULL;
15219 done:
15220 D(p->level--);
15221 return _res;
15222}
15223
15224// invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT
15225static void *
15226invalid_star_etc_rule(Parser *p)
15227{
15228 D(p->level++);
15229 if (p->error_indicator) {
15230 D(p->level--);
15231 return NULL;
15232 }
15233 void * _res = NULL;
15234 int _mark = p->mark;
15235 { // '*' (')' | ',' (')' | '**'))
15236 if (p->error_indicator) {
15237 D(p->level--);
15238 return NULL;
15239 }
15240 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15241 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010015242 void *_tmp_137_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015243 if (
15244 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15245 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015246 (_tmp_137_var = _tmp_137_rule(p)) // ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015247 )
15248 {
15249 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15250 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15251 if (_res == NULL && PyErr_Occurred()) {
15252 p->error_indicator = 1;
15253 D(p->level--);
15254 return NULL;
15255 }
15256 goto done;
15257 }
15258 p->mark = _mark;
15259 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15260 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15261 }
15262 { // '*' ',' TYPE_COMMENT
15263 if (p->error_indicator) {
15264 D(p->level--);
15265 return NULL;
15266 }
15267 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15268 Token * _literal;
15269 Token * _literal_1;
15270 Token * type_comment_var;
15271 if (
15272 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15273 &&
15274 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
15275 &&
15276 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15277 )
15278 {
15279 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15280 _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
15281 if (_res == NULL && PyErr_Occurred()) {
15282 p->error_indicator = 1;
15283 D(p->level--);
15284 return NULL;
15285 }
15286 goto done;
15287 }
15288 p->mark = _mark;
15289 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15290 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15291 }
15292 _res = NULL;
15293 done:
15294 D(p->level--);
15295 return _res;
15296}
15297
15298// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**'))
15299static void *
15300invalid_lambda_star_etc_rule(Parser *p)
15301{
15302 D(p->level++);
15303 if (p->error_indicator) {
15304 D(p->level--);
15305 return NULL;
15306 }
15307 void * _res = NULL;
15308 int _mark = p->mark;
15309 { // '*' (':' | ',' (':' | '**'))
15310 if (p->error_indicator) {
15311 D(p->level--);
15312 return NULL;
15313 }
15314 D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15315 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010015316 void *_tmp_138_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015317 if (
15318 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15319 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015320 (_tmp_138_var = _tmp_138_rule(p)) // ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015321 )
15322 {
15323 D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15324 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15325 if (_res == NULL && PyErr_Occurred()) {
15326 p->error_indicator = 1;
15327 D(p->level--);
15328 return NULL;
15329 }
15330 goto done;
15331 }
15332 p->mark = _mark;
15333 D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15334 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15335 }
15336 _res = NULL;
15337 done:
15338 D(p->level--);
15339 return _res;
15340}
15341
15342// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15343static void *
15344invalid_double_type_comments_rule(Parser *p)
15345{
15346 D(p->level++);
15347 if (p->error_indicator) {
15348 D(p->level--);
15349 return NULL;
15350 }
15351 void * _res = NULL;
15352 int _mark = p->mark;
15353 { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15354 if (p->error_indicator) {
15355 D(p->level--);
15356 return NULL;
15357 }
15358 D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15359 Token * indent_var;
15360 Token * newline_var;
15361 Token * newline_var_1;
15362 Token * type_comment_var;
15363 Token * type_comment_var_1;
15364 if (
15365 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15366 &&
15367 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15368 &&
15369 (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15370 &&
15371 (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15372 &&
15373 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
15374 )
15375 {
15376 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"));
15377 _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
15378 if (_res == NULL && PyErr_Occurred()) {
15379 p->error_indicator = 1;
15380 D(p->level--);
15381 return NULL;
15382 }
15383 goto done;
15384 }
15385 p->mark = _mark;
15386 D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ',
15387 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15388 }
15389 _res = NULL;
15390 done:
15391 D(p->level--);
15392 return _res;
15393}
15394
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015395// invalid_with_item: expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015396static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015397invalid_with_item_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015398{
15399 D(p->level++);
15400 if (p->error_indicator) {
15401 D(p->level--);
15402 return NULL;
15403 }
15404 void * _res = NULL;
15405 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015406 { // expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015407 if (p->error_indicator) {
15408 D(p->level--);
15409 return NULL;
15410 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015411 D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression"));
15412 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015413 expr_ty a;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015414 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015415 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015416 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015417 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015418 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
15419 &&
15420 (a = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015421 )
15422 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015423 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 +030015424 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015425 if (_res == NULL && PyErr_Occurred()) {
15426 p->error_indicator = 1;
15427 D(p->level--);
15428 return NULL;
15429 }
15430 goto done;
15431 }
15432 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015433 D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ',
15434 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression"));
15435 }
15436 _res = NULL;
15437 done:
15438 D(p->level--);
15439 return _res;
15440}
15441
15442// invalid_for_target: ASYNC? 'for' star_expressions
15443static void *
15444invalid_for_target_rule(Parser *p)
15445{
15446 D(p->level++);
15447 if (p->error_indicator) {
15448 D(p->level--);
15449 return NULL;
15450 }
15451 void * _res = NULL;
15452 int _mark = p->mark;
15453 { // ASYNC? 'for' star_expressions
15454 if (p->error_indicator) {
15455 D(p->level--);
15456 return NULL;
15457 }
15458 D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
15459 Token * _keyword;
15460 void *_opt_var;
15461 UNUSED(_opt_var); // Silence compiler warnings
15462 expr_ty a;
15463 if (
15464 (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
15465 &&
15466 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
15467 &&
15468 (a = star_expressions_rule(p)) // star_expressions
15469 )
15470 {
15471 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 +030015472 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015473 if (_res == NULL && PyErr_Occurred()) {
15474 p->error_indicator = 1;
15475 D(p->level--);
15476 return NULL;
15477 }
15478 goto done;
15479 }
15480 p->mark = _mark;
15481 D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ',
15482 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions"));
15483 }
15484 _res = NULL;
15485 done:
15486 D(p->level--);
15487 return _res;
15488}
15489
15490// invalid_group: '(' starred_expression ')'
15491static void *
15492invalid_group_rule(Parser *p)
15493{
15494 D(p->level++);
15495 if (p->error_indicator) {
15496 D(p->level--);
15497 return NULL;
15498 }
15499 void * _res = NULL;
15500 int _mark = p->mark;
15501 { // '(' starred_expression ')'
15502 if (p->error_indicator) {
15503 D(p->level--);
15504 return NULL;
15505 }
15506 D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15507 Token * _literal;
15508 Token * _literal_1;
15509 expr_ty a;
15510 if (
15511 (_literal = _PyPegen_expect_token(p, 7)) // token='('
15512 &&
15513 (a = starred_expression_rule(p)) // starred_expression
15514 &&
15515 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
15516 )
15517 {
15518 D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15519 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "can't use starred expression here" );
15520 if (_res == NULL && PyErr_Occurred()) {
15521 p->error_indicator = 1;
15522 D(p->level--);
15523 return NULL;
15524 }
15525 goto done;
15526 }
15527 p->mark = _mark;
15528 D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
15529 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015530 }
15531 _res = NULL;
15532 done:
15533 D(p->level--);
15534 return _res;
15535}
15536
15537// invalid_import_from_targets: import_from_as_names ','
15538static void *
15539invalid_import_from_targets_rule(Parser *p)
15540{
15541 D(p->level++);
15542 if (p->error_indicator) {
15543 D(p->level--);
15544 return NULL;
15545 }
15546 void * _res = NULL;
15547 int _mark = p->mark;
15548 { // import_from_as_names ','
15549 if (p->error_indicator) {
15550 D(p->level--);
15551 return NULL;
15552 }
15553 D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15554 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +010015555 asdl_alias_seq* import_from_as_names_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015556 if (
15557 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
15558 &&
15559 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15560 )
15561 {
15562 D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15563 _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
15564 if (_res == NULL && PyErr_Occurred()) {
15565 p->error_indicator = 1;
15566 D(p->level--);
15567 return NULL;
15568 }
15569 goto done;
15570 }
15571 p->mark = _mark;
15572 D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
15573 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','"));
15574 }
15575 _res = NULL;
15576 done:
15577 D(p->level--);
15578 return _res;
15579}
15580
15581// _loop0_1: NEWLINE
15582static asdl_seq *
15583_loop0_1_rule(Parser *p)
15584{
15585 D(p->level++);
15586 if (p->error_indicator) {
15587 D(p->level--);
15588 return NULL;
15589 }
15590 void *_res = NULL;
15591 int _mark = p->mark;
15592 int _start_mark = p->mark;
15593 void **_children = PyMem_Malloc(sizeof(void *));
15594 if (!_children) {
15595 p->error_indicator = 1;
15596 PyErr_NoMemory();
15597 D(p->level--);
15598 return NULL;
15599 }
15600 ssize_t _children_capacity = 1;
15601 ssize_t _n = 0;
15602 { // NEWLINE
15603 if (p->error_indicator) {
15604 D(p->level--);
15605 return NULL;
15606 }
15607 D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15608 Token * newline_var;
15609 while (
15610 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15611 )
15612 {
15613 _res = newline_var;
15614 if (_n == _children_capacity) {
15615 _children_capacity *= 2;
15616 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15617 if (!_new_children) {
15618 p->error_indicator = 1;
15619 PyErr_NoMemory();
15620 D(p->level--);
15621 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015622 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015623 _children = _new_children;
15624 }
15625 _children[_n++] = _res;
15626 _mark = p->mark;
15627 }
15628 p->mark = _mark;
15629 D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
15630 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15631 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015632 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015633 if (!_seq) {
15634 PyMem_Free(_children);
15635 p->error_indicator = 1;
15636 PyErr_NoMemory();
15637 D(p->level--);
15638 return NULL;
15639 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015640 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015641 PyMem_Free(_children);
15642 _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq);
15643 D(p->level--);
15644 return _seq;
15645}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015646
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015647// _loop0_2: NEWLINE
15648static asdl_seq *
15649_loop0_2_rule(Parser *p)
15650{
15651 D(p->level++);
15652 if (p->error_indicator) {
15653 D(p->level--);
15654 return NULL;
15655 }
15656 void *_res = NULL;
15657 int _mark = p->mark;
15658 int _start_mark = p->mark;
15659 void **_children = PyMem_Malloc(sizeof(void *));
15660 if (!_children) {
15661 p->error_indicator = 1;
15662 PyErr_NoMemory();
15663 D(p->level--);
15664 return NULL;
15665 }
15666 ssize_t _children_capacity = 1;
15667 ssize_t _n = 0;
15668 { // NEWLINE
15669 if (p->error_indicator) {
15670 D(p->level--);
15671 return NULL;
15672 }
15673 D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15674 Token * newline_var;
15675 while (
15676 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15677 )
15678 {
15679 _res = newline_var;
15680 if (_n == _children_capacity) {
15681 _children_capacity *= 2;
15682 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15683 if (!_new_children) {
15684 p->error_indicator = 1;
15685 PyErr_NoMemory();
15686 D(p->level--);
15687 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015688 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015689 _children = _new_children;
15690 }
15691 _children[_n++] = _res;
15692 _mark = p->mark;
15693 }
15694 p->mark = _mark;
15695 D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ',
15696 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15697 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015698 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015699 if (!_seq) {
15700 PyMem_Free(_children);
15701 p->error_indicator = 1;
15702 PyErr_NoMemory();
15703 D(p->level--);
15704 return NULL;
15705 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015706 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015707 PyMem_Free(_children);
15708 _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq);
15709 D(p->level--);
15710 return _seq;
15711}
15712
15713// _loop0_4: ',' expression
15714static asdl_seq *
15715_loop0_4_rule(Parser *p)
15716{
15717 D(p->level++);
15718 if (p->error_indicator) {
15719 D(p->level--);
15720 return NULL;
15721 }
15722 void *_res = NULL;
15723 int _mark = p->mark;
15724 int _start_mark = p->mark;
15725 void **_children = PyMem_Malloc(sizeof(void *));
15726 if (!_children) {
15727 p->error_indicator = 1;
15728 PyErr_NoMemory();
15729 D(p->level--);
15730 return NULL;
15731 }
15732 ssize_t _children_capacity = 1;
15733 ssize_t _n = 0;
15734 { // ',' expression
15735 if (p->error_indicator) {
15736 D(p->level--);
15737 return NULL;
15738 }
15739 D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15740 Token * _literal;
15741 expr_ty elem;
15742 while (
15743 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15744 &&
15745 (elem = expression_rule(p)) // expression
15746 )
15747 {
15748 _res = elem;
15749 if (_res == NULL && PyErr_Occurred()) {
15750 p->error_indicator = 1;
15751 PyMem_Free(_children);
15752 D(p->level--);
15753 return NULL;
15754 }
15755 if (_n == _children_capacity) {
15756 _children_capacity *= 2;
15757 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15758 if (!_new_children) {
15759 p->error_indicator = 1;
15760 PyErr_NoMemory();
15761 D(p->level--);
15762 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015763 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015764 _children = _new_children;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015765 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015766 _children[_n++] = _res;
15767 _mark = p->mark;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015768 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015769 p->mark = _mark;
15770 D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ',
15771 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015772 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015773 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015774 if (!_seq) {
15775 PyMem_Free(_children);
15776 p->error_indicator = 1;
15777 PyErr_NoMemory();
15778 D(p->level--);
15779 return NULL;
15780 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015781 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015782 PyMem_Free(_children);
15783 _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq);
15784 D(p->level--);
15785 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015786}
15787
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015788// _gather_3: expression _loop0_4
15789static asdl_seq *
15790_gather_3_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015791{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015792 D(p->level++);
15793 if (p->error_indicator) {
15794 D(p->level--);
15795 return NULL;
15796 }
15797 asdl_seq * _res = NULL;
15798 int _mark = p->mark;
15799 { // expression _loop0_4
15800 if (p->error_indicator) {
15801 D(p->level--);
15802 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015803 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015804 D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15805 expr_ty elem;
15806 asdl_seq * seq;
15807 if (
15808 (elem = expression_rule(p)) // expression
15809 &&
15810 (seq = _loop0_4_rule(p)) // _loop0_4
15811 )
15812 {
15813 D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15814 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15815 goto done;
15816 }
15817 p->mark = _mark;
15818 D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ',
15819 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015820 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015821 _res = NULL;
15822 done:
15823 D(p->level--);
15824 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015825}
15826
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015827// _loop0_6: ',' expression
15828static asdl_seq *
15829_loop0_6_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015830{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015831 D(p->level++);
15832 if (p->error_indicator) {
15833 D(p->level--);
15834 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015835 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015836 void *_res = NULL;
15837 int _mark = p->mark;
15838 int _start_mark = p->mark;
15839 void **_children = PyMem_Malloc(sizeof(void *));
15840 if (!_children) {
15841 p->error_indicator = 1;
15842 PyErr_NoMemory();
15843 D(p->level--);
15844 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015845 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015846 ssize_t _children_capacity = 1;
15847 ssize_t _n = 0;
15848 { // ',' expression
15849 if (p->error_indicator) {
15850 D(p->level--);
15851 return NULL;
15852 }
15853 D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15854 Token * _literal;
15855 expr_ty elem;
15856 while (
15857 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15858 &&
15859 (elem = expression_rule(p)) // expression
15860 )
15861 {
15862 _res = elem;
15863 if (_res == NULL && PyErr_Occurred()) {
15864 p->error_indicator = 1;
15865 PyMem_Free(_children);
15866 D(p->level--);
15867 return NULL;
15868 }
15869 if (_n == _children_capacity) {
15870 _children_capacity *= 2;
15871 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15872 if (!_new_children) {
15873 p->error_indicator = 1;
15874 PyErr_NoMemory();
15875 D(p->level--);
15876 return NULL;
15877 }
15878 _children = _new_children;
15879 }
15880 _children[_n++] = _res;
15881 _mark = p->mark;
15882 }
15883 p->mark = _mark;
15884 D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ',
15885 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
15886 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015887 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015888 if (!_seq) {
15889 PyMem_Free(_children);
15890 p->error_indicator = 1;
15891 PyErr_NoMemory();
15892 D(p->level--);
15893 return NULL;
15894 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015895 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015896 PyMem_Free(_children);
15897 _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq);
15898 D(p->level--);
15899 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015900}
15901
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015902// _gather_5: expression _loop0_6
15903static asdl_seq *
15904_gather_5_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015905{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015906 D(p->level++);
15907 if (p->error_indicator) {
15908 D(p->level--);
15909 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015910 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015911 asdl_seq * _res = NULL;
15912 int _mark = p->mark;
15913 { // expression _loop0_6
15914 if (p->error_indicator) {
15915 D(p->level--);
15916 return NULL;
15917 }
15918 D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15919 expr_ty elem;
15920 asdl_seq * seq;
15921 if (
15922 (elem = expression_rule(p)) // expression
15923 &&
15924 (seq = _loop0_6_rule(p)) // _loop0_6
15925 )
15926 {
15927 D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15928 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15929 goto done;
15930 }
15931 p->mark = _mark;
15932 D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ',
15933 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6"));
15934 }
15935 _res = NULL;
15936 done:
15937 D(p->level--);
15938 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015939}
15940
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015941// _loop0_8: ',' expression
15942static asdl_seq *
15943_loop0_8_rule(Parser *p)
15944{
15945 D(p->level++);
15946 if (p->error_indicator) {
15947 D(p->level--);
15948 return NULL;
15949 }
15950 void *_res = NULL;
15951 int _mark = p->mark;
15952 int _start_mark = p->mark;
15953 void **_children = PyMem_Malloc(sizeof(void *));
15954 if (!_children) {
15955 p->error_indicator = 1;
15956 PyErr_NoMemory();
15957 D(p->level--);
15958 return NULL;
15959 }
15960 ssize_t _children_capacity = 1;
15961 ssize_t _n = 0;
15962 { // ',' expression
15963 if (p->error_indicator) {
15964 D(p->level--);
15965 return NULL;
15966 }
15967 D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15968 Token * _literal;
15969 expr_ty elem;
15970 while (
15971 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15972 &&
15973 (elem = expression_rule(p)) // expression
15974 )
15975 {
15976 _res = elem;
15977 if (_res == NULL && PyErr_Occurred()) {
15978 p->error_indicator = 1;
15979 PyMem_Free(_children);
15980 D(p->level--);
15981 return NULL;
15982 }
15983 if (_n == _children_capacity) {
15984 _children_capacity *= 2;
15985 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15986 if (!_new_children) {
15987 p->error_indicator = 1;
15988 PyErr_NoMemory();
15989 D(p->level--);
15990 return NULL;
15991 }
15992 _children = _new_children;
15993 }
15994 _children[_n++] = _res;
15995 _mark = p->mark;
15996 }
15997 p->mark = _mark;
15998 D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ',
15999 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16000 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016001 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016002 if (!_seq) {
16003 PyMem_Free(_children);
16004 p->error_indicator = 1;
16005 PyErr_NoMemory();
16006 D(p->level--);
16007 return NULL;
16008 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016009 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016010 PyMem_Free(_children);
16011 _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq);
16012 D(p->level--);
16013 return _seq;
16014}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016015
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016016// _gather_7: expression _loop0_8
16017static asdl_seq *
16018_gather_7_rule(Parser *p)
16019{
16020 D(p->level++);
16021 if (p->error_indicator) {
16022 D(p->level--);
16023 return NULL;
16024 }
16025 asdl_seq * _res = NULL;
16026 int _mark = p->mark;
16027 { // expression _loop0_8
16028 if (p->error_indicator) {
16029 D(p->level--);
16030 return NULL;
16031 }
16032 D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16033 expr_ty elem;
16034 asdl_seq * seq;
16035 if (
16036 (elem = expression_rule(p)) // expression
16037 &&
16038 (seq = _loop0_8_rule(p)) // _loop0_8
16039 )
16040 {
16041 D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16042 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16043 goto done;
16044 }
16045 p->mark = _mark;
16046 D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ',
16047 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8"));
16048 }
16049 _res = NULL;
16050 done:
16051 D(p->level--);
16052 return _res;
16053}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016054
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016055// _loop0_10: ',' expression
16056static asdl_seq *
16057_loop0_10_rule(Parser *p)
16058{
16059 D(p->level++);
16060 if (p->error_indicator) {
16061 D(p->level--);
16062 return NULL;
16063 }
16064 void *_res = NULL;
16065 int _mark = p->mark;
16066 int _start_mark = p->mark;
16067 void **_children = PyMem_Malloc(sizeof(void *));
16068 if (!_children) {
16069 p->error_indicator = 1;
16070 PyErr_NoMemory();
16071 D(p->level--);
16072 return NULL;
16073 }
16074 ssize_t _children_capacity = 1;
16075 ssize_t _n = 0;
16076 { // ',' expression
16077 if (p->error_indicator) {
16078 D(p->level--);
16079 return NULL;
16080 }
16081 D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
16082 Token * _literal;
16083 expr_ty elem;
16084 while (
16085 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16086 &&
16087 (elem = expression_rule(p)) // expression
16088 )
16089 {
16090 _res = elem;
16091 if (_res == NULL && PyErr_Occurred()) {
16092 p->error_indicator = 1;
16093 PyMem_Free(_children);
16094 D(p->level--);
16095 return NULL;
16096 }
16097 if (_n == _children_capacity) {
16098 _children_capacity *= 2;
16099 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16100 if (!_new_children) {
16101 p->error_indicator = 1;
16102 PyErr_NoMemory();
16103 D(p->level--);
16104 return NULL;
16105 }
16106 _children = _new_children;
16107 }
16108 _children[_n++] = _res;
16109 _mark = p->mark;
16110 }
16111 p->mark = _mark;
16112 D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ',
16113 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16114 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016115 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016116 if (!_seq) {
16117 PyMem_Free(_children);
16118 p->error_indicator = 1;
16119 PyErr_NoMemory();
16120 D(p->level--);
16121 return NULL;
16122 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016123 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016124 PyMem_Free(_children);
16125 _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq);
16126 D(p->level--);
16127 return _seq;
16128}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016129
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016130// _gather_9: expression _loop0_10
16131static asdl_seq *
16132_gather_9_rule(Parser *p)
16133{
16134 D(p->level++);
16135 if (p->error_indicator) {
16136 D(p->level--);
16137 return NULL;
16138 }
16139 asdl_seq * _res = NULL;
16140 int _mark = p->mark;
16141 { // expression _loop0_10
16142 if (p->error_indicator) {
16143 D(p->level--);
16144 return NULL;
16145 }
16146 D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16147 expr_ty elem;
16148 asdl_seq * seq;
16149 if (
16150 (elem = expression_rule(p)) // expression
16151 &&
16152 (seq = _loop0_10_rule(p)) // _loop0_10
16153 )
16154 {
16155 D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16156 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16157 goto done;
16158 }
16159 p->mark = _mark;
16160 D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ',
16161 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10"));
16162 }
16163 _res = NULL;
16164 done:
16165 D(p->level--);
16166 return _res;
16167}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016168
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016169// _loop1_11: statement
16170static asdl_seq *
16171_loop1_11_rule(Parser *p)
16172{
16173 D(p->level++);
16174 if (p->error_indicator) {
16175 D(p->level--);
16176 return NULL;
16177 }
16178 void *_res = NULL;
16179 int _mark = p->mark;
16180 int _start_mark = p->mark;
16181 void **_children = PyMem_Malloc(sizeof(void *));
16182 if (!_children) {
16183 p->error_indicator = 1;
16184 PyErr_NoMemory();
16185 D(p->level--);
16186 return NULL;
16187 }
16188 ssize_t _children_capacity = 1;
16189 ssize_t _n = 0;
16190 { // statement
16191 if (p->error_indicator) {
16192 D(p->level--);
16193 return NULL;
16194 }
16195 D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
Pablo Galindoa5634c42020-09-16 19:42:00 +010016196 asdl_stmt_seq* statement_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016197 while (
16198 (statement_var = statement_rule(p)) // statement
16199 )
16200 {
16201 _res = statement_var;
16202 if (_n == _children_capacity) {
16203 _children_capacity *= 2;
16204 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16205 if (!_new_children) {
16206 p->error_indicator = 1;
16207 PyErr_NoMemory();
16208 D(p->level--);
16209 return NULL;
16210 }
16211 _children = _new_children;
16212 }
16213 _children[_n++] = _res;
16214 _mark = p->mark;
16215 }
16216 p->mark = _mark;
16217 D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ',
16218 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
16219 }
16220 if (_n == 0 || p->error_indicator) {
16221 PyMem_Free(_children);
16222 D(p->level--);
16223 return NULL;
16224 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016225 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016226 if (!_seq) {
16227 PyMem_Free(_children);
16228 p->error_indicator = 1;
16229 PyErr_NoMemory();
16230 D(p->level--);
16231 return NULL;
16232 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016233 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016234 PyMem_Free(_children);
16235 _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq);
16236 D(p->level--);
16237 return _seq;
16238}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016239
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016240// _loop0_13: ';' small_stmt
16241static asdl_seq *
16242_loop0_13_rule(Parser *p)
16243{
16244 D(p->level++);
16245 if (p->error_indicator) {
16246 D(p->level--);
16247 return NULL;
16248 }
16249 void *_res = NULL;
16250 int _mark = p->mark;
16251 int _start_mark = p->mark;
16252 void **_children = PyMem_Malloc(sizeof(void *));
16253 if (!_children) {
16254 p->error_indicator = 1;
16255 PyErr_NoMemory();
16256 D(p->level--);
16257 return NULL;
16258 }
16259 ssize_t _children_capacity = 1;
16260 ssize_t _n = 0;
16261 { // ';' small_stmt
16262 if (p->error_indicator) {
16263 D(p->level--);
16264 return NULL;
16265 }
16266 D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt"));
16267 Token * _literal;
16268 stmt_ty elem;
16269 while (
16270 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
16271 &&
16272 (elem = small_stmt_rule(p)) // small_stmt
16273 )
16274 {
16275 _res = elem;
16276 if (_res == NULL && PyErr_Occurred()) {
16277 p->error_indicator = 1;
16278 PyMem_Free(_children);
16279 D(p->level--);
16280 return NULL;
16281 }
16282 if (_n == _children_capacity) {
16283 _children_capacity *= 2;
16284 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16285 if (!_new_children) {
16286 p->error_indicator = 1;
16287 PyErr_NoMemory();
16288 D(p->level--);
16289 return NULL;
16290 }
16291 _children = _new_children;
16292 }
16293 _children[_n++] = _res;
16294 _mark = p->mark;
16295 }
16296 p->mark = _mark;
16297 D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ',
16298 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt"));
16299 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016300 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016301 if (!_seq) {
16302 PyMem_Free(_children);
16303 p->error_indicator = 1;
16304 PyErr_NoMemory();
16305 D(p->level--);
16306 return NULL;
16307 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016308 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016309 PyMem_Free(_children);
16310 _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq);
16311 D(p->level--);
16312 return _seq;
16313}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016314
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016315// _gather_12: small_stmt _loop0_13
16316static asdl_seq *
16317_gather_12_rule(Parser *p)
16318{
16319 D(p->level++);
16320 if (p->error_indicator) {
16321 D(p->level--);
16322 return NULL;
16323 }
16324 asdl_seq * _res = NULL;
16325 int _mark = p->mark;
16326 { // small_stmt _loop0_13
16327 if (p->error_indicator) {
16328 D(p->level--);
16329 return NULL;
16330 }
16331 D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16332 stmt_ty elem;
16333 asdl_seq * seq;
16334 if (
16335 (elem = small_stmt_rule(p)) // small_stmt
16336 &&
16337 (seq = _loop0_13_rule(p)) // _loop0_13
16338 )
16339 {
16340 D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16341 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16342 goto done;
16343 }
16344 p->mark = _mark;
16345 D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ',
16346 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13"));
16347 }
16348 _res = NULL;
16349 done:
16350 D(p->level--);
16351 return _res;
16352}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016353
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016354// _tmp_14: 'import' | 'from'
16355static void *
16356_tmp_14_rule(Parser *p)
16357{
16358 D(p->level++);
16359 if (p->error_indicator) {
16360 D(p->level--);
16361 return NULL;
16362 }
16363 void * _res = NULL;
16364 int _mark = p->mark;
16365 { // 'import'
16366 if (p->error_indicator) {
16367 D(p->level--);
16368 return NULL;
16369 }
16370 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
16371 Token * _keyword;
16372 if (
16373 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
16374 )
16375 {
16376 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
16377 _res = _keyword;
16378 goto done;
16379 }
16380 p->mark = _mark;
16381 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16382 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
16383 }
16384 { // 'from'
16385 if (p->error_indicator) {
16386 D(p->level--);
16387 return NULL;
16388 }
16389 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
16390 Token * _keyword;
16391 if (
16392 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
16393 )
16394 {
16395 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
16396 _res = _keyword;
16397 goto done;
16398 }
16399 p->mark = _mark;
16400 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16401 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
16402 }
16403 _res = NULL;
16404 done:
16405 D(p->level--);
16406 return _res;
16407}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016408
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016409// _tmp_15: 'def' | '@' | ASYNC
16410static void *
16411_tmp_15_rule(Parser *p)
16412{
16413 D(p->level++);
16414 if (p->error_indicator) {
16415 D(p->level--);
16416 return NULL;
16417 }
16418 void * _res = NULL;
16419 int _mark = p->mark;
16420 { // 'def'
16421 if (p->error_indicator) {
16422 D(p->level--);
16423 return NULL;
16424 }
16425 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
16426 Token * _keyword;
16427 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016428 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016429 )
16430 {
16431 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
16432 _res = _keyword;
16433 goto done;
16434 }
16435 p->mark = _mark;
16436 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16437 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
16438 }
16439 { // '@'
16440 if (p->error_indicator) {
16441 D(p->level--);
16442 return NULL;
16443 }
16444 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16445 Token * _literal;
16446 if (
16447 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16448 )
16449 {
16450 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16451 _res = _literal;
16452 goto done;
16453 }
16454 p->mark = _mark;
16455 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16456 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16457 }
16458 { // ASYNC
16459 if (p->error_indicator) {
16460 D(p->level--);
16461 return NULL;
16462 }
16463 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16464 Token * async_var;
16465 if (
16466 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16467 )
16468 {
16469 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16470 _res = async_var;
16471 goto done;
16472 }
16473 p->mark = _mark;
16474 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16476 }
16477 _res = NULL;
16478 done:
16479 D(p->level--);
16480 return _res;
16481}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016482
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016483// _tmp_16: 'class' | '@'
16484static void *
16485_tmp_16_rule(Parser *p)
16486{
16487 D(p->level++);
16488 if (p->error_indicator) {
16489 D(p->level--);
16490 return NULL;
16491 }
16492 void * _res = NULL;
16493 int _mark = p->mark;
16494 { // 'class'
16495 if (p->error_indicator) {
16496 D(p->level--);
16497 return NULL;
16498 }
16499 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
16500 Token * _keyword;
16501 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016502 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016503 )
16504 {
16505 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
16506 _res = _keyword;
16507 goto done;
16508 }
16509 p->mark = _mark;
16510 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16511 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
16512 }
16513 { // '@'
16514 if (p->error_indicator) {
16515 D(p->level--);
16516 return NULL;
16517 }
16518 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16519 Token * _literal;
16520 if (
16521 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16522 )
16523 {
16524 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16525 _res = _literal;
16526 goto done;
16527 }
16528 p->mark = _mark;
16529 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16530 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16531 }
16532 _res = NULL;
16533 done:
16534 D(p->level--);
16535 return _res;
16536}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016537
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016538// _tmp_17: 'with' | ASYNC
16539static void *
16540_tmp_17_rule(Parser *p)
16541{
16542 D(p->level++);
16543 if (p->error_indicator) {
16544 D(p->level--);
16545 return NULL;
16546 }
16547 void * _res = NULL;
16548 int _mark = p->mark;
16549 { // 'with'
16550 if (p->error_indicator) {
16551 D(p->level--);
16552 return NULL;
16553 }
16554 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
16555 Token * _keyword;
16556 if (
16557 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
16558 )
16559 {
16560 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
16561 _res = _keyword;
16562 goto done;
16563 }
16564 p->mark = _mark;
16565 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16566 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
16567 }
16568 { // ASYNC
16569 if (p->error_indicator) {
16570 D(p->level--);
16571 return NULL;
16572 }
16573 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16574 Token * async_var;
16575 if (
16576 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16577 )
16578 {
16579 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16580 _res = async_var;
16581 goto done;
16582 }
16583 p->mark = _mark;
16584 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16585 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16586 }
16587 _res = NULL;
16588 done:
16589 D(p->level--);
16590 return _res;
16591}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016592
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016593// _tmp_18: 'for' | ASYNC
16594static void *
16595_tmp_18_rule(Parser *p)
16596{
16597 D(p->level++);
16598 if (p->error_indicator) {
16599 D(p->level--);
16600 return NULL;
16601 }
16602 void * _res = NULL;
16603 int _mark = p->mark;
16604 { // 'for'
16605 if (p->error_indicator) {
16606 D(p->level--);
16607 return NULL;
16608 }
16609 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
16610 Token * _keyword;
16611 if (
16612 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
16613 )
16614 {
16615 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
16616 _res = _keyword;
16617 goto done;
16618 }
16619 p->mark = _mark;
16620 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16621 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
16622 }
16623 { // ASYNC
16624 if (p->error_indicator) {
16625 D(p->level--);
16626 return NULL;
16627 }
16628 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16629 Token * async_var;
16630 if (
16631 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16632 )
16633 {
16634 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16635 _res = async_var;
16636 goto done;
16637 }
16638 p->mark = _mark;
16639 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16640 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16641 }
16642 _res = NULL;
16643 done:
16644 D(p->level--);
16645 return _res;
16646}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016647
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016648// _tmp_19: '=' annotated_rhs
16649static void *
16650_tmp_19_rule(Parser *p)
16651{
16652 D(p->level++);
16653 if (p->error_indicator) {
16654 D(p->level--);
16655 return NULL;
16656 }
16657 void * _res = NULL;
16658 int _mark = p->mark;
16659 { // '=' annotated_rhs
16660 if (p->error_indicator) {
16661 D(p->level--);
16662 return NULL;
16663 }
16664 D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16665 Token * _literal;
16666 expr_ty d;
16667 if (
16668 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16669 &&
16670 (d = annotated_rhs_rule(p)) // annotated_rhs
16671 )
16672 {
16673 D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16674 _res = d;
16675 if (_res == NULL && PyErr_Occurred()) {
16676 p->error_indicator = 1;
16677 D(p->level--);
16678 return NULL;
16679 }
16680 goto done;
16681 }
16682 p->mark = _mark;
16683 D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ',
16684 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16685 }
16686 _res = NULL;
16687 done:
16688 D(p->level--);
16689 return _res;
16690}
16691
16692// _tmp_20: '(' single_target ')' | single_subscript_attribute_target
16693static void *
16694_tmp_20_rule(Parser *p)
16695{
16696 D(p->level++);
16697 if (p->error_indicator) {
16698 D(p->level--);
16699 return NULL;
16700 }
16701 void * _res = NULL;
16702 int _mark = p->mark;
16703 { // '(' single_target ')'
16704 if (p->error_indicator) {
16705 D(p->level--);
16706 return NULL;
16707 }
16708 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16709 Token * _literal;
16710 Token * _literal_1;
16711 expr_ty b;
16712 if (
16713 (_literal = _PyPegen_expect_token(p, 7)) // token='('
16714 &&
16715 (b = single_target_rule(p)) // single_target
16716 &&
16717 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
16718 )
16719 {
16720 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16721 _res = b;
16722 if (_res == NULL && PyErr_Occurred()) {
16723 p->error_indicator = 1;
16724 D(p->level--);
16725 return NULL;
16726 }
16727 goto done;
16728 }
16729 p->mark = _mark;
16730 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16731 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
16732 }
16733 { // single_subscript_attribute_target
16734 if (p->error_indicator) {
16735 D(p->level--);
16736 return NULL;
16737 }
16738 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16739 expr_ty single_subscript_attribute_target_var;
16740 if (
16741 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
16742 )
16743 {
16744 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16745 _res = single_subscript_attribute_target_var;
16746 goto done;
16747 }
16748 p->mark = _mark;
16749 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16750 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
16751 }
16752 _res = NULL;
16753 done:
16754 D(p->level--);
16755 return _res;
16756}
16757
16758// _tmp_21: '=' annotated_rhs
16759static void *
16760_tmp_21_rule(Parser *p)
16761{
16762 D(p->level++);
16763 if (p->error_indicator) {
16764 D(p->level--);
16765 return NULL;
16766 }
16767 void * _res = NULL;
16768 int _mark = p->mark;
16769 { // '=' annotated_rhs
16770 if (p->error_indicator) {
16771 D(p->level--);
16772 return NULL;
16773 }
16774 D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16775 Token * _literal;
16776 expr_ty d;
16777 if (
16778 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16779 &&
16780 (d = annotated_rhs_rule(p)) // annotated_rhs
16781 )
16782 {
16783 D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16784 _res = d;
16785 if (_res == NULL && PyErr_Occurred()) {
16786 p->error_indicator = 1;
16787 D(p->level--);
16788 return NULL;
16789 }
16790 goto done;
16791 }
16792 p->mark = _mark;
16793 D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ',
16794 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16795 }
16796 _res = NULL;
16797 done:
16798 D(p->level--);
16799 return _res;
16800}
16801
16802// _loop1_22: (star_targets '=')
16803static asdl_seq *
16804_loop1_22_rule(Parser *p)
16805{
16806 D(p->level++);
16807 if (p->error_indicator) {
16808 D(p->level--);
16809 return NULL;
16810 }
16811 void *_res = NULL;
16812 int _mark = p->mark;
16813 int _start_mark = p->mark;
16814 void **_children = PyMem_Malloc(sizeof(void *));
16815 if (!_children) {
16816 p->error_indicator = 1;
16817 PyErr_NoMemory();
16818 D(p->level--);
16819 return NULL;
16820 }
16821 ssize_t _children_capacity = 1;
16822 ssize_t _n = 0;
16823 { // (star_targets '=')
16824 if (p->error_indicator) {
16825 D(p->level--);
16826 return NULL;
16827 }
16828 D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010016829 void *_tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016830 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010016831 (_tmp_139_var = _tmp_139_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016832 )
16833 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010016834 _res = _tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016835 if (_n == _children_capacity) {
16836 _children_capacity *= 2;
16837 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16838 if (!_new_children) {
16839 p->error_indicator = 1;
16840 PyErr_NoMemory();
16841 D(p->level--);
16842 return NULL;
16843 }
16844 _children = _new_children;
16845 }
16846 _children[_n++] = _res;
16847 _mark = p->mark;
16848 }
16849 p->mark = _mark;
16850 D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ',
16851 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
16852 }
16853 if (_n == 0 || p->error_indicator) {
16854 PyMem_Free(_children);
16855 D(p->level--);
16856 return NULL;
16857 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016858 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016859 if (!_seq) {
16860 PyMem_Free(_children);
16861 p->error_indicator = 1;
16862 PyErr_NoMemory();
16863 D(p->level--);
16864 return NULL;
16865 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016866 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016867 PyMem_Free(_children);
16868 _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq);
16869 D(p->level--);
16870 return _seq;
16871}
16872
16873// _tmp_23: yield_expr | star_expressions
16874static void *
16875_tmp_23_rule(Parser *p)
16876{
16877 D(p->level++);
16878 if (p->error_indicator) {
16879 D(p->level--);
16880 return NULL;
16881 }
16882 void * _res = NULL;
16883 int _mark = p->mark;
16884 { // yield_expr
16885 if (p->error_indicator) {
16886 D(p->level--);
16887 return NULL;
16888 }
16889 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16890 expr_ty yield_expr_var;
16891 if (
16892 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16893 )
16894 {
16895 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16896 _res = yield_expr_var;
16897 goto done;
16898 }
16899 p->mark = _mark;
16900 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16901 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16902 }
16903 { // star_expressions
16904 if (p->error_indicator) {
16905 D(p->level--);
16906 return NULL;
16907 }
16908 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16909 expr_ty star_expressions_var;
16910 if (
16911 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16912 )
16913 {
16914 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16915 _res = star_expressions_var;
16916 goto done;
16917 }
16918 p->mark = _mark;
16919 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16920 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16921 }
16922 _res = NULL;
16923 done:
16924 D(p->level--);
16925 return _res;
16926}
16927
16928// _tmp_24: yield_expr | star_expressions
16929static void *
16930_tmp_24_rule(Parser *p)
16931{
16932 D(p->level++);
16933 if (p->error_indicator) {
16934 D(p->level--);
16935 return NULL;
16936 }
16937 void * _res = NULL;
16938 int _mark = p->mark;
16939 { // yield_expr
16940 if (p->error_indicator) {
16941 D(p->level--);
16942 return NULL;
16943 }
16944 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16945 expr_ty yield_expr_var;
16946 if (
16947 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16948 )
16949 {
16950 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16951 _res = yield_expr_var;
16952 goto done;
16953 }
16954 p->mark = _mark;
16955 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
16956 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16957 }
16958 { // star_expressions
16959 if (p->error_indicator) {
16960 D(p->level--);
16961 return NULL;
16962 }
16963 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16964 expr_ty star_expressions_var;
16965 if (
16966 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16967 )
16968 {
16969 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16970 _res = star_expressions_var;
16971 goto done;
16972 }
16973 p->mark = _mark;
16974 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
16975 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16976 }
16977 _res = NULL;
16978 done:
16979 D(p->level--);
16980 return _res;
16981}
16982
16983// _loop0_26: ',' NAME
16984static asdl_seq *
16985_loop0_26_rule(Parser *p)
16986{
16987 D(p->level++);
16988 if (p->error_indicator) {
16989 D(p->level--);
16990 return NULL;
16991 }
16992 void *_res = NULL;
16993 int _mark = p->mark;
16994 int _start_mark = p->mark;
16995 void **_children = PyMem_Malloc(sizeof(void *));
16996 if (!_children) {
16997 p->error_indicator = 1;
16998 PyErr_NoMemory();
16999 D(p->level--);
17000 return NULL;
17001 }
17002 ssize_t _children_capacity = 1;
17003 ssize_t _n = 0;
17004 { // ',' NAME
17005 if (p->error_indicator) {
17006 D(p->level--);
17007 return NULL;
17008 }
17009 D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17010 Token * _literal;
17011 expr_ty elem;
17012 while (
17013 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17014 &&
17015 (elem = _PyPegen_name_token(p)) // NAME
17016 )
17017 {
17018 _res = elem;
17019 if (_res == NULL && PyErr_Occurred()) {
17020 p->error_indicator = 1;
17021 PyMem_Free(_children);
17022 D(p->level--);
17023 return NULL;
17024 }
17025 if (_n == _children_capacity) {
17026 _children_capacity *= 2;
17027 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17028 if (!_new_children) {
17029 p->error_indicator = 1;
17030 PyErr_NoMemory();
17031 D(p->level--);
17032 return NULL;
17033 }
17034 _children = _new_children;
17035 }
17036 _children[_n++] = _res;
17037 _mark = p->mark;
17038 }
17039 p->mark = _mark;
17040 D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ',
17041 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17042 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017043 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017044 if (!_seq) {
17045 PyMem_Free(_children);
17046 p->error_indicator = 1;
17047 PyErr_NoMemory();
17048 D(p->level--);
17049 return NULL;
17050 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017051 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017052 PyMem_Free(_children);
17053 _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq);
17054 D(p->level--);
17055 return _seq;
17056}
17057
17058// _gather_25: NAME _loop0_26
17059static asdl_seq *
17060_gather_25_rule(Parser *p)
17061{
17062 D(p->level++);
17063 if (p->error_indicator) {
17064 D(p->level--);
17065 return NULL;
17066 }
17067 asdl_seq * _res = NULL;
17068 int _mark = p->mark;
17069 { // NAME _loop0_26
17070 if (p->error_indicator) {
17071 D(p->level--);
17072 return NULL;
17073 }
17074 D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17075 expr_ty elem;
17076 asdl_seq * seq;
17077 if (
17078 (elem = _PyPegen_name_token(p)) // NAME
17079 &&
17080 (seq = _loop0_26_rule(p)) // _loop0_26
17081 )
17082 {
17083 D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17084 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17085 goto done;
17086 }
17087 p->mark = _mark;
17088 D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ',
17089 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26"));
17090 }
17091 _res = NULL;
17092 done:
17093 D(p->level--);
17094 return _res;
17095}
17096
17097// _loop0_28: ',' NAME
17098static asdl_seq *
17099_loop0_28_rule(Parser *p)
17100{
17101 D(p->level++);
17102 if (p->error_indicator) {
17103 D(p->level--);
17104 return NULL;
17105 }
17106 void *_res = NULL;
17107 int _mark = p->mark;
17108 int _start_mark = p->mark;
17109 void **_children = PyMem_Malloc(sizeof(void *));
17110 if (!_children) {
17111 p->error_indicator = 1;
17112 PyErr_NoMemory();
17113 D(p->level--);
17114 return NULL;
17115 }
17116 ssize_t _children_capacity = 1;
17117 ssize_t _n = 0;
17118 { // ',' NAME
17119 if (p->error_indicator) {
17120 D(p->level--);
17121 return NULL;
17122 }
17123 D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17124 Token * _literal;
17125 expr_ty elem;
17126 while (
17127 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17128 &&
17129 (elem = _PyPegen_name_token(p)) // NAME
17130 )
17131 {
17132 _res = elem;
17133 if (_res == NULL && PyErr_Occurred()) {
17134 p->error_indicator = 1;
17135 PyMem_Free(_children);
17136 D(p->level--);
17137 return NULL;
17138 }
17139 if (_n == _children_capacity) {
17140 _children_capacity *= 2;
17141 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17142 if (!_new_children) {
17143 p->error_indicator = 1;
17144 PyErr_NoMemory();
17145 D(p->level--);
17146 return NULL;
17147 }
17148 _children = _new_children;
17149 }
17150 _children[_n++] = _res;
17151 _mark = p->mark;
17152 }
17153 p->mark = _mark;
17154 D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
17155 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17156 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017157 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017158 if (!_seq) {
17159 PyMem_Free(_children);
17160 p->error_indicator = 1;
17161 PyErr_NoMemory();
17162 D(p->level--);
17163 return NULL;
17164 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017165 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017166 PyMem_Free(_children);
17167 _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq);
17168 D(p->level--);
17169 return _seq;
17170}
17171
17172// _gather_27: NAME _loop0_28
17173static asdl_seq *
17174_gather_27_rule(Parser *p)
17175{
17176 D(p->level++);
17177 if (p->error_indicator) {
17178 D(p->level--);
17179 return NULL;
17180 }
17181 asdl_seq * _res = NULL;
17182 int _mark = p->mark;
17183 { // NAME _loop0_28
17184 if (p->error_indicator) {
17185 D(p->level--);
17186 return NULL;
17187 }
17188 D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17189 expr_ty elem;
17190 asdl_seq * seq;
17191 if (
17192 (elem = _PyPegen_name_token(p)) // NAME
17193 &&
17194 (seq = _loop0_28_rule(p)) // _loop0_28
17195 )
17196 {
17197 D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17198 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17199 goto done;
17200 }
17201 p->mark = _mark;
17202 D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ',
17203 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28"));
17204 }
17205 _res = NULL;
17206 done:
17207 D(p->level--);
17208 return _res;
17209}
17210
17211// _tmp_29: ',' expression
17212static void *
17213_tmp_29_rule(Parser *p)
17214{
17215 D(p->level++);
17216 if (p->error_indicator) {
17217 D(p->level--);
17218 return NULL;
17219 }
17220 void * _res = NULL;
17221 int _mark = p->mark;
17222 { // ',' expression
17223 if (p->error_indicator) {
17224 D(p->level--);
17225 return NULL;
17226 }
17227 D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
17228 Token * _literal;
17229 expr_ty z;
17230 if (
17231 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17232 &&
17233 (z = expression_rule(p)) // expression
17234 )
17235 {
17236 D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
17237 _res = z;
17238 if (_res == NULL && PyErr_Occurred()) {
17239 p->error_indicator = 1;
17240 D(p->level--);
17241 return NULL;
17242 }
17243 goto done;
17244 }
17245 p->mark = _mark;
17246 D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ',
17247 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
17248 }
17249 _res = NULL;
17250 done:
17251 D(p->level--);
17252 return _res;
17253}
17254
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017255// _tmp_30: ';' | NEWLINE
17256static void *
17257_tmp_30_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017258{
17259 D(p->level++);
17260 if (p->error_indicator) {
17261 D(p->level--);
17262 return NULL;
17263 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017264 void * _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017265 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017266 { // ';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017267 if (p->error_indicator) {
17268 D(p->level--);
17269 return NULL;
17270 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017271 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
17272 Token * _literal;
17273 if (
17274 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017275 )
17276 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017277 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
17278 _res = _literal;
17279 goto done;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017280 }
17281 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017282 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17283 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017284 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017285 { // NEWLINE
17286 if (p->error_indicator) {
17287 D(p->level--);
17288 return NULL;
17289 }
17290 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17291 Token * newline_var;
17292 if (
17293 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
17294 )
17295 {
17296 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17297 _res = newline_var;
17298 goto done;
17299 }
17300 p->mark = _mark;
17301 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17302 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017303 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017304 _res = NULL;
17305 done:
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017306 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017307 return _res;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017308}
17309
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017310// _loop0_31: ('.' | '...')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017311static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017312_loop0_31_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017313{
17314 D(p->level++);
17315 if (p->error_indicator) {
17316 D(p->level--);
17317 return NULL;
17318 }
17319 void *_res = NULL;
17320 int _mark = p->mark;
17321 int _start_mark = p->mark;
17322 void **_children = PyMem_Malloc(sizeof(void *));
17323 if (!_children) {
17324 p->error_indicator = 1;
17325 PyErr_NoMemory();
17326 D(p->level--);
17327 return NULL;
17328 }
17329 ssize_t _children_capacity = 1;
17330 ssize_t _n = 0;
17331 { // ('.' | '...')
17332 if (p->error_indicator) {
17333 D(p->level--);
17334 return NULL;
17335 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017336 D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010017337 void *_tmp_140_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017338 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010017339 (_tmp_140_var = _tmp_140_rule(p)) // '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017340 )
17341 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010017342 _res = _tmp_140_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017343 if (_n == _children_capacity) {
17344 _children_capacity *= 2;
17345 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17346 if (!_new_children) {
17347 p->error_indicator = 1;
17348 PyErr_NoMemory();
17349 D(p->level--);
17350 return NULL;
17351 }
17352 _children = _new_children;
17353 }
17354 _children[_n++] = _res;
17355 _mark = p->mark;
17356 }
17357 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017358 D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ',
17359 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17360 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017361 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017362 if (!_seq) {
17363 PyMem_Free(_children);
17364 p->error_indicator = 1;
17365 PyErr_NoMemory();
17366 D(p->level--);
17367 return NULL;
17368 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017369 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017370 PyMem_Free(_children);
17371 _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq);
17372 D(p->level--);
17373 return _seq;
17374}
17375
17376// _loop1_32: ('.' | '...')
17377static asdl_seq *
17378_loop1_32_rule(Parser *p)
17379{
17380 D(p->level++);
17381 if (p->error_indicator) {
17382 D(p->level--);
17383 return NULL;
17384 }
17385 void *_res = NULL;
17386 int _mark = p->mark;
17387 int _start_mark = p->mark;
17388 void **_children = PyMem_Malloc(sizeof(void *));
17389 if (!_children) {
17390 p->error_indicator = 1;
17391 PyErr_NoMemory();
17392 D(p->level--);
17393 return NULL;
17394 }
17395 ssize_t _children_capacity = 1;
17396 ssize_t _n = 0;
17397 { // ('.' | '...')
17398 if (p->error_indicator) {
17399 D(p->level--);
17400 return NULL;
17401 }
17402 D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010017403 void *_tmp_141_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017404 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010017405 (_tmp_141_var = _tmp_141_rule(p)) // '.' | '...'
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017406 )
17407 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010017408 _res = _tmp_141_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017409 if (_n == _children_capacity) {
17410 _children_capacity *= 2;
17411 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17412 if (!_new_children) {
17413 p->error_indicator = 1;
17414 PyErr_NoMemory();
17415 D(p->level--);
17416 return NULL;
17417 }
17418 _children = _new_children;
17419 }
17420 _children[_n++] = _res;
17421 _mark = p->mark;
17422 }
17423 p->mark = _mark;
17424 D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017425 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17426 }
17427 if (_n == 0 || p->error_indicator) {
17428 PyMem_Free(_children);
17429 D(p->level--);
17430 return NULL;
17431 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017432 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017433 if (!_seq) {
17434 PyMem_Free(_children);
17435 p->error_indicator = 1;
17436 PyErr_NoMemory();
17437 D(p->level--);
17438 return NULL;
17439 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017440 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017441 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017442 _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017443 D(p->level--);
17444 return _seq;
17445}
17446
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017447// _loop0_34: ',' import_from_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017448static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017449_loop0_34_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017450{
17451 D(p->level++);
17452 if (p->error_indicator) {
17453 D(p->level--);
17454 return NULL;
17455 }
17456 void *_res = NULL;
17457 int _mark = p->mark;
17458 int _start_mark = p->mark;
17459 void **_children = PyMem_Malloc(sizeof(void *));
17460 if (!_children) {
17461 p->error_indicator = 1;
17462 PyErr_NoMemory();
17463 D(p->level--);
17464 return NULL;
17465 }
17466 ssize_t _children_capacity = 1;
17467 ssize_t _n = 0;
17468 { // ',' import_from_as_name
17469 if (p->error_indicator) {
17470 D(p->level--);
17471 return NULL;
17472 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017473 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 +010017474 Token * _literal;
17475 alias_ty elem;
17476 while (
17477 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17478 &&
17479 (elem = import_from_as_name_rule(p)) // import_from_as_name
17480 )
17481 {
17482 _res = elem;
17483 if (_res == NULL && PyErr_Occurred()) {
17484 p->error_indicator = 1;
17485 PyMem_Free(_children);
17486 D(p->level--);
17487 return NULL;
17488 }
17489 if (_n == _children_capacity) {
17490 _children_capacity *= 2;
17491 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17492 if (!_new_children) {
17493 p->error_indicator = 1;
17494 PyErr_NoMemory();
17495 D(p->level--);
17496 return NULL;
17497 }
17498 _children = _new_children;
17499 }
17500 _children[_n++] = _res;
17501 _mark = p->mark;
17502 }
17503 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017504 D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017505 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
17506 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017507 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017508 if (!_seq) {
17509 PyMem_Free(_children);
17510 p->error_indicator = 1;
17511 PyErr_NoMemory();
17512 D(p->level--);
17513 return NULL;
17514 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017515 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017516 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017517 _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017518 D(p->level--);
17519 return _seq;
17520}
17521
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017522// _gather_33: import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017523static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017524_gather_33_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017525{
17526 D(p->level++);
17527 if (p->error_indicator) {
17528 D(p->level--);
17529 return NULL;
17530 }
17531 asdl_seq * _res = NULL;
17532 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017533 { // import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017534 if (p->error_indicator) {
17535 D(p->level--);
17536 return NULL;
17537 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017538 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 +010017539 alias_ty elem;
17540 asdl_seq * seq;
17541 if (
17542 (elem = import_from_as_name_rule(p)) // import_from_as_name
17543 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017544 (seq = _loop0_34_rule(p)) // _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017545 )
17546 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017547 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 +010017548 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17549 goto done;
17550 }
17551 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017552 D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ',
17553 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_34"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017554 }
17555 _res = NULL;
17556 done:
17557 D(p->level--);
17558 return _res;
17559}
17560
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017561// _tmp_35: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017562static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017563_tmp_35_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017564{
17565 D(p->level++);
17566 if (p->error_indicator) {
17567 D(p->level--);
17568 return NULL;
17569 }
17570 void * _res = NULL;
17571 int _mark = p->mark;
17572 { // 'as' NAME
17573 if (p->error_indicator) {
17574 D(p->level--);
17575 return NULL;
17576 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017577 D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017578 Token * _keyword;
17579 expr_ty z;
17580 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017581 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017582 &&
17583 (z = _PyPegen_name_token(p)) // NAME
17584 )
17585 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017586 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 +010017587 _res = z;
17588 if (_res == NULL && PyErr_Occurred()) {
17589 p->error_indicator = 1;
17590 D(p->level--);
17591 return NULL;
17592 }
17593 goto done;
17594 }
17595 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017596 D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017597 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17598 }
17599 _res = NULL;
17600 done:
17601 D(p->level--);
17602 return _res;
17603}
17604
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017605// _loop0_37: ',' dotted_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017606static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017607_loop0_37_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017608{
17609 D(p->level++);
17610 if (p->error_indicator) {
17611 D(p->level--);
17612 return NULL;
17613 }
17614 void *_res = NULL;
17615 int _mark = p->mark;
17616 int _start_mark = p->mark;
17617 void **_children = PyMem_Malloc(sizeof(void *));
17618 if (!_children) {
17619 p->error_indicator = 1;
17620 PyErr_NoMemory();
17621 D(p->level--);
17622 return NULL;
17623 }
17624 ssize_t _children_capacity = 1;
17625 ssize_t _n = 0;
17626 { // ',' dotted_as_name
17627 if (p->error_indicator) {
17628 D(p->level--);
17629 return NULL;
17630 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017631 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 +010017632 Token * _literal;
17633 alias_ty elem;
17634 while (
17635 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17636 &&
17637 (elem = dotted_as_name_rule(p)) // dotted_as_name
17638 )
17639 {
17640 _res = elem;
17641 if (_res == NULL && PyErr_Occurred()) {
17642 p->error_indicator = 1;
17643 PyMem_Free(_children);
17644 D(p->level--);
17645 return NULL;
17646 }
17647 if (_n == _children_capacity) {
17648 _children_capacity *= 2;
17649 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17650 if (!_new_children) {
17651 p->error_indicator = 1;
17652 PyErr_NoMemory();
17653 D(p->level--);
17654 return NULL;
17655 }
17656 _children = _new_children;
17657 }
17658 _children[_n++] = _res;
17659 _mark = p->mark;
17660 }
17661 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017662 D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017663 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
17664 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017665 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017666 if (!_seq) {
17667 PyMem_Free(_children);
17668 p->error_indicator = 1;
17669 PyErr_NoMemory();
17670 D(p->level--);
17671 return NULL;
17672 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017673 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017674 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017675 _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017676 D(p->level--);
17677 return _seq;
17678}
17679
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017680// _gather_36: dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017681static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017682_gather_36_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017683{
17684 D(p->level++);
17685 if (p->error_indicator) {
17686 D(p->level--);
17687 return NULL;
17688 }
17689 asdl_seq * _res = NULL;
17690 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017691 { // dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017692 if (p->error_indicator) {
17693 D(p->level--);
17694 return NULL;
17695 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017696 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 +010017697 alias_ty elem;
17698 asdl_seq * seq;
17699 if (
17700 (elem = dotted_as_name_rule(p)) // dotted_as_name
17701 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017702 (seq = _loop0_37_rule(p)) // _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017703 )
17704 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017705 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 +010017706 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17707 goto done;
17708 }
17709 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017710 D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ',
17711 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017712 }
17713 _res = NULL;
17714 done:
17715 D(p->level--);
17716 return _res;
17717}
17718
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017719// _tmp_38: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017720static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017721_tmp_38_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017722{
17723 D(p->level++);
17724 if (p->error_indicator) {
17725 D(p->level--);
17726 return NULL;
17727 }
17728 void * _res = NULL;
17729 int _mark = p->mark;
17730 { // 'as' NAME
17731 if (p->error_indicator) {
17732 D(p->level--);
17733 return NULL;
17734 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017735 D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017736 Token * _keyword;
17737 expr_ty z;
17738 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017739 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017740 &&
17741 (z = _PyPegen_name_token(p)) // NAME
17742 )
17743 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017744 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 +010017745 _res = z;
17746 if (_res == NULL && PyErr_Occurred()) {
17747 p->error_indicator = 1;
17748 D(p->level--);
17749 return NULL;
17750 }
17751 goto done;
17752 }
17753 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017754 D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017755 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17756 }
17757 _res = NULL;
17758 done:
17759 D(p->level--);
17760 return _res;
17761}
17762
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017763// _loop0_40: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017764static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017765_loop0_40_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017766{
17767 D(p->level++);
17768 if (p->error_indicator) {
17769 D(p->level--);
17770 return NULL;
17771 }
17772 void *_res = NULL;
17773 int _mark = p->mark;
17774 int _start_mark = p->mark;
17775 void **_children = PyMem_Malloc(sizeof(void *));
17776 if (!_children) {
17777 p->error_indicator = 1;
17778 PyErr_NoMemory();
17779 D(p->level--);
17780 return NULL;
17781 }
17782 ssize_t _children_capacity = 1;
17783 ssize_t _n = 0;
17784 { // ',' with_item
17785 if (p->error_indicator) {
17786 D(p->level--);
17787 return NULL;
17788 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017789 D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017790 Token * _literal;
17791 withitem_ty elem;
17792 while (
17793 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17794 &&
17795 (elem = with_item_rule(p)) // with_item
17796 )
17797 {
17798 _res = elem;
17799 if (_res == NULL && PyErr_Occurred()) {
17800 p->error_indicator = 1;
17801 PyMem_Free(_children);
17802 D(p->level--);
17803 return NULL;
17804 }
17805 if (_n == _children_capacity) {
17806 _children_capacity *= 2;
17807 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17808 if (!_new_children) {
17809 p->error_indicator = 1;
17810 PyErr_NoMemory();
17811 D(p->level--);
17812 return NULL;
17813 }
17814 _children = _new_children;
17815 }
17816 _children[_n++] = _res;
17817 _mark = p->mark;
17818 }
17819 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017820 D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017821 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17822 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017823 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017824 if (!_seq) {
17825 PyMem_Free(_children);
17826 p->error_indicator = 1;
17827 PyErr_NoMemory();
17828 D(p->level--);
17829 return NULL;
17830 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017831 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017832 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017833 _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017834 D(p->level--);
17835 return _seq;
17836}
17837
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017838// _gather_39: with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017839static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017840_gather_39_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017841{
17842 D(p->level++);
17843 if (p->error_indicator) {
17844 D(p->level--);
17845 return NULL;
17846 }
17847 asdl_seq * _res = NULL;
17848 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017849 { // with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017850 if (p->error_indicator) {
17851 D(p->level--);
17852 return NULL;
17853 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017854 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 +010017855 withitem_ty elem;
17856 asdl_seq * seq;
17857 if (
17858 (elem = with_item_rule(p)) // with_item
17859 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017860 (seq = _loop0_40_rule(p)) // _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017861 )
17862 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017863 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 +010017864 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17865 goto done;
17866 }
17867 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017868 D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ',
17869 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017870 }
17871 _res = NULL;
17872 done:
17873 D(p->level--);
17874 return _res;
17875}
17876
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017877// _loop0_42: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017878static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017879_loop0_42_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017880{
17881 D(p->level++);
17882 if (p->error_indicator) {
17883 D(p->level--);
17884 return NULL;
17885 }
17886 void *_res = NULL;
17887 int _mark = p->mark;
17888 int _start_mark = p->mark;
17889 void **_children = PyMem_Malloc(sizeof(void *));
17890 if (!_children) {
17891 p->error_indicator = 1;
17892 PyErr_NoMemory();
17893 D(p->level--);
17894 return NULL;
17895 }
17896 ssize_t _children_capacity = 1;
17897 ssize_t _n = 0;
17898 { // ',' with_item
17899 if (p->error_indicator) {
17900 D(p->level--);
17901 return NULL;
17902 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017903 D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017904 Token * _literal;
17905 withitem_ty elem;
17906 while (
17907 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17908 &&
17909 (elem = with_item_rule(p)) // with_item
17910 )
17911 {
17912 _res = elem;
17913 if (_res == NULL && PyErr_Occurred()) {
17914 p->error_indicator = 1;
17915 PyMem_Free(_children);
17916 D(p->level--);
17917 return NULL;
17918 }
17919 if (_n == _children_capacity) {
17920 _children_capacity *= 2;
17921 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17922 if (!_new_children) {
17923 p->error_indicator = 1;
17924 PyErr_NoMemory();
17925 D(p->level--);
17926 return NULL;
17927 }
17928 _children = _new_children;
17929 }
17930 _children[_n++] = _res;
17931 _mark = p->mark;
17932 }
17933 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017934 D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017935 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17936 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017937 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017938 if (!_seq) {
17939 PyMem_Free(_children);
17940 p->error_indicator = 1;
17941 PyErr_NoMemory();
17942 D(p->level--);
17943 return NULL;
17944 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017945 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017946 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017947 _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017948 D(p->level--);
17949 return _seq;
17950}
17951
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017952// _gather_41: with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017953static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017954_gather_41_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017955{
17956 D(p->level++);
17957 if (p->error_indicator) {
17958 D(p->level--);
17959 return NULL;
17960 }
17961 asdl_seq * _res = NULL;
17962 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017963 { // with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017964 if (p->error_indicator) {
17965 D(p->level--);
17966 return NULL;
17967 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017968 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 +010017969 withitem_ty elem;
17970 asdl_seq * seq;
17971 if (
17972 (elem = with_item_rule(p)) // with_item
17973 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017974 (seq = _loop0_42_rule(p)) // _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017975 )
17976 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017977 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 +010017978 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17979 goto done;
17980 }
17981 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017982 D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ',
17983 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017984 }
17985 _res = NULL;
17986 done:
17987 D(p->level--);
17988 return _res;
17989}
17990
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017991// _loop0_44: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017992static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017993_loop0_44_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017994{
17995 D(p->level++);
17996 if (p->error_indicator) {
17997 D(p->level--);
17998 return NULL;
17999 }
18000 void *_res = NULL;
18001 int _mark = p->mark;
18002 int _start_mark = p->mark;
18003 void **_children = PyMem_Malloc(sizeof(void *));
18004 if (!_children) {
18005 p->error_indicator = 1;
18006 PyErr_NoMemory();
18007 D(p->level--);
18008 return NULL;
18009 }
18010 ssize_t _children_capacity = 1;
18011 ssize_t _n = 0;
18012 { // ',' with_item
18013 if (p->error_indicator) {
18014 D(p->level--);
18015 return NULL;
18016 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018017 D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018018 Token * _literal;
18019 withitem_ty elem;
18020 while (
18021 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18022 &&
18023 (elem = with_item_rule(p)) // with_item
18024 )
18025 {
18026 _res = elem;
18027 if (_res == NULL && PyErr_Occurred()) {
18028 p->error_indicator = 1;
18029 PyMem_Free(_children);
18030 D(p->level--);
18031 return NULL;
18032 }
18033 if (_n == _children_capacity) {
18034 _children_capacity *= 2;
18035 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18036 if (!_new_children) {
18037 p->error_indicator = 1;
18038 PyErr_NoMemory();
18039 D(p->level--);
18040 return NULL;
18041 }
18042 _children = _new_children;
18043 }
18044 _children[_n++] = _res;
18045 _mark = p->mark;
18046 }
18047 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018048 D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018049 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18050 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018051 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018052 if (!_seq) {
18053 PyMem_Free(_children);
18054 p->error_indicator = 1;
18055 PyErr_NoMemory();
18056 D(p->level--);
18057 return NULL;
18058 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018059 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018060 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018061 _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018062 D(p->level--);
18063 return _seq;
18064}
18065
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018066// _gather_43: with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018067static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018068_gather_43_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018069{
18070 D(p->level++);
18071 if (p->error_indicator) {
18072 D(p->level--);
18073 return NULL;
18074 }
18075 asdl_seq * _res = NULL;
18076 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018077 { // with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018078 if (p->error_indicator) {
18079 D(p->level--);
18080 return NULL;
18081 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018082 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 +010018083 withitem_ty elem;
18084 asdl_seq * seq;
18085 if (
18086 (elem = with_item_rule(p)) // with_item
18087 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018088 (seq = _loop0_44_rule(p)) // _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018089 )
18090 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018091 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 +010018092 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18093 goto done;
18094 }
18095 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018096 D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ',
18097 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018098 }
18099 _res = NULL;
18100 done:
18101 D(p->level--);
18102 return _res;
18103}
18104
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018105// _loop0_46: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018106static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018107_loop0_46_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018108{
18109 D(p->level++);
18110 if (p->error_indicator) {
18111 D(p->level--);
18112 return NULL;
18113 }
18114 void *_res = NULL;
18115 int _mark = p->mark;
18116 int _start_mark = p->mark;
18117 void **_children = PyMem_Malloc(sizeof(void *));
18118 if (!_children) {
18119 p->error_indicator = 1;
18120 PyErr_NoMemory();
18121 D(p->level--);
18122 return NULL;
18123 }
18124 ssize_t _children_capacity = 1;
18125 ssize_t _n = 0;
18126 { // ',' with_item
18127 if (p->error_indicator) {
18128 D(p->level--);
18129 return NULL;
18130 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018131 D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018132 Token * _literal;
18133 withitem_ty elem;
18134 while (
18135 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18136 &&
18137 (elem = with_item_rule(p)) // with_item
18138 )
18139 {
18140 _res = elem;
18141 if (_res == NULL && PyErr_Occurred()) {
18142 p->error_indicator = 1;
18143 PyMem_Free(_children);
18144 D(p->level--);
18145 return NULL;
18146 }
18147 if (_n == _children_capacity) {
18148 _children_capacity *= 2;
18149 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18150 if (!_new_children) {
18151 p->error_indicator = 1;
18152 PyErr_NoMemory();
18153 D(p->level--);
18154 return NULL;
18155 }
18156 _children = _new_children;
18157 }
18158 _children[_n++] = _res;
18159 _mark = p->mark;
18160 }
18161 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018162 D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018163 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18164 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018165 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018166 if (!_seq) {
18167 PyMem_Free(_children);
18168 p->error_indicator = 1;
18169 PyErr_NoMemory();
18170 D(p->level--);
18171 return NULL;
18172 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018173 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018174 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018175 _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018176 D(p->level--);
18177 return _seq;
18178}
18179
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018180// _gather_45: with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018181static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018182_gather_45_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018183{
18184 D(p->level++);
18185 if (p->error_indicator) {
18186 D(p->level--);
18187 return NULL;
18188 }
18189 asdl_seq * _res = NULL;
18190 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018191 { // with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018192 if (p->error_indicator) {
18193 D(p->level--);
18194 return NULL;
18195 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018196 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 +010018197 withitem_ty elem;
18198 asdl_seq * seq;
18199 if (
18200 (elem = with_item_rule(p)) // with_item
18201 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018202 (seq = _loop0_46_rule(p)) // _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018203 )
18204 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018205 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 +010018206 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18207 goto done;
18208 }
18209 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018210 D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ',
18211 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018212 }
18213 _res = NULL;
18214 done:
18215 D(p->level--);
18216 return _res;
18217}
18218
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018219// _tmp_47: ',' | ')' | ':'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018220static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018221_tmp_47_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018222{
18223 D(p->level++);
18224 if (p->error_indicator) {
18225 D(p->level--);
18226 return NULL;
18227 }
18228 void * _res = NULL;
18229 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018230 { // ','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018231 if (p->error_indicator) {
18232 D(p->level--);
18233 return NULL;
18234 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018235 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
18236 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018237 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018238 (_literal = _PyPegen_expect_token(p, 12)) // token=','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018239 )
18240 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018241 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
18242 _res = _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018243 goto done;
18244 }
18245 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018246 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18247 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
18248 }
18249 { // ')'
18250 if (p->error_indicator) {
18251 D(p->level--);
18252 return NULL;
18253 }
18254 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
18255 Token * _literal;
18256 if (
18257 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
18258 )
18259 {
18260 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
18261 _res = _literal;
18262 goto done;
18263 }
18264 p->mark = _mark;
18265 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18266 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
18267 }
18268 { // ':'
18269 if (p->error_indicator) {
18270 D(p->level--);
18271 return NULL;
18272 }
18273 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
18274 Token * _literal;
18275 if (
18276 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
18277 )
18278 {
18279 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
18280 _res = _literal;
18281 goto done;
18282 }
18283 p->mark = _mark;
18284 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18285 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018286 }
18287 _res = NULL;
18288 done:
18289 D(p->level--);
18290 return _res;
18291}
18292
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018293// _loop1_48: except_block
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018294static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018295_loop1_48_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018296{
18297 D(p->level++);
18298 if (p->error_indicator) {
18299 D(p->level--);
18300 return NULL;
18301 }
18302 void *_res = NULL;
18303 int _mark = p->mark;
18304 int _start_mark = p->mark;
18305 void **_children = PyMem_Malloc(sizeof(void *));
18306 if (!_children) {
18307 p->error_indicator = 1;
18308 PyErr_NoMemory();
18309 D(p->level--);
18310 return NULL;
18311 }
18312 ssize_t _children_capacity = 1;
18313 ssize_t _n = 0;
18314 { // except_block
18315 if (p->error_indicator) {
18316 D(p->level--);
18317 return NULL;
18318 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018319 D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018320 excepthandler_ty except_block_var;
18321 while (
18322 (except_block_var = except_block_rule(p)) // except_block
18323 )
18324 {
18325 _res = except_block_var;
18326 if (_n == _children_capacity) {
18327 _children_capacity *= 2;
18328 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18329 if (!_new_children) {
18330 p->error_indicator = 1;
18331 PyErr_NoMemory();
18332 D(p->level--);
18333 return NULL;
18334 }
18335 _children = _new_children;
18336 }
18337 _children[_n++] = _res;
18338 _mark = p->mark;
18339 }
18340 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018341 D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018342 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
18343 }
18344 if (_n == 0 || p->error_indicator) {
18345 PyMem_Free(_children);
18346 D(p->level--);
18347 return NULL;
18348 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018349 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018350 if (!_seq) {
18351 PyMem_Free(_children);
18352 p->error_indicator = 1;
18353 PyErr_NoMemory();
18354 D(p->level--);
18355 return NULL;
18356 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018357 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018358 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018359 _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018360 D(p->level--);
18361 return _seq;
18362}
18363
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018364// _tmp_49: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018365static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018366_tmp_49_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018367{
18368 D(p->level++);
18369 if (p->error_indicator) {
18370 D(p->level--);
18371 return NULL;
18372 }
18373 void * _res = NULL;
18374 int _mark = p->mark;
18375 { // 'as' NAME
18376 if (p->error_indicator) {
18377 D(p->level--);
18378 return NULL;
18379 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018380 D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018381 Token * _keyword;
18382 expr_ty z;
18383 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018384 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018385 &&
18386 (z = _PyPegen_name_token(p)) // NAME
18387 )
18388 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018389 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 +010018390 _res = z;
18391 if (_res == NULL && PyErr_Occurred()) {
18392 p->error_indicator = 1;
18393 D(p->level--);
18394 return NULL;
18395 }
18396 goto done;
18397 }
18398 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018399 D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018400 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
18401 }
18402 _res = NULL;
18403 done:
18404 D(p->level--);
18405 return _res;
18406}
18407
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018408// _tmp_50: 'from' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018409static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018410_tmp_50_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018411{
18412 D(p->level++);
18413 if (p->error_indicator) {
18414 D(p->level--);
18415 return NULL;
18416 }
18417 void * _res = NULL;
18418 int _mark = p->mark;
18419 { // 'from' expression
18420 if (p->error_indicator) {
18421 D(p->level--);
18422 return NULL;
18423 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018424 D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018425 Token * _keyword;
18426 expr_ty z;
18427 if (
18428 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
18429 &&
18430 (z = expression_rule(p)) // expression
18431 )
18432 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018433 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 +010018434 _res = z;
18435 if (_res == NULL && PyErr_Occurred()) {
18436 p->error_indicator = 1;
18437 D(p->level--);
18438 return NULL;
18439 }
18440 goto done;
18441 }
18442 p->mark = _mark;
18443 D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018444 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018445 }
18446 _res = NULL;
18447 done:
18448 D(p->level--);
18449 return _res;
18450}
18451
18452// _tmp_51: '->' expression
18453static void *
18454_tmp_51_rule(Parser *p)
18455{
18456 D(p->level++);
18457 if (p->error_indicator) {
18458 D(p->level--);
18459 return NULL;
18460 }
18461 void * _res = NULL;
18462 int _mark = p->mark;
18463 { // '->' expression
18464 if (p->error_indicator) {
18465 D(p->level--);
18466 return NULL;
18467 }
18468 D(fprintf(stderr, "%*c> _tmp_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18469 Token * _literal;
18470 expr_ty z;
18471 if (
18472 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18473 &&
18474 (z = expression_rule(p)) // expression
18475 )
18476 {
18477 D(fprintf(stderr, "%*c+ _tmp_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18478 _res = z;
18479 if (_res == NULL && PyErr_Occurred()) {
18480 p->error_indicator = 1;
18481 D(p->level--);
18482 return NULL;
18483 }
18484 goto done;
18485 }
18486 p->mark = _mark;
18487 D(fprintf(stderr, "%*c%s _tmp_51[%d-%d]: %s failed!\n", p->level, ' ',
18488 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18489 }
18490 _res = NULL;
18491 done:
18492 D(p->level--);
18493 return _res;
18494}
18495
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018496// _tmp_52: '->' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018497static void *
18498_tmp_52_rule(Parser *p)
18499{
18500 D(p->level++);
18501 if (p->error_indicator) {
18502 D(p->level--);
18503 return NULL;
18504 }
18505 void * _res = NULL;
18506 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018507 { // '->' expression
18508 if (p->error_indicator) {
18509 D(p->level--);
18510 return NULL;
18511 }
18512 D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18513 Token * _literal;
18514 expr_ty z;
18515 if (
18516 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18517 &&
18518 (z = expression_rule(p)) // expression
18519 )
18520 {
18521 D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18522 _res = z;
18523 if (_res == NULL && PyErr_Occurred()) {
18524 p->error_indicator = 1;
18525 D(p->level--);
18526 return NULL;
18527 }
18528 goto done;
18529 }
18530 p->mark = _mark;
18531 D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ',
18532 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18533 }
18534 _res = NULL;
18535 done:
18536 D(p->level--);
18537 return _res;
18538}
18539
18540// _tmp_53: NEWLINE INDENT
18541static void *
18542_tmp_53_rule(Parser *p)
18543{
18544 D(p->level++);
18545 if (p->error_indicator) {
18546 D(p->level--);
18547 return NULL;
18548 }
18549 void * _res = NULL;
18550 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018551 { // NEWLINE INDENT
18552 if (p->error_indicator) {
18553 D(p->level--);
18554 return NULL;
18555 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018556 D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018557 Token * indent_var;
18558 Token * newline_var;
18559 if (
18560 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
18561 &&
18562 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
18563 )
18564 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018565 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 +010018566 _res = _PyPegen_dummy_name(p, newline_var, indent_var);
18567 goto done;
18568 }
18569 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018570 D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018571 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
18572 }
18573 _res = NULL;
18574 done:
18575 D(p->level--);
18576 return _res;
18577}
18578
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018579// _loop0_54: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018580static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018581_loop0_54_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018582{
18583 D(p->level++);
18584 if (p->error_indicator) {
18585 D(p->level--);
18586 return NULL;
18587 }
18588 void *_res = NULL;
18589 int _mark = p->mark;
18590 int _start_mark = p->mark;
18591 void **_children = PyMem_Malloc(sizeof(void *));
18592 if (!_children) {
18593 p->error_indicator = 1;
18594 PyErr_NoMemory();
18595 D(p->level--);
18596 return NULL;
18597 }
18598 ssize_t _children_capacity = 1;
18599 ssize_t _n = 0;
18600 { // param_no_default
18601 if (p->error_indicator) {
18602 D(p->level--);
18603 return NULL;
18604 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018605 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 +010018606 arg_ty param_no_default_var;
18607 while (
18608 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18609 )
18610 {
18611 _res = param_no_default_var;
18612 if (_n == _children_capacity) {
18613 _children_capacity *= 2;
18614 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18615 if (!_new_children) {
18616 p->error_indicator = 1;
18617 PyErr_NoMemory();
18618 D(p->level--);
18619 return NULL;
18620 }
18621 _children = _new_children;
18622 }
18623 _children[_n++] = _res;
18624 _mark = p->mark;
18625 }
18626 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018627 D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018628 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018629 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018630 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018631 if (!_seq) {
18632 PyMem_Free(_children);
18633 p->error_indicator = 1;
18634 PyErr_NoMemory();
18635 D(p->level--);
18636 return NULL;
18637 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018638 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018639 PyMem_Free(_children);
18640 _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq);
18641 D(p->level--);
18642 return _seq;
18643}
18644
18645// _loop0_55: param_with_default
18646static asdl_seq *
18647_loop0_55_rule(Parser *p)
18648{
18649 D(p->level++);
18650 if (p->error_indicator) {
18651 D(p->level--);
18652 return NULL;
18653 }
18654 void *_res = NULL;
18655 int _mark = p->mark;
18656 int _start_mark = p->mark;
18657 void **_children = PyMem_Malloc(sizeof(void *));
18658 if (!_children) {
18659 p->error_indicator = 1;
18660 PyErr_NoMemory();
18661 D(p->level--);
18662 return NULL;
18663 }
18664 ssize_t _children_capacity = 1;
18665 ssize_t _n = 0;
18666 { // param_with_default
18667 if (p->error_indicator) {
18668 D(p->level--);
18669 return NULL;
18670 }
18671 D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18672 NameDefaultPair* param_with_default_var;
18673 while (
18674 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18675 )
18676 {
18677 _res = param_with_default_var;
18678 if (_n == _children_capacity) {
18679 _children_capacity *= 2;
18680 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18681 if (!_new_children) {
18682 p->error_indicator = 1;
18683 PyErr_NoMemory();
18684 D(p->level--);
18685 return NULL;
18686 }
18687 _children = _new_children;
18688 }
18689 _children[_n++] = _res;
18690 _mark = p->mark;
18691 }
18692 p->mark = _mark;
18693 D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ',
18694 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18695 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018696 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018697 if (!_seq) {
18698 PyMem_Free(_children);
18699 p->error_indicator = 1;
18700 PyErr_NoMemory();
18701 D(p->level--);
18702 return NULL;
18703 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018704 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018705 PyMem_Free(_children);
18706 _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq);
18707 D(p->level--);
18708 return _seq;
18709}
18710
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018711// _loop0_56: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018712static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018713_loop0_56_rule(Parser *p)
18714{
18715 D(p->level++);
18716 if (p->error_indicator) {
18717 D(p->level--);
18718 return NULL;
18719 }
18720 void *_res = NULL;
18721 int _mark = p->mark;
18722 int _start_mark = p->mark;
18723 void **_children = PyMem_Malloc(sizeof(void *));
18724 if (!_children) {
18725 p->error_indicator = 1;
18726 PyErr_NoMemory();
18727 D(p->level--);
18728 return NULL;
18729 }
18730 ssize_t _children_capacity = 1;
18731 ssize_t _n = 0;
18732 { // param_with_default
18733 if (p->error_indicator) {
18734 D(p->level--);
18735 return NULL;
18736 }
18737 D(fprintf(stderr, "%*c> _loop0_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18738 NameDefaultPair* param_with_default_var;
18739 while (
18740 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18741 )
18742 {
18743 _res = param_with_default_var;
18744 if (_n == _children_capacity) {
18745 _children_capacity *= 2;
18746 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18747 if (!_new_children) {
18748 p->error_indicator = 1;
18749 PyErr_NoMemory();
18750 D(p->level--);
18751 return NULL;
18752 }
18753 _children = _new_children;
18754 }
18755 _children[_n++] = _res;
18756 _mark = p->mark;
18757 }
18758 p->mark = _mark;
18759 D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ',
18760 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18761 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018762 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018763 if (!_seq) {
18764 PyMem_Free(_children);
18765 p->error_indicator = 1;
18766 PyErr_NoMemory();
18767 D(p->level--);
18768 return NULL;
18769 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018770 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018771 PyMem_Free(_children);
18772 _PyPegen_insert_memo(p, _start_mark, _loop0_56_type, _seq);
18773 D(p->level--);
18774 return _seq;
18775}
18776
18777// _loop1_57: param_no_default
18778static asdl_seq *
18779_loop1_57_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018780{
18781 D(p->level++);
18782 if (p->error_indicator) {
18783 D(p->level--);
18784 return NULL;
18785 }
18786 void *_res = NULL;
18787 int _mark = p->mark;
18788 int _start_mark = p->mark;
18789 void **_children = PyMem_Malloc(sizeof(void *));
18790 if (!_children) {
18791 p->error_indicator = 1;
18792 PyErr_NoMemory();
18793 D(p->level--);
18794 return NULL;
18795 }
18796 ssize_t _children_capacity = 1;
18797 ssize_t _n = 0;
18798 { // param_no_default
18799 if (p->error_indicator) {
18800 D(p->level--);
18801 return NULL;
18802 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018803 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 +010018804 arg_ty param_no_default_var;
18805 while (
18806 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18807 )
18808 {
18809 _res = param_no_default_var;
18810 if (_n == _children_capacity) {
18811 _children_capacity *= 2;
18812 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18813 if (!_new_children) {
18814 p->error_indicator = 1;
18815 PyErr_NoMemory();
18816 D(p->level--);
18817 return NULL;
18818 }
18819 _children = _new_children;
18820 }
18821 _children[_n++] = _res;
18822 _mark = p->mark;
18823 }
18824 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018825 D(fprintf(stderr, "%*c%s _loop1_57[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018826 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
18827 }
18828 if (_n == 0 || p->error_indicator) {
18829 PyMem_Free(_children);
18830 D(p->level--);
18831 return NULL;
18832 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018833 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018834 if (!_seq) {
18835 PyMem_Free(_children);
18836 p->error_indicator = 1;
18837 PyErr_NoMemory();
18838 D(p->level--);
18839 return NULL;
18840 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018841 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018842 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018843 _PyPegen_insert_memo(p, _start_mark, _loop1_57_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018844 D(p->level--);
18845 return _seq;
18846}
18847
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018848// _loop0_58: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018849static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018850_loop0_58_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018851{
18852 D(p->level++);
18853 if (p->error_indicator) {
18854 D(p->level--);
18855 return NULL;
18856 }
18857 void *_res = NULL;
18858 int _mark = p->mark;
18859 int _start_mark = p->mark;
18860 void **_children = PyMem_Malloc(sizeof(void *));
18861 if (!_children) {
18862 p->error_indicator = 1;
18863 PyErr_NoMemory();
18864 D(p->level--);
18865 return NULL;
18866 }
18867 ssize_t _children_capacity = 1;
18868 ssize_t _n = 0;
18869 { // param_with_default
18870 if (p->error_indicator) {
18871 D(p->level--);
18872 return NULL;
18873 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018874 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 +010018875 NameDefaultPair* param_with_default_var;
18876 while (
18877 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18878 )
18879 {
18880 _res = param_with_default_var;
18881 if (_n == _children_capacity) {
18882 _children_capacity *= 2;
18883 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18884 if (!_new_children) {
18885 p->error_indicator = 1;
18886 PyErr_NoMemory();
18887 D(p->level--);
18888 return NULL;
18889 }
18890 _children = _new_children;
18891 }
18892 _children[_n++] = _res;
18893 _mark = p->mark;
18894 }
18895 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018896 D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018897 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18898 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018899 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018900 if (!_seq) {
18901 PyMem_Free(_children);
18902 p->error_indicator = 1;
18903 PyErr_NoMemory();
18904 D(p->level--);
18905 return NULL;
18906 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018907 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018908 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018909 _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018910 D(p->level--);
18911 return _seq;
18912}
18913
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018914// _loop1_59: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018915static asdl_seq *
18916_loop1_59_rule(Parser *p)
18917{
18918 D(p->level++);
18919 if (p->error_indicator) {
18920 D(p->level--);
18921 return NULL;
18922 }
18923 void *_res = NULL;
18924 int _mark = p->mark;
18925 int _start_mark = p->mark;
18926 void **_children = PyMem_Malloc(sizeof(void *));
18927 if (!_children) {
18928 p->error_indicator = 1;
18929 PyErr_NoMemory();
18930 D(p->level--);
18931 return NULL;
18932 }
18933 ssize_t _children_capacity = 1;
18934 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018935 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018936 if (p->error_indicator) {
18937 D(p->level--);
18938 return NULL;
18939 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018940 D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18941 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018942 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018943 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018944 )
18945 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018946 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018947 if (_n == _children_capacity) {
18948 _children_capacity *= 2;
18949 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18950 if (!_new_children) {
18951 p->error_indicator = 1;
18952 PyErr_NoMemory();
18953 D(p->level--);
18954 return NULL;
18955 }
18956 _children = _new_children;
18957 }
18958 _children[_n++] = _res;
18959 _mark = p->mark;
18960 }
18961 p->mark = _mark;
18962 D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018963 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018964 }
18965 if (_n == 0 || p->error_indicator) {
18966 PyMem_Free(_children);
18967 D(p->level--);
18968 return NULL;
18969 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018970 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018971 if (!_seq) {
18972 PyMem_Free(_children);
18973 p->error_indicator = 1;
18974 PyErr_NoMemory();
18975 D(p->level--);
18976 return NULL;
18977 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018978 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018979 PyMem_Free(_children);
18980 _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq);
18981 D(p->level--);
18982 return _seq;
18983}
18984
18985// _loop1_60: param_no_default
18986static asdl_seq *
18987_loop1_60_rule(Parser *p)
18988{
18989 D(p->level++);
18990 if (p->error_indicator) {
18991 D(p->level--);
18992 return NULL;
18993 }
18994 void *_res = NULL;
18995 int _mark = p->mark;
18996 int _start_mark = p->mark;
18997 void **_children = PyMem_Malloc(sizeof(void *));
18998 if (!_children) {
18999 p->error_indicator = 1;
19000 PyErr_NoMemory();
19001 D(p->level--);
19002 return NULL;
19003 }
19004 ssize_t _children_capacity = 1;
19005 ssize_t _n = 0;
19006 { // param_no_default
19007 if (p->error_indicator) {
19008 D(p->level--);
19009 return NULL;
19010 }
19011 D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19012 arg_ty param_no_default_var;
19013 while (
19014 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19015 )
19016 {
19017 _res = param_no_default_var;
19018 if (_n == _children_capacity) {
19019 _children_capacity *= 2;
19020 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19021 if (!_new_children) {
19022 p->error_indicator = 1;
19023 PyErr_NoMemory();
19024 D(p->level--);
19025 return NULL;
19026 }
19027 _children = _new_children;
19028 }
19029 _children[_n++] = _res;
19030 _mark = p->mark;
19031 }
19032 p->mark = _mark;
19033 D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ',
19034 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19035 }
19036 if (_n == 0 || p->error_indicator) {
19037 PyMem_Free(_children);
19038 D(p->level--);
19039 return NULL;
19040 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019041 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019042 if (!_seq) {
19043 PyMem_Free(_children);
19044 p->error_indicator = 1;
19045 PyErr_NoMemory();
19046 D(p->level--);
19047 return NULL;
19048 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019049 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019050 PyMem_Free(_children);
19051 _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq);
19052 D(p->level--);
19053 return _seq;
19054}
19055
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019056// _loop1_61: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019057static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019058_loop1_61_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019059{
19060 D(p->level++);
19061 if (p->error_indicator) {
19062 D(p->level--);
19063 return NULL;
19064 }
19065 void *_res = NULL;
19066 int _mark = p->mark;
19067 int _start_mark = p->mark;
19068 void **_children = PyMem_Malloc(sizeof(void *));
19069 if (!_children) {
19070 p->error_indicator = 1;
19071 PyErr_NoMemory();
19072 D(p->level--);
19073 return NULL;
19074 }
19075 ssize_t _children_capacity = 1;
19076 ssize_t _n = 0;
19077 { // param_no_default
19078 if (p->error_indicator) {
19079 D(p->level--);
19080 return NULL;
19081 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019082 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 +010019083 arg_ty param_no_default_var;
19084 while (
19085 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19086 )
19087 {
19088 _res = param_no_default_var;
19089 if (_n == _children_capacity) {
19090 _children_capacity *= 2;
19091 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19092 if (!_new_children) {
19093 p->error_indicator = 1;
19094 PyErr_NoMemory();
19095 D(p->level--);
19096 return NULL;
19097 }
19098 _children = _new_children;
19099 }
19100 _children[_n++] = _res;
19101 _mark = p->mark;
19102 }
19103 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019104 D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019105 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19106 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019107 if (_n == 0 || p->error_indicator) {
19108 PyMem_Free(_children);
19109 D(p->level--);
19110 return NULL;
19111 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019112 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019113 if (!_seq) {
19114 PyMem_Free(_children);
19115 p->error_indicator = 1;
19116 PyErr_NoMemory();
19117 D(p->level--);
19118 return NULL;
19119 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019120 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019121 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019122 _PyPegen_insert_memo(p, _start_mark, _loop1_61_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019123 D(p->level--);
19124 return _seq;
19125}
19126
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019127// _loop0_62: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019128static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019129_loop0_62_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019130{
19131 D(p->level++);
19132 if (p->error_indicator) {
19133 D(p->level--);
19134 return NULL;
19135 }
19136 void *_res = NULL;
19137 int _mark = p->mark;
19138 int _start_mark = p->mark;
19139 void **_children = PyMem_Malloc(sizeof(void *));
19140 if (!_children) {
19141 p->error_indicator = 1;
19142 PyErr_NoMemory();
19143 D(p->level--);
19144 return NULL;
19145 }
19146 ssize_t _children_capacity = 1;
19147 ssize_t _n = 0;
19148 { // param_no_default
19149 if (p->error_indicator) {
19150 D(p->level--);
19151 return NULL;
19152 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019153 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 +010019154 arg_ty param_no_default_var;
19155 while (
19156 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19157 )
19158 {
19159 _res = param_no_default_var;
19160 if (_n == _children_capacity) {
19161 _children_capacity *= 2;
19162 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19163 if (!_new_children) {
19164 p->error_indicator = 1;
19165 PyErr_NoMemory();
19166 D(p->level--);
19167 return NULL;
19168 }
19169 _children = _new_children;
19170 }
19171 _children[_n++] = _res;
19172 _mark = p->mark;
19173 }
19174 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019175 D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019176 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19177 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019178 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019179 if (!_seq) {
19180 PyMem_Free(_children);
19181 p->error_indicator = 1;
19182 PyErr_NoMemory();
19183 D(p->level--);
19184 return NULL;
19185 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019186 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019187 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019188 _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019189 D(p->level--);
19190 return _seq;
19191}
19192
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019193// _loop1_63: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019194static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019195_loop1_63_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019196{
19197 D(p->level++);
19198 if (p->error_indicator) {
19199 D(p->level--);
19200 return NULL;
19201 }
19202 void *_res = NULL;
19203 int _mark = p->mark;
19204 int _start_mark = p->mark;
19205 void **_children = PyMem_Malloc(sizeof(void *));
19206 if (!_children) {
19207 p->error_indicator = 1;
19208 PyErr_NoMemory();
19209 D(p->level--);
19210 return NULL;
19211 }
19212 ssize_t _children_capacity = 1;
19213 ssize_t _n = 0;
19214 { // param_with_default
19215 if (p->error_indicator) {
19216 D(p->level--);
19217 return NULL;
19218 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019219 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 +010019220 NameDefaultPair* param_with_default_var;
19221 while (
19222 (param_with_default_var = param_with_default_rule(p)) // param_with_default
19223 )
19224 {
19225 _res = param_with_default_var;
19226 if (_n == _children_capacity) {
19227 _children_capacity *= 2;
19228 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19229 if (!_new_children) {
19230 p->error_indicator = 1;
19231 PyErr_NoMemory();
19232 D(p->level--);
19233 return NULL;
19234 }
19235 _children = _new_children;
19236 }
19237 _children[_n++] = _res;
19238 _mark = p->mark;
19239 }
19240 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019241 D(fprintf(stderr, "%*c%s _loop1_63[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019242 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
19243 }
19244 if (_n == 0 || p->error_indicator) {
19245 PyMem_Free(_children);
19246 D(p->level--);
19247 return NULL;
19248 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019249 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019250 if (!_seq) {
19251 PyMem_Free(_children);
19252 p->error_indicator = 1;
19253 PyErr_NoMemory();
19254 D(p->level--);
19255 return NULL;
19256 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019257 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019258 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019259 _PyPegen_insert_memo(p, _start_mark, _loop1_63_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019260 D(p->level--);
19261 return _seq;
19262}
19263
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019264// _loop0_64: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019265static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019266_loop0_64_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019267{
19268 D(p->level++);
19269 if (p->error_indicator) {
19270 D(p->level--);
19271 return NULL;
19272 }
19273 void *_res = NULL;
19274 int _mark = p->mark;
19275 int _start_mark = p->mark;
19276 void **_children = PyMem_Malloc(sizeof(void *));
19277 if (!_children) {
19278 p->error_indicator = 1;
19279 PyErr_NoMemory();
19280 D(p->level--);
19281 return NULL;
19282 }
19283 ssize_t _children_capacity = 1;
19284 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019285 { // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019286 if (p->error_indicator) {
19287 D(p->level--);
19288 return NULL;
19289 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019290 D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19291 arg_ty param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019292 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019293 (param_no_default_var = param_no_default_rule(p)) // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019294 )
19295 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019296 _res = param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019297 if (_n == _children_capacity) {
19298 _children_capacity *= 2;
19299 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19300 if (!_new_children) {
19301 p->error_indicator = 1;
19302 PyErr_NoMemory();
19303 D(p->level--);
19304 return NULL;
19305 }
19306 _children = _new_children;
19307 }
19308 _children[_n++] = _res;
19309 _mark = p->mark;
19310 }
19311 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019312 D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ',
19313 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019314 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019315 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019316 if (!_seq) {
19317 PyMem_Free(_children);
19318 p->error_indicator = 1;
19319 PyErr_NoMemory();
19320 D(p->level--);
19321 return NULL;
19322 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019323 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019324 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019325 _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019326 D(p->level--);
19327 return _seq;
19328}
19329
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019330// _loop1_65: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019331static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019332_loop1_65_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019333{
19334 D(p->level++);
19335 if (p->error_indicator) {
19336 D(p->level--);
19337 return NULL;
19338 }
19339 void *_res = NULL;
19340 int _mark = p->mark;
19341 int _start_mark = p->mark;
19342 void **_children = PyMem_Malloc(sizeof(void *));
19343 if (!_children) {
19344 p->error_indicator = 1;
19345 PyErr_NoMemory();
19346 D(p->level--);
19347 return NULL;
19348 }
19349 ssize_t _children_capacity = 1;
19350 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019351 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019352 if (p->error_indicator) {
19353 D(p->level--);
19354 return NULL;
19355 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019356 D(fprintf(stderr, "%*c> _loop1_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
19357 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019358 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019359 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019360 )
19361 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019362 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019363 if (_n == _children_capacity) {
19364 _children_capacity *= 2;
19365 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19366 if (!_new_children) {
19367 p->error_indicator = 1;
19368 PyErr_NoMemory();
19369 D(p->level--);
19370 return NULL;
19371 }
19372 _children = _new_children;
19373 }
19374 _children[_n++] = _res;
19375 _mark = p->mark;
19376 }
19377 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019378 D(fprintf(stderr, "%*c%s _loop1_65[%d-%d]: %s failed!\n", p->level, ' ',
19379 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019380 }
19381 if (_n == 0 || p->error_indicator) {
19382 PyMem_Free(_children);
19383 D(p->level--);
19384 return NULL;
19385 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019386 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019387 if (!_seq) {
19388 PyMem_Free(_children);
19389 p->error_indicator = 1;
19390 PyErr_NoMemory();
19391 D(p->level--);
19392 return NULL;
19393 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019394 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019395 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019396 _PyPegen_insert_memo(p, _start_mark, _loop1_65_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019397 D(p->level--);
19398 return _seq;
19399}
19400
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019401// _loop0_66: param_maybe_default
19402static asdl_seq *
19403_loop0_66_rule(Parser *p)
19404{
19405 D(p->level++);
19406 if (p->error_indicator) {
19407 D(p->level--);
19408 return NULL;
19409 }
19410 void *_res = NULL;
19411 int _mark = p->mark;
19412 int _start_mark = p->mark;
19413 void **_children = PyMem_Malloc(sizeof(void *));
19414 if (!_children) {
19415 p->error_indicator = 1;
19416 PyErr_NoMemory();
19417 D(p->level--);
19418 return NULL;
19419 }
19420 ssize_t _children_capacity = 1;
19421 ssize_t _n = 0;
19422 { // param_maybe_default
19423 if (p->error_indicator) {
19424 D(p->level--);
19425 return NULL;
19426 }
19427 D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19428 NameDefaultPair* param_maybe_default_var;
19429 while (
19430 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19431 )
19432 {
19433 _res = param_maybe_default_var;
19434 if (_n == _children_capacity) {
19435 _children_capacity *= 2;
19436 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19437 if (!_new_children) {
19438 p->error_indicator = 1;
19439 PyErr_NoMemory();
19440 D(p->level--);
19441 return NULL;
19442 }
19443 _children = _new_children;
19444 }
19445 _children[_n++] = _res;
19446 _mark = p->mark;
19447 }
19448 p->mark = _mark;
19449 D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ',
19450 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19451 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019452 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019453 if (!_seq) {
19454 PyMem_Free(_children);
19455 p->error_indicator = 1;
19456 PyErr_NoMemory();
19457 D(p->level--);
19458 return NULL;
19459 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019460 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019461 PyMem_Free(_children);
19462 _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq);
19463 D(p->level--);
19464 return _seq;
19465}
19466
19467// _loop1_67: param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019468static asdl_seq *
19469_loop1_67_rule(Parser *p)
19470{
19471 D(p->level++);
19472 if (p->error_indicator) {
19473 D(p->level--);
19474 return NULL;
19475 }
19476 void *_res = NULL;
19477 int _mark = p->mark;
19478 int _start_mark = p->mark;
19479 void **_children = PyMem_Malloc(sizeof(void *));
19480 if (!_children) {
19481 p->error_indicator = 1;
19482 PyErr_NoMemory();
19483 D(p->level--);
19484 return NULL;
19485 }
19486 ssize_t _children_capacity = 1;
19487 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019488 { // param_maybe_default
19489 if (p->error_indicator) {
19490 D(p->level--);
19491 return NULL;
19492 }
19493 D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19494 NameDefaultPair* param_maybe_default_var;
19495 while (
19496 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19497 )
19498 {
19499 _res = param_maybe_default_var;
19500 if (_n == _children_capacity) {
19501 _children_capacity *= 2;
19502 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19503 if (!_new_children) {
19504 p->error_indicator = 1;
19505 PyErr_NoMemory();
19506 D(p->level--);
19507 return NULL;
19508 }
19509 _children = _new_children;
19510 }
19511 _children[_n++] = _res;
19512 _mark = p->mark;
19513 }
19514 p->mark = _mark;
19515 D(fprintf(stderr, "%*c%s _loop1_67[%d-%d]: %s failed!\n", p->level, ' ',
19516 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19517 }
19518 if (_n == 0 || p->error_indicator) {
19519 PyMem_Free(_children);
19520 D(p->level--);
19521 return NULL;
19522 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019523 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019524 if (!_seq) {
19525 PyMem_Free(_children);
19526 p->error_indicator = 1;
19527 PyErr_NoMemory();
19528 D(p->level--);
19529 return NULL;
19530 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019531 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019532 PyMem_Free(_children);
19533 _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq);
19534 D(p->level--);
19535 return _seq;
19536}
19537
19538// _loop1_68: ('@' named_expression NEWLINE)
19539static asdl_seq *
19540_loop1_68_rule(Parser *p)
19541{
19542 D(p->level++);
19543 if (p->error_indicator) {
19544 D(p->level--);
19545 return NULL;
19546 }
19547 void *_res = NULL;
19548 int _mark = p->mark;
19549 int _start_mark = p->mark;
19550 void **_children = PyMem_Malloc(sizeof(void *));
19551 if (!_children) {
19552 p->error_indicator = 1;
19553 PyErr_NoMemory();
19554 D(p->level--);
19555 return NULL;
19556 }
19557 ssize_t _children_capacity = 1;
19558 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019559 { // ('@' named_expression NEWLINE)
19560 if (p->error_indicator) {
19561 D(p->level--);
19562 return NULL;
19563 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019564 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 +010019565 void *_tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019566 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019567 (_tmp_142_var = _tmp_142_rule(p)) // '@' named_expression NEWLINE
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019568 )
19569 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019570 _res = _tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019571 if (_n == _children_capacity) {
19572 _children_capacity *= 2;
19573 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19574 if (!_new_children) {
19575 p->error_indicator = 1;
19576 PyErr_NoMemory();
19577 D(p->level--);
19578 return NULL;
19579 }
19580 _children = _new_children;
19581 }
19582 _children[_n++] = _res;
19583 _mark = p->mark;
19584 }
19585 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019586 D(fprintf(stderr, "%*c%s _loop1_68[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019587 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
19588 }
19589 if (_n == 0 || p->error_indicator) {
19590 PyMem_Free(_children);
19591 D(p->level--);
19592 return NULL;
19593 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019594 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019595 if (!_seq) {
19596 PyMem_Free(_children);
19597 p->error_indicator = 1;
19598 PyErr_NoMemory();
19599 D(p->level--);
19600 return NULL;
19601 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019602 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019603 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019604 _PyPegen_insert_memo(p, _start_mark, _loop1_68_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019605 D(p->level--);
19606 return _seq;
19607}
19608
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019609// _tmp_69: '(' arguments? ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019610static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019611_tmp_69_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019612{
19613 D(p->level++);
19614 if (p->error_indicator) {
19615 D(p->level--);
19616 return NULL;
19617 }
19618 void * _res = NULL;
19619 int _mark = p->mark;
19620 { // '(' arguments? ')'
19621 if (p->error_indicator) {
19622 D(p->level--);
19623 return NULL;
19624 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019625 D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019626 Token * _literal;
19627 Token * _literal_1;
19628 void *z;
19629 if (
19630 (_literal = _PyPegen_expect_token(p, 7)) // token='('
19631 &&
19632 (z = arguments_rule(p), 1) // arguments?
19633 &&
19634 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
19635 )
19636 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019637 D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019638 _res = z;
19639 if (_res == NULL && PyErr_Occurred()) {
19640 p->error_indicator = 1;
19641 D(p->level--);
19642 return NULL;
19643 }
19644 goto done;
19645 }
19646 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019647 D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019648 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
19649 }
19650 _res = NULL;
19651 done:
19652 D(p->level--);
19653 return _res;
19654}
19655
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019656// _loop0_71: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019657static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019658_loop0_71_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019659{
19660 D(p->level++);
19661 if (p->error_indicator) {
19662 D(p->level--);
19663 return NULL;
19664 }
19665 void *_res = NULL;
19666 int _mark = p->mark;
19667 int _start_mark = p->mark;
19668 void **_children = PyMem_Malloc(sizeof(void *));
19669 if (!_children) {
19670 p->error_indicator = 1;
19671 PyErr_NoMemory();
19672 D(p->level--);
19673 return NULL;
19674 }
19675 ssize_t _children_capacity = 1;
19676 ssize_t _n = 0;
19677 { // ',' star_expression
19678 if (p->error_indicator) {
19679 D(p->level--);
19680 return NULL;
19681 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019682 D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019683 Token * _literal;
19684 expr_ty elem;
19685 while (
19686 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19687 &&
19688 (elem = star_expression_rule(p)) // star_expression
19689 )
19690 {
19691 _res = elem;
19692 if (_res == NULL && PyErr_Occurred()) {
19693 p->error_indicator = 1;
19694 PyMem_Free(_children);
19695 D(p->level--);
19696 return NULL;
19697 }
19698 if (_n == _children_capacity) {
19699 _children_capacity *= 2;
19700 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19701 if (!_new_children) {
19702 p->error_indicator = 1;
19703 PyErr_NoMemory();
19704 D(p->level--);
19705 return NULL;
19706 }
19707 _children = _new_children;
19708 }
19709 _children[_n++] = _res;
19710 _mark = p->mark;
19711 }
19712 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019713 D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019714 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
19715 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019716 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019717 if (!_seq) {
19718 PyMem_Free(_children);
19719 p->error_indicator = 1;
19720 PyErr_NoMemory();
19721 D(p->level--);
19722 return NULL;
19723 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019724 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019725 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019726 _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019727 D(p->level--);
19728 return _seq;
19729}
19730
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019731// _gather_70: star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019732static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019733_gather_70_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019734{
19735 D(p->level++);
19736 if (p->error_indicator) {
19737 D(p->level--);
19738 return NULL;
19739 }
19740 asdl_seq * _res = NULL;
19741 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019742 { // star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019743 if (p->error_indicator) {
19744 D(p->level--);
19745 return NULL;
19746 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019747 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 +010019748 expr_ty elem;
19749 asdl_seq * seq;
19750 if (
19751 (elem = star_expression_rule(p)) // star_expression
19752 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019753 (seq = _loop0_71_rule(p)) // _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019754 )
19755 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019756 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 +010019757 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19758 goto done;
19759 }
19760 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019761 D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ',
19762 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_71"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019763 }
19764 _res = NULL;
19765 done:
19766 D(p->level--);
19767 return _res;
19768}
19769
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019770// _loop1_72: (',' star_expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019771static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019772_loop1_72_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019773{
19774 D(p->level++);
19775 if (p->error_indicator) {
19776 D(p->level--);
19777 return NULL;
19778 }
19779 void *_res = NULL;
19780 int _mark = p->mark;
19781 int _start_mark = p->mark;
19782 void **_children = PyMem_Malloc(sizeof(void *));
19783 if (!_children) {
19784 p->error_indicator = 1;
19785 PyErr_NoMemory();
19786 D(p->level--);
19787 return NULL;
19788 }
19789 ssize_t _children_capacity = 1;
19790 ssize_t _n = 0;
19791 { // (',' star_expression)
19792 if (p->error_indicator) {
19793 D(p->level--);
19794 return NULL;
19795 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019796 D(fprintf(stderr, "%*c> _loop1_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010019797 void *_tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019798 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019799 (_tmp_143_var = _tmp_143_rule(p)) // ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019800 )
19801 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019802 _res = _tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019803 if (_n == _children_capacity) {
19804 _children_capacity *= 2;
19805 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19806 if (!_new_children) {
19807 p->error_indicator = 1;
19808 PyErr_NoMemory();
19809 D(p->level--);
19810 return NULL;
19811 }
19812 _children = _new_children;
19813 }
19814 _children[_n++] = _res;
19815 _mark = p->mark;
19816 }
19817 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019818 D(fprintf(stderr, "%*c%s _loop1_72[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019819 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
19820 }
19821 if (_n == 0 || p->error_indicator) {
19822 PyMem_Free(_children);
19823 D(p->level--);
19824 return NULL;
19825 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019826 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019827 if (!_seq) {
19828 PyMem_Free(_children);
19829 p->error_indicator = 1;
19830 PyErr_NoMemory();
19831 D(p->level--);
19832 return NULL;
19833 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019834 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019835 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019836 _PyPegen_insert_memo(p, _start_mark, _loop1_72_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019837 D(p->level--);
19838 return _seq;
19839}
19840
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019841// _loop0_74: ',' star_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019842static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019843_loop0_74_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019844{
19845 D(p->level++);
19846 if (p->error_indicator) {
19847 D(p->level--);
19848 return NULL;
19849 }
19850 void *_res = NULL;
19851 int _mark = p->mark;
19852 int _start_mark = p->mark;
19853 void **_children = PyMem_Malloc(sizeof(void *));
19854 if (!_children) {
19855 p->error_indicator = 1;
19856 PyErr_NoMemory();
19857 D(p->level--);
19858 return NULL;
19859 }
19860 ssize_t _children_capacity = 1;
19861 ssize_t _n = 0;
19862 { // ',' star_named_expression
19863 if (p->error_indicator) {
19864 D(p->level--);
19865 return NULL;
19866 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019867 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 +010019868 Token * _literal;
19869 expr_ty elem;
19870 while (
19871 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19872 &&
19873 (elem = star_named_expression_rule(p)) // star_named_expression
19874 )
19875 {
19876 _res = elem;
19877 if (_res == NULL && PyErr_Occurred()) {
19878 p->error_indicator = 1;
19879 PyMem_Free(_children);
19880 D(p->level--);
19881 return NULL;
19882 }
19883 if (_n == _children_capacity) {
19884 _children_capacity *= 2;
19885 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19886 if (!_new_children) {
19887 p->error_indicator = 1;
19888 PyErr_NoMemory();
19889 D(p->level--);
19890 return NULL;
19891 }
19892 _children = _new_children;
19893 }
19894 _children[_n++] = _res;
19895 _mark = p->mark;
19896 }
19897 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019898 D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019899 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
19900 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019901 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019902 if (!_seq) {
19903 PyMem_Free(_children);
19904 p->error_indicator = 1;
19905 PyErr_NoMemory();
19906 D(p->level--);
19907 return NULL;
19908 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019909 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019910 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019911 _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019912 D(p->level--);
19913 return _seq;
19914}
19915
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019916// _gather_73: star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019917static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019918_gather_73_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019919{
19920 D(p->level++);
19921 if (p->error_indicator) {
19922 D(p->level--);
19923 return NULL;
19924 }
19925 asdl_seq * _res = NULL;
19926 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019927 { // star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019928 if (p->error_indicator) {
19929 D(p->level--);
19930 return NULL;
19931 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019932 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 +010019933 expr_ty elem;
19934 asdl_seq * seq;
19935 if (
19936 (elem = star_named_expression_rule(p)) // star_named_expression
19937 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019938 (seq = _loop0_74_rule(p)) // _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019939 )
19940 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019941 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 +010019942 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19943 goto done;
19944 }
19945 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019946 D(fprintf(stderr, "%*c%s _gather_73[%d-%d]: %s failed!\n", p->level, ' ',
19947 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_74"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019948 }
19949 _res = NULL;
19950 done:
19951 D(p->level--);
19952 return _res;
19953}
19954
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019955// _loop1_75: (',' expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019956static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019957_loop1_75_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019958{
19959 D(p->level++);
19960 if (p->error_indicator) {
19961 D(p->level--);
19962 return NULL;
19963 }
19964 void *_res = NULL;
19965 int _mark = p->mark;
19966 int _start_mark = p->mark;
19967 void **_children = PyMem_Malloc(sizeof(void *));
19968 if (!_children) {
19969 p->error_indicator = 1;
19970 PyErr_NoMemory();
19971 D(p->level--);
19972 return NULL;
19973 }
19974 ssize_t _children_capacity = 1;
19975 ssize_t _n = 0;
19976 { // (',' expression)
19977 if (p->error_indicator) {
19978 D(p->level--);
19979 return NULL;
19980 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019981 D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010019982 void *_tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019983 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019984 (_tmp_144_var = _tmp_144_rule(p)) // ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019985 )
19986 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019987 _res = _tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019988 if (_n == _children_capacity) {
19989 _children_capacity *= 2;
19990 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19991 if (!_new_children) {
19992 p->error_indicator = 1;
19993 PyErr_NoMemory();
19994 D(p->level--);
19995 return NULL;
19996 }
19997 _children = _new_children;
19998 }
19999 _children[_n++] = _res;
20000 _mark = p->mark;
20001 }
20002 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020003 D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020004 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
20005 }
20006 if (_n == 0 || p->error_indicator) {
20007 PyMem_Free(_children);
20008 D(p->level--);
20009 return NULL;
20010 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020011 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020012 if (!_seq) {
20013 PyMem_Free(_children);
20014 p->error_indicator = 1;
20015 PyErr_NoMemory();
20016 D(p->level--);
20017 return NULL;
20018 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020019 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020020 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020021 _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020022 D(p->level--);
20023 return _seq;
20024}
20025
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020026// _loop0_76: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020027static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020028_loop0_76_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020029{
20030 D(p->level++);
20031 if (p->error_indicator) {
20032 D(p->level--);
20033 return NULL;
20034 }
20035 void *_res = NULL;
20036 int _mark = p->mark;
20037 int _start_mark = p->mark;
20038 void **_children = PyMem_Malloc(sizeof(void *));
20039 if (!_children) {
20040 p->error_indicator = 1;
20041 PyErr_NoMemory();
20042 D(p->level--);
20043 return NULL;
20044 }
20045 ssize_t _children_capacity = 1;
20046 ssize_t _n = 0;
20047 { // lambda_param_no_default
20048 if (p->error_indicator) {
20049 D(p->level--);
20050 return NULL;
20051 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020052 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 +010020053 arg_ty lambda_param_no_default_var;
20054 while (
20055 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20056 )
20057 {
20058 _res = lambda_param_no_default_var;
20059 if (_n == _children_capacity) {
20060 _children_capacity *= 2;
20061 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20062 if (!_new_children) {
20063 p->error_indicator = 1;
20064 PyErr_NoMemory();
20065 D(p->level--);
20066 return NULL;
20067 }
20068 _children = _new_children;
20069 }
20070 _children[_n++] = _res;
20071 _mark = p->mark;
20072 }
20073 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020074 D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020075 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020076 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020077 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020078 if (!_seq) {
20079 PyMem_Free(_children);
20080 p->error_indicator = 1;
20081 PyErr_NoMemory();
20082 D(p->level--);
20083 return NULL;
20084 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020085 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020086 PyMem_Free(_children);
20087 _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq);
20088 D(p->level--);
20089 return _seq;
20090}
20091
20092// _loop0_77: lambda_param_with_default
20093static asdl_seq *
20094_loop0_77_rule(Parser *p)
20095{
20096 D(p->level++);
20097 if (p->error_indicator) {
20098 D(p->level--);
20099 return NULL;
20100 }
20101 void *_res = NULL;
20102 int _mark = p->mark;
20103 int _start_mark = p->mark;
20104 void **_children = PyMem_Malloc(sizeof(void *));
20105 if (!_children) {
20106 p->error_indicator = 1;
20107 PyErr_NoMemory();
20108 D(p->level--);
20109 return NULL;
20110 }
20111 ssize_t _children_capacity = 1;
20112 ssize_t _n = 0;
20113 { // lambda_param_with_default
20114 if (p->error_indicator) {
20115 D(p->level--);
20116 return NULL;
20117 }
20118 D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20119 NameDefaultPair* lambda_param_with_default_var;
20120 while (
20121 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20122 )
20123 {
20124 _res = lambda_param_with_default_var;
20125 if (_n == _children_capacity) {
20126 _children_capacity *= 2;
20127 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20128 if (!_new_children) {
20129 p->error_indicator = 1;
20130 PyErr_NoMemory();
20131 D(p->level--);
20132 return NULL;
20133 }
20134 _children = _new_children;
20135 }
20136 _children[_n++] = _res;
20137 _mark = p->mark;
20138 }
20139 p->mark = _mark;
20140 D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ',
20141 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20142 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020143 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020144 if (!_seq) {
20145 PyMem_Free(_children);
20146 p->error_indicator = 1;
20147 PyErr_NoMemory();
20148 D(p->level--);
20149 return NULL;
20150 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020151 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020152 PyMem_Free(_children);
20153 _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq);
20154 D(p->level--);
20155 return _seq;
20156}
20157
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020158// _loop0_78: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020159static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020160_loop0_78_rule(Parser *p)
20161{
20162 D(p->level++);
20163 if (p->error_indicator) {
20164 D(p->level--);
20165 return NULL;
20166 }
20167 void *_res = NULL;
20168 int _mark = p->mark;
20169 int _start_mark = p->mark;
20170 void **_children = PyMem_Malloc(sizeof(void *));
20171 if (!_children) {
20172 p->error_indicator = 1;
20173 PyErr_NoMemory();
20174 D(p->level--);
20175 return NULL;
20176 }
20177 ssize_t _children_capacity = 1;
20178 ssize_t _n = 0;
20179 { // lambda_param_with_default
20180 if (p->error_indicator) {
20181 D(p->level--);
20182 return NULL;
20183 }
20184 D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20185 NameDefaultPair* lambda_param_with_default_var;
20186 while (
20187 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20188 )
20189 {
20190 _res = lambda_param_with_default_var;
20191 if (_n == _children_capacity) {
20192 _children_capacity *= 2;
20193 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20194 if (!_new_children) {
20195 p->error_indicator = 1;
20196 PyErr_NoMemory();
20197 D(p->level--);
20198 return NULL;
20199 }
20200 _children = _new_children;
20201 }
20202 _children[_n++] = _res;
20203 _mark = p->mark;
20204 }
20205 p->mark = _mark;
20206 D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
20207 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20208 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020209 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020210 if (!_seq) {
20211 PyMem_Free(_children);
20212 p->error_indicator = 1;
20213 PyErr_NoMemory();
20214 D(p->level--);
20215 return NULL;
20216 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020217 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020218 PyMem_Free(_children);
20219 _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq);
20220 D(p->level--);
20221 return _seq;
20222}
20223
20224// _loop1_79: lambda_param_no_default
20225static asdl_seq *
20226_loop1_79_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020227{
20228 D(p->level++);
20229 if (p->error_indicator) {
20230 D(p->level--);
20231 return NULL;
20232 }
20233 void *_res = NULL;
20234 int _mark = p->mark;
20235 int _start_mark = p->mark;
20236 void **_children = PyMem_Malloc(sizeof(void *));
20237 if (!_children) {
20238 p->error_indicator = 1;
20239 PyErr_NoMemory();
20240 D(p->level--);
20241 return NULL;
20242 }
20243 ssize_t _children_capacity = 1;
20244 ssize_t _n = 0;
20245 { // lambda_param_no_default
20246 if (p->error_indicator) {
20247 D(p->level--);
20248 return NULL;
20249 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020250 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 +010020251 arg_ty lambda_param_no_default_var;
20252 while (
20253 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20254 )
20255 {
20256 _res = lambda_param_no_default_var;
20257 if (_n == _children_capacity) {
20258 _children_capacity *= 2;
20259 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20260 if (!_new_children) {
20261 p->error_indicator = 1;
20262 PyErr_NoMemory();
20263 D(p->level--);
20264 return NULL;
20265 }
20266 _children = _new_children;
20267 }
20268 _children[_n++] = _res;
20269 _mark = p->mark;
20270 }
20271 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020272 D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020273 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20274 }
20275 if (_n == 0 || p->error_indicator) {
20276 PyMem_Free(_children);
20277 D(p->level--);
20278 return NULL;
20279 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020280 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020281 if (!_seq) {
20282 PyMem_Free(_children);
20283 p->error_indicator = 1;
20284 PyErr_NoMemory();
20285 D(p->level--);
20286 return NULL;
20287 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020288 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020289 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020290 _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020291 D(p->level--);
20292 return _seq;
20293}
20294
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020295// _loop0_80: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020296static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020297_loop0_80_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020298{
20299 D(p->level++);
20300 if (p->error_indicator) {
20301 D(p->level--);
20302 return NULL;
20303 }
20304 void *_res = NULL;
20305 int _mark = p->mark;
20306 int _start_mark = p->mark;
20307 void **_children = PyMem_Malloc(sizeof(void *));
20308 if (!_children) {
20309 p->error_indicator = 1;
20310 PyErr_NoMemory();
20311 D(p->level--);
20312 return NULL;
20313 }
20314 ssize_t _children_capacity = 1;
20315 ssize_t _n = 0;
20316 { // lambda_param_with_default
20317 if (p->error_indicator) {
20318 D(p->level--);
20319 return NULL;
20320 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020321 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 +010020322 NameDefaultPair* lambda_param_with_default_var;
20323 while (
20324 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20325 )
20326 {
20327 _res = lambda_param_with_default_var;
20328 if (_n == _children_capacity) {
20329 _children_capacity *= 2;
20330 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20331 if (!_new_children) {
20332 p->error_indicator = 1;
20333 PyErr_NoMemory();
20334 D(p->level--);
20335 return NULL;
20336 }
20337 _children = _new_children;
20338 }
20339 _children[_n++] = _res;
20340 _mark = p->mark;
20341 }
20342 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020343 D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020344 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20345 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020346 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020347 if (!_seq) {
20348 PyMem_Free(_children);
20349 p->error_indicator = 1;
20350 PyErr_NoMemory();
20351 D(p->level--);
20352 return NULL;
20353 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020354 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020355 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020356 _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020357 D(p->level--);
20358 return _seq;
20359}
20360
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020361// _loop1_81: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020362static asdl_seq *
20363_loop1_81_rule(Parser *p)
20364{
20365 D(p->level++);
20366 if (p->error_indicator) {
20367 D(p->level--);
20368 return NULL;
20369 }
20370 void *_res = NULL;
20371 int _mark = p->mark;
20372 int _start_mark = p->mark;
20373 void **_children = PyMem_Malloc(sizeof(void *));
20374 if (!_children) {
20375 p->error_indicator = 1;
20376 PyErr_NoMemory();
20377 D(p->level--);
20378 return NULL;
20379 }
20380 ssize_t _children_capacity = 1;
20381 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020382 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020383 if (p->error_indicator) {
20384 D(p->level--);
20385 return NULL;
20386 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020387 D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20388 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020389 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020390 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020391 )
20392 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020393 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020394 if (_n == _children_capacity) {
20395 _children_capacity *= 2;
20396 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20397 if (!_new_children) {
20398 p->error_indicator = 1;
20399 PyErr_NoMemory();
20400 D(p->level--);
20401 return NULL;
20402 }
20403 _children = _new_children;
20404 }
20405 _children[_n++] = _res;
20406 _mark = p->mark;
20407 }
20408 p->mark = _mark;
20409 D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020410 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020411 }
20412 if (_n == 0 || p->error_indicator) {
20413 PyMem_Free(_children);
20414 D(p->level--);
20415 return NULL;
20416 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020417 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020418 if (!_seq) {
20419 PyMem_Free(_children);
20420 p->error_indicator = 1;
20421 PyErr_NoMemory();
20422 D(p->level--);
20423 return NULL;
20424 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020425 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020426 PyMem_Free(_children);
20427 _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
20428 D(p->level--);
20429 return _seq;
20430}
20431
20432// _loop1_82: lambda_param_no_default
20433static asdl_seq *
20434_loop1_82_rule(Parser *p)
20435{
20436 D(p->level++);
20437 if (p->error_indicator) {
20438 D(p->level--);
20439 return NULL;
20440 }
20441 void *_res = NULL;
20442 int _mark = p->mark;
20443 int _start_mark = p->mark;
20444 void **_children = PyMem_Malloc(sizeof(void *));
20445 if (!_children) {
20446 p->error_indicator = 1;
20447 PyErr_NoMemory();
20448 D(p->level--);
20449 return NULL;
20450 }
20451 ssize_t _children_capacity = 1;
20452 ssize_t _n = 0;
20453 { // lambda_param_no_default
20454 if (p->error_indicator) {
20455 D(p->level--);
20456 return NULL;
20457 }
20458 D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20459 arg_ty lambda_param_no_default_var;
20460 while (
20461 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20462 )
20463 {
20464 _res = lambda_param_no_default_var;
20465 if (_n == _children_capacity) {
20466 _children_capacity *= 2;
20467 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20468 if (!_new_children) {
20469 p->error_indicator = 1;
20470 PyErr_NoMemory();
20471 D(p->level--);
20472 return NULL;
20473 }
20474 _children = _new_children;
20475 }
20476 _children[_n++] = _res;
20477 _mark = p->mark;
20478 }
20479 p->mark = _mark;
20480 D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ',
20481 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20482 }
20483 if (_n == 0 || p->error_indicator) {
20484 PyMem_Free(_children);
20485 D(p->level--);
20486 return NULL;
20487 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020488 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020489 if (!_seq) {
20490 PyMem_Free(_children);
20491 p->error_indicator = 1;
20492 PyErr_NoMemory();
20493 D(p->level--);
20494 return NULL;
20495 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020496 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020497 PyMem_Free(_children);
20498 _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq);
20499 D(p->level--);
20500 return _seq;
20501}
20502
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020503// _loop1_83: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020504static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020505_loop1_83_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020506{
20507 D(p->level++);
20508 if (p->error_indicator) {
20509 D(p->level--);
20510 return NULL;
20511 }
20512 void *_res = NULL;
20513 int _mark = p->mark;
20514 int _start_mark = p->mark;
20515 void **_children = PyMem_Malloc(sizeof(void *));
20516 if (!_children) {
20517 p->error_indicator = 1;
20518 PyErr_NoMemory();
20519 D(p->level--);
20520 return NULL;
20521 }
20522 ssize_t _children_capacity = 1;
20523 ssize_t _n = 0;
20524 { // lambda_param_no_default
20525 if (p->error_indicator) {
20526 D(p->level--);
20527 return NULL;
20528 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020529 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 +010020530 arg_ty lambda_param_no_default_var;
20531 while (
20532 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20533 )
20534 {
20535 _res = lambda_param_no_default_var;
20536 if (_n == _children_capacity) {
20537 _children_capacity *= 2;
20538 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20539 if (!_new_children) {
20540 p->error_indicator = 1;
20541 PyErr_NoMemory();
20542 D(p->level--);
20543 return NULL;
20544 }
20545 _children = _new_children;
20546 }
20547 _children[_n++] = _res;
20548 _mark = p->mark;
20549 }
20550 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020551 D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020552 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20553 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020554 if (_n == 0 || p->error_indicator) {
20555 PyMem_Free(_children);
20556 D(p->level--);
20557 return NULL;
20558 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020559 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020560 if (!_seq) {
20561 PyMem_Free(_children);
20562 p->error_indicator = 1;
20563 PyErr_NoMemory();
20564 D(p->level--);
20565 return NULL;
20566 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020567 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020568 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020569 _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020570 D(p->level--);
20571 return _seq;
20572}
20573
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020574// _loop0_84: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020575static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020576_loop0_84_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020577{
20578 D(p->level++);
20579 if (p->error_indicator) {
20580 D(p->level--);
20581 return NULL;
20582 }
20583 void *_res = NULL;
20584 int _mark = p->mark;
20585 int _start_mark = p->mark;
20586 void **_children = PyMem_Malloc(sizeof(void *));
20587 if (!_children) {
20588 p->error_indicator = 1;
20589 PyErr_NoMemory();
20590 D(p->level--);
20591 return NULL;
20592 }
20593 ssize_t _children_capacity = 1;
20594 ssize_t _n = 0;
20595 { // lambda_param_no_default
20596 if (p->error_indicator) {
20597 D(p->level--);
20598 return NULL;
20599 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020600 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 +010020601 arg_ty lambda_param_no_default_var;
20602 while (
20603 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20604 )
20605 {
20606 _res = lambda_param_no_default_var;
20607 if (_n == _children_capacity) {
20608 _children_capacity *= 2;
20609 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20610 if (!_new_children) {
20611 p->error_indicator = 1;
20612 PyErr_NoMemory();
20613 D(p->level--);
20614 return NULL;
20615 }
20616 _children = _new_children;
20617 }
20618 _children[_n++] = _res;
20619 _mark = p->mark;
20620 }
20621 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020622 D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020623 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20624 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020625 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020626 if (!_seq) {
20627 PyMem_Free(_children);
20628 p->error_indicator = 1;
20629 PyErr_NoMemory();
20630 D(p->level--);
20631 return NULL;
20632 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020633 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020634 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020635 _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020636 D(p->level--);
20637 return _seq;
20638}
20639
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020640// _loop1_85: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020641static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020642_loop1_85_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020643{
20644 D(p->level++);
20645 if (p->error_indicator) {
20646 D(p->level--);
20647 return NULL;
20648 }
20649 void *_res = NULL;
20650 int _mark = p->mark;
20651 int _start_mark = p->mark;
20652 void **_children = PyMem_Malloc(sizeof(void *));
20653 if (!_children) {
20654 p->error_indicator = 1;
20655 PyErr_NoMemory();
20656 D(p->level--);
20657 return NULL;
20658 }
20659 ssize_t _children_capacity = 1;
20660 ssize_t _n = 0;
20661 { // lambda_param_with_default
20662 if (p->error_indicator) {
20663 D(p->level--);
20664 return NULL;
20665 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020666 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 +010020667 NameDefaultPair* lambda_param_with_default_var;
20668 while (
20669 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20670 )
20671 {
20672 _res = lambda_param_with_default_var;
20673 if (_n == _children_capacity) {
20674 _children_capacity *= 2;
20675 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20676 if (!_new_children) {
20677 p->error_indicator = 1;
20678 PyErr_NoMemory();
20679 D(p->level--);
20680 return NULL;
20681 }
20682 _children = _new_children;
20683 }
20684 _children[_n++] = _res;
20685 _mark = p->mark;
20686 }
20687 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020688 D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020689 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20690 }
20691 if (_n == 0 || p->error_indicator) {
20692 PyMem_Free(_children);
20693 D(p->level--);
20694 return NULL;
20695 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020696 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020697 if (!_seq) {
20698 PyMem_Free(_children);
20699 p->error_indicator = 1;
20700 PyErr_NoMemory();
20701 D(p->level--);
20702 return NULL;
20703 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020704 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020705 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020706 _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020707 D(p->level--);
20708 return _seq;
20709}
20710
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020711// _loop0_86: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020712static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020713_loop0_86_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020714{
20715 D(p->level++);
20716 if (p->error_indicator) {
20717 D(p->level--);
20718 return NULL;
20719 }
20720 void *_res = NULL;
20721 int _mark = p->mark;
20722 int _start_mark = p->mark;
20723 void **_children = PyMem_Malloc(sizeof(void *));
20724 if (!_children) {
20725 p->error_indicator = 1;
20726 PyErr_NoMemory();
20727 D(p->level--);
20728 return NULL;
20729 }
20730 ssize_t _children_capacity = 1;
20731 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020732 { // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020733 if (p->error_indicator) {
20734 D(p->level--);
20735 return NULL;
20736 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020737 D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20738 arg_ty lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020739 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020740 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020741 )
20742 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020743 _res = lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020744 if (_n == _children_capacity) {
20745 _children_capacity *= 2;
20746 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20747 if (!_new_children) {
20748 p->error_indicator = 1;
20749 PyErr_NoMemory();
20750 D(p->level--);
20751 return NULL;
20752 }
20753 _children = _new_children;
20754 }
20755 _children[_n++] = _res;
20756 _mark = p->mark;
20757 }
20758 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020759 D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ',
20760 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020761 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020762 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020763 if (!_seq) {
20764 PyMem_Free(_children);
20765 p->error_indicator = 1;
20766 PyErr_NoMemory();
20767 D(p->level--);
20768 return NULL;
20769 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020770 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020771 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020772 _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020773 D(p->level--);
20774 return _seq;
20775}
20776
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020777// _loop1_87: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020778static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020779_loop1_87_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020780{
20781 D(p->level++);
20782 if (p->error_indicator) {
20783 D(p->level--);
20784 return NULL;
20785 }
20786 void *_res = NULL;
20787 int _mark = p->mark;
20788 int _start_mark = p->mark;
20789 void **_children = PyMem_Malloc(sizeof(void *));
20790 if (!_children) {
20791 p->error_indicator = 1;
20792 PyErr_NoMemory();
20793 D(p->level--);
20794 return NULL;
20795 }
20796 ssize_t _children_capacity = 1;
20797 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020798 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020799 if (p->error_indicator) {
20800 D(p->level--);
20801 return NULL;
20802 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020803 D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20804 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020805 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020806 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020807 )
20808 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020809 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020810 if (_n == _children_capacity) {
20811 _children_capacity *= 2;
20812 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20813 if (!_new_children) {
20814 p->error_indicator = 1;
20815 PyErr_NoMemory();
20816 D(p->level--);
20817 return NULL;
20818 }
20819 _children = _new_children;
20820 }
20821 _children[_n++] = _res;
20822 _mark = p->mark;
20823 }
20824 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020825 D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ',
20826 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020827 }
20828 if (_n == 0 || p->error_indicator) {
20829 PyMem_Free(_children);
20830 D(p->level--);
20831 return NULL;
20832 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020833 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020834 if (!_seq) {
20835 PyMem_Free(_children);
20836 p->error_indicator = 1;
20837 PyErr_NoMemory();
20838 D(p->level--);
20839 return NULL;
20840 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020841 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020842 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020843 _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020844 D(p->level--);
20845 return _seq;
20846}
20847
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020848// _loop0_88: lambda_param_maybe_default
20849static asdl_seq *
20850_loop0_88_rule(Parser *p)
20851{
20852 D(p->level++);
20853 if (p->error_indicator) {
20854 D(p->level--);
20855 return NULL;
20856 }
20857 void *_res = NULL;
20858 int _mark = p->mark;
20859 int _start_mark = p->mark;
20860 void **_children = PyMem_Malloc(sizeof(void *));
20861 if (!_children) {
20862 p->error_indicator = 1;
20863 PyErr_NoMemory();
20864 D(p->level--);
20865 return NULL;
20866 }
20867 ssize_t _children_capacity = 1;
20868 ssize_t _n = 0;
20869 { // lambda_param_maybe_default
20870 if (p->error_indicator) {
20871 D(p->level--);
20872 return NULL;
20873 }
20874 D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20875 NameDefaultPair* lambda_param_maybe_default_var;
20876 while (
20877 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20878 )
20879 {
20880 _res = lambda_param_maybe_default_var;
20881 if (_n == _children_capacity) {
20882 _children_capacity *= 2;
20883 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20884 if (!_new_children) {
20885 p->error_indicator = 1;
20886 PyErr_NoMemory();
20887 D(p->level--);
20888 return NULL;
20889 }
20890 _children = _new_children;
20891 }
20892 _children[_n++] = _res;
20893 _mark = p->mark;
20894 }
20895 p->mark = _mark;
20896 D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ',
20897 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20898 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020899 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020900 if (!_seq) {
20901 PyMem_Free(_children);
20902 p->error_indicator = 1;
20903 PyErr_NoMemory();
20904 D(p->level--);
20905 return NULL;
20906 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020907 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020908 PyMem_Free(_children);
20909 _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq);
20910 D(p->level--);
20911 return _seq;
20912}
20913
20914// _loop1_89: lambda_param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020915static asdl_seq *
20916_loop1_89_rule(Parser *p)
20917{
20918 D(p->level++);
20919 if (p->error_indicator) {
20920 D(p->level--);
20921 return NULL;
20922 }
20923 void *_res = NULL;
20924 int _mark = p->mark;
20925 int _start_mark = p->mark;
20926 void **_children = PyMem_Malloc(sizeof(void *));
20927 if (!_children) {
20928 p->error_indicator = 1;
20929 PyErr_NoMemory();
20930 D(p->level--);
20931 return NULL;
20932 }
20933 ssize_t _children_capacity = 1;
20934 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020935 { // lambda_param_maybe_default
20936 if (p->error_indicator) {
20937 D(p->level--);
20938 return NULL;
20939 }
20940 D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20941 NameDefaultPair* lambda_param_maybe_default_var;
20942 while (
20943 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20944 )
20945 {
20946 _res = lambda_param_maybe_default_var;
20947 if (_n == _children_capacity) {
20948 _children_capacity *= 2;
20949 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20950 if (!_new_children) {
20951 p->error_indicator = 1;
20952 PyErr_NoMemory();
20953 D(p->level--);
20954 return NULL;
20955 }
20956 _children = _new_children;
20957 }
20958 _children[_n++] = _res;
20959 _mark = p->mark;
20960 }
20961 p->mark = _mark;
20962 D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ',
20963 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20964 }
20965 if (_n == 0 || p->error_indicator) {
20966 PyMem_Free(_children);
20967 D(p->level--);
20968 return NULL;
20969 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020970 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020971 if (!_seq) {
20972 PyMem_Free(_children);
20973 p->error_indicator = 1;
20974 PyErr_NoMemory();
20975 D(p->level--);
20976 return NULL;
20977 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020978 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020979 PyMem_Free(_children);
20980 _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq);
20981 D(p->level--);
20982 return _seq;
20983}
20984
20985// _loop1_90: ('or' conjunction)
20986static asdl_seq *
20987_loop1_90_rule(Parser *p)
20988{
20989 D(p->level++);
20990 if (p->error_indicator) {
20991 D(p->level--);
20992 return NULL;
20993 }
20994 void *_res = NULL;
20995 int _mark = p->mark;
20996 int _start_mark = p->mark;
20997 void **_children = PyMem_Malloc(sizeof(void *));
20998 if (!_children) {
20999 p->error_indicator = 1;
21000 PyErr_NoMemory();
21001 D(p->level--);
21002 return NULL;
21003 }
21004 ssize_t _children_capacity = 1;
21005 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021006 { // ('or' conjunction)
21007 if (p->error_indicator) {
21008 D(p->level--);
21009 return NULL;
21010 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021011 D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010021012 void *_tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021013 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010021014 (_tmp_145_var = _tmp_145_rule(p)) // 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021015 )
21016 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021017 _res = _tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021018 if (_n == _children_capacity) {
21019 _children_capacity *= 2;
21020 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21021 if (!_new_children) {
21022 p->error_indicator = 1;
21023 PyErr_NoMemory();
21024 D(p->level--);
21025 return NULL;
21026 }
21027 _children = _new_children;
21028 }
21029 _children[_n++] = _res;
21030 _mark = p->mark;
21031 }
21032 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021033 D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021034 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
21035 }
21036 if (_n == 0 || p->error_indicator) {
21037 PyMem_Free(_children);
21038 D(p->level--);
21039 return NULL;
21040 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021041 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021042 if (!_seq) {
21043 PyMem_Free(_children);
21044 p->error_indicator = 1;
21045 PyErr_NoMemory();
21046 D(p->level--);
21047 return NULL;
21048 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021049 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021050 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021051 _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021052 D(p->level--);
21053 return _seq;
21054}
21055
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021056// _loop1_91: ('and' inversion)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021057static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021058_loop1_91_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021059{
21060 D(p->level++);
21061 if (p->error_indicator) {
21062 D(p->level--);
21063 return NULL;
21064 }
21065 void *_res = NULL;
21066 int _mark = p->mark;
21067 int _start_mark = p->mark;
21068 void **_children = PyMem_Malloc(sizeof(void *));
21069 if (!_children) {
21070 p->error_indicator = 1;
21071 PyErr_NoMemory();
21072 D(p->level--);
21073 return NULL;
21074 }
21075 ssize_t _children_capacity = 1;
21076 ssize_t _n = 0;
21077 { // ('and' inversion)
21078 if (p->error_indicator) {
21079 D(p->level--);
21080 return NULL;
21081 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021082 D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010021083 void *_tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021084 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010021085 (_tmp_146_var = _tmp_146_rule(p)) // 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021086 )
21087 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021088 _res = _tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021089 if (_n == _children_capacity) {
21090 _children_capacity *= 2;
21091 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21092 if (!_new_children) {
21093 p->error_indicator = 1;
21094 PyErr_NoMemory();
21095 D(p->level--);
21096 return NULL;
21097 }
21098 _children = _new_children;
21099 }
21100 _children[_n++] = _res;
21101 _mark = p->mark;
21102 }
21103 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021104 D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021105 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
21106 }
21107 if (_n == 0 || p->error_indicator) {
21108 PyMem_Free(_children);
21109 D(p->level--);
21110 return NULL;
21111 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021112 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021113 if (!_seq) {
21114 PyMem_Free(_children);
21115 p->error_indicator = 1;
21116 PyErr_NoMemory();
21117 D(p->level--);
21118 return NULL;
21119 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021120 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021121 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021122 _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021123 D(p->level--);
21124 return _seq;
21125}
21126
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021127// _loop1_92: compare_op_bitwise_or_pair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021128static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021129_loop1_92_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021130{
21131 D(p->level++);
21132 if (p->error_indicator) {
21133 D(p->level--);
21134 return NULL;
21135 }
21136 void *_res = NULL;
21137 int _mark = p->mark;
21138 int _start_mark = p->mark;
21139 void **_children = PyMem_Malloc(sizeof(void *));
21140 if (!_children) {
21141 p->error_indicator = 1;
21142 PyErr_NoMemory();
21143 D(p->level--);
21144 return NULL;
21145 }
21146 ssize_t _children_capacity = 1;
21147 ssize_t _n = 0;
21148 { // compare_op_bitwise_or_pair
21149 if (p->error_indicator) {
21150 D(p->level--);
21151 return NULL;
21152 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021153 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 +010021154 CmpopExprPair* compare_op_bitwise_or_pair_var;
21155 while (
21156 (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair
21157 )
21158 {
21159 _res = compare_op_bitwise_or_pair_var;
21160 if (_n == _children_capacity) {
21161 _children_capacity *= 2;
21162 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21163 if (!_new_children) {
21164 p->error_indicator = 1;
21165 PyErr_NoMemory();
21166 D(p->level--);
21167 return NULL;
21168 }
21169 _children = _new_children;
21170 }
21171 _children[_n++] = _res;
21172 _mark = p->mark;
21173 }
21174 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021175 D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021176 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
21177 }
21178 if (_n == 0 || p->error_indicator) {
21179 PyMem_Free(_children);
21180 D(p->level--);
21181 return NULL;
21182 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021183 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021184 if (!_seq) {
21185 PyMem_Free(_children);
21186 p->error_indicator = 1;
21187 PyErr_NoMemory();
21188 D(p->level--);
21189 return NULL;
21190 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021191 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021192 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021193 _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021194 D(p->level--);
21195 return _seq;
21196}
21197
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021198// _tmp_93: '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021199static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021200_tmp_93_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021201{
21202 D(p->level++);
21203 if (p->error_indicator) {
21204 D(p->level--);
21205 return NULL;
21206 }
21207 void * _res = NULL;
21208 int _mark = p->mark;
21209 { // '!='
21210 if (p->error_indicator) {
21211 D(p->level--);
21212 return NULL;
21213 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021214 D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021215 Token * tok;
21216 if (
21217 (tok = _PyPegen_expect_token(p, 28)) // token='!='
21218 )
21219 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021220 D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021221 _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok;
21222 if (_res == NULL && PyErr_Occurred()) {
21223 p->error_indicator = 1;
21224 D(p->level--);
21225 return NULL;
21226 }
21227 goto done;
21228 }
21229 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021230 D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021231 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
21232 }
21233 _res = NULL;
21234 done:
21235 D(p->level--);
21236 return _res;
21237}
21238
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021239// _loop0_95: ',' slice
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021240static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021241_loop0_95_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021242{
21243 D(p->level++);
21244 if (p->error_indicator) {
21245 D(p->level--);
21246 return NULL;
21247 }
21248 void *_res = NULL;
21249 int _mark = p->mark;
21250 int _start_mark = p->mark;
21251 void **_children = PyMem_Malloc(sizeof(void *));
21252 if (!_children) {
21253 p->error_indicator = 1;
21254 PyErr_NoMemory();
21255 D(p->level--);
21256 return NULL;
21257 }
21258 ssize_t _children_capacity = 1;
21259 ssize_t _n = 0;
21260 { // ',' slice
21261 if (p->error_indicator) {
21262 D(p->level--);
21263 return NULL;
21264 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021265 D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021266 Token * _literal;
21267 expr_ty elem;
21268 while (
21269 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21270 &&
21271 (elem = slice_rule(p)) // slice
21272 )
21273 {
21274 _res = elem;
21275 if (_res == NULL && PyErr_Occurred()) {
21276 p->error_indicator = 1;
21277 PyMem_Free(_children);
21278 D(p->level--);
21279 return NULL;
21280 }
21281 if (_n == _children_capacity) {
21282 _children_capacity *= 2;
21283 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21284 if (!_new_children) {
21285 p->error_indicator = 1;
21286 PyErr_NoMemory();
21287 D(p->level--);
21288 return NULL;
21289 }
21290 _children = _new_children;
21291 }
21292 _children[_n++] = _res;
21293 _mark = p->mark;
21294 }
21295 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021296 D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021297 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
21298 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021299 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021300 if (!_seq) {
21301 PyMem_Free(_children);
21302 p->error_indicator = 1;
21303 PyErr_NoMemory();
21304 D(p->level--);
21305 return NULL;
21306 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021307 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021308 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021309 _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021310 D(p->level--);
21311 return _seq;
21312}
21313
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021314// _gather_94: slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021315static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021316_gather_94_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021317{
21318 D(p->level++);
21319 if (p->error_indicator) {
21320 D(p->level--);
21321 return NULL;
21322 }
21323 asdl_seq * _res = NULL;
21324 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021325 { // slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021326 if (p->error_indicator) {
21327 D(p->level--);
21328 return NULL;
21329 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021330 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 +010021331 expr_ty elem;
21332 asdl_seq * seq;
21333 if (
21334 (elem = slice_rule(p)) // slice
21335 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021336 (seq = _loop0_95_rule(p)) // _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021337 )
21338 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021339 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 +010021340 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21341 goto done;
21342 }
21343 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021344 D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ',
21345 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_95"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021346 }
21347 _res = NULL;
21348 done:
21349 D(p->level--);
21350 return _res;
21351}
21352
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021353// _tmp_96: ':' expression?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021354static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021355_tmp_96_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021356{
21357 D(p->level++);
21358 if (p->error_indicator) {
21359 D(p->level--);
21360 return NULL;
21361 }
21362 void * _res = NULL;
21363 int _mark = p->mark;
21364 { // ':' expression?
21365 if (p->error_indicator) {
21366 D(p->level--);
21367 return NULL;
21368 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021369 D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021370 Token * _literal;
21371 void *d;
21372 if (
21373 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
21374 &&
21375 (d = expression_rule(p), 1) // expression?
21376 )
21377 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021378 D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021379 _res = d;
21380 if (_res == NULL && PyErr_Occurred()) {
21381 p->error_indicator = 1;
21382 D(p->level--);
21383 return NULL;
21384 }
21385 goto done;
21386 }
21387 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021388 D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021389 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
21390 }
21391 _res = NULL;
21392 done:
21393 D(p->level--);
21394 return _res;
21395}
21396
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021397// _tmp_97: tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021398static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021399_tmp_97_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021400{
21401 D(p->level++);
21402 if (p->error_indicator) {
21403 D(p->level--);
21404 return NULL;
21405 }
21406 void * _res = NULL;
21407 int _mark = p->mark;
21408 { // tuple
21409 if (p->error_indicator) {
21410 D(p->level--);
21411 return NULL;
21412 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021413 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021414 expr_ty tuple_var;
21415 if (
21416 (tuple_var = tuple_rule(p)) // tuple
21417 )
21418 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021419 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021420 _res = tuple_var;
21421 goto done;
21422 }
21423 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021424 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021425 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
21426 }
21427 { // group
21428 if (p->error_indicator) {
21429 D(p->level--);
21430 return NULL;
21431 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021432 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021433 expr_ty group_var;
21434 if (
21435 (group_var = group_rule(p)) // group
21436 )
21437 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021438 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021439 _res = group_var;
21440 goto done;
21441 }
21442 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021443 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021444 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
21445 }
21446 { // genexp
21447 if (p->error_indicator) {
21448 D(p->level--);
21449 return NULL;
21450 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021451 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021452 expr_ty genexp_var;
21453 if (
21454 (genexp_var = genexp_rule(p)) // genexp
21455 )
21456 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021457 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021458 _res = genexp_var;
21459 goto done;
21460 }
21461 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021462 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021463 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
21464 }
21465 _res = NULL;
21466 done:
21467 D(p->level--);
21468 return _res;
21469}
21470
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021471// _tmp_98: list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021472static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021473_tmp_98_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021474{
21475 D(p->level++);
21476 if (p->error_indicator) {
21477 D(p->level--);
21478 return NULL;
21479 }
21480 void * _res = NULL;
21481 int _mark = p->mark;
21482 { // list
21483 if (p->error_indicator) {
21484 D(p->level--);
21485 return NULL;
21486 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021487 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021488 expr_ty list_var;
21489 if (
21490 (list_var = list_rule(p)) // list
21491 )
21492 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021493 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021494 _res = list_var;
21495 goto done;
21496 }
21497 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021498 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021499 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
21500 }
21501 { // listcomp
21502 if (p->error_indicator) {
21503 D(p->level--);
21504 return NULL;
21505 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021506 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021507 expr_ty listcomp_var;
21508 if (
21509 (listcomp_var = listcomp_rule(p)) // listcomp
21510 )
21511 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021512 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021513 _res = listcomp_var;
21514 goto done;
21515 }
21516 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021517 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021518 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
21519 }
21520 _res = NULL;
21521 done:
21522 D(p->level--);
21523 return _res;
21524}
21525
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021526// _tmp_99: dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021527static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021528_tmp_99_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021529{
21530 D(p->level++);
21531 if (p->error_indicator) {
21532 D(p->level--);
21533 return NULL;
21534 }
21535 void * _res = NULL;
21536 int _mark = p->mark;
21537 { // dict
21538 if (p->error_indicator) {
21539 D(p->level--);
21540 return NULL;
21541 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021542 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021543 expr_ty dict_var;
21544 if (
21545 (dict_var = dict_rule(p)) // dict
21546 )
21547 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021548 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021549 _res = dict_var;
21550 goto done;
21551 }
21552 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021553 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021554 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
21555 }
21556 { // set
21557 if (p->error_indicator) {
21558 D(p->level--);
21559 return NULL;
21560 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021561 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021562 expr_ty set_var;
21563 if (
21564 (set_var = set_rule(p)) // set
21565 )
21566 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021567 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021568 _res = set_var;
21569 goto done;
21570 }
21571 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021572 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021573 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
21574 }
21575 { // dictcomp
21576 if (p->error_indicator) {
21577 D(p->level--);
21578 return NULL;
21579 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021580 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021581 expr_ty dictcomp_var;
21582 if (
21583 (dictcomp_var = dictcomp_rule(p)) // dictcomp
21584 )
21585 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021586 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021587 _res = dictcomp_var;
21588 goto done;
21589 }
21590 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021591 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021592 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
21593 }
21594 { // setcomp
21595 if (p->error_indicator) {
21596 D(p->level--);
21597 return NULL;
21598 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021599 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021600 expr_ty setcomp_var;
21601 if (
21602 (setcomp_var = setcomp_rule(p)) // setcomp
21603 )
21604 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021605 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021606 _res = setcomp_var;
21607 goto done;
21608 }
21609 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021610 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021611 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
21612 }
21613 _res = NULL;
21614 done:
21615 D(p->level--);
21616 return _res;
21617}
21618
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021619// _loop1_100: STRING
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021620static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021621_loop1_100_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021622{
21623 D(p->level++);
21624 if (p->error_indicator) {
21625 D(p->level--);
21626 return NULL;
21627 }
21628 void *_res = NULL;
21629 int _mark = p->mark;
21630 int _start_mark = p->mark;
21631 void **_children = PyMem_Malloc(sizeof(void *));
21632 if (!_children) {
21633 p->error_indicator = 1;
21634 PyErr_NoMemory();
21635 D(p->level--);
21636 return NULL;
21637 }
21638 ssize_t _children_capacity = 1;
21639 ssize_t _n = 0;
21640 { // STRING
21641 if (p->error_indicator) {
21642 D(p->level--);
21643 return NULL;
21644 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021645 D(fprintf(stderr, "%*c> _loop1_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021646 expr_ty string_var;
21647 while (
21648 (string_var = _PyPegen_string_token(p)) // STRING
21649 )
21650 {
21651 _res = string_var;
21652 if (_n == _children_capacity) {
21653 _children_capacity *= 2;
21654 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21655 if (!_new_children) {
21656 p->error_indicator = 1;
21657 PyErr_NoMemory();
21658 D(p->level--);
21659 return NULL;
21660 }
21661 _children = _new_children;
21662 }
21663 _children[_n++] = _res;
21664 _mark = p->mark;
21665 }
21666 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021667 D(fprintf(stderr, "%*c%s _loop1_100[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021668 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
21669 }
21670 if (_n == 0 || p->error_indicator) {
21671 PyMem_Free(_children);
21672 D(p->level--);
21673 return NULL;
21674 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021675 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021676 if (!_seq) {
21677 PyMem_Free(_children);
21678 p->error_indicator = 1;
21679 PyErr_NoMemory();
21680 D(p->level--);
21681 return NULL;
21682 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021683 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021684 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021685 _PyPegen_insert_memo(p, _start_mark, _loop1_100_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021686 D(p->level--);
21687 return _seq;
21688}
21689
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021690// _tmp_101: star_named_expression ',' star_named_expressions?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021691static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021692_tmp_101_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021693{
21694 D(p->level++);
21695 if (p->error_indicator) {
21696 D(p->level--);
21697 return NULL;
21698 }
21699 void * _res = NULL;
21700 int _mark = p->mark;
21701 { // star_named_expression ',' star_named_expressions?
21702 if (p->error_indicator) {
21703 D(p->level--);
21704 return NULL;
21705 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021706 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 +010021707 Token * _literal;
21708 expr_ty y;
21709 void *z;
21710 if (
21711 (y = star_named_expression_rule(p)) // star_named_expression
21712 &&
21713 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21714 &&
21715 (z = star_named_expressions_rule(p), 1) // star_named_expressions?
21716 )
21717 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021718 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 +010021719 _res = _PyPegen_seq_insert_in_front ( p , y , z );
21720 if (_res == NULL && PyErr_Occurred()) {
21721 p->error_indicator = 1;
21722 D(p->level--);
21723 return NULL;
21724 }
21725 goto done;
21726 }
21727 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021728 D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021729 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
21730 }
21731 _res = NULL;
21732 done:
21733 D(p->level--);
21734 return _res;
21735}
21736
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021737// _tmp_102: yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021738static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021739_tmp_102_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021740{
21741 D(p->level++);
21742 if (p->error_indicator) {
21743 D(p->level--);
21744 return NULL;
21745 }
21746 void * _res = NULL;
21747 int _mark = p->mark;
21748 { // yield_expr
21749 if (p->error_indicator) {
21750 D(p->level--);
21751 return NULL;
21752 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021753 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021754 expr_ty yield_expr_var;
21755 if (
21756 (yield_expr_var = yield_expr_rule(p)) // yield_expr
21757 )
21758 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021759 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 +010021760 _res = yield_expr_var;
21761 goto done;
21762 }
21763 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021764 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021765 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
21766 }
21767 { // named_expression
21768 if (p->error_indicator) {
21769 D(p->level--);
21770 return NULL;
21771 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021772 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021773 expr_ty named_expression_var;
21774 if (
21775 (named_expression_var = named_expression_rule(p)) // named_expression
21776 )
21777 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021778 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 +010021779 _res = named_expression_var;
21780 goto done;
21781 }
21782 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021783 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021784 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
21785 }
21786 _res = NULL;
21787 done:
21788 D(p->level--);
21789 return _res;
21790}
21791
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021792// _loop0_104: ',' double_starred_kvpair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021793static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021794_loop0_104_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021795{
21796 D(p->level++);
21797 if (p->error_indicator) {
21798 D(p->level--);
21799 return NULL;
21800 }
21801 void *_res = NULL;
21802 int _mark = p->mark;
21803 int _start_mark = p->mark;
21804 void **_children = PyMem_Malloc(sizeof(void *));
21805 if (!_children) {
21806 p->error_indicator = 1;
21807 PyErr_NoMemory();
21808 D(p->level--);
21809 return NULL;
21810 }
21811 ssize_t _children_capacity = 1;
21812 ssize_t _n = 0;
21813 { // ',' double_starred_kvpair
21814 if (p->error_indicator) {
21815 D(p->level--);
21816 return NULL;
21817 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021818 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 +010021819 Token * _literal;
21820 KeyValuePair* elem;
21821 while (
21822 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21823 &&
21824 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21825 )
21826 {
21827 _res = elem;
21828 if (_res == NULL && PyErr_Occurred()) {
21829 p->error_indicator = 1;
21830 PyMem_Free(_children);
21831 D(p->level--);
21832 return NULL;
21833 }
21834 if (_n == _children_capacity) {
21835 _children_capacity *= 2;
21836 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21837 if (!_new_children) {
21838 p->error_indicator = 1;
21839 PyErr_NoMemory();
21840 D(p->level--);
21841 return NULL;
21842 }
21843 _children = _new_children;
21844 }
21845 _children[_n++] = _res;
21846 _mark = p->mark;
21847 }
21848 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021849 D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021850 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
21851 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021852 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021853 if (!_seq) {
21854 PyMem_Free(_children);
21855 p->error_indicator = 1;
21856 PyErr_NoMemory();
21857 D(p->level--);
21858 return NULL;
21859 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021860 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021861 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021862 _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021863 D(p->level--);
21864 return _seq;
21865}
21866
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021867// _gather_103: double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021868static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021869_gather_103_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021870{
21871 D(p->level++);
21872 if (p->error_indicator) {
21873 D(p->level--);
21874 return NULL;
21875 }
21876 asdl_seq * _res = NULL;
21877 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021878 { // double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021879 if (p->error_indicator) {
21880 D(p->level--);
21881 return NULL;
21882 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021883 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 +010021884 KeyValuePair* elem;
21885 asdl_seq * seq;
21886 if (
21887 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21888 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021889 (seq = _loop0_104_rule(p)) // _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021890 )
21891 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021892 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 +010021893 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21894 goto done;
21895 }
21896 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021897 D(fprintf(stderr, "%*c%s _gather_103[%d-%d]: %s failed!\n", p->level, ' ',
21898 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_104"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021899 }
21900 _res = NULL;
21901 done:
21902 D(p->level--);
21903 return _res;
21904}
21905
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021906// _loop1_105: for_if_clause
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021907static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021908_loop1_105_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021909{
21910 D(p->level++);
21911 if (p->error_indicator) {
21912 D(p->level--);
21913 return NULL;
21914 }
21915 void *_res = NULL;
21916 int _mark = p->mark;
21917 int _start_mark = p->mark;
21918 void **_children = PyMem_Malloc(sizeof(void *));
21919 if (!_children) {
21920 p->error_indicator = 1;
21921 PyErr_NoMemory();
21922 D(p->level--);
21923 return NULL;
21924 }
21925 ssize_t _children_capacity = 1;
21926 ssize_t _n = 0;
21927 { // for_if_clause
21928 if (p->error_indicator) {
21929 D(p->level--);
21930 return NULL;
21931 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021932 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 +010021933 comprehension_ty for_if_clause_var;
21934 while (
21935 (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause
21936 )
21937 {
21938 _res = for_if_clause_var;
21939 if (_n == _children_capacity) {
21940 _children_capacity *= 2;
21941 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21942 if (!_new_children) {
21943 p->error_indicator = 1;
21944 PyErr_NoMemory();
21945 D(p->level--);
21946 return NULL;
21947 }
21948 _children = _new_children;
21949 }
21950 _children[_n++] = _res;
21951 _mark = p->mark;
21952 }
21953 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021954 D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021955 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
21956 }
21957 if (_n == 0 || p->error_indicator) {
21958 PyMem_Free(_children);
21959 D(p->level--);
21960 return NULL;
21961 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021962 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021963 if (!_seq) {
21964 PyMem_Free(_children);
21965 p->error_indicator = 1;
21966 PyErr_NoMemory();
21967 D(p->level--);
21968 return NULL;
21969 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021970 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021971 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021972 _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021973 D(p->level--);
21974 return _seq;
21975}
21976
21977// _loop0_106: ('if' disjunction)
21978static asdl_seq *
21979_loop0_106_rule(Parser *p)
21980{
21981 D(p->level++);
21982 if (p->error_indicator) {
21983 D(p->level--);
21984 return NULL;
21985 }
21986 void *_res = NULL;
21987 int _mark = p->mark;
21988 int _start_mark = p->mark;
21989 void **_children = PyMem_Malloc(sizeof(void *));
21990 if (!_children) {
21991 p->error_indicator = 1;
21992 PyErr_NoMemory();
21993 D(p->level--);
21994 return NULL;
21995 }
21996 ssize_t _children_capacity = 1;
21997 ssize_t _n = 0;
21998 { // ('if' disjunction)
21999 if (p->error_indicator) {
22000 D(p->level--);
22001 return NULL;
22002 }
22003 D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010022004 void *_tmp_147_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022005 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022006 (_tmp_147_var = _tmp_147_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022007 )
22008 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022009 _res = _tmp_147_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022010 if (_n == _children_capacity) {
22011 _children_capacity *= 2;
22012 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22013 if (!_new_children) {
22014 p->error_indicator = 1;
22015 PyErr_NoMemory();
22016 D(p->level--);
22017 return NULL;
22018 }
22019 _children = _new_children;
22020 }
22021 _children[_n++] = _res;
22022 _mark = p->mark;
22023 }
22024 p->mark = _mark;
22025 D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ',
22026 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
22027 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022028 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022029 if (!_seq) {
22030 PyMem_Free(_children);
22031 p->error_indicator = 1;
22032 PyErr_NoMemory();
22033 D(p->level--);
22034 return NULL;
22035 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022036 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022037 PyMem_Free(_children);
22038 _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq);
22039 D(p->level--);
22040 return _seq;
22041}
22042
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022043// _loop0_107: ('if' disjunction)
22044static asdl_seq *
22045_loop0_107_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022046{
22047 D(p->level++);
22048 if (p->error_indicator) {
22049 D(p->level--);
22050 return NULL;
22051 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022052 void *_res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022053 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022054 int _start_mark = p->mark;
22055 void **_children = PyMem_Malloc(sizeof(void *));
22056 if (!_children) {
22057 p->error_indicator = 1;
22058 PyErr_NoMemory();
22059 D(p->level--);
22060 return NULL;
22061 }
22062 ssize_t _children_capacity = 1;
22063 ssize_t _n = 0;
22064 { // ('if' disjunction)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022065 if (p->error_indicator) {
22066 D(p->level--);
22067 return NULL;
22068 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022069 D(fprintf(stderr, "%*c> _loop0_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010022070 void *_tmp_148_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022071 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022072 (_tmp_148_var = _tmp_148_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022073 )
22074 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022075 _res = _tmp_148_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022076 if (_n == _children_capacity) {
22077 _children_capacity *= 2;
22078 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22079 if (!_new_children) {
22080 p->error_indicator = 1;
22081 PyErr_NoMemory();
22082 D(p->level--);
22083 return NULL;
22084 }
22085 _children = _new_children;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022086 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022087 _children[_n++] = _res;
22088 _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022089 }
22090 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022091 D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ',
22092 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022093 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022094 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022095 if (!_seq) {
22096 PyMem_Free(_children);
22097 p->error_indicator = 1;
22098 PyErr_NoMemory();
22099 D(p->level--);
22100 return NULL;
22101 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022102 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022103 PyMem_Free(_children);
22104 _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022105 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022106 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022107}
22108
Pablo Galindo4a97b152020-09-02 17:44:19 +010022109// _loop0_109: ',' (starred_expression | named_expression !'=')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022110static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022111_loop0_109_rule(Parser *p)
22112{
22113 D(p->level++);
22114 if (p->error_indicator) {
22115 D(p->level--);
22116 return NULL;
22117 }
22118 void *_res = NULL;
22119 int _mark = p->mark;
22120 int _start_mark = p->mark;
22121 void **_children = PyMem_Malloc(sizeof(void *));
22122 if (!_children) {
22123 p->error_indicator = 1;
22124 PyErr_NoMemory();
22125 D(p->level--);
22126 return NULL;
22127 }
22128 ssize_t _children_capacity = 1;
22129 ssize_t _n = 0;
22130 { // ',' (starred_expression | named_expression !'=')
22131 if (p->error_indicator) {
22132 D(p->level--);
22133 return NULL;
22134 }
22135 D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
22136 Token * _literal;
22137 void *elem;
22138 while (
22139 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22140 &&
22141 (elem = _tmp_149_rule(p)) // starred_expression | named_expression !'='
22142 )
22143 {
22144 _res = elem;
22145 if (_res == NULL && PyErr_Occurred()) {
22146 p->error_indicator = 1;
22147 PyMem_Free(_children);
22148 D(p->level--);
22149 return NULL;
22150 }
22151 if (_n == _children_capacity) {
22152 _children_capacity *= 2;
22153 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22154 if (!_new_children) {
22155 p->error_indicator = 1;
22156 PyErr_NoMemory();
22157 D(p->level--);
22158 return NULL;
22159 }
22160 _children = _new_children;
22161 }
22162 _children[_n++] = _res;
22163 _mark = p->mark;
22164 }
22165 p->mark = _mark;
22166 D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ',
22167 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
22168 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022169 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022170 if (!_seq) {
22171 PyMem_Free(_children);
22172 p->error_indicator = 1;
22173 PyErr_NoMemory();
22174 D(p->level--);
22175 return NULL;
22176 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022177 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022178 PyMem_Free(_children);
22179 _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq);
22180 D(p->level--);
22181 return _seq;
22182}
22183
22184// _gather_108: (starred_expression | named_expression !'=') _loop0_109
22185static asdl_seq *
22186_gather_108_rule(Parser *p)
22187{
22188 D(p->level++);
22189 if (p->error_indicator) {
22190 D(p->level--);
22191 return NULL;
22192 }
22193 asdl_seq * _res = NULL;
22194 int _mark = p->mark;
22195 { // (starred_expression | named_expression !'=') _loop0_109
22196 if (p->error_indicator) {
22197 D(p->level--);
22198 return NULL;
22199 }
22200 D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22201 void *elem;
22202 asdl_seq * seq;
22203 if (
22204 (elem = _tmp_149_rule(p)) // starred_expression | named_expression !'='
22205 &&
22206 (seq = _loop0_109_rule(p)) // _loop0_109
22207 )
22208 {
22209 D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22210 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22211 goto done;
22212 }
22213 p->mark = _mark;
22214 D(fprintf(stderr, "%*c%s _gather_108[%d-%d]: %s failed!\n", p->level, ' ',
22215 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22216 }
22217 _res = NULL;
22218 done:
22219 D(p->level--);
22220 return _res;
22221}
22222
22223// _tmp_110: ',' kwargs
22224static void *
22225_tmp_110_rule(Parser *p)
22226{
22227 D(p->level++);
22228 if (p->error_indicator) {
22229 D(p->level--);
22230 return NULL;
22231 }
22232 void * _res = NULL;
22233 int _mark = p->mark;
22234 { // ',' kwargs
22235 if (p->error_indicator) {
22236 D(p->level--);
22237 return NULL;
22238 }
22239 D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
22240 Token * _literal;
22241 asdl_seq* k;
22242 if (
22243 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22244 &&
22245 (k = kwargs_rule(p)) // kwargs
22246 )
22247 {
22248 D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
22249 _res = k;
22250 if (_res == NULL && PyErr_Occurred()) {
22251 p->error_indicator = 1;
22252 D(p->level--);
22253 return NULL;
22254 }
22255 goto done;
22256 }
22257 p->mark = _mark;
22258 D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ',
22259 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs"));
22260 }
22261 _res = NULL;
22262 done:
22263 D(p->level--);
22264 return _res;
22265}
22266
22267// _loop0_112: ',' kwarg_or_starred
22268static asdl_seq *
22269_loop0_112_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022270{
22271 D(p->level++);
22272 if (p->error_indicator) {
22273 D(p->level--);
22274 return NULL;
22275 }
22276 void *_res = NULL;
22277 int _mark = p->mark;
22278 int _start_mark = p->mark;
22279 void **_children = PyMem_Malloc(sizeof(void *));
22280 if (!_children) {
22281 p->error_indicator = 1;
22282 PyErr_NoMemory();
22283 D(p->level--);
22284 return NULL;
22285 }
22286 ssize_t _children_capacity = 1;
22287 ssize_t _n = 0;
22288 { // ',' kwarg_or_starred
22289 if (p->error_indicator) {
22290 D(p->level--);
22291 return NULL;
22292 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022293 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 +010022294 Token * _literal;
22295 KeywordOrStarred* elem;
22296 while (
22297 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22298 &&
22299 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22300 )
22301 {
22302 _res = elem;
22303 if (_res == NULL && PyErr_Occurred()) {
22304 p->error_indicator = 1;
22305 PyMem_Free(_children);
22306 D(p->level--);
22307 return NULL;
22308 }
22309 if (_n == _children_capacity) {
22310 _children_capacity *= 2;
22311 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22312 if (!_new_children) {
22313 p->error_indicator = 1;
22314 PyErr_NoMemory();
22315 D(p->level--);
22316 return NULL;
22317 }
22318 _children = _new_children;
22319 }
22320 _children[_n++] = _res;
22321 _mark = p->mark;
22322 }
22323 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022324 D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022325 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22326 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022327 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022328 if (!_seq) {
22329 PyMem_Free(_children);
22330 p->error_indicator = 1;
22331 PyErr_NoMemory();
22332 D(p->level--);
22333 return NULL;
22334 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022335 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022336 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022337 _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022338 D(p->level--);
22339 return _seq;
22340}
22341
Pablo Galindo4a97b152020-09-02 17:44:19 +010022342// _gather_111: kwarg_or_starred _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022343static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022344_gather_111_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022345{
22346 D(p->level++);
22347 if (p->error_indicator) {
22348 D(p->level--);
22349 return NULL;
22350 }
22351 asdl_seq * _res = NULL;
22352 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022353 { // kwarg_or_starred _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022354 if (p->error_indicator) {
22355 D(p->level--);
22356 return NULL;
22357 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022358 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 +010022359 KeywordOrStarred* elem;
22360 asdl_seq * seq;
22361 if (
22362 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22363 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022364 (seq = _loop0_112_rule(p)) // _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022365 )
22366 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022367 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 +010022368 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22369 goto done;
22370 }
22371 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022372 D(fprintf(stderr, "%*c%s _gather_111[%d-%d]: %s failed!\n", p->level, ' ',
22373 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_112"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022374 }
22375 _res = NULL;
22376 done:
22377 D(p->level--);
22378 return _res;
22379}
22380
Pablo Galindo4a97b152020-09-02 17:44:19 +010022381// _loop0_114: ',' kwarg_or_double_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022382static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022383_loop0_114_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022384{
22385 D(p->level++);
22386 if (p->error_indicator) {
22387 D(p->level--);
22388 return NULL;
22389 }
22390 void *_res = NULL;
22391 int _mark = p->mark;
22392 int _start_mark = p->mark;
22393 void **_children = PyMem_Malloc(sizeof(void *));
22394 if (!_children) {
22395 p->error_indicator = 1;
22396 PyErr_NoMemory();
22397 D(p->level--);
22398 return NULL;
22399 }
22400 ssize_t _children_capacity = 1;
22401 ssize_t _n = 0;
22402 { // ',' kwarg_or_double_starred
22403 if (p->error_indicator) {
22404 D(p->level--);
22405 return NULL;
22406 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022407 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 +010022408 Token * _literal;
22409 KeywordOrStarred* elem;
22410 while (
22411 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22412 &&
22413 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22414 )
22415 {
22416 _res = elem;
22417 if (_res == NULL && PyErr_Occurred()) {
22418 p->error_indicator = 1;
22419 PyMem_Free(_children);
22420 D(p->level--);
22421 return NULL;
22422 }
22423 if (_n == _children_capacity) {
22424 _children_capacity *= 2;
22425 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22426 if (!_new_children) {
22427 p->error_indicator = 1;
22428 PyErr_NoMemory();
22429 D(p->level--);
22430 return NULL;
22431 }
22432 _children = _new_children;
22433 }
22434 _children[_n++] = _res;
22435 _mark = p->mark;
22436 }
22437 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022438 D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022439 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22440 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022441 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022442 if (!_seq) {
22443 PyMem_Free(_children);
22444 p->error_indicator = 1;
22445 PyErr_NoMemory();
22446 D(p->level--);
22447 return NULL;
22448 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022449 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022450 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022451 _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022452 D(p->level--);
22453 return _seq;
22454}
22455
Pablo Galindo4a97b152020-09-02 17:44:19 +010022456// _gather_113: kwarg_or_double_starred _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022457static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022458_gather_113_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022459{
22460 D(p->level++);
22461 if (p->error_indicator) {
22462 D(p->level--);
22463 return NULL;
22464 }
22465 asdl_seq * _res = NULL;
22466 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022467 { // kwarg_or_double_starred _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022468 if (p->error_indicator) {
22469 D(p->level--);
22470 return NULL;
22471 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022472 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 +010022473 KeywordOrStarred* elem;
22474 asdl_seq * seq;
22475 if (
22476 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22477 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022478 (seq = _loop0_114_rule(p)) // _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022479 )
22480 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022481 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 +010022482 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22483 goto done;
22484 }
22485 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022486 D(fprintf(stderr, "%*c%s _gather_113[%d-%d]: %s failed!\n", p->level, ' ',
22487 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_114"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022488 }
22489 _res = NULL;
22490 done:
22491 D(p->level--);
22492 return _res;
22493}
22494
Pablo Galindo4a97b152020-09-02 17:44:19 +010022495// _loop0_116: ',' kwarg_or_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022496static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022497_loop0_116_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022498{
22499 D(p->level++);
22500 if (p->error_indicator) {
22501 D(p->level--);
22502 return NULL;
22503 }
22504 void *_res = NULL;
22505 int _mark = p->mark;
22506 int _start_mark = p->mark;
22507 void **_children = PyMem_Malloc(sizeof(void *));
22508 if (!_children) {
22509 p->error_indicator = 1;
22510 PyErr_NoMemory();
22511 D(p->level--);
22512 return NULL;
22513 }
22514 ssize_t _children_capacity = 1;
22515 ssize_t _n = 0;
22516 { // ',' kwarg_or_starred
22517 if (p->error_indicator) {
22518 D(p->level--);
22519 return NULL;
22520 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022521 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 +010022522 Token * _literal;
22523 KeywordOrStarred* elem;
22524 while (
22525 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22526 &&
22527 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22528 )
22529 {
22530 _res = elem;
22531 if (_res == NULL && PyErr_Occurred()) {
22532 p->error_indicator = 1;
22533 PyMem_Free(_children);
22534 D(p->level--);
22535 return NULL;
22536 }
22537 if (_n == _children_capacity) {
22538 _children_capacity *= 2;
22539 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22540 if (!_new_children) {
22541 p->error_indicator = 1;
22542 PyErr_NoMemory();
22543 D(p->level--);
22544 return NULL;
22545 }
22546 _children = _new_children;
22547 }
22548 _children[_n++] = _res;
22549 _mark = p->mark;
22550 }
22551 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022552 D(fprintf(stderr, "%*c%s _loop0_116[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022553 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22554 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022555 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022556 if (!_seq) {
22557 PyMem_Free(_children);
22558 p->error_indicator = 1;
22559 PyErr_NoMemory();
22560 D(p->level--);
22561 return NULL;
22562 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022563 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022564 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022565 _PyPegen_insert_memo(p, _start_mark, _loop0_116_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022566 D(p->level--);
22567 return _seq;
22568}
22569
Pablo Galindo4a97b152020-09-02 17:44:19 +010022570// _gather_115: kwarg_or_starred _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022571static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022572_gather_115_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022573{
22574 D(p->level++);
22575 if (p->error_indicator) {
22576 D(p->level--);
22577 return NULL;
22578 }
22579 asdl_seq * _res = NULL;
22580 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022581 { // kwarg_or_starred _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022582 if (p->error_indicator) {
22583 D(p->level--);
22584 return NULL;
22585 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022586 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 +010022587 KeywordOrStarred* elem;
22588 asdl_seq * seq;
22589 if (
22590 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22591 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022592 (seq = _loop0_116_rule(p)) // _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022593 )
22594 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022595 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 +010022596 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22597 goto done;
22598 }
22599 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022600 D(fprintf(stderr, "%*c%s _gather_115[%d-%d]: %s failed!\n", p->level, ' ',
22601 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_116"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022602 }
22603 _res = NULL;
22604 done:
22605 D(p->level--);
22606 return _res;
22607}
22608
Pablo Galindo4a97b152020-09-02 17:44:19 +010022609// _loop0_118: ',' kwarg_or_double_starred
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022610static asdl_seq *
22611_loop0_118_rule(Parser *p)
22612{
22613 D(p->level++);
22614 if (p->error_indicator) {
22615 D(p->level--);
22616 return NULL;
22617 }
22618 void *_res = NULL;
22619 int _mark = p->mark;
22620 int _start_mark = p->mark;
22621 void **_children = PyMem_Malloc(sizeof(void *));
22622 if (!_children) {
22623 p->error_indicator = 1;
22624 PyErr_NoMemory();
22625 D(p->level--);
22626 return NULL;
22627 }
22628 ssize_t _children_capacity = 1;
22629 ssize_t _n = 0;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022630 { // ',' kwarg_or_double_starred
22631 if (p->error_indicator) {
22632 D(p->level--);
22633 return NULL;
22634 }
22635 D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
22636 Token * _literal;
22637 KeywordOrStarred* elem;
22638 while (
22639 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22640 &&
22641 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22642 )
22643 {
22644 _res = elem;
22645 if (_res == NULL && PyErr_Occurred()) {
22646 p->error_indicator = 1;
22647 PyMem_Free(_children);
22648 D(p->level--);
22649 return NULL;
22650 }
22651 if (_n == _children_capacity) {
22652 _children_capacity *= 2;
22653 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22654 if (!_new_children) {
22655 p->error_indicator = 1;
22656 PyErr_NoMemory();
22657 D(p->level--);
22658 return NULL;
22659 }
22660 _children = _new_children;
22661 }
22662 _children[_n++] = _res;
22663 _mark = p->mark;
22664 }
22665 p->mark = _mark;
22666 D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ',
22667 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22668 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022669 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022670 if (!_seq) {
22671 PyMem_Free(_children);
22672 p->error_indicator = 1;
22673 PyErr_NoMemory();
22674 D(p->level--);
22675 return NULL;
22676 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022677 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022678 PyMem_Free(_children);
22679 _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq);
22680 D(p->level--);
22681 return _seq;
22682}
22683
22684// _gather_117: kwarg_or_double_starred _loop0_118
22685static asdl_seq *
22686_gather_117_rule(Parser *p)
22687{
22688 D(p->level++);
22689 if (p->error_indicator) {
22690 D(p->level--);
22691 return NULL;
22692 }
22693 asdl_seq * _res = NULL;
22694 int _mark = p->mark;
22695 { // kwarg_or_double_starred _loop0_118
22696 if (p->error_indicator) {
22697 D(p->level--);
22698 return NULL;
22699 }
22700 D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22701 KeywordOrStarred* elem;
22702 asdl_seq * seq;
22703 if (
22704 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22705 &&
22706 (seq = _loop0_118_rule(p)) // _loop0_118
22707 )
22708 {
22709 D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22710 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22711 goto done;
22712 }
22713 p->mark = _mark;
22714 D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ',
22715 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22716 }
22717 _res = NULL;
22718 done:
22719 D(p->level--);
22720 return _res;
22721}
22722
22723// _loop0_119: (',' star_target)
22724static asdl_seq *
22725_loop0_119_rule(Parser *p)
22726{
22727 D(p->level++);
22728 if (p->error_indicator) {
22729 D(p->level--);
22730 return NULL;
22731 }
22732 void *_res = NULL;
22733 int _mark = p->mark;
22734 int _start_mark = p->mark;
22735 void **_children = PyMem_Malloc(sizeof(void *));
22736 if (!_children) {
22737 p->error_indicator = 1;
22738 PyErr_NoMemory();
22739 D(p->level--);
22740 return NULL;
22741 }
22742 ssize_t _children_capacity = 1;
22743 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022744 { // (',' star_target)
22745 if (p->error_indicator) {
22746 D(p->level--);
22747 return NULL;
22748 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022749 D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
22750 void *_tmp_150_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022751 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022752 (_tmp_150_var = _tmp_150_rule(p)) // ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022753 )
22754 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022755 _res = _tmp_150_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022756 if (_n == _children_capacity) {
22757 _children_capacity *= 2;
22758 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22759 if (!_new_children) {
22760 p->error_indicator = 1;
22761 PyErr_NoMemory();
22762 D(p->level--);
22763 return NULL;
22764 }
22765 _children = _new_children;
22766 }
22767 _children[_n++] = _res;
22768 _mark = p->mark;
22769 }
22770 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022771 D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022772 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
22773 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022774 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022775 if (!_seq) {
22776 PyMem_Free(_children);
22777 p->error_indicator = 1;
22778 PyErr_NoMemory();
22779 D(p->level--);
22780 return NULL;
22781 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022782 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022783 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022784 _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022785 D(p->level--);
22786 return _seq;
22787}
22788
Pablo Galindo4a97b152020-09-02 17:44:19 +010022789// _loop0_121: ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022790static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022791_loop0_121_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022792{
22793 D(p->level++);
22794 if (p->error_indicator) {
22795 D(p->level--);
22796 return NULL;
22797 }
22798 void *_res = NULL;
22799 int _mark = p->mark;
22800 int _start_mark = p->mark;
22801 void **_children = PyMem_Malloc(sizeof(void *));
22802 if (!_children) {
22803 p->error_indicator = 1;
22804 PyErr_NoMemory();
22805 D(p->level--);
22806 return NULL;
22807 }
22808 ssize_t _children_capacity = 1;
22809 ssize_t _n = 0;
22810 { // ',' star_target
22811 if (p->error_indicator) {
22812 D(p->level--);
22813 return NULL;
22814 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022815 D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022816 Token * _literal;
22817 expr_ty elem;
22818 while (
22819 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22820 &&
22821 (elem = star_target_rule(p)) // star_target
22822 )
22823 {
22824 _res = elem;
22825 if (_res == NULL && PyErr_Occurred()) {
22826 p->error_indicator = 1;
22827 PyMem_Free(_children);
22828 D(p->level--);
22829 return NULL;
22830 }
22831 if (_n == _children_capacity) {
22832 _children_capacity *= 2;
22833 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22834 if (!_new_children) {
22835 p->error_indicator = 1;
22836 PyErr_NoMemory();
22837 D(p->level--);
22838 return NULL;
22839 }
22840 _children = _new_children;
22841 }
22842 _children[_n++] = _res;
22843 _mark = p->mark;
22844 }
22845 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022846 D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022847 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
22848 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022849 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022850 if (!_seq) {
22851 PyMem_Free(_children);
22852 p->error_indicator = 1;
22853 PyErr_NoMemory();
22854 D(p->level--);
22855 return NULL;
22856 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022857 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022858 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022859 _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022860 D(p->level--);
22861 return _seq;
22862}
22863
Pablo Galindo4a97b152020-09-02 17:44:19 +010022864// _gather_120: star_target _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022865static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022866_gather_120_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022867{
22868 D(p->level++);
22869 if (p->error_indicator) {
22870 D(p->level--);
22871 return NULL;
22872 }
22873 asdl_seq * _res = NULL;
22874 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022875 { // star_target _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022876 if (p->error_indicator) {
22877 D(p->level--);
22878 return NULL;
22879 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022880 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 +010022881 expr_ty elem;
22882 asdl_seq * seq;
22883 if (
22884 (elem = star_target_rule(p)) // star_target
22885 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022886 (seq = _loop0_121_rule(p)) // _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022887 )
22888 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022889 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 +010022890 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22891 goto done;
22892 }
22893 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022894 D(fprintf(stderr, "%*c%s _gather_120[%d-%d]: %s failed!\n", p->level, ' ',
22895 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_121"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022896 }
22897 _res = NULL;
22898 done:
22899 D(p->level--);
22900 return _res;
22901}
22902
Pablo Galindo4a97b152020-09-02 17:44:19 +010022903// _tmp_122: !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022904static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022905_tmp_122_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022906{
22907 D(p->level++);
22908 if (p->error_indicator) {
22909 D(p->level--);
22910 return NULL;
22911 }
22912 void * _res = NULL;
22913 int _mark = p->mark;
22914 { // !'*' star_target
22915 if (p->error_indicator) {
22916 D(p->level--);
22917 return NULL;
22918 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022919 D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022920 expr_ty star_target_var;
22921 if (
22922 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*'
22923 &&
22924 (star_target_var = star_target_rule(p)) // star_target
22925 )
22926 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022927 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 +010022928 _res = star_target_var;
22929 goto done;
22930 }
22931 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022932 D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022933 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
22934 }
22935 _res = NULL;
22936 done:
22937 D(p->level--);
22938 return _res;
22939}
22940
Pablo Galindo4a97b152020-09-02 17:44:19 +010022941// _loop0_124: ',' del_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022942static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022943_loop0_124_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022944{
22945 D(p->level++);
22946 if (p->error_indicator) {
22947 D(p->level--);
22948 return NULL;
22949 }
22950 void *_res = NULL;
22951 int _mark = p->mark;
22952 int _start_mark = p->mark;
22953 void **_children = PyMem_Malloc(sizeof(void *));
22954 if (!_children) {
22955 p->error_indicator = 1;
22956 PyErr_NoMemory();
22957 D(p->level--);
22958 return NULL;
22959 }
22960 ssize_t _children_capacity = 1;
22961 ssize_t _n = 0;
22962 { // ',' del_target
22963 if (p->error_indicator) {
22964 D(p->level--);
22965 return NULL;
22966 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022967 D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022968 Token * _literal;
22969 expr_ty elem;
22970 while (
22971 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22972 &&
22973 (elem = del_target_rule(p)) // del_target
22974 )
22975 {
22976 _res = elem;
22977 if (_res == NULL && PyErr_Occurred()) {
22978 p->error_indicator = 1;
22979 PyMem_Free(_children);
22980 D(p->level--);
22981 return NULL;
22982 }
22983 if (_n == _children_capacity) {
22984 _children_capacity *= 2;
22985 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22986 if (!_new_children) {
22987 p->error_indicator = 1;
22988 PyErr_NoMemory();
22989 D(p->level--);
22990 return NULL;
22991 }
22992 _children = _new_children;
22993 }
22994 _children[_n++] = _res;
22995 _mark = p->mark;
22996 }
22997 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022998 D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022999 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
23000 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023001 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023002 if (!_seq) {
23003 PyMem_Free(_children);
23004 p->error_indicator = 1;
23005 PyErr_NoMemory();
23006 D(p->level--);
23007 return NULL;
23008 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023009 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023010 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023011 _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023012 D(p->level--);
23013 return _seq;
23014}
23015
Pablo Galindo4a97b152020-09-02 17:44:19 +010023016// _gather_123: del_target _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023017static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023018_gather_123_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023019{
23020 D(p->level++);
23021 if (p->error_indicator) {
23022 D(p->level--);
23023 return NULL;
23024 }
23025 asdl_seq * _res = NULL;
23026 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023027 { // del_target _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023028 if (p->error_indicator) {
23029 D(p->level--);
23030 return NULL;
23031 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023032 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 +010023033 expr_ty elem;
23034 asdl_seq * seq;
23035 if (
23036 (elem = del_target_rule(p)) // del_target
23037 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023038 (seq = _loop0_124_rule(p)) // _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023039 )
23040 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023041 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 +010023042 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23043 goto done;
23044 }
23045 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023046 D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ',
23047 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_124"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023048 }
23049 _res = NULL;
23050 done:
23051 D(p->level--);
23052 return _res;
23053}
23054
Pablo Galindo4a97b152020-09-02 17:44:19 +010023055// _loop0_126: ',' target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023056static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023057_loop0_126_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023058{
23059 D(p->level++);
23060 if (p->error_indicator) {
23061 D(p->level--);
23062 return NULL;
23063 }
23064 void *_res = NULL;
23065 int _mark = p->mark;
23066 int _start_mark = p->mark;
23067 void **_children = PyMem_Malloc(sizeof(void *));
23068 if (!_children) {
23069 p->error_indicator = 1;
23070 PyErr_NoMemory();
23071 D(p->level--);
23072 return NULL;
23073 }
23074 ssize_t _children_capacity = 1;
23075 ssize_t _n = 0;
23076 { // ',' target
23077 if (p->error_indicator) {
23078 D(p->level--);
23079 return NULL;
23080 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023081 D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023082 Token * _literal;
23083 expr_ty elem;
23084 while (
23085 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23086 &&
23087 (elem = target_rule(p)) // target
23088 )
23089 {
23090 _res = elem;
23091 if (_res == NULL && PyErr_Occurred()) {
23092 p->error_indicator = 1;
23093 PyMem_Free(_children);
23094 D(p->level--);
23095 return NULL;
23096 }
23097 if (_n == _children_capacity) {
23098 _children_capacity *= 2;
23099 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23100 if (!_new_children) {
23101 p->error_indicator = 1;
23102 PyErr_NoMemory();
23103 D(p->level--);
23104 return NULL;
23105 }
23106 _children = _new_children;
23107 }
23108 _children[_n++] = _res;
23109 _mark = p->mark;
23110 }
23111 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023112 D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023113 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target"));
23114 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023115 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023116 if (!_seq) {
23117 PyMem_Free(_children);
23118 p->error_indicator = 1;
23119 PyErr_NoMemory();
23120 D(p->level--);
23121 return NULL;
23122 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023123 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023124 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023125 _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023126 D(p->level--);
23127 return _seq;
23128}
23129
Pablo Galindo4a97b152020-09-02 17:44:19 +010023130// _gather_125: target _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023131static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023132_gather_125_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023133{
23134 D(p->level++);
23135 if (p->error_indicator) {
23136 D(p->level--);
23137 return NULL;
23138 }
23139 asdl_seq * _res = NULL;
23140 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023141 { // target _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023142 if (p->error_indicator) {
23143 D(p->level--);
23144 return NULL;
23145 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023146 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 +010023147 expr_ty elem;
23148 asdl_seq * seq;
23149 if (
23150 (elem = target_rule(p)) // target
23151 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023152 (seq = _loop0_126_rule(p)) // _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023153 )
23154 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023155 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 +010023156 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23157 goto done;
23158 }
23159 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023160 D(fprintf(stderr, "%*c%s _gather_125[%d-%d]: %s failed!\n", p->level, ' ',
23161 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_126"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023162 }
23163 _res = NULL;
23164 done:
23165 D(p->level--);
23166 return _res;
23167}
23168
Pablo Galindo4a97b152020-09-02 17:44:19 +010023169// _tmp_127: args | expression for_if_clauses
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023170static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023171_tmp_127_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023172{
23173 D(p->level++);
23174 if (p->error_indicator) {
23175 D(p->level--);
23176 return NULL;
23177 }
23178 void * _res = NULL;
23179 int _mark = p->mark;
23180 { // args
23181 if (p->error_indicator) {
23182 D(p->level--);
23183 return NULL;
23184 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023185 D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023186 expr_ty args_var;
23187 if (
23188 (args_var = args_rule(p)) // args
23189 )
23190 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023191 D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023192 _res = args_var;
23193 goto done;
23194 }
23195 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023196 D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023197 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args"));
23198 }
23199 { // expression for_if_clauses
23200 if (p->error_indicator) {
23201 D(p->level--);
23202 return NULL;
23203 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023204 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 +010023205 expr_ty expression_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +010023206 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023207 if (
23208 (expression_var = expression_rule(p)) // expression
23209 &&
23210 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
23211 )
23212 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023213 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 +010023214 _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
23215 goto done;
23216 }
23217 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023218 D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023219 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses"));
23220 }
23221 _res = NULL;
23222 done:
23223 D(p->level--);
23224 return _res;
23225}
23226
Pablo Galindo4a97b152020-09-02 17:44:19 +010023227// _loop0_128: star_named_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023228static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023229_loop0_128_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023230{
23231 D(p->level++);
23232 if (p->error_indicator) {
23233 D(p->level--);
23234 return NULL;
23235 }
23236 void *_res = NULL;
23237 int _mark = p->mark;
23238 int _start_mark = p->mark;
23239 void **_children = PyMem_Malloc(sizeof(void *));
23240 if (!_children) {
23241 p->error_indicator = 1;
23242 PyErr_NoMemory();
23243 D(p->level--);
23244 return NULL;
23245 }
23246 ssize_t _children_capacity = 1;
23247 ssize_t _n = 0;
23248 { // star_named_expressions
23249 if (p->error_indicator) {
23250 D(p->level--);
23251 return NULL;
23252 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023253 D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions"));
Pablo Galindoa5634c42020-09-16 19:42:00 +010023254 asdl_expr_seq* star_named_expressions_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023255 while (
23256 (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions
23257 )
23258 {
23259 _res = star_named_expressions_var;
23260 if (_n == _children_capacity) {
23261 _children_capacity *= 2;
23262 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23263 if (!_new_children) {
23264 p->error_indicator = 1;
23265 PyErr_NoMemory();
23266 D(p->level--);
23267 return NULL;
23268 }
23269 _children = _new_children;
23270 }
23271 _children[_n++] = _res;
23272 _mark = p->mark;
23273 }
23274 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023275 D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010023276 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023277 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023278 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023279 if (!_seq) {
23280 PyMem_Free(_children);
23281 p->error_indicator = 1;
23282 PyErr_NoMemory();
23283 D(p->level--);
23284 return NULL;
23285 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023286 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023287 PyMem_Free(_children);
23288 _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023289 D(p->level--);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023290 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023291}
23292
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023293// _loop0_129: (star_targets '=')
23294static asdl_seq *
23295_loop0_129_rule(Parser *p)
23296{
23297 D(p->level++);
23298 if (p->error_indicator) {
23299 D(p->level--);
23300 return NULL;
23301 }
23302 void *_res = NULL;
23303 int _mark = p->mark;
23304 int _start_mark = p->mark;
23305 void **_children = PyMem_Malloc(sizeof(void *));
23306 if (!_children) {
23307 p->error_indicator = 1;
23308 PyErr_NoMemory();
23309 D(p->level--);
23310 return NULL;
23311 }
23312 ssize_t _children_capacity = 1;
23313 ssize_t _n = 0;
23314 { // (star_targets '=')
23315 if (p->error_indicator) {
23316 D(p->level--);
23317 return NULL;
23318 }
23319 D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010023320 void *_tmp_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023321 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023322 (_tmp_151_var = _tmp_151_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023323 )
23324 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023325 _res = _tmp_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023326 if (_n == _children_capacity) {
23327 _children_capacity *= 2;
23328 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23329 if (!_new_children) {
23330 p->error_indicator = 1;
23331 PyErr_NoMemory();
23332 D(p->level--);
23333 return NULL;
23334 }
23335 _children = _new_children;
23336 }
23337 _children[_n++] = _res;
23338 _mark = p->mark;
23339 }
23340 p->mark = _mark;
23341 D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ',
23342 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23343 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023344 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023345 if (!_seq) {
23346 PyMem_Free(_children);
23347 p->error_indicator = 1;
23348 PyErr_NoMemory();
23349 D(p->level--);
23350 return NULL;
23351 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023352 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023353 PyMem_Free(_children);
23354 _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq);
23355 D(p->level--);
23356 return _seq;
23357}
23358
Pablo Galindo4a97b152020-09-02 17:44:19 +010023359// _loop0_130: (star_targets '=')
23360static asdl_seq *
23361_loop0_130_rule(Parser *p)
23362{
23363 D(p->level++);
23364 if (p->error_indicator) {
23365 D(p->level--);
23366 return NULL;
23367 }
23368 void *_res = NULL;
23369 int _mark = p->mark;
23370 int _start_mark = p->mark;
23371 void **_children = PyMem_Malloc(sizeof(void *));
23372 if (!_children) {
23373 p->error_indicator = 1;
23374 PyErr_NoMemory();
23375 D(p->level--);
23376 return NULL;
23377 }
23378 ssize_t _children_capacity = 1;
23379 ssize_t _n = 0;
23380 { // (star_targets '=')
23381 if (p->error_indicator) {
23382 D(p->level--);
23383 return NULL;
23384 }
23385 D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
23386 void *_tmp_152_var;
23387 while (
23388 (_tmp_152_var = _tmp_152_rule(p)) // star_targets '='
23389 )
23390 {
23391 _res = _tmp_152_var;
23392 if (_n == _children_capacity) {
23393 _children_capacity *= 2;
23394 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23395 if (!_new_children) {
23396 p->error_indicator = 1;
23397 PyErr_NoMemory();
23398 D(p->level--);
23399 return NULL;
23400 }
23401 _children = _new_children;
23402 }
23403 _children[_n++] = _res;
23404 _mark = p->mark;
23405 }
23406 p->mark = _mark;
23407 D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ',
23408 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23409 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023410 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023411 if (!_seq) {
23412 PyMem_Free(_children);
23413 p->error_indicator = 1;
23414 PyErr_NoMemory();
23415 D(p->level--);
23416 return NULL;
23417 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023418 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023419 PyMem_Free(_children);
23420 _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq);
23421 D(p->level--);
23422 return _seq;
23423}
23424
23425// _tmp_131: yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023426static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023427_tmp_131_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023428{
23429 D(p->level++);
23430 if (p->error_indicator) {
23431 D(p->level--);
23432 return NULL;
23433 }
23434 void * _res = NULL;
23435 int _mark = p->mark;
23436 { // yield_expr
23437 if (p->error_indicator) {
23438 D(p->level--);
23439 return NULL;
23440 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023441 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023442 expr_ty yield_expr_var;
23443 if (
23444 (yield_expr_var = yield_expr_rule(p)) // yield_expr
23445 )
23446 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023447 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 +010023448 _res = yield_expr_var;
23449 goto done;
23450 }
23451 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023452 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023453 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
23454 }
23455 { // star_expressions
23456 if (p->error_indicator) {
23457 D(p->level--);
23458 return NULL;
23459 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023460 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023461 expr_ty star_expressions_var;
23462 if (
23463 (star_expressions_var = star_expressions_rule(p)) // star_expressions
23464 )
23465 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023466 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 +010023467 _res = star_expressions_var;
23468 goto done;
23469 }
23470 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023471 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023472 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
23473 }
23474 _res = NULL;
23475 done:
23476 D(p->level--);
23477 return _res;
23478}
23479
Pablo Galindo4a97b152020-09-02 17:44:19 +010023480// _tmp_132: '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023481static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023482_tmp_132_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023483{
23484 D(p->level++);
23485 if (p->error_indicator) {
23486 D(p->level--);
23487 return NULL;
23488 }
23489 void * _res = NULL;
23490 int _mark = p->mark;
23491 { // '['
23492 if (p->error_indicator) {
23493 D(p->level--);
23494 return NULL;
23495 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023496 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023497 Token * _literal;
23498 if (
23499 (_literal = _PyPegen_expect_token(p, 9)) // token='['
23500 )
23501 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023502 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023503 _res = _literal;
23504 goto done;
23505 }
23506 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023507 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023508 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
23509 }
23510 { // '('
23511 if (p->error_indicator) {
23512 D(p->level--);
23513 return NULL;
23514 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023515 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023516 Token * _literal;
23517 if (
23518 (_literal = _PyPegen_expect_token(p, 7)) // token='('
23519 )
23520 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023521 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023522 _res = _literal;
23523 goto done;
23524 }
23525 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023526 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023527 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
23528 }
23529 { // '{'
23530 if (p->error_indicator) {
23531 D(p->level--);
23532 return NULL;
23533 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023534 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023535 Token * _literal;
23536 if (
23537 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
23538 )
23539 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023540 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023541 _res = _literal;
23542 goto done;
23543 }
23544 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023545 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023546 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
23547 }
23548 _res = NULL;
23549 done:
23550 D(p->level--);
23551 return _res;
23552}
23553
Pablo Galindo4a97b152020-09-02 17:44:19 +010023554// _loop0_133: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023555static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023556_loop0_133_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023557{
23558 D(p->level++);
23559 if (p->error_indicator) {
23560 D(p->level--);
23561 return NULL;
23562 }
23563 void *_res = NULL;
23564 int _mark = p->mark;
23565 int _start_mark = p->mark;
23566 void **_children = PyMem_Malloc(sizeof(void *));
23567 if (!_children) {
23568 p->error_indicator = 1;
23569 PyErr_NoMemory();
23570 D(p->level--);
23571 return NULL;
23572 }
23573 ssize_t _children_capacity = 1;
23574 ssize_t _n = 0;
23575 { // param_no_default
23576 if (p->error_indicator) {
23577 D(p->level--);
23578 return NULL;
23579 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023580 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 +010023581 arg_ty param_no_default_var;
23582 while (
23583 (param_no_default_var = param_no_default_rule(p)) // param_no_default
23584 )
23585 {
23586 _res = param_no_default_var;
23587 if (_n == _children_capacity) {
23588 _children_capacity *= 2;
23589 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23590 if (!_new_children) {
23591 p->error_indicator = 1;
23592 PyErr_NoMemory();
23593 D(p->level--);
23594 return NULL;
23595 }
23596 _children = _new_children;
23597 }
23598 _children[_n++] = _res;
23599 _mark = p->mark;
23600 }
23601 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023602 D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023603 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
23604 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023605 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023606 if (!_seq) {
23607 PyMem_Free(_children);
23608 p->error_indicator = 1;
23609 PyErr_NoMemory();
23610 D(p->level--);
23611 return NULL;
23612 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023613 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023614 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023615 _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023616 D(p->level--);
23617 return _seq;
23618}
23619
Pablo Galindo4a97b152020-09-02 17:44:19 +010023620// _tmp_134: slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023621static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023622_tmp_134_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023623{
23624 D(p->level++);
23625 if (p->error_indicator) {
23626 D(p->level--);
23627 return NULL;
23628 }
23629 void * _res = NULL;
23630 int _mark = p->mark;
23631 { // slash_with_default
23632 if (p->error_indicator) {
23633 D(p->level--);
23634 return NULL;
23635 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023636 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 +010023637 SlashWithDefault* slash_with_default_var;
23638 if (
23639 (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default
23640 )
23641 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023642 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 +010023643 _res = slash_with_default_var;
23644 goto done;
23645 }
23646 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023647 D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023648 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
23649 }
23650 { // param_with_default+
23651 if (p->error_indicator) {
23652 D(p->level--);
23653 return NULL;
23654 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023655 D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23656 asdl_seq * _loop1_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023657 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023658 (_loop1_153_var = _loop1_153_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023659 )
23660 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023661 D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23662 _res = _loop1_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023663 goto done;
23664 }
23665 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023666 D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023667 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+"));
23668 }
23669 _res = NULL;
23670 done:
23671 D(p->level--);
23672 return _res;
23673}
23674
Pablo Galindo4a97b152020-09-02 17:44:19 +010023675// _loop0_135: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023676static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023677_loop0_135_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023678{
23679 D(p->level++);
23680 if (p->error_indicator) {
23681 D(p->level--);
23682 return NULL;
23683 }
23684 void *_res = NULL;
23685 int _mark = p->mark;
23686 int _start_mark = p->mark;
23687 void **_children = PyMem_Malloc(sizeof(void *));
23688 if (!_children) {
23689 p->error_indicator = 1;
23690 PyErr_NoMemory();
23691 D(p->level--);
23692 return NULL;
23693 }
23694 ssize_t _children_capacity = 1;
23695 ssize_t _n = 0;
23696 { // lambda_param_no_default
23697 if (p->error_indicator) {
23698 D(p->level--);
23699 return NULL;
23700 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023701 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 +010023702 arg_ty lambda_param_no_default_var;
23703 while (
23704 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
23705 )
23706 {
23707 _res = lambda_param_no_default_var;
23708 if (_n == _children_capacity) {
23709 _children_capacity *= 2;
23710 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23711 if (!_new_children) {
23712 p->error_indicator = 1;
23713 PyErr_NoMemory();
23714 D(p->level--);
23715 return NULL;
23716 }
23717 _children = _new_children;
23718 }
23719 _children[_n++] = _res;
23720 _mark = p->mark;
23721 }
23722 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023723 D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023724 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
23725 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023726 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023727 if (!_seq) {
23728 PyMem_Free(_children);
23729 p->error_indicator = 1;
23730 PyErr_NoMemory();
23731 D(p->level--);
23732 return NULL;
23733 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023734 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023735 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023736 _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023737 D(p->level--);
23738 return _seq;
23739}
23740
Pablo Galindo4a97b152020-09-02 17:44:19 +010023741// _tmp_136: lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023742static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023743_tmp_136_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023744{
23745 D(p->level++);
23746 if (p->error_indicator) {
23747 D(p->level--);
23748 return NULL;
23749 }
23750 void * _res = NULL;
23751 int _mark = p->mark;
23752 { // lambda_slash_with_default
23753 if (p->error_indicator) {
23754 D(p->level--);
23755 return NULL;
23756 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023757 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 +010023758 SlashWithDefault* lambda_slash_with_default_var;
23759 if (
23760 (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
23761 )
23762 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023763 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 +010023764 _res = lambda_slash_with_default_var;
23765 goto done;
23766 }
23767 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023768 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023769 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
23770 }
23771 { // lambda_param_with_default+
23772 if (p->error_indicator) {
23773 D(p->level--);
23774 return NULL;
23775 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023776 D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23777 asdl_seq * _loop1_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023778 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023779 (_loop1_154_var = _loop1_154_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023780 )
23781 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023782 D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23783 _res = _loop1_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023784 goto done;
23785 }
23786 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023787 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023788 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+"));
23789 }
23790 _res = NULL;
23791 done:
23792 D(p->level--);
23793 return _res;
23794}
23795
Pablo Galindo4a97b152020-09-02 17:44:19 +010023796// _tmp_137: ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023797static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023798_tmp_137_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023799{
23800 D(p->level++);
23801 if (p->error_indicator) {
23802 D(p->level--);
23803 return NULL;
23804 }
23805 void * _res = NULL;
23806 int _mark = p->mark;
23807 { // ')'
23808 if (p->error_indicator) {
23809 D(p->level--);
23810 return NULL;
23811 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023812 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023813 Token * _literal;
23814 if (
23815 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
23816 )
23817 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023818 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023819 _res = _literal;
23820 goto done;
23821 }
23822 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023823 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023824 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
23825 }
23826 { // ',' (')' | '**')
23827 if (p->error_indicator) {
23828 D(p->level--);
23829 return NULL;
23830 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023831 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023832 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023833 void *_tmp_155_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023834 if (
23835 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23836 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023837 (_tmp_155_var = _tmp_155_rule(p)) // ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023838 )
23839 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023840 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
23841 _res = _PyPegen_dummy_name(p, _literal, _tmp_155_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023842 goto done;
23843 }
23844 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023845 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023846 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')"));
23847 }
23848 _res = NULL;
23849 done:
23850 D(p->level--);
23851 return _res;
23852}
23853
Pablo Galindo4a97b152020-09-02 17:44:19 +010023854// _tmp_138: ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023855static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023856_tmp_138_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023857{
23858 D(p->level++);
23859 if (p->error_indicator) {
23860 D(p->level--);
23861 return NULL;
23862 }
23863 void * _res = NULL;
23864 int _mark = p->mark;
23865 { // ':'
23866 if (p->error_indicator) {
23867 D(p->level--);
23868 return NULL;
23869 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023870 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023871 Token * _literal;
23872 if (
23873 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
23874 )
23875 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023876 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023877 _res = _literal;
23878 goto done;
23879 }
23880 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023881 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023882 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
23883 }
23884 { // ',' (':' | '**')
23885 if (p->error_indicator) {
23886 D(p->level--);
23887 return NULL;
23888 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023889 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023890 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023891 void *_tmp_156_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023892 if (
23893 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23894 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023895 (_tmp_156_var = _tmp_156_rule(p)) // ':' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023896 )
23897 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023898 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
23899 _res = _PyPegen_dummy_name(p, _literal, _tmp_156_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023900 goto done;
23901 }
23902 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023903 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023904 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')"));
23905 }
23906 _res = NULL;
23907 done:
23908 D(p->level--);
23909 return _res;
23910}
23911
Pablo Galindo4a97b152020-09-02 17:44:19 +010023912// _tmp_139: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023913static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023914_tmp_139_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023915{
23916 D(p->level++);
23917 if (p->error_indicator) {
23918 D(p->level--);
23919 return NULL;
23920 }
23921 void * _res = NULL;
23922 int _mark = p->mark;
23923 { // star_targets '='
23924 if (p->error_indicator) {
23925 D(p->level--);
23926 return NULL;
23927 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023928 D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023929 Token * _literal;
23930 expr_ty z;
23931 if (
23932 (z = star_targets_rule(p)) // star_targets
23933 &&
23934 (_literal = _PyPegen_expect_token(p, 22)) // token='='
23935 )
23936 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023937 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 +010023938 _res = z;
23939 if (_res == NULL && PyErr_Occurred()) {
23940 p->error_indicator = 1;
23941 D(p->level--);
23942 return NULL;
23943 }
23944 goto done;
23945 }
23946 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023947 D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023948 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
23949 }
23950 _res = NULL;
23951 done:
23952 D(p->level--);
23953 return _res;
23954}
23955
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023956// _tmp_140: '.' | '...'
23957static void *
23958_tmp_140_rule(Parser *p)
23959{
23960 D(p->level++);
23961 if (p->error_indicator) {
23962 D(p->level--);
23963 return NULL;
23964 }
23965 void * _res = NULL;
23966 int _mark = p->mark;
23967 { // '.'
23968 if (p->error_indicator) {
23969 D(p->level--);
23970 return NULL;
23971 }
23972 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
23973 Token * _literal;
23974 if (
23975 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
23976 )
23977 {
23978 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
23979 _res = _literal;
23980 goto done;
23981 }
23982 p->mark = _mark;
23983 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
23984 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
23985 }
23986 { // '...'
23987 if (p->error_indicator) {
23988 D(p->level--);
23989 return NULL;
23990 }
23991 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
23992 Token * _literal;
23993 if (
23994 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
23995 )
23996 {
23997 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
23998 _res = _literal;
23999 goto done;
24000 }
24001 p->mark = _mark;
24002 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
24003 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
24004 }
24005 _res = NULL;
24006 done:
24007 D(p->level--);
24008 return _res;
24009}
24010
Pablo Galindo4a97b152020-09-02 17:44:19 +010024011// _tmp_141: '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024012static void *
24013_tmp_141_rule(Parser *p)
24014{
24015 D(p->level++);
24016 if (p->error_indicator) {
24017 D(p->level--);
24018 return NULL;
24019 }
24020 void * _res = NULL;
24021 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024022 { // '.'
24023 if (p->error_indicator) {
24024 D(p->level--);
24025 return NULL;
24026 }
24027 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
24028 Token * _literal;
24029 if (
24030 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
24031 )
24032 {
24033 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
24034 _res = _literal;
24035 goto done;
24036 }
24037 p->mark = _mark;
24038 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
24039 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
24040 }
24041 { // '...'
24042 if (p->error_indicator) {
24043 D(p->level--);
24044 return NULL;
24045 }
24046 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
24047 Token * _literal;
24048 if (
24049 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
24050 )
24051 {
24052 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
24053 _res = _literal;
24054 goto done;
24055 }
24056 p->mark = _mark;
24057 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
24058 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
24059 }
24060 _res = NULL;
24061 done:
24062 D(p->level--);
24063 return _res;
24064}
24065
24066// _tmp_142: '@' named_expression NEWLINE
24067static void *
24068_tmp_142_rule(Parser *p)
24069{
24070 D(p->level++);
24071 if (p->error_indicator) {
24072 D(p->level--);
24073 return NULL;
24074 }
24075 void * _res = NULL;
24076 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024077 { // '@' named_expression NEWLINE
24078 if (p->error_indicator) {
24079 D(p->level--);
24080 return NULL;
24081 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024082 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 +010024083 Token * _literal;
24084 expr_ty f;
24085 Token * newline_var;
24086 if (
24087 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
24088 &&
24089 (f = named_expression_rule(p)) // named_expression
24090 &&
24091 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
24092 )
24093 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024094 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 +010024095 _res = f;
24096 if (_res == NULL && PyErr_Occurred()) {
24097 p->error_indicator = 1;
24098 D(p->level--);
24099 return NULL;
24100 }
24101 goto done;
24102 }
24103 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024104 D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024105 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE"));
24106 }
24107 _res = NULL;
24108 done:
24109 D(p->level--);
24110 return _res;
24111}
24112
Pablo Galindo4a97b152020-09-02 17:44:19 +010024113// _tmp_143: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024114static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024115_tmp_143_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024116{
24117 D(p->level++);
24118 if (p->error_indicator) {
24119 D(p->level--);
24120 return NULL;
24121 }
24122 void * _res = NULL;
24123 int _mark = p->mark;
24124 { // ',' star_expression
24125 if (p->error_indicator) {
24126 D(p->level--);
24127 return NULL;
24128 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024129 D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024130 Token * _literal;
24131 expr_ty c;
24132 if (
24133 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24134 &&
24135 (c = star_expression_rule(p)) // star_expression
24136 )
24137 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024138 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 +010024139 _res = c;
24140 if (_res == NULL && PyErr_Occurred()) {
24141 p->error_indicator = 1;
24142 D(p->level--);
24143 return NULL;
24144 }
24145 goto done;
24146 }
24147 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024148 D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024149 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
24150 }
24151 _res = NULL;
24152 done:
24153 D(p->level--);
24154 return _res;
24155}
24156
Pablo Galindo4a97b152020-09-02 17:44:19 +010024157// _tmp_144: ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024158static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024159_tmp_144_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024160{
24161 D(p->level++);
24162 if (p->error_indicator) {
24163 D(p->level--);
24164 return NULL;
24165 }
24166 void * _res = NULL;
24167 int _mark = p->mark;
24168 { // ',' expression
24169 if (p->error_indicator) {
24170 D(p->level--);
24171 return NULL;
24172 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024173 D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024174 Token * _literal;
24175 expr_ty c;
24176 if (
24177 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24178 &&
24179 (c = expression_rule(p)) // expression
24180 )
24181 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024182 D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024183 _res = c;
24184 if (_res == NULL && PyErr_Occurred()) {
24185 p->error_indicator = 1;
24186 D(p->level--);
24187 return NULL;
24188 }
24189 goto done;
24190 }
24191 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024192 D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024193 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
24194 }
24195 _res = NULL;
24196 done:
24197 D(p->level--);
24198 return _res;
24199}
24200
Pablo Galindo4a97b152020-09-02 17:44:19 +010024201// _tmp_145: 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024202static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024203_tmp_145_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024204{
24205 D(p->level++);
24206 if (p->error_indicator) {
24207 D(p->level--);
24208 return NULL;
24209 }
24210 void * _res = NULL;
24211 int _mark = p->mark;
24212 { // 'or' conjunction
24213 if (p->error_indicator) {
24214 D(p->level--);
24215 return NULL;
24216 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024217 D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024218 Token * _keyword;
24219 expr_ty c;
24220 if (
24221 (_keyword = _PyPegen_expect_token(p, 531)) // token='or'
24222 &&
24223 (c = conjunction_rule(p)) // conjunction
24224 )
24225 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024226 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 +010024227 _res = c;
24228 if (_res == NULL && PyErr_Occurred()) {
24229 p->error_indicator = 1;
24230 D(p->level--);
24231 return NULL;
24232 }
24233 goto done;
24234 }
24235 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024236 D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024237 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction"));
24238 }
24239 _res = NULL;
24240 done:
24241 D(p->level--);
24242 return _res;
24243}
24244
Pablo Galindo4a97b152020-09-02 17:44:19 +010024245// _tmp_146: 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024246static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024247_tmp_146_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024248{
24249 D(p->level++);
24250 if (p->error_indicator) {
24251 D(p->level--);
24252 return NULL;
24253 }
24254 void * _res = NULL;
24255 int _mark = p->mark;
24256 { // 'and' inversion
24257 if (p->error_indicator) {
24258 D(p->level--);
24259 return NULL;
24260 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024261 D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024262 Token * _keyword;
24263 expr_ty c;
24264 if (
24265 (_keyword = _PyPegen_expect_token(p, 532)) // token='and'
24266 &&
24267 (c = inversion_rule(p)) // inversion
24268 )
24269 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024270 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 +010024271 _res = c;
24272 if (_res == NULL && PyErr_Occurred()) {
24273 p->error_indicator = 1;
24274 D(p->level--);
24275 return NULL;
24276 }
24277 goto done;
24278 }
24279 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024280 D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010024281 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024282 }
24283 _res = NULL;
24284 done:
24285 D(p->level--);
24286 return _res;
24287}
24288
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024289// _tmp_147: 'if' disjunction
24290static void *
24291_tmp_147_rule(Parser *p)
24292{
24293 D(p->level++);
24294 if (p->error_indicator) {
24295 D(p->level--);
24296 return NULL;
24297 }
24298 void * _res = NULL;
24299 int _mark = p->mark;
24300 { // 'if' disjunction
24301 if (p->error_indicator) {
24302 D(p->level--);
24303 return NULL;
24304 }
24305 D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24306 Token * _keyword;
24307 expr_ty z;
24308 if (
24309 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24310 &&
24311 (z = disjunction_rule(p)) // disjunction
24312 )
24313 {
24314 D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24315 _res = z;
24316 if (_res == NULL && PyErr_Occurred()) {
24317 p->error_indicator = 1;
24318 D(p->level--);
24319 return NULL;
24320 }
24321 goto done;
24322 }
24323 p->mark = _mark;
24324 D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
24325 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24326 }
24327 _res = NULL;
24328 done:
24329 D(p->level--);
24330 return _res;
24331}
24332
Pablo Galindo4a97b152020-09-02 17:44:19 +010024333// _tmp_148: 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024334static void *
24335_tmp_148_rule(Parser *p)
24336{
24337 D(p->level++);
24338 if (p->error_indicator) {
24339 D(p->level--);
24340 return NULL;
24341 }
24342 void * _res = NULL;
24343 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024344 { // 'if' disjunction
24345 if (p->error_indicator) {
24346 D(p->level--);
24347 return NULL;
24348 }
24349 D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24350 Token * _keyword;
24351 expr_ty z;
24352 if (
24353 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24354 &&
24355 (z = disjunction_rule(p)) // disjunction
24356 )
24357 {
24358 D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24359 _res = z;
24360 if (_res == NULL && PyErr_Occurred()) {
24361 p->error_indicator = 1;
24362 D(p->level--);
24363 return NULL;
24364 }
24365 goto done;
24366 }
24367 p->mark = _mark;
24368 D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
24369 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24370 }
24371 _res = NULL;
24372 done:
24373 D(p->level--);
24374 return _res;
24375}
24376
24377// _tmp_149: starred_expression | named_expression !'='
24378static void *
24379_tmp_149_rule(Parser *p)
24380{
24381 D(p->level++);
24382 if (p->error_indicator) {
24383 D(p->level--);
24384 return NULL;
24385 }
24386 void * _res = NULL;
24387 int _mark = p->mark;
24388 { // starred_expression
24389 if (p->error_indicator) {
24390 D(p->level--);
24391 return NULL;
24392 }
24393 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
24394 expr_ty starred_expression_var;
24395 if (
24396 (starred_expression_var = starred_expression_rule(p)) // starred_expression
24397 )
24398 {
24399 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
24400 _res = starred_expression_var;
24401 goto done;
24402 }
24403 p->mark = _mark;
24404 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24405 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
24406 }
24407 { // named_expression !'='
24408 if (p->error_indicator) {
24409 D(p->level--);
24410 return NULL;
24411 }
24412 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
24413 expr_ty named_expression_var;
24414 if (
24415 (named_expression_var = named_expression_rule(p)) // named_expression
24416 &&
24417 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
24418 )
24419 {
24420 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
24421 _res = named_expression_var;
24422 goto done;
24423 }
24424 p->mark = _mark;
24425 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24426 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression !'='"));
24427 }
24428 _res = NULL;
24429 done:
24430 D(p->level--);
24431 return _res;
24432}
24433
24434// _tmp_150: ',' star_target
24435static void *
24436_tmp_150_rule(Parser *p)
24437{
24438 D(p->level++);
24439 if (p->error_indicator) {
24440 D(p->level--);
24441 return NULL;
24442 }
24443 void * _res = NULL;
24444 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024445 { // ',' star_target
24446 if (p->error_indicator) {
24447 D(p->level--);
24448 return NULL;
24449 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024450 D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024451 Token * _literal;
24452 expr_ty c;
24453 if (
24454 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24455 &&
24456 (c = star_target_rule(p)) // star_target
24457 )
24458 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024459 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 +010024460 _res = c;
24461 if (_res == NULL && PyErr_Occurred()) {
24462 p->error_indicator = 1;
24463 D(p->level--);
24464 return NULL;
24465 }
24466 goto done;
24467 }
24468 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024469 D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030024470 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024471 }
24472 _res = NULL;
24473 done:
24474 D(p->level--);
24475 return _res;
24476}
24477
Pablo Galindo4a97b152020-09-02 17:44:19 +010024478// _tmp_151: star_targets '='
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024479static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024480_tmp_151_rule(Parser *p)
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024481{
24482 D(p->level++);
24483 if (p->error_indicator) {
24484 D(p->level--);
24485 return NULL;
24486 }
24487 void * _res = NULL;
24488 int _mark = p->mark;
24489 { // star_targets '='
24490 if (p->error_indicator) {
24491 D(p->level--);
24492 return NULL;
24493 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024494 D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024495 Token * _literal;
24496 expr_ty star_targets_var;
24497 if (
24498 (star_targets_var = star_targets_rule(p)) // star_targets
24499 &&
24500 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24501 )
24502 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024503 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 +030024504 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24505 goto done;
24506 }
24507 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024508 D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024509 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24510 }
24511 _res = NULL;
24512 done:
24513 D(p->level--);
24514 return _res;
24515}
24516
Pablo Galindo4a97b152020-09-02 17:44:19 +010024517// _tmp_152: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024518static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024519_tmp_152_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024520{
24521 D(p->level++);
24522 if (p->error_indicator) {
24523 D(p->level--);
24524 return NULL;
24525 }
24526 void * _res = NULL;
24527 int _mark = p->mark;
24528 { // star_targets '='
24529 if (p->error_indicator) {
24530 D(p->level--);
24531 return NULL;
24532 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024533 D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024534 Token * _literal;
24535 expr_ty star_targets_var;
24536 if (
24537 (star_targets_var = star_targets_rule(p)) // star_targets
24538 &&
24539 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24540 )
24541 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024542 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 +010024543 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24544 goto done;
24545 }
24546 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024547 D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024548 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24549 }
24550 _res = NULL;
24551 done:
24552 D(p->level--);
24553 return _res;
24554}
24555
Pablo Galindo4a97b152020-09-02 17:44:19 +010024556// _loop1_153: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024557static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024558_loop1_153_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024559{
24560 D(p->level++);
24561 if (p->error_indicator) {
24562 D(p->level--);
24563 return NULL;
24564 }
24565 void *_res = NULL;
24566 int _mark = p->mark;
24567 int _start_mark = p->mark;
24568 void **_children = PyMem_Malloc(sizeof(void *));
24569 if (!_children) {
24570 p->error_indicator = 1;
24571 PyErr_NoMemory();
24572 D(p->level--);
24573 return NULL;
24574 }
24575 ssize_t _children_capacity = 1;
24576 ssize_t _n = 0;
24577 { // param_with_default
24578 if (p->error_indicator) {
24579 D(p->level--);
24580 return NULL;
24581 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024582 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 +010024583 NameDefaultPair* param_with_default_var;
24584 while (
24585 (param_with_default_var = param_with_default_rule(p)) // param_with_default
24586 )
24587 {
24588 _res = param_with_default_var;
24589 if (_n == _children_capacity) {
24590 _children_capacity *= 2;
24591 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24592 if (!_new_children) {
24593 p->error_indicator = 1;
24594 PyErr_NoMemory();
24595 D(p->level--);
24596 return NULL;
24597 }
24598 _children = _new_children;
24599 }
24600 _children[_n++] = _res;
24601 _mark = p->mark;
24602 }
24603 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024604 D(fprintf(stderr, "%*c%s _loop1_153[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024605 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
24606 }
24607 if (_n == 0 || p->error_indicator) {
24608 PyMem_Free(_children);
24609 D(p->level--);
24610 return NULL;
24611 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024612 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024613 if (!_seq) {
24614 PyMem_Free(_children);
24615 p->error_indicator = 1;
24616 PyErr_NoMemory();
24617 D(p->level--);
24618 return NULL;
24619 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024620 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024621 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010024622 _PyPegen_insert_memo(p, _start_mark, _loop1_153_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024623 D(p->level--);
24624 return _seq;
24625}
24626
Pablo Galindo4a97b152020-09-02 17:44:19 +010024627// _loop1_154: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024628static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024629_loop1_154_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024630{
24631 D(p->level++);
24632 if (p->error_indicator) {
24633 D(p->level--);
24634 return NULL;
24635 }
24636 void *_res = NULL;
24637 int _mark = p->mark;
24638 int _start_mark = p->mark;
24639 void **_children = PyMem_Malloc(sizeof(void *));
24640 if (!_children) {
24641 p->error_indicator = 1;
24642 PyErr_NoMemory();
24643 D(p->level--);
24644 return NULL;
24645 }
24646 ssize_t _children_capacity = 1;
24647 ssize_t _n = 0;
24648 { // lambda_param_with_default
24649 if (p->error_indicator) {
24650 D(p->level--);
24651 return NULL;
24652 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024653 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 +010024654 NameDefaultPair* lambda_param_with_default_var;
24655 while (
24656 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
24657 )
24658 {
24659 _res = lambda_param_with_default_var;
24660 if (_n == _children_capacity) {
24661 _children_capacity *= 2;
24662 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24663 if (!_new_children) {
24664 p->error_indicator = 1;
24665 PyErr_NoMemory();
24666 D(p->level--);
24667 return NULL;
24668 }
24669 _children = _new_children;
24670 }
24671 _children[_n++] = _res;
24672 _mark = p->mark;
24673 }
24674 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024675 D(fprintf(stderr, "%*c%s _loop1_154[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024676 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
24677 }
24678 if (_n == 0 || p->error_indicator) {
24679 PyMem_Free(_children);
24680 D(p->level--);
24681 return NULL;
24682 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024683 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024684 if (!_seq) {
24685 PyMem_Free(_children);
24686 p->error_indicator = 1;
24687 PyErr_NoMemory();
24688 D(p->level--);
24689 return NULL;
24690 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024691 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024692 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010024693 _PyPegen_insert_memo(p, _start_mark, _loop1_154_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024694 D(p->level--);
24695 return _seq;
24696}
24697
Pablo Galindo4a97b152020-09-02 17:44:19 +010024698// _tmp_155: ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024699static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024700_tmp_155_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024701{
24702 D(p->level++);
24703 if (p->error_indicator) {
24704 D(p->level--);
24705 return NULL;
24706 }
24707 void * _res = NULL;
24708 int _mark = p->mark;
24709 { // ')'
24710 if (p->error_indicator) {
24711 D(p->level--);
24712 return NULL;
24713 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024714 D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024715 Token * _literal;
24716 if (
24717 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
24718 )
24719 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024720 D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024721 _res = _literal;
24722 goto done;
24723 }
24724 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024725 D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024726 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
24727 }
24728 { // '**'
24729 if (p->error_indicator) {
24730 D(p->level--);
24731 return NULL;
24732 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024733 D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024734 Token * _literal;
24735 if (
24736 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24737 )
24738 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024739 D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024740 _res = _literal;
24741 goto done;
24742 }
24743 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024744 D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024745 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24746 }
24747 _res = NULL;
24748 done:
24749 D(p->level--);
24750 return _res;
24751}
24752
Pablo Galindo4a97b152020-09-02 17:44:19 +010024753// _tmp_156: ':' | '**'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024754static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024755_tmp_156_rule(Parser *p)
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024756{
24757 D(p->level++);
24758 if (p->error_indicator) {
24759 D(p->level--);
24760 return NULL;
24761 }
24762 void * _res = NULL;
24763 int _mark = p->mark;
24764 { // ':'
24765 if (p->error_indicator) {
24766 D(p->level--);
24767 return NULL;
24768 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024769 D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024770 Token * _literal;
24771 if (
24772 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
24773 )
24774 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024775 D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024776 _res = _literal;
24777 goto done;
24778 }
24779 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024780 D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024781 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024782 }
24783 { // '**'
24784 if (p->error_indicator) {
24785 D(p->level--);
24786 return NULL;
24787 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024788 D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024789 Token * _literal;
24790 if (
24791 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24792 )
24793 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024794 D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024795 _res = _literal;
24796 goto done;
24797 }
24798 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024799 D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024800 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24801 }
24802 _res = NULL;
24803 done:
24804 D(p->level--);
24805 return _res;
24806}
24807
24808void *
24809_PyPegen_parse(Parser *p)
24810{
24811 // Initialize keywords
24812 p->keywords = reserved_keywords;
24813 p->n_keyword_lists = n_keyword_lists;
24814
24815 // Run parser
24816 void *result = NULL;
24817 if (p->start_rule == Py_file_input) {
24818 result = file_rule(p);
24819 } else if (p->start_rule == Py_single_input) {
24820 result = interactive_rule(p);
24821 } else if (p->start_rule == Py_eval_input) {
24822 result = eval_rule(p);
24823 } else if (p->start_rule == Py_func_type_input) {
24824 result = func_type_rule(p);
24825 } else if (p->start_rule == Py_fstring_input) {
24826 result = fstring_rule(p);
24827 }
24828
24829 return result;
24830}
24831
24832// The end