blob: e438f06c9be9a06ca2d7b415808957b7333cb605 [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
Lysandros Nikolaoubca70142020-10-27 00:42:04 +0200212#define invalid_arguments_type 1143
Lysandros Nikolaou01ece632020-06-19 02:10:43 +0300213#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);
Lysandros Nikolaoubca70142020-10-27 00:42:04 +0200530static void *invalid_arguments_rule(Parser *p);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +0100531static 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"));
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +0300981 _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _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"));
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03001083 _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _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
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03001372 _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , CHECK ( stmt_ty , _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
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002080 _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotation syntax is" , _Py_AnnAssign ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002081 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
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002122 _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002123 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 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02002221 if (p->call_invalid_rules) { // invalid_assignment
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002222 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, "'@='"));
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002354 _res = CHECK_VERSION ( AugOperator * , 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002355 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
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002632 _res = _Py_Global ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002633 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
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03002694 _res = _Py_Nonlocal ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01002695 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 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02002894 if (p->call_invalid_rules) { // invalid_del_stmt
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03002895 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, "'*'"));
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03003233 _res = ( asdl_alias_seq * ) _PyPegen_singleton_seq ( p , CHECK ( alias_ty , _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 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02003245 if (p->call_invalid_rules) { // invalid_import_from_targets
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003246 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
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03003591 _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
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03003709 _res = _Py_If ( a , b , CHECK ( asdl_stmt_seq * , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01003710 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
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03004022 _res = CHECK_VERSION ( stmt_ty , 5 , "Async for loops are" , _Py_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004023 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 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02004038 if (p->call_invalid_rules) { // invalid_for_target
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004039 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
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03004227 _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004228 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
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03004275 _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004276 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
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004293// with_item:
4294// | expression 'as' star_target &(',' | ')' | ':')
4295// | invalid_with_item
4296// | expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004297static withitem_ty
4298with_item_rule(Parser *p)
4299{
4300 D(p->level++);
4301 if (p->error_indicator) {
4302 D(p->level--);
4303 return NULL;
4304 }
4305 withitem_ty _res = NULL;
4306 int _mark = p->mark;
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004307 { // expression 'as' star_target &(',' | ')' | ':')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004308 if (p->error_indicator) {
4309 D(p->level--);
4310 return NULL;
4311 }
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004312 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004313 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004314 expr_ty e;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004315 expr_ty t;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004316 if (
4317 (e = expression_rule(p)) // expression
4318 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004319 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
4320 &&
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004321 (t = star_target_rule(p)) // star_target
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004322 &&
4323 _PyPegen_lookahead(1, _tmp_47_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004324 )
4325 {
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004326 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004327 _res = _Py_withitem ( e , t , p -> arena );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004328 if (_res == NULL && PyErr_Occurred()) {
4329 p->error_indicator = 1;
4330 D(p->level--);
4331 return NULL;
4332 }
4333 goto done;
4334 }
4335 p->mark = _mark;
4336 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
Batuhan Taskaya48f305f2020-10-09 12:56:48 +03004337 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004338 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02004339 if (p->call_invalid_rules) { // invalid_with_item
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004340 if (p->error_indicator) {
4341 D(p->level--);
4342 return NULL;
4343 }
4344 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4345 void *invalid_with_item_var;
4346 if (
4347 (invalid_with_item_var = invalid_with_item_rule(p)) // invalid_with_item
4348 )
4349 {
4350 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
4351 _res = invalid_with_item_var;
4352 goto done;
4353 }
4354 p->mark = _mark;
4355 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4356 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item"));
4357 }
4358 { // expression
4359 if (p->error_indicator) {
4360 D(p->level--);
4361 return NULL;
4362 }
4363 D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
4364 expr_ty e;
4365 if (
4366 (e = expression_rule(p)) // expression
4367 )
4368 {
4369 D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
4370 _res = _Py_withitem ( e , NULL , p -> arena );
4371 if (_res == NULL && PyErr_Occurred()) {
4372 p->error_indicator = 1;
4373 D(p->level--);
4374 return NULL;
4375 }
4376 goto done;
4377 }
4378 p->mark = _mark;
4379 D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
4380 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004381 }
4382 _res = NULL;
4383 done:
4384 D(p->level--);
4385 return _res;
4386}
4387
4388// try_stmt:
4389// | 'try' ':' block finally_block
4390// | 'try' ':' block except_block+ else_block? finally_block?
4391static stmt_ty
4392try_stmt_rule(Parser *p)
4393{
4394 D(p->level++);
4395 if (p->error_indicator) {
4396 D(p->level--);
4397 return NULL;
4398 }
4399 stmt_ty _res = NULL;
4400 int _mark = p->mark;
4401 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4402 p->error_indicator = 1;
4403 D(p->level--);
4404 return NULL;
4405 }
4406 int _start_lineno = p->tokens[_mark]->lineno;
4407 UNUSED(_start_lineno); // Only used by EXTRA macro
4408 int _start_col_offset = p->tokens[_mark]->col_offset;
4409 UNUSED(_start_col_offset); // Only used by EXTRA macro
4410 { // 'try' ':' block finally_block
4411 if (p->error_indicator) {
4412 D(p->level--);
4413 return NULL;
4414 }
4415 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4416 Token * _keyword;
4417 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004418 asdl_stmt_seq* b;
4419 asdl_stmt_seq* f;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004420 if (
4421 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4422 &&
4423 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4424 &&
4425 (b = block_rule(p)) // block
4426 &&
4427 (f = finally_block_rule(p)) // finally_block
4428 )
4429 {
4430 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
4431 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4432 if (_token == NULL) {
4433 D(p->level--);
4434 return NULL;
4435 }
4436 int _end_lineno = _token->end_lineno;
4437 UNUSED(_end_lineno); // Only used by EXTRA macro
4438 int _end_col_offset = _token->end_col_offset;
4439 UNUSED(_end_col_offset); // Only used by EXTRA macro
4440 _res = _Py_Try ( b , NULL , NULL , f , EXTRA );
4441 if (_res == NULL && PyErr_Occurred()) {
4442 p->error_indicator = 1;
4443 D(p->level--);
4444 return NULL;
4445 }
4446 goto done;
4447 }
4448 p->mark = _mark;
4449 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4450 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block finally_block"));
4451 }
4452 { // 'try' ':' block except_block+ else_block? finally_block?
4453 if (p->error_indicator) {
4454 D(p->level--);
4455 return NULL;
4456 }
4457 D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4458 Token * _keyword;
4459 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004460 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004461 void *el;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004462 asdl_excepthandler_seq* ex;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004463 void *f;
4464 if (
4465 (_keyword = _PyPegen_expect_token(p, 511)) // token='try'
4466 &&
4467 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4468 &&
4469 (b = block_rule(p)) // block
4470 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01004471 (ex = (asdl_excepthandler_seq*)_loop1_48_rule(p)) // except_block+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004472 &&
4473 (el = else_block_rule(p), 1) // else_block?
4474 &&
4475 (f = finally_block_rule(p), 1) // finally_block?
4476 )
4477 {
4478 D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4479 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4480 if (_token == NULL) {
4481 D(p->level--);
4482 return NULL;
4483 }
4484 int _end_lineno = _token->end_lineno;
4485 UNUSED(_end_lineno); // Only used by EXTRA macro
4486 int _end_col_offset = _token->end_col_offset;
4487 UNUSED(_end_col_offset); // Only used by EXTRA macro
4488 _res = _Py_Try ( b , ex , el , f , EXTRA );
4489 if (_res == NULL && PyErr_Occurred()) {
4490 p->error_indicator = 1;
4491 D(p->level--);
4492 return NULL;
4493 }
4494 goto done;
4495 }
4496 p->mark = _mark;
4497 D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4498 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
4499 }
4500 _res = NULL;
4501 done:
4502 D(p->level--);
4503 return _res;
4504}
4505
4506// except_block: 'except' expression ['as' NAME] ':' block | 'except' ':' block
4507static excepthandler_ty
4508except_block_rule(Parser *p)
4509{
4510 D(p->level++);
4511 if (p->error_indicator) {
4512 D(p->level--);
4513 return NULL;
4514 }
4515 excepthandler_ty _res = NULL;
4516 int _mark = p->mark;
4517 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4518 p->error_indicator = 1;
4519 D(p->level--);
4520 return NULL;
4521 }
4522 int _start_lineno = p->tokens[_mark]->lineno;
4523 UNUSED(_start_lineno); // Only used by EXTRA macro
4524 int _start_col_offset = p->tokens[_mark]->col_offset;
4525 UNUSED(_start_col_offset); // Only used by EXTRA macro
4526 { // 'except' expression ['as' NAME] ':' block
4527 if (p->error_indicator) {
4528 D(p->level--);
4529 return NULL;
4530 }
4531 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4532 Token * _keyword;
4533 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004534 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004535 expr_ty e;
4536 void *t;
4537 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004538 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004539 &&
4540 (e = expression_rule(p)) // expression
4541 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004542 (t = _tmp_49_rule(p), 1) // ['as' NAME]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004543 &&
4544 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4545 &&
4546 (b = block_rule(p)) // block
4547 )
4548 {
4549 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4550 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4551 if (_token == NULL) {
4552 D(p->level--);
4553 return NULL;
4554 }
4555 int _end_lineno = _token->end_lineno;
4556 UNUSED(_end_lineno); // Only used by EXTRA macro
4557 int _end_col_offset = _token->end_col_offset;
4558 UNUSED(_end_col_offset); // Only used by EXTRA macro
4559 _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
4560 if (_res == NULL && PyErr_Occurred()) {
4561 p->error_indicator = 1;
4562 D(p->level--);
4563 return NULL;
4564 }
4565 goto done;
4566 }
4567 p->mark = _mark;
4568 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4569 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
4570 }
4571 { // 'except' ':' block
4572 if (p->error_indicator) {
4573 D(p->level--);
4574 return NULL;
4575 }
4576 D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4577 Token * _keyword;
4578 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004579 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004580 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004581 (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004582 &&
4583 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4584 &&
4585 (b = block_rule(p)) // block
4586 )
4587 {
4588 D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
4589 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4590 if (_token == NULL) {
4591 D(p->level--);
4592 return NULL;
4593 }
4594 int _end_lineno = _token->end_lineno;
4595 UNUSED(_end_lineno); // Only used by EXTRA macro
4596 int _end_col_offset = _token->end_col_offset;
4597 UNUSED(_end_col_offset); // Only used by EXTRA macro
4598 _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
4599 if (_res == NULL && PyErr_Occurred()) {
4600 p->error_indicator = 1;
4601 D(p->level--);
4602 return NULL;
4603 }
4604 goto done;
4605 }
4606 p->mark = _mark;
4607 D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
4608 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block"));
4609 }
4610 _res = NULL;
4611 done:
4612 D(p->level--);
4613 return _res;
4614}
4615
4616// finally_block: 'finally' ':' block
Pablo Galindoa5634c42020-09-16 19:42:00 +01004617static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004618finally_block_rule(Parser *p)
4619{
4620 D(p->level++);
4621 if (p->error_indicator) {
4622 D(p->level--);
4623 return NULL;
4624 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01004625 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004626 int _mark = p->mark;
4627 { // 'finally' ':' block
4628 if (p->error_indicator) {
4629 D(p->level--);
4630 return NULL;
4631 }
4632 D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4633 Token * _keyword;
4634 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004635 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004636 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004637 (_keyword = _PyPegen_expect_token(p, 522)) // token='finally'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004638 &&
4639 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
4640 &&
4641 (a = block_rule(p)) // block
4642 )
4643 {
4644 D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
4645 _res = a;
4646 if (_res == NULL && PyErr_Occurred()) {
4647 p->error_indicator = 1;
4648 D(p->level--);
4649 return NULL;
4650 }
4651 goto done;
4652 }
4653 p->mark = _mark;
4654 D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
4655 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block"));
4656 }
4657 _res = NULL;
4658 done:
4659 D(p->level--);
4660 return _res;
4661}
4662
4663// return_stmt: 'return' star_expressions?
4664static stmt_ty
4665return_stmt_rule(Parser *p)
4666{
4667 D(p->level++);
4668 if (p->error_indicator) {
4669 D(p->level--);
4670 return NULL;
4671 }
4672 stmt_ty _res = NULL;
4673 int _mark = p->mark;
4674 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4675 p->error_indicator = 1;
4676 D(p->level--);
4677 return NULL;
4678 }
4679 int _start_lineno = p->tokens[_mark]->lineno;
4680 UNUSED(_start_lineno); // Only used by EXTRA macro
4681 int _start_col_offset = p->tokens[_mark]->col_offset;
4682 UNUSED(_start_col_offset); // Only used by EXTRA macro
4683 { // 'return' star_expressions?
4684 if (p->error_indicator) {
4685 D(p->level--);
4686 return NULL;
4687 }
4688 D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4689 Token * _keyword;
4690 void *a;
4691 if (
4692 (_keyword = _PyPegen_expect_token(p, 500)) // token='return'
4693 &&
4694 (a = star_expressions_rule(p), 1) // star_expressions?
4695 )
4696 {
4697 D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
4698 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4699 if (_token == NULL) {
4700 D(p->level--);
4701 return NULL;
4702 }
4703 int _end_lineno = _token->end_lineno;
4704 UNUSED(_end_lineno); // Only used by EXTRA macro
4705 int _end_col_offset = _token->end_col_offset;
4706 UNUSED(_end_col_offset); // Only used by EXTRA macro
4707 _res = _Py_Return ( a , EXTRA );
4708 if (_res == NULL && PyErr_Occurred()) {
4709 p->error_indicator = 1;
4710 D(p->level--);
4711 return NULL;
4712 }
4713 goto done;
4714 }
4715 p->mark = _mark;
4716 D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4717 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
4718 }
4719 _res = NULL;
4720 done:
4721 D(p->level--);
4722 return _res;
4723}
4724
4725// raise_stmt: 'raise' expression ['from' expression] | 'raise'
4726static stmt_ty
4727raise_stmt_rule(Parser *p)
4728{
4729 D(p->level++);
4730 if (p->error_indicator) {
4731 D(p->level--);
4732 return NULL;
4733 }
4734 stmt_ty _res = NULL;
4735 int _mark = p->mark;
4736 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4737 p->error_indicator = 1;
4738 D(p->level--);
4739 return NULL;
4740 }
4741 int _start_lineno = p->tokens[_mark]->lineno;
4742 UNUSED(_start_lineno); // Only used by EXTRA macro
4743 int _start_col_offset = p->tokens[_mark]->col_offset;
4744 UNUSED(_start_col_offset); // Only used by EXTRA macro
4745 { // 'raise' expression ['from' expression]
4746 if (p->error_indicator) {
4747 D(p->level--);
4748 return NULL;
4749 }
4750 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4751 Token * _keyword;
4752 expr_ty a;
4753 void *b;
4754 if (
4755 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4756 &&
4757 (a = expression_rule(p)) // expression
4758 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004759 (b = _tmp_50_rule(p), 1) // ['from' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004760 )
4761 {
4762 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
4763 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4764 if (_token == NULL) {
4765 D(p->level--);
4766 return NULL;
4767 }
4768 int _end_lineno = _token->end_lineno;
4769 UNUSED(_end_lineno); // Only used by EXTRA macro
4770 int _end_col_offset = _token->end_col_offset;
4771 UNUSED(_end_col_offset); // Only used by EXTRA macro
4772 _res = _Py_Raise ( a , b , EXTRA );
4773 if (_res == NULL && PyErr_Occurred()) {
4774 p->error_indicator = 1;
4775 D(p->level--);
4776 return NULL;
4777 }
4778 goto done;
4779 }
4780 p->mark = _mark;
4781 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4782 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
4783 }
4784 { // 'raise'
4785 if (p->error_indicator) {
4786 D(p->level--);
4787 return NULL;
4788 }
4789 D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
4790 Token * _keyword;
4791 if (
4792 (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
4793 )
4794 {
4795 D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
4796 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4797 if (_token == NULL) {
4798 D(p->level--);
4799 return NULL;
4800 }
4801 int _end_lineno = _token->end_lineno;
4802 UNUSED(_end_lineno); // Only used by EXTRA macro
4803 int _end_col_offset = _token->end_col_offset;
4804 UNUSED(_end_col_offset); // Only used by EXTRA macro
4805 _res = _Py_Raise ( NULL , NULL , EXTRA );
4806 if (_res == NULL && PyErr_Occurred()) {
4807 p->error_indicator = 1;
4808 D(p->level--);
4809 return NULL;
4810 }
4811 goto done;
4812 }
4813 p->mark = _mark;
4814 D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
4815 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
4816 }
4817 _res = NULL;
4818 done:
4819 D(p->level--);
4820 return _res;
4821}
4822
4823// function_def: decorators function_def_raw | function_def_raw
4824static stmt_ty
4825function_def_rule(Parser *p)
4826{
4827 D(p->level++);
4828 if (p->error_indicator) {
4829 D(p->level--);
4830 return NULL;
4831 }
4832 stmt_ty _res = NULL;
4833 int _mark = p->mark;
4834 { // decorators function_def_raw
4835 if (p->error_indicator) {
4836 D(p->level--);
4837 return NULL;
4838 }
4839 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 +01004840 asdl_expr_seq* d;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004841 stmt_ty f;
4842 if (
4843 (d = decorators_rule(p)) // decorators
4844 &&
4845 (f = function_def_raw_rule(p)) // function_def_raw
4846 )
4847 {
4848 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
4849 _res = _PyPegen_function_def_decorators ( p , d , f );
4850 if (_res == NULL && PyErr_Occurred()) {
4851 p->error_indicator = 1;
4852 D(p->level--);
4853 return NULL;
4854 }
4855 goto done;
4856 }
4857 p->mark = _mark;
4858 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4859 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
4860 }
4861 { // function_def_raw
4862 if (p->error_indicator) {
4863 D(p->level--);
4864 return NULL;
4865 }
4866 D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4867 stmt_ty function_def_raw_var;
4868 if (
4869 (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw
4870 )
4871 {
4872 D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
4873 _res = function_def_raw_var;
4874 goto done;
4875 }
4876 p->mark = _mark;
4877 D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
4878 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
4879 }
4880 _res = NULL;
4881 done:
4882 D(p->level--);
4883 return _res;
4884}
4885
4886// function_def_raw:
4887// | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4888// | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4889static stmt_ty
4890function_def_raw_rule(Parser *p)
4891{
4892 D(p->level++);
4893 if (p->error_indicator) {
4894 D(p->level--);
4895 return NULL;
4896 }
4897 stmt_ty _res = NULL;
4898 int _mark = p->mark;
4899 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
4900 p->error_indicator = 1;
4901 D(p->level--);
4902 return NULL;
4903 }
4904 int _start_lineno = p->tokens[_mark]->lineno;
4905 UNUSED(_start_lineno); // Only used by EXTRA macro
4906 int _start_col_offset = p->tokens[_mark]->col_offset;
4907 UNUSED(_start_col_offset); // Only used by EXTRA macro
4908 { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4909 if (p->error_indicator) {
4910 D(p->level--);
4911 return NULL;
4912 }
4913 D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4914 Token * _keyword;
4915 Token * _literal;
4916 Token * _literal_1;
4917 Token * _literal_2;
4918 void *a;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004919 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004920 expr_ty n;
4921 void *params;
4922 void *tc;
4923 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004924 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004925 &&
4926 (n = _PyPegen_name_token(p)) // NAME
4927 &&
4928 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4929 &&
4930 (params = params_rule(p), 1) // params?
4931 &&
4932 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4933 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004934 (a = _tmp_51_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004935 &&
4936 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4937 &&
4938 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4939 &&
4940 (b = block_rule(p)) // block
4941 )
4942 {
4943 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"));
4944 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
4945 if (_token == NULL) {
4946 D(p->level--);
4947 return NULL;
4948 }
4949 int _end_lineno = _token->end_lineno;
4950 UNUSED(_end_lineno); // Only used by EXTRA macro
4951 int _end_col_offset = _token->end_col_offset;
4952 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03004953 _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004954 if (_res == NULL && PyErr_Occurred()) {
4955 p->error_indicator = 1;
4956 D(p->level--);
4957 return NULL;
4958 }
4959 goto done;
4960 }
4961 p->mark = _mark;
4962 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
4963 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
4964 }
4965 { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
4966 if (p->error_indicator) {
4967 D(p->level--);
4968 return NULL;
4969 }
4970 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"));
4971 Token * _keyword;
4972 Token * _literal;
4973 Token * _literal_1;
4974 Token * _literal_2;
4975 void *a;
4976 Token * async_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +01004977 asdl_stmt_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004978 expr_ty n;
4979 void *params;
4980 void *tc;
4981 if (
4982 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
4983 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004984 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004985 &&
4986 (n = _PyPegen_name_token(p)) // NAME
4987 &&
4988 (_literal = _PyPegen_expect_token(p, 7)) // token='('
4989 &&
4990 (params = params_rule(p), 1) // params?
4991 &&
4992 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
4993 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03004994 (a = _tmp_52_rule(p), 1) // ['->' expression]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01004995 &&
4996 (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':'
4997 &&
4998 (tc = func_type_comment_rule(p), 1) // func_type_comment?
4999 &&
5000 (b = block_rule(p)) // block
5001 )
5002 {
5003 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"));
5004 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
5005 if (_token == NULL) {
5006 D(p->level--);
5007 return NULL;
5008 }
5009 int _end_lineno = _token->end_lineno;
5010 UNUSED(_end_lineno); // Only used by EXTRA macro
5011 int _end_col_offset = _token->end_col_offset;
5012 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03005013 _res = CHECK_VERSION ( stmt_ty , 5 , "Async functions are" , _Py_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005014 if (_res == NULL && PyErr_Occurred()) {
5015 p->error_indicator = 1;
5016 D(p->level--);
5017 return NULL;
5018 }
5019 goto done;
5020 }
5021 p->mark = _mark;
5022 D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
5023 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
5024 }
5025 _res = NULL;
5026 done:
5027 D(p->level--);
5028 return _res;
5029}
5030
5031// func_type_comment:
5032// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5033// | invalid_double_type_comments
5034// | TYPE_COMMENT
5035static Token*
5036func_type_comment_rule(Parser *p)
5037{
5038 D(p->level++);
5039 if (p->error_indicator) {
5040 D(p->level--);
5041 return NULL;
5042 }
5043 Token* _res = NULL;
5044 int _mark = p->mark;
5045 { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
5046 if (p->error_indicator) {
5047 D(p->level--);
5048 return NULL;
5049 }
5050 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5051 Token * newline_var;
5052 Token * t;
5053 if (
5054 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
5055 &&
5056 (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5057 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005058 _PyPegen_lookahead(1, _tmp_53_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005059 )
5060 {
5061 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5062 _res = t;
5063 if (_res == NULL && PyErr_Occurred()) {
5064 p->error_indicator = 1;
5065 D(p->level--);
5066 return NULL;
5067 }
5068 goto done;
5069 }
5070 p->mark = _mark;
5071 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5072 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
5073 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02005074 if (p->call_invalid_rules) { // invalid_double_type_comments
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005075 if (p->error_indicator) {
5076 D(p->level--);
5077 return NULL;
5078 }
5079 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5080 void *invalid_double_type_comments_var;
5081 if (
5082 (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments
5083 )
5084 {
5085 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
5086 _res = invalid_double_type_comments_var;
5087 goto done;
5088 }
5089 p->mark = _mark;
5090 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5091 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
5092 }
5093 { // TYPE_COMMENT
5094 if (p->error_indicator) {
5095 D(p->level--);
5096 return NULL;
5097 }
5098 D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5099 Token * type_comment_var;
5100 if (
5101 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
5102 )
5103 {
5104 D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
5105 _res = type_comment_var;
5106 goto done;
5107 }
5108 p->mark = _mark;
5109 D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
5110 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
5111 }
5112 _res = NULL;
5113 done:
5114 D(p->level--);
5115 return _res;
5116}
5117
5118// params: invalid_parameters | parameters
5119static arguments_ty
5120params_rule(Parser *p)
5121{
5122 D(p->level++);
5123 if (p->error_indicator) {
5124 D(p->level--);
5125 return NULL;
5126 }
5127 arguments_ty _res = NULL;
5128 int _mark = p->mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02005129 if (p->call_invalid_rules) { // invalid_parameters
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005130 if (p->error_indicator) {
5131 D(p->level--);
5132 return NULL;
5133 }
5134 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5135 void *invalid_parameters_var;
5136 if (
5137 (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters
5138 )
5139 {
5140 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
5141 _res = invalid_parameters_var;
5142 goto done;
5143 }
5144 p->mark = _mark;
5145 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5146 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
5147 }
5148 { // parameters
5149 if (p->error_indicator) {
5150 D(p->level--);
5151 return NULL;
5152 }
5153 D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
5154 arguments_ty parameters_var;
5155 if (
5156 (parameters_var = parameters_rule(p)) // parameters
5157 )
5158 {
5159 D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
5160 _res = parameters_var;
5161 goto done;
5162 }
5163 p->mark = _mark;
5164 D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
5165 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
5166 }
5167 _res = NULL;
5168 done:
5169 D(p->level--);
5170 return _res;
5171}
5172
5173// parameters:
5174// | slash_no_default param_no_default* param_with_default* star_etc?
5175// | slash_with_default param_with_default* star_etc?
5176// | param_no_default+ param_with_default* star_etc?
5177// | param_with_default+ star_etc?
5178// | star_etc
5179static arguments_ty
5180parameters_rule(Parser *p)
5181{
5182 D(p->level++);
5183 if (p->error_indicator) {
5184 D(p->level--);
5185 return NULL;
5186 }
5187 arguments_ty _res = NULL;
5188 int _mark = p->mark;
5189 { // slash_no_default param_no_default* param_with_default* star_etc?
5190 if (p->error_indicator) {
5191 D(p->level--);
5192 return NULL;
5193 }
5194 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 +01005195 asdl_arg_seq* a;
5196 asdl_arg_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005197 asdl_seq * c;
5198 void *d;
5199 if (
5200 (a = slash_no_default_rule(p)) // slash_no_default
5201 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01005202 (b = (asdl_arg_seq*)_loop0_54_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005203 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005204 (c = _loop0_55_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005205 &&
5206 (d = star_etc_rule(p), 1) // star_etc?
5207 )
5208 {
5209 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?"));
5210 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
5211 if (_res == NULL && PyErr_Occurred()) {
5212 p->error_indicator = 1;
5213 D(p->level--);
5214 return NULL;
5215 }
5216 goto done;
5217 }
5218 p->mark = _mark;
5219 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5220 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
5221 }
5222 { // slash_with_default param_with_default* star_etc?
5223 if (p->error_indicator) {
5224 D(p->level--);
5225 return NULL;
5226 }
5227 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5228 SlashWithDefault* a;
5229 asdl_seq * b;
5230 void *c;
5231 if (
5232 (a = slash_with_default_rule(p)) // slash_with_default
5233 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005234 (b = _loop0_56_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005235 &&
5236 (c = star_etc_rule(p), 1) // star_etc?
5237 )
5238 {
5239 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5240 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
5241 if (_res == NULL && PyErr_Occurred()) {
5242 p->error_indicator = 1;
5243 D(p->level--);
5244 return NULL;
5245 }
5246 goto done;
5247 }
5248 p->mark = _mark;
5249 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5250 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
5251 }
5252 { // param_no_default+ param_with_default* star_etc?
5253 if (p->error_indicator) {
5254 D(p->level--);
5255 return NULL;
5256 }
5257 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 +01005258 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005259 asdl_seq * b;
5260 void *c;
5261 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01005262 (a = (asdl_arg_seq*)_loop1_57_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005263 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005264 (b = _loop0_58_rule(p)) // param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005265 &&
5266 (c = star_etc_rule(p), 1) // star_etc?
5267 )
5268 {
5269 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5270 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
5271 if (_res == NULL && PyErr_Occurred()) {
5272 p->error_indicator = 1;
5273 D(p->level--);
5274 return NULL;
5275 }
5276 goto done;
5277 }
5278 p->mark = _mark;
5279 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5280 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
5281 }
5282 { // param_with_default+ star_etc?
5283 if (p->error_indicator) {
5284 D(p->level--);
5285 return NULL;
5286 }
5287 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5288 asdl_seq * a;
5289 void *b;
5290 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005291 (a = _loop1_59_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005292 &&
5293 (b = star_etc_rule(p), 1) // star_etc?
5294 )
5295 {
5296 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
5297 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
5298 if (_res == NULL && PyErr_Occurred()) {
5299 p->error_indicator = 1;
5300 D(p->level--);
5301 return NULL;
5302 }
5303 goto done;
5304 }
5305 p->mark = _mark;
5306 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5307 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
5308 }
5309 { // star_etc
5310 if (p->error_indicator) {
5311 D(p->level--);
5312 return NULL;
5313 }
5314 D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
5315 StarEtc* a;
5316 if (
5317 (a = star_etc_rule(p)) // star_etc
5318 )
5319 {
5320 D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
5321 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
5322 if (_res == NULL && PyErr_Occurred()) {
5323 p->error_indicator = 1;
5324 D(p->level--);
5325 return NULL;
5326 }
5327 goto done;
5328 }
5329 p->mark = _mark;
5330 D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
5331 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
5332 }
5333 _res = NULL;
5334 done:
5335 D(p->level--);
5336 return _res;
5337}
5338
5339// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
Pablo Galindoa5634c42020-09-16 19:42:00 +01005340static asdl_arg_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005341slash_no_default_rule(Parser *p)
5342{
5343 D(p->level++);
5344 if (p->error_indicator) {
5345 D(p->level--);
5346 return NULL;
5347 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01005348 asdl_arg_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005349 int _mark = p->mark;
5350 { // param_no_default+ '/' ','
5351 if (p->error_indicator) {
5352 D(p->level--);
5353 return NULL;
5354 }
5355 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5356 Token * _literal;
5357 Token * _literal_1;
Pablo Galindoa5634c42020-09-16 19:42:00 +01005358 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005359 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01005360 (a = (asdl_arg_seq*)_loop1_60_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005361 &&
5362 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5363 &&
5364 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5365 )
5366 {
5367 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
5368 _res = a;
5369 if (_res == NULL && PyErr_Occurred()) {
5370 p->error_indicator = 1;
5371 D(p->level--);
5372 return NULL;
5373 }
5374 goto done;
5375 }
5376 p->mark = _mark;
5377 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5378 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
5379 }
5380 { // param_no_default+ '/' &')'
5381 if (p->error_indicator) {
5382 D(p->level--);
5383 return NULL;
5384 }
5385 D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5386 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01005387 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005388 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01005389 (a = (asdl_arg_seq*)_loop1_61_rule(p)) // param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005390 &&
5391 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5392 &&
5393 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5394 )
5395 {
5396 D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
5397 _res = a;
5398 if (_res == NULL && PyErr_Occurred()) {
5399 p->error_indicator = 1;
5400 D(p->level--);
5401 return NULL;
5402 }
5403 goto done;
5404 }
5405 p->mark = _mark;
5406 D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5407 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
5408 }
5409 _res = NULL;
5410 done:
5411 D(p->level--);
5412 return _res;
5413}
5414
5415// slash_with_default:
5416// | param_no_default* param_with_default+ '/' ','
5417// | param_no_default* param_with_default+ '/' &')'
5418static SlashWithDefault*
5419slash_with_default_rule(Parser *p)
5420{
5421 D(p->level++);
5422 if (p->error_indicator) {
5423 D(p->level--);
5424 return NULL;
5425 }
5426 SlashWithDefault* _res = NULL;
5427 int _mark = p->mark;
5428 { // param_no_default* param_with_default+ '/' ','
5429 if (p->error_indicator) {
5430 D(p->level--);
5431 return NULL;
5432 }
5433 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5434 Token * _literal;
5435 Token * _literal_1;
5436 asdl_seq * a;
5437 asdl_seq * b;
5438 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005439 (a = _loop0_62_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005440 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005441 (b = _loop1_63_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005442 &&
5443 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5444 &&
5445 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5446 )
5447 {
5448 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 +01005449 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005450 if (_res == NULL && PyErr_Occurred()) {
5451 p->error_indicator = 1;
5452 D(p->level--);
5453 return NULL;
5454 }
5455 goto done;
5456 }
5457 p->mark = _mark;
5458 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5459 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
5460 }
5461 { // param_no_default* param_with_default+ '/' &')'
5462 if (p->error_indicator) {
5463 D(p->level--);
5464 return NULL;
5465 }
5466 D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5467 Token * _literal;
5468 asdl_seq * a;
5469 asdl_seq * b;
5470 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005471 (a = _loop0_64_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005472 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005473 (b = _loop1_65_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005474 &&
5475 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
5476 &&
5477 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5478 )
5479 {
5480 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 +01005481 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005482 if (_res == NULL && PyErr_Occurred()) {
5483 p->error_indicator = 1;
5484 D(p->level--);
5485 return NULL;
5486 }
5487 goto done;
5488 }
5489 p->mark = _mark;
5490 D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5491 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
5492 }
5493 _res = NULL;
5494 done:
5495 D(p->level--);
5496 return _res;
5497}
5498
5499// star_etc:
5500// | '*' param_no_default param_maybe_default* kwds?
5501// | '*' ',' param_maybe_default+ kwds?
5502// | kwds
5503// | invalid_star_etc
5504static StarEtc*
5505star_etc_rule(Parser *p)
5506{
5507 D(p->level++);
5508 if (p->error_indicator) {
5509 D(p->level--);
5510 return NULL;
5511 }
5512 StarEtc* _res = NULL;
5513 int _mark = p->mark;
5514 { // '*' param_no_default param_maybe_default* kwds?
5515 if (p->error_indicator) {
5516 D(p->level--);
5517 return NULL;
5518 }
5519 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5520 Token * _literal;
5521 arg_ty a;
5522 asdl_seq * b;
5523 void *c;
5524 if (
5525 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5526 &&
5527 (a = param_no_default_rule(p)) // param_no_default
5528 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005529 (b = _loop0_66_rule(p)) // param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005530 &&
5531 (c = kwds_rule(p), 1) // kwds?
5532 )
5533 {
5534 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5535 _res = _PyPegen_star_etc ( p , a , b , c );
5536 if (_res == NULL && PyErr_Occurred()) {
5537 p->error_indicator = 1;
5538 D(p->level--);
5539 return NULL;
5540 }
5541 goto done;
5542 }
5543 p->mark = _mark;
5544 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5545 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
5546 }
5547 { // '*' ',' param_maybe_default+ kwds?
5548 if (p->error_indicator) {
5549 D(p->level--);
5550 return NULL;
5551 }
5552 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5553 Token * _literal;
5554 Token * _literal_1;
5555 asdl_seq * b;
5556 void *c;
5557 if (
5558 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
5559 &&
5560 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
5561 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03005562 (b = _loop1_67_rule(p)) // param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005563 &&
5564 (c = kwds_rule(p), 1) // kwds?
5565 )
5566 {
5567 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5568 _res = _PyPegen_star_etc ( p , NULL , b , c );
5569 if (_res == NULL && PyErr_Occurred()) {
5570 p->error_indicator = 1;
5571 D(p->level--);
5572 return NULL;
5573 }
5574 goto done;
5575 }
5576 p->mark = _mark;
5577 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5578 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
5579 }
5580 { // kwds
5581 if (p->error_indicator) {
5582 D(p->level--);
5583 return NULL;
5584 }
5585 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
5586 arg_ty a;
5587 if (
5588 (a = kwds_rule(p)) // kwds
5589 )
5590 {
5591 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
5592 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
5593 if (_res == NULL && PyErr_Occurred()) {
5594 p->error_indicator = 1;
5595 D(p->level--);
5596 return NULL;
5597 }
5598 goto done;
5599 }
5600 p->mark = _mark;
5601 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5602 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
5603 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02005604 if (p->call_invalid_rules) { // invalid_star_etc
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01005605 if (p->error_indicator) {
5606 D(p->level--);
5607 return NULL;
5608 }
5609 D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5610 void *invalid_star_etc_var;
5611 if (
5612 (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc
5613 )
5614 {
5615 D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
5616 _res = invalid_star_etc_var;
5617 goto done;
5618 }
5619 p->mark = _mark;
5620 D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
5621 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
5622 }
5623 _res = NULL;
5624 done:
5625 D(p->level--);
5626 return _res;
5627}
5628
5629// kwds: '**' param_no_default
5630static arg_ty
5631kwds_rule(Parser *p)
5632{
5633 D(p->level++);
5634 if (p->error_indicator) {
5635 D(p->level--);
5636 return NULL;
5637 }
5638 arg_ty _res = NULL;
5639 int _mark = p->mark;
5640 { // '**' param_no_default
5641 if (p->error_indicator) {
5642 D(p->level--);
5643 return NULL;
5644 }
5645 D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5646 Token * _literal;
5647 arg_ty a;
5648 if (
5649 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
5650 &&
5651 (a = param_no_default_rule(p)) // param_no_default
5652 )
5653 {
5654 D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
5655 _res = a;
5656 if (_res == NULL && PyErr_Occurred()) {
5657 p->error_indicator = 1;
5658 D(p->level--);
5659 return NULL;
5660 }
5661 goto done;
5662 }
5663 p->mark = _mark;
5664 D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
5665 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
5666 }
5667 _res = NULL;
5668 done:
5669 D(p->level--);
5670 return _res;
5671}
5672
5673// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
5674static arg_ty
5675param_no_default_rule(Parser *p)
5676{
5677 D(p->level++);
5678 if (p->error_indicator) {
5679 D(p->level--);
5680 return NULL;
5681 }
5682 arg_ty _res = NULL;
5683 int _mark = p->mark;
5684 { // param ',' TYPE_COMMENT?
5685 if (p->error_indicator) {
5686 D(p->level--);
5687 return NULL;
5688 }
5689 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5690 Token * _literal;
5691 arg_ty a;
5692 void *tc;
5693 if (
5694 (a = param_rule(p)) // param
5695 &&
5696 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5697 &&
5698 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5699 )
5700 {
5701 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
5702 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5703 if (_res == NULL && PyErr_Occurred()) {
5704 p->error_indicator = 1;
5705 D(p->level--);
5706 return NULL;
5707 }
5708 goto done;
5709 }
5710 p->mark = _mark;
5711 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5712 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
5713 }
5714 { // param TYPE_COMMENT? &')'
5715 if (p->error_indicator) {
5716 D(p->level--);
5717 return NULL;
5718 }
5719 D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5720 arg_ty a;
5721 void *tc;
5722 if (
5723 (a = param_rule(p)) // param
5724 &&
5725 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5726 &&
5727 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5728 )
5729 {
5730 D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
5731 _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
5732 if (_res == NULL && PyErr_Occurred()) {
5733 p->error_indicator = 1;
5734 D(p->level--);
5735 return NULL;
5736 }
5737 goto done;
5738 }
5739 p->mark = _mark;
5740 D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
5741 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
5742 }
5743 _res = NULL;
5744 done:
5745 D(p->level--);
5746 return _res;
5747}
5748
5749// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
5750static NameDefaultPair*
5751param_with_default_rule(Parser *p)
5752{
5753 D(p->level++);
5754 if (p->error_indicator) {
5755 D(p->level--);
5756 return NULL;
5757 }
5758 NameDefaultPair* _res = NULL;
5759 int _mark = p->mark;
5760 { // param default ',' TYPE_COMMENT?
5761 if (p->error_indicator) {
5762 D(p->level--);
5763 return NULL;
5764 }
5765 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5766 Token * _literal;
5767 arg_ty a;
5768 expr_ty c;
5769 void *tc;
5770 if (
5771 (a = param_rule(p)) // param
5772 &&
5773 (c = default_rule(p)) // default
5774 &&
5775 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5776 &&
5777 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5778 )
5779 {
5780 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5781 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5782 if (_res == NULL && PyErr_Occurred()) {
5783 p->error_indicator = 1;
5784 D(p->level--);
5785 return NULL;
5786 }
5787 goto done;
5788 }
5789 p->mark = _mark;
5790 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5791 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
5792 }
5793 { // param default TYPE_COMMENT? &')'
5794 if (p->error_indicator) {
5795 D(p->level--);
5796 return NULL;
5797 }
5798 D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5799 arg_ty a;
5800 expr_ty c;
5801 void *tc;
5802 if (
5803 (a = param_rule(p)) // param
5804 &&
5805 (c = default_rule(p)) // default
5806 &&
5807 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5808 &&
5809 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5810 )
5811 {
5812 D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5813 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5814 if (_res == NULL && PyErr_Occurred()) {
5815 p->error_indicator = 1;
5816 D(p->level--);
5817 return NULL;
5818 }
5819 goto done;
5820 }
5821 p->mark = _mark;
5822 D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
5823 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
5824 }
5825 _res = NULL;
5826 done:
5827 D(p->level--);
5828 return _res;
5829}
5830
5831// param_maybe_default:
5832// | param default? ',' TYPE_COMMENT?
5833// | param default? TYPE_COMMENT? &')'
5834static NameDefaultPair*
5835param_maybe_default_rule(Parser *p)
5836{
5837 D(p->level++);
5838 if (p->error_indicator) {
5839 D(p->level--);
5840 return NULL;
5841 }
5842 NameDefaultPair* _res = NULL;
5843 int _mark = p->mark;
5844 { // param default? ',' TYPE_COMMENT?
5845 if (p->error_indicator) {
5846 D(p->level--);
5847 return NULL;
5848 }
5849 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5850 Token * _literal;
5851 arg_ty a;
5852 void *c;
5853 void *tc;
5854 if (
5855 (a = param_rule(p)) // param
5856 &&
5857 (c = default_rule(p), 1) // default?
5858 &&
5859 (_literal = _PyPegen_expect_token(p, 12)) // token=','
5860 &&
5861 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5862 )
5863 {
5864 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5865 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5866 if (_res == NULL && PyErr_Occurred()) {
5867 p->error_indicator = 1;
5868 D(p->level--);
5869 return NULL;
5870 }
5871 goto done;
5872 }
5873 p->mark = _mark;
5874 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5875 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
5876 }
5877 { // param default? TYPE_COMMENT? &')'
5878 if (p->error_indicator) {
5879 D(p->level--);
5880 return NULL;
5881 }
5882 D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5883 arg_ty a;
5884 void *c;
5885 void *tc;
5886 if (
5887 (a = param_rule(p)) // param
5888 &&
5889 (c = default_rule(p), 1) // default?
5890 &&
5891 (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
5892 &&
5893 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
5894 )
5895 {
5896 D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5897 _res = _PyPegen_name_default_pair ( p , a , c , tc );
5898 if (_res == NULL && PyErr_Occurred()) {
5899 p->error_indicator = 1;
5900 D(p->level--);
5901 return NULL;
5902 }
5903 goto done;
5904 }
5905 p->mark = _mark;
5906 D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
5907 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
5908 }
5909 _res = NULL;
5910 done:
5911 D(p->level--);
5912 return _res;
5913}
5914
5915// param: NAME annotation?
5916static arg_ty
5917param_rule(Parser *p)
5918{
5919 D(p->level++);
5920 if (p->error_indicator) {
5921 D(p->level--);
5922 return NULL;
5923 }
5924 arg_ty _res = NULL;
5925 int _mark = p->mark;
5926 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
5927 p->error_indicator = 1;
5928 D(p->level--);
5929 return NULL;
5930 }
5931 int _start_lineno = p->tokens[_mark]->lineno;
5932 UNUSED(_start_lineno); // Only used by EXTRA macro
5933 int _start_col_offset = p->tokens[_mark]->col_offset;
5934 UNUSED(_start_col_offset); // Only used by EXTRA macro
5935 { // NAME annotation?
5936 if (p->error_indicator) {
5937 D(p->level--);
5938 return NULL;
5939 }
5940 D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5941 expr_ty a;
5942 void *b;
5943 if (
5944 (a = _PyPegen_name_token(p)) // NAME
5945 &&
5946 (b = annotation_rule(p), 1) // annotation?
5947 )
5948 {
5949 D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
5950 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
5951 if (_token == NULL) {
5952 D(p->level--);
5953 return NULL;
5954 }
5955 int _end_lineno = _token->end_lineno;
5956 UNUSED(_end_lineno); // Only used by EXTRA macro
5957 int _end_col_offset = _token->end_col_offset;
5958 UNUSED(_end_col_offset); // Only used by EXTRA macro
5959 _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
5960 if (_res == NULL && PyErr_Occurred()) {
5961 p->error_indicator = 1;
5962 D(p->level--);
5963 return NULL;
5964 }
5965 goto done;
5966 }
5967 p->mark = _mark;
5968 D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
5969 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
5970 }
5971 _res = NULL;
5972 done:
5973 D(p->level--);
5974 return _res;
5975}
5976
5977// annotation: ':' expression
5978static expr_ty
5979annotation_rule(Parser *p)
5980{
5981 D(p->level++);
5982 if (p->error_indicator) {
5983 D(p->level--);
5984 return NULL;
5985 }
5986 expr_ty _res = NULL;
5987 int _mark = p->mark;
5988 { // ':' expression
5989 if (p->error_indicator) {
5990 D(p->level--);
5991 return NULL;
5992 }
5993 D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
5994 Token * _literal;
5995 expr_ty a;
5996 if (
5997 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
5998 &&
5999 (a = expression_rule(p)) // expression
6000 )
6001 {
6002 D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
6003 _res = a;
6004 if (_res == NULL && PyErr_Occurred()) {
6005 p->error_indicator = 1;
6006 D(p->level--);
6007 return NULL;
6008 }
6009 goto done;
6010 }
6011 p->mark = _mark;
6012 D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
6013 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
6014 }
6015 _res = NULL;
6016 done:
6017 D(p->level--);
6018 return _res;
6019}
6020
6021// default: '=' expression
6022static expr_ty
6023default_rule(Parser *p)
6024{
6025 D(p->level++);
6026 if (p->error_indicator) {
6027 D(p->level--);
6028 return NULL;
6029 }
6030 expr_ty _res = NULL;
6031 int _mark = p->mark;
6032 { // '=' expression
6033 if (p->error_indicator) {
6034 D(p->level--);
6035 return NULL;
6036 }
6037 D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6038 Token * _literal;
6039 expr_ty a;
6040 if (
6041 (_literal = _PyPegen_expect_token(p, 22)) // token='='
6042 &&
6043 (a = expression_rule(p)) // expression
6044 )
6045 {
6046 D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
6047 _res = a;
6048 if (_res == NULL && PyErr_Occurred()) {
6049 p->error_indicator = 1;
6050 D(p->level--);
6051 return NULL;
6052 }
6053 goto done;
6054 }
6055 p->mark = _mark;
6056 D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
6057 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
6058 }
6059 _res = NULL;
6060 done:
6061 D(p->level--);
6062 return _res;
6063}
6064
6065// decorators: (('@' named_expression NEWLINE))+
Pablo Galindoa5634c42020-09-16 19:42:00 +01006066static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006067decorators_rule(Parser *p)
6068{
6069 D(p->level++);
6070 if (p->error_indicator) {
6071 D(p->level--);
6072 return NULL;
6073 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006074 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006075 int _mark = p->mark;
6076 { // (('@' named_expression NEWLINE))+
6077 if (p->error_indicator) {
6078 D(p->level--);
6079 return NULL;
6080 }
6081 D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01006082 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006083 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01006084 (a = (asdl_expr_seq*)_loop1_68_rule(p)) // (('@' named_expression NEWLINE))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006085 )
6086 {
6087 D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6088 _res = a;
6089 if (_res == NULL && PyErr_Occurred()) {
6090 p->error_indicator = 1;
6091 D(p->level--);
6092 return NULL;
6093 }
6094 goto done;
6095 }
6096 p->mark = _mark;
6097 D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
6098 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
6099 }
6100 _res = NULL;
6101 done:
6102 D(p->level--);
6103 return _res;
6104}
6105
6106// class_def: decorators class_def_raw | class_def_raw
6107static stmt_ty
6108class_def_rule(Parser *p)
6109{
6110 D(p->level++);
6111 if (p->error_indicator) {
6112 D(p->level--);
6113 return NULL;
6114 }
6115 stmt_ty _res = NULL;
6116 int _mark = p->mark;
6117 { // decorators class_def_raw
6118 if (p->error_indicator) {
6119 D(p->level--);
6120 return NULL;
6121 }
6122 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 +01006123 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006124 stmt_ty b;
6125 if (
6126 (a = decorators_rule(p)) // decorators
6127 &&
6128 (b = class_def_raw_rule(p)) // class_def_raw
6129 )
6130 {
6131 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
6132 _res = _PyPegen_class_def_decorators ( p , a , b );
6133 if (_res == NULL && PyErr_Occurred()) {
6134 p->error_indicator = 1;
6135 D(p->level--);
6136 return NULL;
6137 }
6138 goto done;
6139 }
6140 p->mark = _mark;
6141 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6142 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
6143 }
6144 { // class_def_raw
6145 if (p->error_indicator) {
6146 D(p->level--);
6147 return NULL;
6148 }
6149 D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6150 stmt_ty class_def_raw_var;
6151 if (
6152 (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw
6153 )
6154 {
6155 D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
6156 _res = class_def_raw_var;
6157 goto done;
6158 }
6159 p->mark = _mark;
6160 D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
6161 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
6162 }
6163 _res = NULL;
6164 done:
6165 D(p->level--);
6166 return _res;
6167}
6168
6169// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
6170static stmt_ty
6171class_def_raw_rule(Parser *p)
6172{
6173 D(p->level++);
6174 if (p->error_indicator) {
6175 D(p->level--);
6176 return NULL;
6177 }
6178 stmt_ty _res = NULL;
6179 int _mark = p->mark;
6180 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6181 p->error_indicator = 1;
6182 D(p->level--);
6183 return NULL;
6184 }
6185 int _start_lineno = p->tokens[_mark]->lineno;
6186 UNUSED(_start_lineno); // Only used by EXTRA macro
6187 int _start_col_offset = p->tokens[_mark]->col_offset;
6188 UNUSED(_start_col_offset); // Only used by EXTRA macro
6189 { // 'class' NAME ['(' arguments? ')'] ':' block
6190 if (p->error_indicator) {
6191 D(p->level--);
6192 return NULL;
6193 }
6194 D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6195 Token * _keyword;
6196 Token * _literal;
6197 expr_ty a;
6198 void *b;
Pablo Galindoa5634c42020-09-16 19:42:00 +01006199 asdl_stmt_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006200 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006201 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006202 &&
6203 (a = _PyPegen_name_token(p)) // NAME
6204 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006205 (b = _tmp_69_rule(p), 1) // ['(' arguments? ')']
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006206 &&
6207 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
6208 &&
6209 (c = block_rule(p)) // block
6210 )
6211 {
6212 D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6213 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6214 if (_token == NULL) {
6215 D(p->level--);
6216 return NULL;
6217 }
6218 int _end_lineno = _token->end_lineno;
6219 UNUSED(_end_lineno); // Only used by EXTRA macro
6220 int _end_col_offset = _token->end_col_offset;
6221 UNUSED(_end_col_offset); // Only used by EXTRA macro
6222 _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 );
6223 if (_res == NULL && PyErr_Occurred()) {
6224 p->error_indicator = 1;
6225 D(p->level--);
6226 return NULL;
6227 }
6228 goto done;
6229 }
6230 p->mark = _mark;
6231 D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
6232 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
6233 }
6234 _res = NULL;
6235 done:
6236 D(p->level--);
6237 return _res;
6238}
6239
6240// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
Pablo Galindoa5634c42020-09-16 19:42:00 +01006241static asdl_stmt_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006242block_rule(Parser *p)
6243{
6244 D(p->level++);
6245 if (p->error_indicator) {
6246 D(p->level--);
6247 return NULL;
6248 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006249 asdl_stmt_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006250 if (_PyPegen_is_memoized(p, block_type, &_res)) {
6251 D(p->level--);
6252 return _res;
6253 }
6254 int _mark = p->mark;
6255 { // NEWLINE INDENT statements DEDENT
6256 if (p->error_indicator) {
6257 D(p->level--);
6258 return NULL;
6259 }
6260 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 +01006261 asdl_stmt_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006262 Token * dedent_var;
6263 Token * indent_var;
6264 Token * newline_var;
6265 if (
6266 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
6267 &&
6268 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
6269 &&
6270 (a = statements_rule(p)) // statements
6271 &&
6272 (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
6273 )
6274 {
6275 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6276 _res = a;
6277 if (_res == NULL && PyErr_Occurred()) {
6278 p->error_indicator = 1;
6279 D(p->level--);
6280 return NULL;
6281 }
6282 goto done;
6283 }
6284 p->mark = _mark;
6285 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6286 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
6287 }
6288 { // simple_stmt
6289 if (p->error_indicator) {
6290 D(p->level--);
6291 return NULL;
6292 }
6293 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
Pablo Galindoa5634c42020-09-16 19:42:00 +01006294 asdl_stmt_seq* simple_stmt_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006295 if (
6296 (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt
6297 )
6298 {
6299 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
6300 _res = simple_stmt_var;
6301 goto done;
6302 }
6303 p->mark = _mark;
6304 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6305 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
6306 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02006307 if (p->call_invalid_rules) { // invalid_block
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006308 if (p->error_indicator) {
6309 D(p->level--);
6310 return NULL;
6311 }
6312 D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6313 void *invalid_block_var;
6314 if (
6315 (invalid_block_var = invalid_block_rule(p)) // invalid_block
6316 )
6317 {
6318 D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
6319 _res = invalid_block_var;
6320 goto done;
6321 }
6322 p->mark = _mark;
6323 D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
6324 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
6325 }
6326 _res = NULL;
6327 done:
6328 _PyPegen_insert_memo(p, _mark, block_type, _res);
6329 D(p->level--);
6330 return _res;
6331}
6332
6333// expressions_list: ','.star_expression+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +01006334static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006335expressions_list_rule(Parser *p)
6336{
6337 D(p->level++);
6338 if (p->error_indicator) {
6339 D(p->level--);
6340 return NULL;
6341 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006342 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006343 int _mark = p->mark;
6344 { // ','.star_expression+ ','?
6345 if (p->error_indicator) {
6346 D(p->level--);
6347 return NULL;
6348 }
6349 D(fprintf(stderr, "%*c> expressions_list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6350 void *_opt_var;
6351 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01006352 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006353 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01006354 (a = (asdl_expr_seq*)_gather_70_rule(p)) // ','.star_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006355 &&
6356 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6357 )
6358 {
6359 D(fprintf(stderr, "%*c+ expressions_list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_expression+ ','?"));
6360 _res = a;
6361 if (_res == NULL && PyErr_Occurred()) {
6362 p->error_indicator = 1;
6363 D(p->level--);
6364 return NULL;
6365 }
6366 goto done;
6367 }
6368 p->mark = _mark;
6369 D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ',
6370 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?"));
6371 }
6372 _res = NULL;
6373 done:
6374 D(p->level--);
6375 return _res;
6376}
6377
6378// star_expressions:
6379// | star_expression ((',' star_expression))+ ','?
6380// | star_expression ','
6381// | star_expression
6382static expr_ty
6383star_expressions_rule(Parser *p)
6384{
6385 D(p->level++);
6386 if (p->error_indicator) {
6387 D(p->level--);
6388 return NULL;
6389 }
6390 expr_ty _res = NULL;
6391 int _mark = p->mark;
6392 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6393 p->error_indicator = 1;
6394 D(p->level--);
6395 return NULL;
6396 }
6397 int _start_lineno = p->tokens[_mark]->lineno;
6398 UNUSED(_start_lineno); // Only used by EXTRA macro
6399 int _start_col_offset = p->tokens[_mark]->col_offset;
6400 UNUSED(_start_col_offset); // Only used by EXTRA macro
6401 { // star_expression ((',' star_expression))+ ','?
6402 if (p->error_indicator) {
6403 D(p->level--);
6404 return NULL;
6405 }
6406 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6407 void *_opt_var;
6408 UNUSED(_opt_var); // Silence compiler warnings
6409 expr_ty a;
6410 asdl_seq * b;
6411 if (
6412 (a = star_expression_rule(p)) // star_expression
6413 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006414 (b = _loop1_72_rule(p)) // ((',' star_expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006415 &&
6416 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6417 )
6418 {
6419 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6420 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6421 if (_token == NULL) {
6422 D(p->level--);
6423 return NULL;
6424 }
6425 int _end_lineno = _token->end_lineno;
6426 UNUSED(_end_lineno); // Only used by EXTRA macro
6427 int _end_col_offset = _token->end_col_offset;
6428 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006429 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006430 if (_res == NULL && PyErr_Occurred()) {
6431 p->error_indicator = 1;
6432 D(p->level--);
6433 return NULL;
6434 }
6435 goto done;
6436 }
6437 p->mark = _mark;
6438 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6439 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
6440 }
6441 { // star_expression ','
6442 if (p->error_indicator) {
6443 D(p->level--);
6444 return NULL;
6445 }
6446 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6447 Token * _literal;
6448 expr_ty a;
6449 if (
6450 (a = star_expression_rule(p)) // star_expression
6451 &&
6452 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6453 )
6454 {
6455 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
6456 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6457 if (_token == NULL) {
6458 D(p->level--);
6459 return NULL;
6460 }
6461 int _end_lineno = _token->end_lineno;
6462 UNUSED(_end_lineno); // Only used by EXTRA macro
6463 int _end_col_offset = _token->end_col_offset;
6464 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006465 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006466 if (_res == NULL && PyErr_Occurred()) {
6467 p->error_indicator = 1;
6468 D(p->level--);
6469 return NULL;
6470 }
6471 goto done;
6472 }
6473 p->mark = _mark;
6474 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','"));
6476 }
6477 { // star_expression
6478 if (p->error_indicator) {
6479 D(p->level--);
6480 return NULL;
6481 }
6482 D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression"));
6483 expr_ty star_expression_var;
6484 if (
6485 (star_expression_var = star_expression_rule(p)) // star_expression
6486 )
6487 {
6488 D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression"));
6489 _res = star_expression_var;
6490 goto done;
6491 }
6492 p->mark = _mark;
6493 D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6494 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression"));
6495 }
6496 _res = NULL;
6497 done:
6498 D(p->level--);
6499 return _res;
6500}
6501
6502// star_expression: '*' bitwise_or | expression
6503static expr_ty
6504star_expression_rule(Parser *p)
6505{
6506 D(p->level++);
6507 if (p->error_indicator) {
6508 D(p->level--);
6509 return NULL;
6510 }
6511 expr_ty _res = NULL;
6512 if (_PyPegen_is_memoized(p, star_expression_type, &_res)) {
6513 D(p->level--);
6514 return _res;
6515 }
6516 int _mark = p->mark;
6517 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6518 p->error_indicator = 1;
6519 D(p->level--);
6520 return NULL;
6521 }
6522 int _start_lineno = p->tokens[_mark]->lineno;
6523 UNUSED(_start_lineno); // Only used by EXTRA macro
6524 int _start_col_offset = p->tokens[_mark]->col_offset;
6525 UNUSED(_start_col_offset); // Only used by EXTRA macro
6526 { // '*' bitwise_or
6527 if (p->error_indicator) {
6528 D(p->level--);
6529 return NULL;
6530 }
6531 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6532 Token * _literal;
6533 expr_ty a;
6534 if (
6535 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6536 &&
6537 (a = bitwise_or_rule(p)) // bitwise_or
6538 )
6539 {
6540 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6541 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6542 if (_token == NULL) {
6543 D(p->level--);
6544 return NULL;
6545 }
6546 int _end_lineno = _token->end_lineno;
6547 UNUSED(_end_lineno); // Only used by EXTRA macro
6548 int _end_col_offset = _token->end_col_offset;
6549 UNUSED(_end_col_offset); // Only used by EXTRA macro
6550 _res = _Py_Starred ( a , Load , EXTRA );
6551 if (_res == NULL && PyErr_Occurred()) {
6552 p->error_indicator = 1;
6553 D(p->level--);
6554 return NULL;
6555 }
6556 goto done;
6557 }
6558 p->mark = _mark;
6559 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6560 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6561 }
6562 { // expression
6563 if (p->error_indicator) {
6564 D(p->level--);
6565 return NULL;
6566 }
6567 D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6568 expr_ty expression_var;
6569 if (
6570 (expression_var = expression_rule(p)) // expression
6571 )
6572 {
6573 D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6574 _res = expression_var;
6575 goto done;
6576 }
6577 p->mark = _mark;
6578 D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
6579 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6580 }
6581 _res = NULL;
6582 done:
6583 _PyPegen_insert_memo(p, _mark, star_expression_type, _res);
6584 D(p->level--);
6585 return _res;
6586}
6587
6588// star_named_expressions: ','.star_named_expression+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +01006589static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006590star_named_expressions_rule(Parser *p)
6591{
6592 D(p->level++);
6593 if (p->error_indicator) {
6594 D(p->level--);
6595 return NULL;
6596 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01006597 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006598 int _mark = p->mark;
6599 { // ','.star_named_expression+ ','?
6600 if (p->error_indicator) {
6601 D(p->level--);
6602 return NULL;
6603 }
6604 D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6605 void *_opt_var;
6606 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +01006607 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006608 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01006609 (a = (asdl_expr_seq*)_gather_73_rule(p)) // ','.star_named_expression+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006610 &&
6611 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6612 )
6613 {
6614 D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
6615 _res = a;
6616 if (_res == NULL && PyErr_Occurred()) {
6617 p->error_indicator = 1;
6618 D(p->level--);
6619 return NULL;
6620 }
6621 goto done;
6622 }
6623 p->mark = _mark;
6624 D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ',
6625 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?"));
6626 }
6627 _res = NULL;
6628 done:
6629 D(p->level--);
6630 return _res;
6631}
6632
6633// star_named_expression: '*' bitwise_or | named_expression
6634static expr_ty
6635star_named_expression_rule(Parser *p)
6636{
6637 D(p->level++);
6638 if (p->error_indicator) {
6639 D(p->level--);
6640 return NULL;
6641 }
6642 expr_ty _res = NULL;
6643 int _mark = p->mark;
6644 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6645 p->error_indicator = 1;
6646 D(p->level--);
6647 return NULL;
6648 }
6649 int _start_lineno = p->tokens[_mark]->lineno;
6650 UNUSED(_start_lineno); // Only used by EXTRA macro
6651 int _start_col_offset = p->tokens[_mark]->col_offset;
6652 UNUSED(_start_col_offset); // Only used by EXTRA macro
6653 { // '*' bitwise_or
6654 if (p->error_indicator) {
6655 D(p->level--);
6656 return NULL;
6657 }
6658 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6659 Token * _literal;
6660 expr_ty a;
6661 if (
6662 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
6663 &&
6664 (a = bitwise_or_rule(p)) // bitwise_or
6665 )
6666 {
6667 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
6668 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6669 if (_token == NULL) {
6670 D(p->level--);
6671 return NULL;
6672 }
6673 int _end_lineno = _token->end_lineno;
6674 UNUSED(_end_lineno); // Only used by EXTRA macro
6675 int _end_col_offset = _token->end_col_offset;
6676 UNUSED(_end_col_offset); // Only used by EXTRA macro
6677 _res = _Py_Starred ( a , Load , EXTRA );
6678 if (_res == NULL && PyErr_Occurred()) {
6679 p->error_indicator = 1;
6680 D(p->level--);
6681 return NULL;
6682 }
6683 goto done;
6684 }
6685 p->mark = _mark;
6686 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6687 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
6688 }
6689 { // named_expression
6690 if (p->error_indicator) {
6691 D(p->level--);
6692 return NULL;
6693 }
6694 D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
6695 expr_ty named_expression_var;
6696 if (
6697 (named_expression_var = named_expression_rule(p)) // named_expression
6698 )
6699 {
6700 D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
6701 _res = named_expression_var;
6702 goto done;
6703 }
6704 p->mark = _mark;
6705 D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6706 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
6707 }
6708 _res = NULL;
6709 done:
6710 D(p->level--);
6711 return _res;
6712}
6713
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006714// named_expression: NAME ':=' ~ expression | expression !':=' | invalid_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006715static expr_ty
6716named_expression_rule(Parser *p)
6717{
6718 D(p->level++);
6719 if (p->error_indicator) {
6720 D(p->level--);
6721 return NULL;
6722 }
6723 expr_ty _res = NULL;
6724 int _mark = p->mark;
6725 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6726 p->error_indicator = 1;
6727 D(p->level--);
6728 return NULL;
6729 }
6730 int _start_lineno = p->tokens[_mark]->lineno;
6731 UNUSED(_start_lineno); // Only used by EXTRA macro
6732 int _start_col_offset = p->tokens[_mark]->col_offset;
6733 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006734 { // NAME ':=' ~ expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006735 if (p->error_indicator) {
6736 D(p->level--);
6737 return NULL;
6738 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006739 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
6740 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006741 Token * _literal;
6742 expr_ty a;
6743 expr_ty b;
6744 if (
6745 (a = _PyPegen_name_token(p)) // NAME
6746 &&
6747 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
6748 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006749 (_cut_var = 1)
6750 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006751 (b = expression_rule(p)) // expression
6752 )
6753 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006754 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 +01006755 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6756 if (_token == NULL) {
6757 D(p->level--);
6758 return NULL;
6759 }
6760 int _end_lineno = _token->end_lineno;
6761 UNUSED(_end_lineno); // Only used by EXTRA macro
6762 int _end_col_offset = _token->end_col_offset;
6763 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006764 _res = _Py_NamedExpr ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006765 if (_res == NULL && PyErr_Occurred()) {
6766 p->error_indicator = 1;
6767 D(p->level--);
6768 return NULL;
6769 }
6770 goto done;
6771 }
6772 p->mark = _mark;
6773 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006774 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression"));
6775 if (_cut_var) {
6776 D(p->level--);
6777 return NULL;
6778 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006779 }
6780 { // expression !':='
6781 if (p->error_indicator) {
6782 D(p->level--);
6783 return NULL;
6784 }
6785 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6786 expr_ty expression_var;
6787 if (
6788 (expression_var = expression_rule(p)) // expression
6789 &&
6790 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
6791 )
6792 {
6793 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
6794 _res = expression_var;
6795 goto done;
6796 }
6797 p->mark = _mark;
6798 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6799 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
6800 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02006801 if (p->call_invalid_rules) { // invalid_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006802 if (p->error_indicator) {
6803 D(p->level--);
6804 return NULL;
6805 }
6806 D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6807 void *invalid_named_expression_var;
6808 if (
6809 (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression
6810 )
6811 {
6812 D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
6813 _res = invalid_named_expression_var;
6814 goto done;
6815 }
6816 p->mark = _mark;
6817 D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
6818 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression"));
6819 }
6820 _res = NULL;
6821 done:
6822 D(p->level--);
6823 return _res;
6824}
6825
6826// annotated_rhs: yield_expr | star_expressions
6827static expr_ty
6828annotated_rhs_rule(Parser *p)
6829{
6830 D(p->level++);
6831 if (p->error_indicator) {
6832 D(p->level--);
6833 return NULL;
6834 }
6835 expr_ty _res = NULL;
6836 int _mark = p->mark;
6837 { // yield_expr
6838 if (p->error_indicator) {
6839 D(p->level--);
6840 return NULL;
6841 }
6842 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6843 expr_ty yield_expr_var;
6844 if (
6845 (yield_expr_var = yield_expr_rule(p)) // yield_expr
6846 )
6847 {
6848 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
6849 _res = yield_expr_var;
6850 goto done;
6851 }
6852 p->mark = _mark;
6853 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6854 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
6855 }
6856 { // star_expressions
6857 if (p->error_indicator) {
6858 D(p->level--);
6859 return NULL;
6860 }
6861 D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6862 expr_ty star_expressions_var;
6863 if (
6864 (star_expressions_var = star_expressions_rule(p)) // star_expressions
6865 )
6866 {
6867 D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
6868 _res = star_expressions_var;
6869 goto done;
6870 }
6871 p->mark = _mark;
6872 D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
6873 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
6874 }
6875 _res = NULL;
6876 done:
6877 D(p->level--);
6878 return _res;
6879}
6880
6881// expressions: expression ((',' expression))+ ','? | expression ',' | expression
6882static expr_ty
6883expressions_rule(Parser *p)
6884{
6885 D(p->level++);
6886 if (p->error_indicator) {
6887 D(p->level--);
6888 return NULL;
6889 }
6890 expr_ty _res = NULL;
6891 int _mark = p->mark;
6892 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
6893 p->error_indicator = 1;
6894 D(p->level--);
6895 return NULL;
6896 }
6897 int _start_lineno = p->tokens[_mark]->lineno;
6898 UNUSED(_start_lineno); // Only used by EXTRA macro
6899 int _start_col_offset = p->tokens[_mark]->col_offset;
6900 UNUSED(_start_col_offset); // Only used by EXTRA macro
6901 { // expression ((',' expression))+ ','?
6902 if (p->error_indicator) {
6903 D(p->level--);
6904 return NULL;
6905 }
6906 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6907 void *_opt_var;
6908 UNUSED(_opt_var); // Silence compiler warnings
6909 expr_ty a;
6910 asdl_seq * b;
6911 if (
6912 (a = expression_rule(p)) // expression
6913 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03006914 (b = _loop1_75_rule(p)) // ((',' expression))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006915 &&
6916 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
6917 )
6918 {
6919 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
6920 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6921 if (_token == NULL) {
6922 D(p->level--);
6923 return NULL;
6924 }
6925 int _end_lineno = _token->end_lineno;
6926 UNUSED(_end_lineno); // Only used by EXTRA macro
6927 int _end_col_offset = _token->end_col_offset;
6928 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006929 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006930 if (_res == NULL && PyErr_Occurred()) {
6931 p->error_indicator = 1;
6932 D(p->level--);
6933 return NULL;
6934 }
6935 goto done;
6936 }
6937 p->mark = _mark;
6938 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6939 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
6940 }
6941 { // expression ','
6942 if (p->error_indicator) {
6943 D(p->level--);
6944 return NULL;
6945 }
6946 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
6947 Token * _literal;
6948 expr_ty a;
6949 if (
6950 (a = expression_rule(p)) // expression
6951 &&
6952 (_literal = _PyPegen_expect_token(p, 12)) // token=','
6953 )
6954 {
6955 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
6956 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
6957 if (_token == NULL) {
6958 D(p->level--);
6959 return NULL;
6960 }
6961 int _end_lineno = _token->end_lineno;
6962 UNUSED(_end_lineno); // Only used by EXTRA macro
6963 int _end_col_offset = _token->end_col_offset;
6964 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03006965 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01006966 if (_res == NULL && PyErr_Occurred()) {
6967 p->error_indicator = 1;
6968 D(p->level--);
6969 return NULL;
6970 }
6971 goto done;
6972 }
6973 p->mark = _mark;
6974 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6975 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
6976 }
6977 { // expression
6978 if (p->error_indicator) {
6979 D(p->level--);
6980 return NULL;
6981 }
6982 D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
6983 expr_ty expression_var;
6984 if (
6985 (expression_var = expression_rule(p)) // expression
6986 )
6987 {
6988 D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
6989 _res = expression_var;
6990 goto done;
6991 }
6992 p->mark = _mark;
6993 D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
6994 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
6995 }
6996 _res = NULL;
6997 done:
6998 D(p->level--);
6999 return _res;
7000}
7001
7002// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
7003static expr_ty
7004expression_rule(Parser *p)
7005{
7006 D(p->level++);
7007 if (p->error_indicator) {
7008 D(p->level--);
7009 return NULL;
7010 }
7011 expr_ty _res = NULL;
7012 if (_PyPegen_is_memoized(p, expression_type, &_res)) {
7013 D(p->level--);
7014 return _res;
7015 }
7016 int _mark = p->mark;
7017 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7018 p->error_indicator = 1;
7019 D(p->level--);
7020 return NULL;
7021 }
7022 int _start_lineno = p->tokens[_mark]->lineno;
7023 UNUSED(_start_lineno); // Only used by EXTRA macro
7024 int _start_col_offset = p->tokens[_mark]->col_offset;
7025 UNUSED(_start_col_offset); // Only used by EXTRA macro
7026 { // disjunction 'if' disjunction 'else' expression
7027 if (p->error_indicator) {
7028 D(p->level--);
7029 return NULL;
7030 }
7031 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7032 Token * _keyword;
7033 Token * _keyword_1;
7034 expr_ty a;
7035 expr_ty b;
7036 expr_ty c;
7037 if (
7038 (a = disjunction_rule(p)) // disjunction
7039 &&
7040 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
7041 &&
7042 (b = disjunction_rule(p)) // disjunction
7043 &&
7044 (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else'
7045 &&
7046 (c = expression_rule(p)) // expression
7047 )
7048 {
7049 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7050 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7051 if (_token == NULL) {
7052 D(p->level--);
7053 return NULL;
7054 }
7055 int _end_lineno = _token->end_lineno;
7056 UNUSED(_end_lineno); // Only used by EXTRA macro
7057 int _end_col_offset = _token->end_col_offset;
7058 UNUSED(_end_col_offset); // Only used by EXTRA macro
7059 _res = _Py_IfExp ( b , a , c , EXTRA );
7060 if (_res == NULL && PyErr_Occurred()) {
7061 p->error_indicator = 1;
7062 D(p->level--);
7063 return NULL;
7064 }
7065 goto done;
7066 }
7067 p->mark = _mark;
7068 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7069 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
7070 }
7071 { // disjunction
7072 if (p->error_indicator) {
7073 D(p->level--);
7074 return NULL;
7075 }
7076 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
7077 expr_ty disjunction_var;
7078 if (
7079 (disjunction_var = disjunction_rule(p)) // disjunction
7080 )
7081 {
7082 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
7083 _res = disjunction_var;
7084 goto done;
7085 }
7086 p->mark = _mark;
7087 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7088 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
7089 }
7090 { // lambdef
7091 if (p->error_indicator) {
7092 D(p->level--);
7093 return NULL;
7094 }
7095 D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
7096 expr_ty lambdef_var;
7097 if (
7098 (lambdef_var = lambdef_rule(p)) // lambdef
7099 )
7100 {
7101 D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
7102 _res = lambdef_var;
7103 goto done;
7104 }
7105 p->mark = _mark;
7106 D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
7107 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
7108 }
7109 _res = NULL;
7110 done:
7111 _PyPegen_insert_memo(p, _mark, expression_type, _res);
7112 D(p->level--);
7113 return _res;
7114}
7115
7116// lambdef: 'lambda' lambda_params? ':' expression
7117static expr_ty
7118lambdef_rule(Parser *p)
7119{
7120 D(p->level++);
7121 if (p->error_indicator) {
7122 D(p->level--);
7123 return NULL;
7124 }
7125 expr_ty _res = NULL;
7126 int _mark = p->mark;
7127 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7128 p->error_indicator = 1;
7129 D(p->level--);
7130 return NULL;
7131 }
7132 int _start_lineno = p->tokens[_mark]->lineno;
7133 UNUSED(_start_lineno); // Only used by EXTRA macro
7134 int _start_col_offset = p->tokens[_mark]->col_offset;
7135 UNUSED(_start_col_offset); // Only used by EXTRA macro
7136 { // 'lambda' lambda_params? ':' expression
7137 if (p->error_indicator) {
7138 D(p->level--);
7139 return NULL;
7140 }
7141 D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7142 Token * _keyword;
7143 Token * _literal;
7144 void *a;
7145 expr_ty b;
7146 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007147 (_keyword = _PyPegen_expect_token(p, 525)) // token='lambda'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007148 &&
7149 (a = lambda_params_rule(p), 1) // lambda_params?
7150 &&
7151 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
7152 &&
7153 (b = expression_rule(p)) // expression
7154 )
7155 {
7156 D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7157 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7158 if (_token == NULL) {
7159 D(p->level--);
7160 return NULL;
7161 }
7162 int _end_lineno = _token->end_lineno;
7163 UNUSED(_end_lineno); // Only used by EXTRA macro
7164 int _end_col_offset = _token->end_col_offset;
7165 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03007166 _res = _Py_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007167 if (_res == NULL && PyErr_Occurred()) {
7168 p->error_indicator = 1;
7169 D(p->level--);
7170 return NULL;
7171 }
7172 goto done;
7173 }
7174 p->mark = _mark;
7175 D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
7176 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
7177 }
7178 _res = NULL;
7179 done:
7180 D(p->level--);
7181 return _res;
7182}
7183
7184// lambda_params: invalid_lambda_parameters | lambda_parameters
7185static arguments_ty
7186lambda_params_rule(Parser *p)
7187{
7188 D(p->level++);
7189 if (p->error_indicator) {
7190 D(p->level--);
7191 return NULL;
7192 }
7193 arguments_ty _res = NULL;
7194 int _mark = p->mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02007195 if (p->call_invalid_rules) { // invalid_lambda_parameters
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007196 if (p->error_indicator) {
7197 D(p->level--);
7198 return NULL;
7199 }
7200 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7201 void *invalid_lambda_parameters_var;
7202 if (
7203 (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters
7204 )
7205 {
7206 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
7207 _res = invalid_lambda_parameters_var;
7208 goto done;
7209 }
7210 p->mark = _mark;
7211 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7212 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
7213 }
7214 { // lambda_parameters
7215 if (p->error_indicator) {
7216 D(p->level--);
7217 return NULL;
7218 }
7219 D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7220 arguments_ty lambda_parameters_var;
7221 if (
7222 (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters
7223 )
7224 {
7225 D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
7226 _res = lambda_parameters_var;
7227 goto done;
7228 }
7229 p->mark = _mark;
7230 D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
7231 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
7232 }
7233 _res = NULL;
7234 done:
7235 D(p->level--);
7236 return _res;
7237}
7238
7239// lambda_parameters:
7240// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7241// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7242// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7243// | lambda_param_with_default+ lambda_star_etc?
7244// | lambda_star_etc
7245static arguments_ty
7246lambda_parameters_rule(Parser *p)
7247{
7248 D(p->level++);
7249 if (p->error_indicator) {
7250 D(p->level--);
7251 return NULL;
7252 }
7253 arguments_ty _res = NULL;
7254 int _mark = p->mark;
7255 { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
7256 if (p->error_indicator) {
7257 D(p->level--);
7258 return NULL;
7259 }
7260 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 +01007261 asdl_arg_seq* a;
7262 asdl_arg_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007263 asdl_seq * c;
7264 void *d;
7265 if (
7266 (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
7267 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +01007268 (b = (asdl_arg_seq*)_loop0_76_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007269 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007270 (c = _loop0_77_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007271 &&
7272 (d = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7273 )
7274 {
7275 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?"));
7276 _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
7277 if (_res == NULL && PyErr_Occurred()) {
7278 p->error_indicator = 1;
7279 D(p->level--);
7280 return NULL;
7281 }
7282 goto done;
7283 }
7284 p->mark = _mark;
7285 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7286 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
7287 }
7288 { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
7289 if (p->error_indicator) {
7290 D(p->level--);
7291 return NULL;
7292 }
7293 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?"));
7294 SlashWithDefault* a;
7295 asdl_seq * b;
7296 void *c;
7297 if (
7298 (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
7299 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007300 (b = _loop0_78_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007301 &&
7302 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7303 )
7304 {
7305 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?"));
7306 _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
7307 if (_res == NULL && PyErr_Occurred()) {
7308 p->error_indicator = 1;
7309 D(p->level--);
7310 return NULL;
7311 }
7312 goto done;
7313 }
7314 p->mark = _mark;
7315 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7316 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
7317 }
7318 { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
7319 if (p->error_indicator) {
7320 D(p->level--);
7321 return NULL;
7322 }
7323 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 +01007324 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007325 asdl_seq * b;
7326 void *c;
7327 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01007328 (a = (asdl_arg_seq*)_loop1_79_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007329 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007330 (b = _loop0_80_rule(p)) // lambda_param_with_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007331 &&
7332 (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7333 )
7334 {
7335 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?"));
7336 _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
7337 if (_res == NULL && PyErr_Occurred()) {
7338 p->error_indicator = 1;
7339 D(p->level--);
7340 return NULL;
7341 }
7342 goto done;
7343 }
7344 p->mark = _mark;
7345 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7346 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
7347 }
7348 { // lambda_param_with_default+ lambda_star_etc?
7349 if (p->error_indicator) {
7350 D(p->level--);
7351 return NULL;
7352 }
7353 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7354 asdl_seq * a;
7355 void *b;
7356 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007357 (a = _loop1_81_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007358 &&
7359 (b = lambda_star_etc_rule(p), 1) // lambda_star_etc?
7360 )
7361 {
7362 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7363 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
7364 if (_res == NULL && PyErr_Occurred()) {
7365 p->error_indicator = 1;
7366 D(p->level--);
7367 return NULL;
7368 }
7369 goto done;
7370 }
7371 p->mark = _mark;
7372 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7373 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
7374 }
7375 { // lambda_star_etc
7376 if (p->error_indicator) {
7377 D(p->level--);
7378 return NULL;
7379 }
7380 D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7381 StarEtc* a;
7382 if (
7383 (a = lambda_star_etc_rule(p)) // lambda_star_etc
7384 )
7385 {
7386 D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
7387 _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
7388 if (_res == NULL && PyErr_Occurred()) {
7389 p->error_indicator = 1;
7390 D(p->level--);
7391 return NULL;
7392 }
7393 goto done;
7394 }
7395 p->mark = _mark;
7396 D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
7397 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
7398 }
7399 _res = NULL;
7400 done:
7401 D(p->level--);
7402 return _res;
7403}
7404
7405// lambda_slash_no_default:
7406// | lambda_param_no_default+ '/' ','
7407// | lambda_param_no_default+ '/' &':'
Pablo Galindoa5634c42020-09-16 19:42:00 +01007408static asdl_arg_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007409lambda_slash_no_default_rule(Parser *p)
7410{
7411 D(p->level++);
7412 if (p->error_indicator) {
7413 D(p->level--);
7414 return NULL;
7415 }
Pablo Galindoa5634c42020-09-16 19:42:00 +01007416 asdl_arg_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007417 int _mark = p->mark;
7418 { // lambda_param_no_default+ '/' ','
7419 if (p->error_indicator) {
7420 D(p->level--);
7421 return NULL;
7422 }
7423 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7424 Token * _literal;
7425 Token * _literal_1;
Pablo Galindoa5634c42020-09-16 19:42:00 +01007426 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007427 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01007428 (a = (asdl_arg_seq*)_loop1_82_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007429 &&
7430 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7431 &&
7432 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7433 )
7434 {
7435 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7436 _res = a;
7437 if (_res == NULL && PyErr_Occurred()) {
7438 p->error_indicator = 1;
7439 D(p->level--);
7440 return NULL;
7441 }
7442 goto done;
7443 }
7444 p->mark = _mark;
7445 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7446 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
7447 }
7448 { // lambda_param_no_default+ '/' &':'
7449 if (p->error_indicator) {
7450 D(p->level--);
7451 return NULL;
7452 }
7453 D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7454 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +01007455 asdl_arg_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007456 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +01007457 (a = (asdl_arg_seq*)_loop1_83_rule(p)) // lambda_param_no_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007458 &&
7459 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7460 &&
7461 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7462 )
7463 {
7464 D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7465 _res = a;
7466 if (_res == NULL && PyErr_Occurred()) {
7467 p->error_indicator = 1;
7468 D(p->level--);
7469 return NULL;
7470 }
7471 goto done;
7472 }
7473 p->mark = _mark;
7474 D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
7476 }
7477 _res = NULL;
7478 done:
7479 D(p->level--);
7480 return _res;
7481}
7482
7483// lambda_slash_with_default:
7484// | lambda_param_no_default* lambda_param_with_default+ '/' ','
7485// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
7486static SlashWithDefault*
7487lambda_slash_with_default_rule(Parser *p)
7488{
7489 D(p->level++);
7490 if (p->error_indicator) {
7491 D(p->level--);
7492 return NULL;
7493 }
7494 SlashWithDefault* _res = NULL;
7495 int _mark = p->mark;
7496 { // lambda_param_no_default* lambda_param_with_default+ '/' ','
7497 if (p->error_indicator) {
7498 D(p->level--);
7499 return NULL;
7500 }
7501 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+ '/' ','"));
7502 Token * _literal;
7503 Token * _literal_1;
7504 asdl_seq * a;
7505 asdl_seq * b;
7506 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007507 (a = _loop0_84_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007508 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007509 (b = _loop1_85_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007510 &&
7511 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7512 &&
7513 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7514 )
7515 {
7516 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 +01007517 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007518 if (_res == NULL && PyErr_Occurred()) {
7519 p->error_indicator = 1;
7520 D(p->level--);
7521 return NULL;
7522 }
7523 goto done;
7524 }
7525 p->mark = _mark;
7526 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7527 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
7528 }
7529 { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
7530 if (p->error_indicator) {
7531 D(p->level--);
7532 return NULL;
7533 }
7534 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+ '/' &':'"));
7535 Token * _literal;
7536 asdl_seq * a;
7537 asdl_seq * b;
7538 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007539 (a = _loop0_86_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007540 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007541 (b = _loop1_87_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007542 &&
7543 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
7544 &&
7545 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7546 )
7547 {
7548 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 +01007549 _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007550 if (_res == NULL && PyErr_Occurred()) {
7551 p->error_indicator = 1;
7552 D(p->level--);
7553 return NULL;
7554 }
7555 goto done;
7556 }
7557 p->mark = _mark;
7558 D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7559 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
7560 }
7561 _res = NULL;
7562 done:
7563 D(p->level--);
7564 return _res;
7565}
7566
7567// lambda_star_etc:
7568// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7569// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
7570// | lambda_kwds
7571// | invalid_lambda_star_etc
7572static StarEtc*
7573lambda_star_etc_rule(Parser *p)
7574{
7575 D(p->level++);
7576 if (p->error_indicator) {
7577 D(p->level--);
7578 return NULL;
7579 }
7580 StarEtc* _res = NULL;
7581 int _mark = p->mark;
7582 { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
7583 if (p->error_indicator) {
7584 D(p->level--);
7585 return NULL;
7586 }
7587 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?"));
7588 Token * _literal;
7589 arg_ty a;
7590 asdl_seq * b;
7591 void *c;
7592 if (
7593 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7594 &&
7595 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7596 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007597 (b = _loop0_88_rule(p)) // lambda_param_maybe_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007598 &&
7599 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7600 )
7601 {
7602 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?"));
7603 _res = _PyPegen_star_etc ( p , a , b , c );
7604 if (_res == NULL && PyErr_Occurred()) {
7605 p->error_indicator = 1;
7606 D(p->level--);
7607 return NULL;
7608 }
7609 goto done;
7610 }
7611 p->mark = _mark;
7612 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7613 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
7614 }
7615 { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
7616 if (p->error_indicator) {
7617 D(p->level--);
7618 return NULL;
7619 }
7620 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7621 Token * _literal;
7622 Token * _literal_1;
7623 asdl_seq * b;
7624 void *c;
7625 if (
7626 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
7627 &&
7628 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
7629 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03007630 (b = _loop1_89_rule(p)) // lambda_param_maybe_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007631 &&
7632 (c = lambda_kwds_rule(p), 1) // lambda_kwds?
7633 )
7634 {
7635 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7636 _res = _PyPegen_star_etc ( p , NULL , b , c );
7637 if (_res == NULL && PyErr_Occurred()) {
7638 p->error_indicator = 1;
7639 D(p->level--);
7640 return NULL;
7641 }
7642 goto done;
7643 }
7644 p->mark = _mark;
7645 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7646 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
7647 }
7648 { // lambda_kwds
7649 if (p->error_indicator) {
7650 D(p->level--);
7651 return NULL;
7652 }
7653 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7654 arg_ty a;
7655 if (
7656 (a = lambda_kwds_rule(p)) // lambda_kwds
7657 )
7658 {
7659 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
7660 _res = _PyPegen_star_etc ( p , NULL , NULL , a );
7661 if (_res == NULL && PyErr_Occurred()) {
7662 p->error_indicator = 1;
7663 D(p->level--);
7664 return NULL;
7665 }
7666 goto done;
7667 }
7668 p->mark = _mark;
7669 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7670 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
7671 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +02007672 if (p->call_invalid_rules) { // invalid_lambda_star_etc
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01007673 if (p->error_indicator) {
7674 D(p->level--);
7675 return NULL;
7676 }
7677 D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7678 void *invalid_lambda_star_etc_var;
7679 if (
7680 (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc
7681 )
7682 {
7683 D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
7684 _res = invalid_lambda_star_etc_var;
7685 goto done;
7686 }
7687 p->mark = _mark;
7688 D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
7689 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
7690 }
7691 _res = NULL;
7692 done:
7693 D(p->level--);
7694 return _res;
7695}
7696
7697// lambda_kwds: '**' lambda_param_no_default
7698static arg_ty
7699lambda_kwds_rule(Parser *p)
7700{
7701 D(p->level++);
7702 if (p->error_indicator) {
7703 D(p->level--);
7704 return NULL;
7705 }
7706 arg_ty _res = NULL;
7707 int _mark = p->mark;
7708 { // '**' lambda_param_no_default
7709 if (p->error_indicator) {
7710 D(p->level--);
7711 return NULL;
7712 }
7713 D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7714 Token * _literal;
7715 arg_ty a;
7716 if (
7717 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
7718 &&
7719 (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
7720 )
7721 {
7722 D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
7723 _res = a;
7724 if (_res == NULL && PyErr_Occurred()) {
7725 p->error_indicator = 1;
7726 D(p->level--);
7727 return NULL;
7728 }
7729 goto done;
7730 }
7731 p->mark = _mark;
7732 D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
7733 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
7734 }
7735 _res = NULL;
7736 done:
7737 D(p->level--);
7738 return _res;
7739}
7740
7741// lambda_param_no_default: lambda_param ',' | lambda_param &':'
7742static arg_ty
7743lambda_param_no_default_rule(Parser *p)
7744{
7745 D(p->level++);
7746 if (p->error_indicator) {
7747 D(p->level--);
7748 return NULL;
7749 }
7750 arg_ty _res = NULL;
7751 int _mark = p->mark;
7752 { // lambda_param ','
7753 if (p->error_indicator) {
7754 D(p->level--);
7755 return NULL;
7756 }
7757 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7758 Token * _literal;
7759 arg_ty a;
7760 if (
7761 (a = lambda_param_rule(p)) // lambda_param
7762 &&
7763 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7764 )
7765 {
7766 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
7767 _res = a;
7768 if (_res == NULL && PyErr_Occurred()) {
7769 p->error_indicator = 1;
7770 D(p->level--);
7771 return NULL;
7772 }
7773 goto done;
7774 }
7775 p->mark = _mark;
7776 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7777 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
7778 }
7779 { // lambda_param &':'
7780 if (p->error_indicator) {
7781 D(p->level--);
7782 return NULL;
7783 }
7784 D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7785 arg_ty a;
7786 if (
7787 (a = lambda_param_rule(p)) // lambda_param
7788 &&
7789 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7790 )
7791 {
7792 D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
7793 _res = a;
7794 if (_res == NULL && PyErr_Occurred()) {
7795 p->error_indicator = 1;
7796 D(p->level--);
7797 return NULL;
7798 }
7799 goto done;
7800 }
7801 p->mark = _mark;
7802 D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
7803 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
7804 }
7805 _res = NULL;
7806 done:
7807 D(p->level--);
7808 return _res;
7809}
7810
7811// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
7812static NameDefaultPair*
7813lambda_param_with_default_rule(Parser *p)
7814{
7815 D(p->level++);
7816 if (p->error_indicator) {
7817 D(p->level--);
7818 return NULL;
7819 }
7820 NameDefaultPair* _res = NULL;
7821 int _mark = p->mark;
7822 { // lambda_param default ','
7823 if (p->error_indicator) {
7824 D(p->level--);
7825 return NULL;
7826 }
7827 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7828 Token * _literal;
7829 arg_ty a;
7830 expr_ty c;
7831 if (
7832 (a = lambda_param_rule(p)) // lambda_param
7833 &&
7834 (c = default_rule(p)) // default
7835 &&
7836 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7837 )
7838 {
7839 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
7840 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7841 if (_res == NULL && PyErr_Occurred()) {
7842 p->error_indicator = 1;
7843 D(p->level--);
7844 return NULL;
7845 }
7846 goto done;
7847 }
7848 p->mark = _mark;
7849 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7850 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
7851 }
7852 { // lambda_param default &':'
7853 if (p->error_indicator) {
7854 D(p->level--);
7855 return NULL;
7856 }
7857 D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7858 arg_ty a;
7859 expr_ty c;
7860 if (
7861 (a = lambda_param_rule(p)) // lambda_param
7862 &&
7863 (c = default_rule(p)) // default
7864 &&
7865 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7866 )
7867 {
7868 D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
7869 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7870 if (_res == NULL && PyErr_Occurred()) {
7871 p->error_indicator = 1;
7872 D(p->level--);
7873 return NULL;
7874 }
7875 goto done;
7876 }
7877 p->mark = _mark;
7878 D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
7879 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
7880 }
7881 _res = NULL;
7882 done:
7883 D(p->level--);
7884 return _res;
7885}
7886
7887// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
7888static NameDefaultPair*
7889lambda_param_maybe_default_rule(Parser *p)
7890{
7891 D(p->level++);
7892 if (p->error_indicator) {
7893 D(p->level--);
7894 return NULL;
7895 }
7896 NameDefaultPair* _res = NULL;
7897 int _mark = p->mark;
7898 { // lambda_param default? ','
7899 if (p->error_indicator) {
7900 D(p->level--);
7901 return NULL;
7902 }
7903 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7904 Token * _literal;
7905 arg_ty a;
7906 void *c;
7907 if (
7908 (a = lambda_param_rule(p)) // lambda_param
7909 &&
7910 (c = default_rule(p), 1) // default?
7911 &&
7912 (_literal = _PyPegen_expect_token(p, 12)) // token=','
7913 )
7914 {
7915 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
7916 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7917 if (_res == NULL && PyErr_Occurred()) {
7918 p->error_indicator = 1;
7919 D(p->level--);
7920 return NULL;
7921 }
7922 goto done;
7923 }
7924 p->mark = _mark;
7925 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7926 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
7927 }
7928 { // lambda_param default? &':'
7929 if (p->error_indicator) {
7930 D(p->level--);
7931 return NULL;
7932 }
7933 D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7934 arg_ty a;
7935 void *c;
7936 if (
7937 (a = lambda_param_rule(p)) // lambda_param
7938 &&
7939 (c = default_rule(p), 1) // default?
7940 &&
7941 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
7942 )
7943 {
7944 D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
7945 _res = _PyPegen_name_default_pair ( p , a , c , NULL );
7946 if (_res == NULL && PyErr_Occurred()) {
7947 p->error_indicator = 1;
7948 D(p->level--);
7949 return NULL;
7950 }
7951 goto done;
7952 }
7953 p->mark = _mark;
7954 D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
7955 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
7956 }
7957 _res = NULL;
7958 done:
7959 D(p->level--);
7960 return _res;
7961}
7962
7963// lambda_param: NAME
7964static arg_ty
7965lambda_param_rule(Parser *p)
7966{
7967 D(p->level++);
7968 if (p->error_indicator) {
7969 D(p->level--);
7970 return NULL;
7971 }
7972 arg_ty _res = NULL;
7973 int _mark = p->mark;
7974 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
7975 p->error_indicator = 1;
7976 D(p->level--);
7977 return NULL;
7978 }
7979 int _start_lineno = p->tokens[_mark]->lineno;
7980 UNUSED(_start_lineno); // Only used by EXTRA macro
7981 int _start_col_offset = p->tokens[_mark]->col_offset;
7982 UNUSED(_start_col_offset); // Only used by EXTRA macro
7983 { // NAME
7984 if (p->error_indicator) {
7985 D(p->level--);
7986 return NULL;
7987 }
7988 D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
7989 expr_ty a;
7990 if (
7991 (a = _PyPegen_name_token(p)) // NAME
7992 )
7993 {
7994 D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
7995 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
7996 if (_token == NULL) {
7997 D(p->level--);
7998 return NULL;
7999 }
8000 int _end_lineno = _token->end_lineno;
8001 UNUSED(_end_lineno); // Only used by EXTRA macro
8002 int _end_col_offset = _token->end_col_offset;
8003 UNUSED(_end_col_offset); // Only used by EXTRA macro
8004 _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
8005 if (_res == NULL && PyErr_Occurred()) {
8006 p->error_indicator = 1;
8007 D(p->level--);
8008 return NULL;
8009 }
8010 goto done;
8011 }
8012 p->mark = _mark;
8013 D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
8014 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
8015 }
8016 _res = NULL;
8017 done:
8018 D(p->level--);
8019 return _res;
8020}
8021
8022// disjunction: conjunction (('or' conjunction))+ | conjunction
8023static expr_ty
8024disjunction_rule(Parser *p)
8025{
8026 D(p->level++);
8027 if (p->error_indicator) {
8028 D(p->level--);
8029 return NULL;
8030 }
8031 expr_ty _res = NULL;
8032 if (_PyPegen_is_memoized(p, disjunction_type, &_res)) {
8033 D(p->level--);
8034 return _res;
8035 }
8036 int _mark = p->mark;
8037 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8038 p->error_indicator = 1;
8039 D(p->level--);
8040 return NULL;
8041 }
8042 int _start_lineno = p->tokens[_mark]->lineno;
8043 UNUSED(_start_lineno); // Only used by EXTRA macro
8044 int _start_col_offset = p->tokens[_mark]->col_offset;
8045 UNUSED(_start_col_offset); // Only used by EXTRA macro
8046 { // conjunction (('or' conjunction))+
8047 if (p->error_indicator) {
8048 D(p->level--);
8049 return NULL;
8050 }
8051 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8052 expr_ty a;
8053 asdl_seq * b;
8054 if (
8055 (a = conjunction_rule(p)) // conjunction
8056 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008057 (b = _loop1_90_rule(p)) // (('or' conjunction))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008058 )
8059 {
8060 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
8061 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8062 if (_token == NULL) {
8063 D(p->level--);
8064 return NULL;
8065 }
8066 int _end_lineno = _token->end_lineno;
8067 UNUSED(_end_lineno); // Only used by EXTRA macro
8068 int _end_col_offset = _token->end_col_offset;
8069 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03008070 _res = _Py_BoolOp ( Or , CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008071 if (_res == NULL && PyErr_Occurred()) {
8072 p->error_indicator = 1;
8073 D(p->level--);
8074 return NULL;
8075 }
8076 goto done;
8077 }
8078 p->mark = _mark;
8079 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8080 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+"));
8081 }
8082 { // conjunction
8083 if (p->error_indicator) {
8084 D(p->level--);
8085 return NULL;
8086 }
8087 D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction"));
8088 expr_ty conjunction_var;
8089 if (
8090 (conjunction_var = conjunction_rule(p)) // conjunction
8091 )
8092 {
8093 D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction"));
8094 _res = conjunction_var;
8095 goto done;
8096 }
8097 p->mark = _mark;
8098 D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
8099 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction"));
8100 }
8101 _res = NULL;
8102 done:
8103 _PyPegen_insert_memo(p, _mark, disjunction_type, _res);
8104 D(p->level--);
8105 return _res;
8106}
8107
8108// conjunction: inversion (('and' inversion))+ | inversion
8109static expr_ty
8110conjunction_rule(Parser *p)
8111{
8112 D(p->level++);
8113 if (p->error_indicator) {
8114 D(p->level--);
8115 return NULL;
8116 }
8117 expr_ty _res = NULL;
8118 if (_PyPegen_is_memoized(p, conjunction_type, &_res)) {
8119 D(p->level--);
8120 return _res;
8121 }
8122 int _mark = p->mark;
8123 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8124 p->error_indicator = 1;
8125 D(p->level--);
8126 return NULL;
8127 }
8128 int _start_lineno = p->tokens[_mark]->lineno;
8129 UNUSED(_start_lineno); // Only used by EXTRA macro
8130 int _start_col_offset = p->tokens[_mark]->col_offset;
8131 UNUSED(_start_col_offset); // Only used by EXTRA macro
8132 { // inversion (('and' inversion))+
8133 if (p->error_indicator) {
8134 D(p->level--);
8135 return NULL;
8136 }
8137 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8138 expr_ty a;
8139 asdl_seq * b;
8140 if (
8141 (a = inversion_rule(p)) // inversion
8142 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008143 (b = _loop1_91_rule(p)) // (('and' inversion))+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008144 )
8145 {
8146 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
8147 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8148 if (_token == NULL) {
8149 D(p->level--);
8150 return NULL;
8151 }
8152 int _end_lineno = _token->end_lineno;
8153 UNUSED(_end_lineno); // Only used by EXTRA macro
8154 int _end_col_offset = _token->end_col_offset;
8155 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03008156 _res = _Py_BoolOp ( And , CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008157 if (_res == NULL && PyErr_Occurred()) {
8158 p->error_indicator = 1;
8159 D(p->level--);
8160 return NULL;
8161 }
8162 goto done;
8163 }
8164 p->mark = _mark;
8165 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8166 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+"));
8167 }
8168 { // inversion
8169 if (p->error_indicator) {
8170 D(p->level--);
8171 return NULL;
8172 }
8173 D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion"));
8174 expr_ty inversion_var;
8175 if (
8176 (inversion_var = inversion_rule(p)) // inversion
8177 )
8178 {
8179 D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion"));
8180 _res = inversion_var;
8181 goto done;
8182 }
8183 p->mark = _mark;
8184 D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
8185 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion"));
8186 }
8187 _res = NULL;
8188 done:
8189 _PyPegen_insert_memo(p, _mark, conjunction_type, _res);
8190 D(p->level--);
8191 return _res;
8192}
8193
8194// inversion: 'not' inversion | comparison
8195static expr_ty
8196inversion_rule(Parser *p)
8197{
8198 D(p->level++);
8199 if (p->error_indicator) {
8200 D(p->level--);
8201 return NULL;
8202 }
8203 expr_ty _res = NULL;
8204 if (_PyPegen_is_memoized(p, inversion_type, &_res)) {
8205 D(p->level--);
8206 return _res;
8207 }
8208 int _mark = p->mark;
8209 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8210 p->error_indicator = 1;
8211 D(p->level--);
8212 return NULL;
8213 }
8214 int _start_lineno = p->tokens[_mark]->lineno;
8215 UNUSED(_start_lineno); // Only used by EXTRA macro
8216 int _start_col_offset = p->tokens[_mark]->col_offset;
8217 UNUSED(_start_col_offset); // Only used by EXTRA macro
8218 { // 'not' inversion
8219 if (p->error_indicator) {
8220 D(p->level--);
8221 return NULL;
8222 }
8223 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8224 Token * _keyword;
8225 expr_ty a;
8226 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008227 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008228 &&
8229 (a = inversion_rule(p)) // inversion
8230 )
8231 {
8232 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
8233 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8234 if (_token == NULL) {
8235 D(p->level--);
8236 return NULL;
8237 }
8238 int _end_lineno = _token->end_lineno;
8239 UNUSED(_end_lineno); // Only used by EXTRA macro
8240 int _end_col_offset = _token->end_col_offset;
8241 UNUSED(_end_col_offset); // Only used by EXTRA macro
8242 _res = _Py_UnaryOp ( Not , a , EXTRA );
8243 if (_res == NULL && PyErr_Occurred()) {
8244 p->error_indicator = 1;
8245 D(p->level--);
8246 return NULL;
8247 }
8248 goto done;
8249 }
8250 p->mark = _mark;
8251 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8252 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion"));
8253 }
8254 { // comparison
8255 if (p->error_indicator) {
8256 D(p->level--);
8257 return NULL;
8258 }
8259 D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison"));
8260 expr_ty comparison_var;
8261 if (
8262 (comparison_var = comparison_rule(p)) // comparison
8263 )
8264 {
8265 D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison"));
8266 _res = comparison_var;
8267 goto done;
8268 }
8269 p->mark = _mark;
8270 D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
8271 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison"));
8272 }
8273 _res = NULL;
8274 done:
8275 _PyPegen_insert_memo(p, _mark, inversion_type, _res);
8276 D(p->level--);
8277 return _res;
8278}
8279
8280// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
8281static expr_ty
8282comparison_rule(Parser *p)
8283{
8284 D(p->level++);
8285 if (p->error_indicator) {
8286 D(p->level--);
8287 return NULL;
8288 }
8289 expr_ty _res = NULL;
8290 int _mark = p->mark;
8291 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
8292 p->error_indicator = 1;
8293 D(p->level--);
8294 return NULL;
8295 }
8296 int _start_lineno = p->tokens[_mark]->lineno;
8297 UNUSED(_start_lineno); // Only used by EXTRA macro
8298 int _start_col_offset = p->tokens[_mark]->col_offset;
8299 UNUSED(_start_col_offset); // Only used by EXTRA macro
8300 { // bitwise_or compare_op_bitwise_or_pair+
8301 if (p->error_indicator) {
8302 D(p->level--);
8303 return NULL;
8304 }
8305 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8306 expr_ty a;
8307 asdl_seq * b;
8308 if (
8309 (a = bitwise_or_rule(p)) // bitwise_or
8310 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008311 (b = _loop1_92_rule(p)) // compare_op_bitwise_or_pair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008312 )
8313 {
8314 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8315 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
8316 if (_token == NULL) {
8317 D(p->level--);
8318 return NULL;
8319 }
8320 int _end_lineno = _token->end_lineno;
8321 UNUSED(_end_lineno); // Only used by EXTRA macro
8322 int _end_col_offset = _token->end_col_offset;
8323 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03008324 _res = _Py_Compare ( a , CHECK ( asdl_int_seq * , _PyPegen_get_cmpops ( p , b ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_exprs ( p , b ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008325 if (_res == NULL && PyErr_Occurred()) {
8326 p->error_indicator = 1;
8327 D(p->level--);
8328 return NULL;
8329 }
8330 goto done;
8331 }
8332 p->mark = _mark;
8333 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8334 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
8335 }
8336 { // bitwise_or
8337 if (p->error_indicator) {
8338 D(p->level--);
8339 return NULL;
8340 }
8341 D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8342 expr_ty bitwise_or_var;
8343 if (
8344 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
8345 )
8346 {
8347 D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
8348 _res = bitwise_or_var;
8349 goto done;
8350 }
8351 p->mark = _mark;
8352 D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
8353 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or"));
8354 }
8355 _res = NULL;
8356 done:
8357 D(p->level--);
8358 return _res;
8359}
8360
8361// compare_op_bitwise_or_pair:
8362// | eq_bitwise_or
8363// | noteq_bitwise_or
8364// | lte_bitwise_or
8365// | lt_bitwise_or
8366// | gte_bitwise_or
8367// | gt_bitwise_or
8368// | notin_bitwise_or
8369// | in_bitwise_or
8370// | isnot_bitwise_or
8371// | is_bitwise_or
8372static CmpopExprPair*
8373compare_op_bitwise_or_pair_rule(Parser *p)
8374{
8375 D(p->level++);
8376 if (p->error_indicator) {
8377 D(p->level--);
8378 return NULL;
8379 }
8380 CmpopExprPair* _res = NULL;
8381 int _mark = p->mark;
8382 { // eq_bitwise_or
8383 if (p->error_indicator) {
8384 D(p->level--);
8385 return NULL;
8386 }
8387 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8388 CmpopExprPair* eq_bitwise_or_var;
8389 if (
8390 (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or
8391 )
8392 {
8393 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
8394 _res = eq_bitwise_or_var;
8395 goto done;
8396 }
8397 p->mark = _mark;
8398 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8399 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or"));
8400 }
8401 { // noteq_bitwise_or
8402 if (p->error_indicator) {
8403 D(p->level--);
8404 return NULL;
8405 }
8406 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8407 CmpopExprPair* noteq_bitwise_or_var;
8408 if (
8409 (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or
8410 )
8411 {
8412 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
8413 _res = noteq_bitwise_or_var;
8414 goto done;
8415 }
8416 p->mark = _mark;
8417 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8418 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or"));
8419 }
8420 { // lte_bitwise_or
8421 if (p->error_indicator) {
8422 D(p->level--);
8423 return NULL;
8424 }
8425 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8426 CmpopExprPair* lte_bitwise_or_var;
8427 if (
8428 (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or
8429 )
8430 {
8431 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
8432 _res = lte_bitwise_or_var;
8433 goto done;
8434 }
8435 p->mark = _mark;
8436 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8437 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or"));
8438 }
8439 { // lt_bitwise_or
8440 if (p->error_indicator) {
8441 D(p->level--);
8442 return NULL;
8443 }
8444 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8445 CmpopExprPair* lt_bitwise_or_var;
8446 if (
8447 (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or
8448 )
8449 {
8450 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
8451 _res = lt_bitwise_or_var;
8452 goto done;
8453 }
8454 p->mark = _mark;
8455 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8456 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or"));
8457 }
8458 { // gte_bitwise_or
8459 if (p->error_indicator) {
8460 D(p->level--);
8461 return NULL;
8462 }
8463 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8464 CmpopExprPair* gte_bitwise_or_var;
8465 if (
8466 (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or
8467 )
8468 {
8469 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
8470 _res = gte_bitwise_or_var;
8471 goto done;
8472 }
8473 p->mark = _mark;
8474 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or"));
8476 }
8477 { // gt_bitwise_or
8478 if (p->error_indicator) {
8479 D(p->level--);
8480 return NULL;
8481 }
8482 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8483 CmpopExprPair* gt_bitwise_or_var;
8484 if (
8485 (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or
8486 )
8487 {
8488 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
8489 _res = gt_bitwise_or_var;
8490 goto done;
8491 }
8492 p->mark = _mark;
8493 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8494 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or"));
8495 }
8496 { // notin_bitwise_or
8497 if (p->error_indicator) {
8498 D(p->level--);
8499 return NULL;
8500 }
8501 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8502 CmpopExprPair* notin_bitwise_or_var;
8503 if (
8504 (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or
8505 )
8506 {
8507 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
8508 _res = notin_bitwise_or_var;
8509 goto done;
8510 }
8511 p->mark = _mark;
8512 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8513 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or"));
8514 }
8515 { // in_bitwise_or
8516 if (p->error_indicator) {
8517 D(p->level--);
8518 return NULL;
8519 }
8520 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8521 CmpopExprPair* in_bitwise_or_var;
8522 if (
8523 (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or
8524 )
8525 {
8526 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
8527 _res = in_bitwise_or_var;
8528 goto done;
8529 }
8530 p->mark = _mark;
8531 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8532 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or"));
8533 }
8534 { // isnot_bitwise_or
8535 if (p->error_indicator) {
8536 D(p->level--);
8537 return NULL;
8538 }
8539 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8540 CmpopExprPair* isnot_bitwise_or_var;
8541 if (
8542 (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or
8543 )
8544 {
8545 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
8546 _res = isnot_bitwise_or_var;
8547 goto done;
8548 }
8549 p->mark = _mark;
8550 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8551 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or"));
8552 }
8553 { // is_bitwise_or
8554 if (p->error_indicator) {
8555 D(p->level--);
8556 return NULL;
8557 }
8558 D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8559 CmpopExprPair* is_bitwise_or_var;
8560 if (
8561 (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or
8562 )
8563 {
8564 D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
8565 _res = is_bitwise_or_var;
8566 goto done;
8567 }
8568 p->mark = _mark;
8569 D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
8570 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or"));
8571 }
8572 _res = NULL;
8573 done:
8574 D(p->level--);
8575 return _res;
8576}
8577
8578// eq_bitwise_or: '==' bitwise_or
8579static CmpopExprPair*
8580eq_bitwise_or_rule(Parser *p)
8581{
8582 D(p->level++);
8583 if (p->error_indicator) {
8584 D(p->level--);
8585 return NULL;
8586 }
8587 CmpopExprPair* _res = NULL;
8588 int _mark = p->mark;
8589 { // '==' bitwise_or
8590 if (p->error_indicator) {
8591 D(p->level--);
8592 return NULL;
8593 }
8594 D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8595 Token * _literal;
8596 expr_ty a;
8597 if (
8598 (_literal = _PyPegen_expect_token(p, 27)) // token='=='
8599 &&
8600 (a = bitwise_or_rule(p)) // bitwise_or
8601 )
8602 {
8603 D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
8604 _res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
8605 if (_res == NULL && PyErr_Occurred()) {
8606 p->error_indicator = 1;
8607 D(p->level--);
8608 return NULL;
8609 }
8610 goto done;
8611 }
8612 p->mark = _mark;
8613 D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8614 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or"));
8615 }
8616 _res = NULL;
8617 done:
8618 D(p->level--);
8619 return _res;
8620}
8621
8622// noteq_bitwise_or: ('!=') bitwise_or
8623static CmpopExprPair*
8624noteq_bitwise_or_rule(Parser *p)
8625{
8626 D(p->level++);
8627 if (p->error_indicator) {
8628 D(p->level--);
8629 return NULL;
8630 }
8631 CmpopExprPair* _res = NULL;
8632 int _mark = p->mark;
8633 { // ('!=') bitwise_or
8634 if (p->error_indicator) {
8635 D(p->level--);
8636 return NULL;
8637 }
8638 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 +03008639 void *_tmp_93_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008640 expr_ty a;
8641 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008642 (_tmp_93_var = _tmp_93_rule(p)) // '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008643 &&
8644 (a = bitwise_or_rule(p)) // bitwise_or
8645 )
8646 {
8647 D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
8648 _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
8649 if (_res == NULL && PyErr_Occurred()) {
8650 p->error_indicator = 1;
8651 D(p->level--);
8652 return NULL;
8653 }
8654 goto done;
8655 }
8656 p->mark = _mark;
8657 D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8658 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or"));
8659 }
8660 _res = NULL;
8661 done:
8662 D(p->level--);
8663 return _res;
8664}
8665
8666// lte_bitwise_or: '<=' bitwise_or
8667static CmpopExprPair*
8668lte_bitwise_or_rule(Parser *p)
8669{
8670 D(p->level++);
8671 if (p->error_indicator) {
8672 D(p->level--);
8673 return NULL;
8674 }
8675 CmpopExprPair* _res = NULL;
8676 int _mark = p->mark;
8677 { // '<=' bitwise_or
8678 if (p->error_indicator) {
8679 D(p->level--);
8680 return NULL;
8681 }
8682 D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8683 Token * _literal;
8684 expr_ty a;
8685 if (
8686 (_literal = _PyPegen_expect_token(p, 29)) // token='<='
8687 &&
8688 (a = bitwise_or_rule(p)) // bitwise_or
8689 )
8690 {
8691 D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
8692 _res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
8693 if (_res == NULL && PyErr_Occurred()) {
8694 p->error_indicator = 1;
8695 D(p->level--);
8696 return NULL;
8697 }
8698 goto done;
8699 }
8700 p->mark = _mark;
8701 D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8702 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or"));
8703 }
8704 _res = NULL;
8705 done:
8706 D(p->level--);
8707 return _res;
8708}
8709
8710// lt_bitwise_or: '<' bitwise_or
8711static CmpopExprPair*
8712lt_bitwise_or_rule(Parser *p)
8713{
8714 D(p->level++);
8715 if (p->error_indicator) {
8716 D(p->level--);
8717 return NULL;
8718 }
8719 CmpopExprPair* _res = NULL;
8720 int _mark = p->mark;
8721 { // '<' bitwise_or
8722 if (p->error_indicator) {
8723 D(p->level--);
8724 return NULL;
8725 }
8726 D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8727 Token * _literal;
8728 expr_ty a;
8729 if (
8730 (_literal = _PyPegen_expect_token(p, 20)) // token='<'
8731 &&
8732 (a = bitwise_or_rule(p)) // bitwise_or
8733 )
8734 {
8735 D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
8736 _res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
8737 if (_res == NULL && PyErr_Occurred()) {
8738 p->error_indicator = 1;
8739 D(p->level--);
8740 return NULL;
8741 }
8742 goto done;
8743 }
8744 p->mark = _mark;
8745 D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8746 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or"));
8747 }
8748 _res = NULL;
8749 done:
8750 D(p->level--);
8751 return _res;
8752}
8753
8754// gte_bitwise_or: '>=' bitwise_or
8755static CmpopExprPair*
8756gte_bitwise_or_rule(Parser *p)
8757{
8758 D(p->level++);
8759 if (p->error_indicator) {
8760 D(p->level--);
8761 return NULL;
8762 }
8763 CmpopExprPair* _res = NULL;
8764 int _mark = p->mark;
8765 { // '>=' bitwise_or
8766 if (p->error_indicator) {
8767 D(p->level--);
8768 return NULL;
8769 }
8770 D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8771 Token * _literal;
8772 expr_ty a;
8773 if (
8774 (_literal = _PyPegen_expect_token(p, 30)) // token='>='
8775 &&
8776 (a = bitwise_or_rule(p)) // bitwise_or
8777 )
8778 {
8779 D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
8780 _res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
8781 if (_res == NULL && PyErr_Occurred()) {
8782 p->error_indicator = 1;
8783 D(p->level--);
8784 return NULL;
8785 }
8786 goto done;
8787 }
8788 p->mark = _mark;
8789 D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8790 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or"));
8791 }
8792 _res = NULL;
8793 done:
8794 D(p->level--);
8795 return _res;
8796}
8797
8798// gt_bitwise_or: '>' bitwise_or
8799static CmpopExprPair*
8800gt_bitwise_or_rule(Parser *p)
8801{
8802 D(p->level++);
8803 if (p->error_indicator) {
8804 D(p->level--);
8805 return NULL;
8806 }
8807 CmpopExprPair* _res = NULL;
8808 int _mark = p->mark;
8809 { // '>' bitwise_or
8810 if (p->error_indicator) {
8811 D(p->level--);
8812 return NULL;
8813 }
8814 D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8815 Token * _literal;
8816 expr_ty a;
8817 if (
8818 (_literal = _PyPegen_expect_token(p, 21)) // token='>'
8819 &&
8820 (a = bitwise_or_rule(p)) // bitwise_or
8821 )
8822 {
8823 D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
8824 _res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
8825 if (_res == NULL && PyErr_Occurred()) {
8826 p->error_indicator = 1;
8827 D(p->level--);
8828 return NULL;
8829 }
8830 goto done;
8831 }
8832 p->mark = _mark;
8833 D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8834 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or"));
8835 }
8836 _res = NULL;
8837 done:
8838 D(p->level--);
8839 return _res;
8840}
8841
8842// notin_bitwise_or: 'not' 'in' bitwise_or
8843static CmpopExprPair*
8844notin_bitwise_or_rule(Parser *p)
8845{
8846 D(p->level++);
8847 if (p->error_indicator) {
8848 D(p->level--);
8849 return NULL;
8850 }
8851 CmpopExprPair* _res = NULL;
8852 int _mark = p->mark;
8853 { // 'not' 'in' bitwise_or
8854 if (p->error_indicator) {
8855 D(p->level--);
8856 return NULL;
8857 }
8858 D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8859 Token * _keyword;
8860 Token * _keyword_1;
8861 expr_ty a;
8862 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008863 (_keyword = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008864 &&
8865 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
8866 &&
8867 (a = bitwise_or_rule(p)) // bitwise_or
8868 )
8869 {
8870 D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
8871 _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
8872 if (_res == NULL && PyErr_Occurred()) {
8873 p->error_indicator = 1;
8874 D(p->level--);
8875 return NULL;
8876 }
8877 goto done;
8878 }
8879 p->mark = _mark;
8880 D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8881 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or"));
8882 }
8883 _res = NULL;
8884 done:
8885 D(p->level--);
8886 return _res;
8887}
8888
8889// in_bitwise_or: 'in' bitwise_or
8890static CmpopExprPair*
8891in_bitwise_or_rule(Parser *p)
8892{
8893 D(p->level++);
8894 if (p->error_indicator) {
8895 D(p->level--);
8896 return NULL;
8897 }
8898 CmpopExprPair* _res = NULL;
8899 int _mark = p->mark;
8900 { // 'in' bitwise_or
8901 if (p->error_indicator) {
8902 D(p->level--);
8903 return NULL;
8904 }
8905 D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8906 Token * _keyword;
8907 expr_ty a;
8908 if (
8909 (_keyword = _PyPegen_expect_token(p, 518)) // token='in'
8910 &&
8911 (a = bitwise_or_rule(p)) // bitwise_or
8912 )
8913 {
8914 D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
8915 _res = _PyPegen_cmpop_expr_pair ( p , In , a );
8916 if (_res == NULL && PyErr_Occurred()) {
8917 p->error_indicator = 1;
8918 D(p->level--);
8919 return NULL;
8920 }
8921 goto done;
8922 }
8923 p->mark = _mark;
8924 D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8925 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or"));
8926 }
8927 _res = NULL;
8928 done:
8929 D(p->level--);
8930 return _res;
8931}
8932
8933// isnot_bitwise_or: 'is' 'not' bitwise_or
8934static CmpopExprPair*
8935isnot_bitwise_or_rule(Parser *p)
8936{
8937 D(p->level++);
8938 if (p->error_indicator) {
8939 D(p->level--);
8940 return NULL;
8941 }
8942 CmpopExprPair* _res = NULL;
8943 int _mark = p->mark;
8944 { // 'is' 'not' bitwise_or
8945 if (p->error_indicator) {
8946 D(p->level--);
8947 return NULL;
8948 }
8949 D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8950 Token * _keyword;
8951 Token * _keyword_1;
8952 expr_ty a;
8953 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008954 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008955 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03008956 (_keyword_1 = _PyPegen_expect_token(p, 526)) // token='not'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01008957 &&
8958 (a = bitwise_or_rule(p)) // bitwise_or
8959 )
8960 {
8961 D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
8962 _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
8963 if (_res == NULL && PyErr_Occurred()) {
8964 p->error_indicator = 1;
8965 D(p->level--);
8966 return NULL;
8967 }
8968 goto done;
8969 }
8970 p->mark = _mark;
8971 D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
8972 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or"));
8973 }
8974 _res = NULL;
8975 done:
8976 D(p->level--);
8977 return _res;
8978}
8979
8980// is_bitwise_or: 'is' bitwise_or
8981static CmpopExprPair*
8982is_bitwise_or_rule(Parser *p)
8983{
8984 D(p->level++);
8985 if (p->error_indicator) {
8986 D(p->level--);
8987 return NULL;
8988 }
8989 CmpopExprPair* _res = NULL;
8990 int _mark = p->mark;
8991 { // 'is' bitwise_or
8992 if (p->error_indicator) {
8993 D(p->level--);
8994 return NULL;
8995 }
8996 D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
8997 Token * _keyword;
8998 expr_ty a;
8999 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +03009000 (_keyword = _PyPegen_expect_token(p, 527)) // token='is'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01009001 &&
9002 (a = bitwise_or_rule(p)) // bitwise_or
9003 )
9004 {
9005 D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
9006 _res = _PyPegen_cmpop_expr_pair ( p , Is , a );
9007 if (_res == NULL && PyErr_Occurred()) {
9008 p->error_indicator = 1;
9009 D(p->level--);
9010 return NULL;
9011 }
9012 goto done;
9013 }
9014 p->mark = _mark;
9015 D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9016 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or"));
9017 }
9018 _res = NULL;
9019 done:
9020 D(p->level--);
9021 return _res;
9022}
9023
9024// Left-recursive
9025// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
9026static expr_ty bitwise_or_raw(Parser *);
9027static expr_ty
9028bitwise_or_rule(Parser *p)
9029{
9030 D(p->level++);
9031 expr_ty _res = NULL;
9032 if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) {
9033 D(p->level--);
9034 return _res;
9035 }
9036 int _mark = p->mark;
9037 int _resmark = p->mark;
9038 while (1) {
9039 int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res);
9040 if (tmpvar_1) {
9041 D(p->level--);
9042 return _res;
9043 }
9044 p->mark = _mark;
9045 void *_raw = bitwise_or_raw(p);
9046 if (_raw == NULL || p->mark <= _resmark)
9047 break;
9048 _resmark = p->mark;
9049 _res = _raw;
9050 }
9051 p->mark = _resmark;
9052 D(p->level--);
9053 return _res;
9054}
9055static expr_ty
9056bitwise_or_raw(Parser *p)
9057{
9058 D(p->level++);
9059 if (p->error_indicator) {
9060 D(p->level--);
9061 return NULL;
9062 }
9063 expr_ty _res = NULL;
9064 int _mark = p->mark;
9065 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9066 p->error_indicator = 1;
9067 D(p->level--);
9068 return NULL;
9069 }
9070 int _start_lineno = p->tokens[_mark]->lineno;
9071 UNUSED(_start_lineno); // Only used by EXTRA macro
9072 int _start_col_offset = p->tokens[_mark]->col_offset;
9073 UNUSED(_start_col_offset); // Only used by EXTRA macro
9074 { // bitwise_or '|' bitwise_xor
9075 if (p->error_indicator) {
9076 D(p->level--);
9077 return NULL;
9078 }
9079 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9080 Token * _literal;
9081 expr_ty a;
9082 expr_ty b;
9083 if (
9084 (a = bitwise_or_rule(p)) // bitwise_or
9085 &&
9086 (_literal = _PyPegen_expect_token(p, 18)) // token='|'
9087 &&
9088 (b = bitwise_xor_rule(p)) // bitwise_xor
9089 )
9090 {
9091 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9092 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9093 if (_token == NULL) {
9094 D(p->level--);
9095 return NULL;
9096 }
9097 int _end_lineno = _token->end_lineno;
9098 UNUSED(_end_lineno); // Only used by EXTRA macro
9099 int _end_col_offset = _token->end_col_offset;
9100 UNUSED(_end_col_offset); // Only used by EXTRA macro
9101 _res = _Py_BinOp ( a , BitOr , b , EXTRA );
9102 if (_res == NULL && PyErr_Occurred()) {
9103 p->error_indicator = 1;
9104 D(p->level--);
9105 return NULL;
9106 }
9107 goto done;
9108 }
9109 p->mark = _mark;
9110 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9111 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor"));
9112 }
9113 { // bitwise_xor
9114 if (p->error_indicator) {
9115 D(p->level--);
9116 return NULL;
9117 }
9118 D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9119 expr_ty bitwise_xor_var;
9120 if (
9121 (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor
9122 )
9123 {
9124 D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
9125 _res = bitwise_xor_var;
9126 goto done;
9127 }
9128 p->mark = _mark;
9129 D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
9130 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor"));
9131 }
9132 _res = NULL;
9133 done:
9134 D(p->level--);
9135 return _res;
9136}
9137
9138// Left-recursive
9139// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
9140static expr_ty bitwise_xor_raw(Parser *);
9141static expr_ty
9142bitwise_xor_rule(Parser *p)
9143{
9144 D(p->level++);
9145 expr_ty _res = NULL;
9146 if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) {
9147 D(p->level--);
9148 return _res;
9149 }
9150 int _mark = p->mark;
9151 int _resmark = p->mark;
9152 while (1) {
9153 int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res);
9154 if (tmpvar_2) {
9155 D(p->level--);
9156 return _res;
9157 }
9158 p->mark = _mark;
9159 void *_raw = bitwise_xor_raw(p);
9160 if (_raw == NULL || p->mark <= _resmark)
9161 break;
9162 _resmark = p->mark;
9163 _res = _raw;
9164 }
9165 p->mark = _resmark;
9166 D(p->level--);
9167 return _res;
9168}
9169static expr_ty
9170bitwise_xor_raw(Parser *p)
9171{
9172 D(p->level++);
9173 if (p->error_indicator) {
9174 D(p->level--);
9175 return NULL;
9176 }
9177 expr_ty _res = NULL;
9178 int _mark = p->mark;
9179 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9180 p->error_indicator = 1;
9181 D(p->level--);
9182 return NULL;
9183 }
9184 int _start_lineno = p->tokens[_mark]->lineno;
9185 UNUSED(_start_lineno); // Only used by EXTRA macro
9186 int _start_col_offset = p->tokens[_mark]->col_offset;
9187 UNUSED(_start_col_offset); // Only used by EXTRA macro
9188 { // bitwise_xor '^' bitwise_and
9189 if (p->error_indicator) {
9190 D(p->level--);
9191 return NULL;
9192 }
9193 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9194 Token * _literal;
9195 expr_ty a;
9196 expr_ty b;
9197 if (
9198 (a = bitwise_xor_rule(p)) // bitwise_xor
9199 &&
9200 (_literal = _PyPegen_expect_token(p, 32)) // token='^'
9201 &&
9202 (b = bitwise_and_rule(p)) // bitwise_and
9203 )
9204 {
9205 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9206 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9207 if (_token == NULL) {
9208 D(p->level--);
9209 return NULL;
9210 }
9211 int _end_lineno = _token->end_lineno;
9212 UNUSED(_end_lineno); // Only used by EXTRA macro
9213 int _end_col_offset = _token->end_col_offset;
9214 UNUSED(_end_col_offset); // Only used by EXTRA macro
9215 _res = _Py_BinOp ( a , BitXor , b , EXTRA );
9216 if (_res == NULL && PyErr_Occurred()) {
9217 p->error_indicator = 1;
9218 D(p->level--);
9219 return NULL;
9220 }
9221 goto done;
9222 }
9223 p->mark = _mark;
9224 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9225 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and"));
9226 }
9227 { // bitwise_and
9228 if (p->error_indicator) {
9229 D(p->level--);
9230 return NULL;
9231 }
9232 D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9233 expr_ty bitwise_and_var;
9234 if (
9235 (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and
9236 )
9237 {
9238 D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
9239 _res = bitwise_and_var;
9240 goto done;
9241 }
9242 p->mark = _mark;
9243 D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
9244 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and"));
9245 }
9246 _res = NULL;
9247 done:
9248 D(p->level--);
9249 return _res;
9250}
9251
9252// Left-recursive
9253// bitwise_and: bitwise_and '&' shift_expr | shift_expr
9254static expr_ty bitwise_and_raw(Parser *);
9255static expr_ty
9256bitwise_and_rule(Parser *p)
9257{
9258 D(p->level++);
9259 expr_ty _res = NULL;
9260 if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) {
9261 D(p->level--);
9262 return _res;
9263 }
9264 int _mark = p->mark;
9265 int _resmark = p->mark;
9266 while (1) {
9267 int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res);
9268 if (tmpvar_3) {
9269 D(p->level--);
9270 return _res;
9271 }
9272 p->mark = _mark;
9273 void *_raw = bitwise_and_raw(p);
9274 if (_raw == NULL || p->mark <= _resmark)
9275 break;
9276 _resmark = p->mark;
9277 _res = _raw;
9278 }
9279 p->mark = _resmark;
9280 D(p->level--);
9281 return _res;
9282}
9283static expr_ty
9284bitwise_and_raw(Parser *p)
9285{
9286 D(p->level++);
9287 if (p->error_indicator) {
9288 D(p->level--);
9289 return NULL;
9290 }
9291 expr_ty _res = NULL;
9292 int _mark = p->mark;
9293 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9294 p->error_indicator = 1;
9295 D(p->level--);
9296 return NULL;
9297 }
9298 int _start_lineno = p->tokens[_mark]->lineno;
9299 UNUSED(_start_lineno); // Only used by EXTRA macro
9300 int _start_col_offset = p->tokens[_mark]->col_offset;
9301 UNUSED(_start_col_offset); // Only used by EXTRA macro
9302 { // bitwise_and '&' shift_expr
9303 if (p->error_indicator) {
9304 D(p->level--);
9305 return NULL;
9306 }
9307 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9308 Token * _literal;
9309 expr_ty a;
9310 expr_ty b;
9311 if (
9312 (a = bitwise_and_rule(p)) // bitwise_and
9313 &&
9314 (_literal = _PyPegen_expect_token(p, 19)) // token='&'
9315 &&
9316 (b = shift_expr_rule(p)) // shift_expr
9317 )
9318 {
9319 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
9320 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9321 if (_token == NULL) {
9322 D(p->level--);
9323 return NULL;
9324 }
9325 int _end_lineno = _token->end_lineno;
9326 UNUSED(_end_lineno); // Only used by EXTRA macro
9327 int _end_col_offset = _token->end_col_offset;
9328 UNUSED(_end_col_offset); // Only used by EXTRA macro
9329 _res = _Py_BinOp ( a , BitAnd , b , EXTRA );
9330 if (_res == NULL && PyErr_Occurred()) {
9331 p->error_indicator = 1;
9332 D(p->level--);
9333 return NULL;
9334 }
9335 goto done;
9336 }
9337 p->mark = _mark;
9338 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9339 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr"));
9340 }
9341 { // shift_expr
9342 if (p->error_indicator) {
9343 D(p->level--);
9344 return NULL;
9345 }
9346 D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9347 expr_ty shift_expr_var;
9348 if (
9349 (shift_expr_var = shift_expr_rule(p)) // shift_expr
9350 )
9351 {
9352 D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr"));
9353 _res = shift_expr_var;
9354 goto done;
9355 }
9356 p->mark = _mark;
9357 D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
9358 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr"));
9359 }
9360 _res = NULL;
9361 done:
9362 D(p->level--);
9363 return _res;
9364}
9365
9366// Left-recursive
9367// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
9368static expr_ty shift_expr_raw(Parser *);
9369static expr_ty
9370shift_expr_rule(Parser *p)
9371{
9372 D(p->level++);
9373 expr_ty _res = NULL;
9374 if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) {
9375 D(p->level--);
9376 return _res;
9377 }
9378 int _mark = p->mark;
9379 int _resmark = p->mark;
9380 while (1) {
9381 int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res);
9382 if (tmpvar_4) {
9383 D(p->level--);
9384 return _res;
9385 }
9386 p->mark = _mark;
9387 void *_raw = shift_expr_raw(p);
9388 if (_raw == NULL || p->mark <= _resmark)
9389 break;
9390 _resmark = p->mark;
9391 _res = _raw;
9392 }
9393 p->mark = _resmark;
9394 D(p->level--);
9395 return _res;
9396}
9397static expr_ty
9398shift_expr_raw(Parser *p)
9399{
9400 D(p->level++);
9401 if (p->error_indicator) {
9402 D(p->level--);
9403 return NULL;
9404 }
9405 expr_ty _res = NULL;
9406 int _mark = p->mark;
9407 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9408 p->error_indicator = 1;
9409 D(p->level--);
9410 return NULL;
9411 }
9412 int _start_lineno = p->tokens[_mark]->lineno;
9413 UNUSED(_start_lineno); // Only used by EXTRA macro
9414 int _start_col_offset = p->tokens[_mark]->col_offset;
9415 UNUSED(_start_col_offset); // Only used by EXTRA macro
9416 { // shift_expr '<<' sum
9417 if (p->error_indicator) {
9418 D(p->level--);
9419 return NULL;
9420 }
9421 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9422 Token * _literal;
9423 expr_ty a;
9424 expr_ty b;
9425 if (
9426 (a = shift_expr_rule(p)) // shift_expr
9427 &&
9428 (_literal = _PyPegen_expect_token(p, 33)) // token='<<'
9429 &&
9430 (b = sum_rule(p)) // sum
9431 )
9432 {
9433 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
9434 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9435 if (_token == NULL) {
9436 D(p->level--);
9437 return NULL;
9438 }
9439 int _end_lineno = _token->end_lineno;
9440 UNUSED(_end_lineno); // Only used by EXTRA macro
9441 int _end_col_offset = _token->end_col_offset;
9442 UNUSED(_end_col_offset); // Only used by EXTRA macro
9443 _res = _Py_BinOp ( a , LShift , b , EXTRA );
9444 if (_res == NULL && PyErr_Occurred()) {
9445 p->error_indicator = 1;
9446 D(p->level--);
9447 return NULL;
9448 }
9449 goto done;
9450 }
9451 p->mark = _mark;
9452 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9453 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum"));
9454 }
9455 { // shift_expr '>>' sum
9456 if (p->error_indicator) {
9457 D(p->level--);
9458 return NULL;
9459 }
9460 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9461 Token * _literal;
9462 expr_ty a;
9463 expr_ty b;
9464 if (
9465 (a = shift_expr_rule(p)) // shift_expr
9466 &&
9467 (_literal = _PyPegen_expect_token(p, 34)) // token='>>'
9468 &&
9469 (b = sum_rule(p)) // sum
9470 )
9471 {
9472 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
9473 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9474 if (_token == NULL) {
9475 D(p->level--);
9476 return NULL;
9477 }
9478 int _end_lineno = _token->end_lineno;
9479 UNUSED(_end_lineno); // Only used by EXTRA macro
9480 int _end_col_offset = _token->end_col_offset;
9481 UNUSED(_end_col_offset); // Only used by EXTRA macro
9482 _res = _Py_BinOp ( a , RShift , b , EXTRA );
9483 if (_res == NULL && PyErr_Occurred()) {
9484 p->error_indicator = 1;
9485 D(p->level--);
9486 return NULL;
9487 }
9488 goto done;
9489 }
9490 p->mark = _mark;
9491 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9492 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum"));
9493 }
9494 { // sum
9495 if (p->error_indicator) {
9496 D(p->level--);
9497 return NULL;
9498 }
9499 D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum"));
9500 expr_ty sum_var;
9501 if (
9502 (sum_var = sum_rule(p)) // sum
9503 )
9504 {
9505 D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum"));
9506 _res = sum_var;
9507 goto done;
9508 }
9509 p->mark = _mark;
9510 D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
9511 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum"));
9512 }
9513 _res = NULL;
9514 done:
9515 D(p->level--);
9516 return _res;
9517}
9518
9519// Left-recursive
9520// sum: sum '+' term | sum '-' term | term
9521static expr_ty sum_raw(Parser *);
9522static expr_ty
9523sum_rule(Parser *p)
9524{
9525 D(p->level++);
9526 expr_ty _res = NULL;
9527 if (_PyPegen_is_memoized(p, sum_type, &_res)) {
9528 D(p->level--);
9529 return _res;
9530 }
9531 int _mark = p->mark;
9532 int _resmark = p->mark;
9533 while (1) {
9534 int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res);
9535 if (tmpvar_5) {
9536 D(p->level--);
9537 return _res;
9538 }
9539 p->mark = _mark;
9540 void *_raw = sum_raw(p);
9541 if (_raw == NULL || p->mark <= _resmark)
9542 break;
9543 _resmark = p->mark;
9544 _res = _raw;
9545 }
9546 p->mark = _resmark;
9547 D(p->level--);
9548 return _res;
9549}
9550static expr_ty
9551sum_raw(Parser *p)
9552{
9553 D(p->level++);
9554 if (p->error_indicator) {
9555 D(p->level--);
9556 return NULL;
9557 }
9558 expr_ty _res = NULL;
9559 int _mark = p->mark;
9560 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9561 p->error_indicator = 1;
9562 D(p->level--);
9563 return NULL;
9564 }
9565 int _start_lineno = p->tokens[_mark]->lineno;
9566 UNUSED(_start_lineno); // Only used by EXTRA macro
9567 int _start_col_offset = p->tokens[_mark]->col_offset;
9568 UNUSED(_start_col_offset); // Only used by EXTRA macro
9569 { // sum '+' term
9570 if (p->error_indicator) {
9571 D(p->level--);
9572 return NULL;
9573 }
9574 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9575 Token * _literal;
9576 expr_ty a;
9577 expr_ty b;
9578 if (
9579 (a = sum_rule(p)) // sum
9580 &&
9581 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9582 &&
9583 (b = term_rule(p)) // term
9584 )
9585 {
9586 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
9587 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9588 if (_token == NULL) {
9589 D(p->level--);
9590 return NULL;
9591 }
9592 int _end_lineno = _token->end_lineno;
9593 UNUSED(_end_lineno); // Only used by EXTRA macro
9594 int _end_col_offset = _token->end_col_offset;
9595 UNUSED(_end_col_offset); // Only used by EXTRA macro
9596 _res = _Py_BinOp ( a , Add , b , EXTRA );
9597 if (_res == NULL && PyErr_Occurred()) {
9598 p->error_indicator = 1;
9599 D(p->level--);
9600 return NULL;
9601 }
9602 goto done;
9603 }
9604 p->mark = _mark;
9605 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9606 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term"));
9607 }
9608 { // sum '-' term
9609 if (p->error_indicator) {
9610 D(p->level--);
9611 return NULL;
9612 }
9613 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9614 Token * _literal;
9615 expr_ty a;
9616 expr_ty b;
9617 if (
9618 (a = sum_rule(p)) // sum
9619 &&
9620 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
9621 &&
9622 (b = term_rule(p)) // term
9623 )
9624 {
9625 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
9626 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9627 if (_token == NULL) {
9628 D(p->level--);
9629 return NULL;
9630 }
9631 int _end_lineno = _token->end_lineno;
9632 UNUSED(_end_lineno); // Only used by EXTRA macro
9633 int _end_col_offset = _token->end_col_offset;
9634 UNUSED(_end_col_offset); // Only used by EXTRA macro
9635 _res = _Py_BinOp ( a , Sub , b , EXTRA );
9636 if (_res == NULL && PyErr_Occurred()) {
9637 p->error_indicator = 1;
9638 D(p->level--);
9639 return NULL;
9640 }
9641 goto done;
9642 }
9643 p->mark = _mark;
9644 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9645 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term"));
9646 }
9647 { // term
9648 if (p->error_indicator) {
9649 D(p->level--);
9650 return NULL;
9651 }
9652 D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term"));
9653 expr_ty term_var;
9654 if (
9655 (term_var = term_rule(p)) // term
9656 )
9657 {
9658 D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term"));
9659 _res = term_var;
9660 goto done;
9661 }
9662 p->mark = _mark;
9663 D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
9664 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term"));
9665 }
9666 _res = NULL;
9667 done:
9668 D(p->level--);
9669 return _res;
9670}
9671
9672// Left-recursive
9673// term:
9674// | term '*' factor
9675// | term '/' factor
9676// | term '//' factor
9677// | term '%' factor
9678// | term '@' factor
9679// | factor
9680static expr_ty term_raw(Parser *);
9681static expr_ty
9682term_rule(Parser *p)
9683{
9684 D(p->level++);
9685 expr_ty _res = NULL;
9686 if (_PyPegen_is_memoized(p, term_type, &_res)) {
9687 D(p->level--);
9688 return _res;
9689 }
9690 int _mark = p->mark;
9691 int _resmark = p->mark;
9692 while (1) {
9693 int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res);
9694 if (tmpvar_6) {
9695 D(p->level--);
9696 return _res;
9697 }
9698 p->mark = _mark;
9699 void *_raw = term_raw(p);
9700 if (_raw == NULL || p->mark <= _resmark)
9701 break;
9702 _resmark = p->mark;
9703 _res = _raw;
9704 }
9705 p->mark = _resmark;
9706 D(p->level--);
9707 return _res;
9708}
9709static expr_ty
9710term_raw(Parser *p)
9711{
9712 D(p->level++);
9713 if (p->error_indicator) {
9714 D(p->level--);
9715 return NULL;
9716 }
9717 expr_ty _res = NULL;
9718 int _mark = p->mark;
9719 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9720 p->error_indicator = 1;
9721 D(p->level--);
9722 return NULL;
9723 }
9724 int _start_lineno = p->tokens[_mark]->lineno;
9725 UNUSED(_start_lineno); // Only used by EXTRA macro
9726 int _start_col_offset = p->tokens[_mark]->col_offset;
9727 UNUSED(_start_col_offset); // Only used by EXTRA macro
9728 { // term '*' factor
9729 if (p->error_indicator) {
9730 D(p->level--);
9731 return NULL;
9732 }
9733 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9734 Token * _literal;
9735 expr_ty a;
9736 expr_ty b;
9737 if (
9738 (a = term_rule(p)) // term
9739 &&
9740 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
9741 &&
9742 (b = factor_rule(p)) // factor
9743 )
9744 {
9745 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
9746 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9747 if (_token == NULL) {
9748 D(p->level--);
9749 return NULL;
9750 }
9751 int _end_lineno = _token->end_lineno;
9752 UNUSED(_end_lineno); // Only used by EXTRA macro
9753 int _end_col_offset = _token->end_col_offset;
9754 UNUSED(_end_col_offset); // Only used by EXTRA macro
9755 _res = _Py_BinOp ( a , Mult , b , EXTRA );
9756 if (_res == NULL && PyErr_Occurred()) {
9757 p->error_indicator = 1;
9758 D(p->level--);
9759 return NULL;
9760 }
9761 goto done;
9762 }
9763 p->mark = _mark;
9764 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9765 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor"));
9766 }
9767 { // term '/' factor
9768 if (p->error_indicator) {
9769 D(p->level--);
9770 return NULL;
9771 }
9772 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9773 Token * _literal;
9774 expr_ty a;
9775 expr_ty b;
9776 if (
9777 (a = term_rule(p)) // term
9778 &&
9779 (_literal = _PyPegen_expect_token(p, 17)) // token='/'
9780 &&
9781 (b = factor_rule(p)) // factor
9782 )
9783 {
9784 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
9785 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9786 if (_token == NULL) {
9787 D(p->level--);
9788 return NULL;
9789 }
9790 int _end_lineno = _token->end_lineno;
9791 UNUSED(_end_lineno); // Only used by EXTRA macro
9792 int _end_col_offset = _token->end_col_offset;
9793 UNUSED(_end_col_offset); // Only used by EXTRA macro
9794 _res = _Py_BinOp ( a , Div , b , EXTRA );
9795 if (_res == NULL && PyErr_Occurred()) {
9796 p->error_indicator = 1;
9797 D(p->level--);
9798 return NULL;
9799 }
9800 goto done;
9801 }
9802 p->mark = _mark;
9803 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9804 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor"));
9805 }
9806 { // term '//' factor
9807 if (p->error_indicator) {
9808 D(p->level--);
9809 return NULL;
9810 }
9811 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9812 Token * _literal;
9813 expr_ty a;
9814 expr_ty b;
9815 if (
9816 (a = term_rule(p)) // term
9817 &&
9818 (_literal = _PyPegen_expect_token(p, 47)) // token='//'
9819 &&
9820 (b = factor_rule(p)) // factor
9821 )
9822 {
9823 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
9824 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9825 if (_token == NULL) {
9826 D(p->level--);
9827 return NULL;
9828 }
9829 int _end_lineno = _token->end_lineno;
9830 UNUSED(_end_lineno); // Only used by EXTRA macro
9831 int _end_col_offset = _token->end_col_offset;
9832 UNUSED(_end_col_offset); // Only used by EXTRA macro
9833 _res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
9834 if (_res == NULL && PyErr_Occurred()) {
9835 p->error_indicator = 1;
9836 D(p->level--);
9837 return NULL;
9838 }
9839 goto done;
9840 }
9841 p->mark = _mark;
9842 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9843 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor"));
9844 }
9845 { // term '%' factor
9846 if (p->error_indicator) {
9847 D(p->level--);
9848 return NULL;
9849 }
9850 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9851 Token * _literal;
9852 expr_ty a;
9853 expr_ty b;
9854 if (
9855 (a = term_rule(p)) // term
9856 &&
9857 (_literal = _PyPegen_expect_token(p, 24)) // token='%'
9858 &&
9859 (b = factor_rule(p)) // factor
9860 )
9861 {
9862 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
9863 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9864 if (_token == NULL) {
9865 D(p->level--);
9866 return NULL;
9867 }
9868 int _end_lineno = _token->end_lineno;
9869 UNUSED(_end_lineno); // Only used by EXTRA macro
9870 int _end_col_offset = _token->end_col_offset;
9871 UNUSED(_end_col_offset); // Only used by EXTRA macro
9872 _res = _Py_BinOp ( a , Mod , b , EXTRA );
9873 if (_res == NULL && PyErr_Occurred()) {
9874 p->error_indicator = 1;
9875 D(p->level--);
9876 return NULL;
9877 }
9878 goto done;
9879 }
9880 p->mark = _mark;
9881 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9882 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor"));
9883 }
9884 { // term '@' factor
9885 if (p->error_indicator) {
9886 D(p->level--);
9887 return NULL;
9888 }
9889 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9890 Token * _literal;
9891 expr_ty a;
9892 expr_ty b;
9893 if (
9894 (a = term_rule(p)) // term
9895 &&
9896 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
9897 &&
9898 (b = factor_rule(p)) // factor
9899 )
9900 {
9901 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
9902 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9903 if (_token == NULL) {
9904 D(p->level--);
9905 return NULL;
9906 }
9907 int _end_lineno = _token->end_lineno;
9908 UNUSED(_end_lineno); // Only used by EXTRA macro
9909 int _end_col_offset = _token->end_col_offset;
9910 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +03009911 _res = CHECK_VERSION ( expr_ty , 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +01009912 if (_res == NULL && PyErr_Occurred()) {
9913 p->error_indicator = 1;
9914 D(p->level--);
9915 return NULL;
9916 }
9917 goto done;
9918 }
9919 p->mark = _mark;
9920 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9921 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor"));
9922 }
9923 { // factor
9924 if (p->error_indicator) {
9925 D(p->level--);
9926 return NULL;
9927 }
9928 D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor"));
9929 expr_ty factor_var;
9930 if (
9931 (factor_var = factor_rule(p)) // factor
9932 )
9933 {
9934 D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor"));
9935 _res = factor_var;
9936 goto done;
9937 }
9938 p->mark = _mark;
9939 D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
9940 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor"));
9941 }
9942 _res = NULL;
9943 done:
9944 D(p->level--);
9945 return _res;
9946}
9947
9948// factor: '+' factor | '-' factor | '~' factor | power
9949static expr_ty
9950factor_rule(Parser *p)
9951{
9952 D(p->level++);
9953 if (p->error_indicator) {
9954 D(p->level--);
9955 return NULL;
9956 }
9957 expr_ty _res = NULL;
9958 if (_PyPegen_is_memoized(p, factor_type, &_res)) {
9959 D(p->level--);
9960 return _res;
9961 }
9962 int _mark = p->mark;
9963 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
9964 p->error_indicator = 1;
9965 D(p->level--);
9966 return NULL;
9967 }
9968 int _start_lineno = p->tokens[_mark]->lineno;
9969 UNUSED(_start_lineno); // Only used by EXTRA macro
9970 int _start_col_offset = p->tokens[_mark]->col_offset;
9971 UNUSED(_start_col_offset); // Only used by EXTRA macro
9972 { // '+' factor
9973 if (p->error_indicator) {
9974 D(p->level--);
9975 return NULL;
9976 }
9977 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9978 Token * _literal;
9979 expr_ty a;
9980 if (
9981 (_literal = _PyPegen_expect_token(p, 14)) // token='+'
9982 &&
9983 (a = factor_rule(p)) // factor
9984 )
9985 {
9986 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor"));
9987 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
9988 if (_token == NULL) {
9989 D(p->level--);
9990 return NULL;
9991 }
9992 int _end_lineno = _token->end_lineno;
9993 UNUSED(_end_lineno); // Only used by EXTRA macro
9994 int _end_col_offset = _token->end_col_offset;
9995 UNUSED(_end_col_offset); // Only used by EXTRA macro
9996 _res = _Py_UnaryOp ( UAdd , a , EXTRA );
9997 if (_res == NULL && PyErr_Occurred()) {
9998 p->error_indicator = 1;
9999 D(p->level--);
10000 return NULL;
10001 }
10002 goto done;
10003 }
10004 p->mark = _mark;
10005 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10006 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor"));
10007 }
10008 { // '-' factor
10009 if (p->error_indicator) {
10010 D(p->level--);
10011 return NULL;
10012 }
10013 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10014 Token * _literal;
10015 expr_ty a;
10016 if (
10017 (_literal = _PyPegen_expect_token(p, 15)) // token='-'
10018 &&
10019 (a = factor_rule(p)) // factor
10020 )
10021 {
10022 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor"));
10023 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10024 if (_token == NULL) {
10025 D(p->level--);
10026 return NULL;
10027 }
10028 int _end_lineno = _token->end_lineno;
10029 UNUSED(_end_lineno); // Only used by EXTRA macro
10030 int _end_col_offset = _token->end_col_offset;
10031 UNUSED(_end_col_offset); // Only used by EXTRA macro
10032 _res = _Py_UnaryOp ( USub , a , EXTRA );
10033 if (_res == NULL && PyErr_Occurred()) {
10034 p->error_indicator = 1;
10035 D(p->level--);
10036 return NULL;
10037 }
10038 goto done;
10039 }
10040 p->mark = _mark;
10041 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10042 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor"));
10043 }
10044 { // '~' factor
10045 if (p->error_indicator) {
10046 D(p->level--);
10047 return NULL;
10048 }
10049 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10050 Token * _literal;
10051 expr_ty a;
10052 if (
10053 (_literal = _PyPegen_expect_token(p, 31)) // token='~'
10054 &&
10055 (a = factor_rule(p)) // factor
10056 )
10057 {
10058 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor"));
10059 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10060 if (_token == NULL) {
10061 D(p->level--);
10062 return NULL;
10063 }
10064 int _end_lineno = _token->end_lineno;
10065 UNUSED(_end_lineno); // Only used by EXTRA macro
10066 int _end_col_offset = _token->end_col_offset;
10067 UNUSED(_end_col_offset); // Only used by EXTRA macro
10068 _res = _Py_UnaryOp ( Invert , a , EXTRA );
10069 if (_res == NULL && PyErr_Occurred()) {
10070 p->error_indicator = 1;
10071 D(p->level--);
10072 return NULL;
10073 }
10074 goto done;
10075 }
10076 p->mark = _mark;
10077 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10078 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor"));
10079 }
10080 { // power
10081 if (p->error_indicator) {
10082 D(p->level--);
10083 return NULL;
10084 }
10085 D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power"));
10086 expr_ty power_var;
10087 if (
10088 (power_var = power_rule(p)) // power
10089 )
10090 {
10091 D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power"));
10092 _res = power_var;
10093 goto done;
10094 }
10095 p->mark = _mark;
10096 D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
10097 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power"));
10098 }
10099 _res = NULL;
10100 done:
10101 _PyPegen_insert_memo(p, _mark, factor_type, _res);
10102 D(p->level--);
10103 return _res;
10104}
10105
10106// power: await_primary '**' factor | await_primary
10107static expr_ty
10108power_rule(Parser *p)
10109{
10110 D(p->level++);
10111 if (p->error_indicator) {
10112 D(p->level--);
10113 return NULL;
10114 }
10115 expr_ty _res = NULL;
10116 int _mark = p->mark;
10117 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10118 p->error_indicator = 1;
10119 D(p->level--);
10120 return NULL;
10121 }
10122 int _start_lineno = p->tokens[_mark]->lineno;
10123 UNUSED(_start_lineno); // Only used by EXTRA macro
10124 int _start_col_offset = p->tokens[_mark]->col_offset;
10125 UNUSED(_start_col_offset); // Only used by EXTRA macro
10126 { // await_primary '**' factor
10127 if (p->error_indicator) {
10128 D(p->level--);
10129 return NULL;
10130 }
10131 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10132 Token * _literal;
10133 expr_ty a;
10134 expr_ty b;
10135 if (
10136 (a = await_primary_rule(p)) // await_primary
10137 &&
10138 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
10139 &&
10140 (b = factor_rule(p)) // factor
10141 )
10142 {
10143 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
10144 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10145 if (_token == NULL) {
10146 D(p->level--);
10147 return NULL;
10148 }
10149 int _end_lineno = _token->end_lineno;
10150 UNUSED(_end_lineno); // Only used by EXTRA macro
10151 int _end_col_offset = _token->end_col_offset;
10152 UNUSED(_end_col_offset); // Only used by EXTRA macro
10153 _res = _Py_BinOp ( a , Pow , b , EXTRA );
10154 if (_res == NULL && PyErr_Occurred()) {
10155 p->error_indicator = 1;
10156 D(p->level--);
10157 return NULL;
10158 }
10159 goto done;
10160 }
10161 p->mark = _mark;
10162 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10163 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor"));
10164 }
10165 { // await_primary
10166 if (p->error_indicator) {
10167 D(p->level--);
10168 return NULL;
10169 }
10170 D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary"));
10171 expr_ty await_primary_var;
10172 if (
10173 (await_primary_var = await_primary_rule(p)) // await_primary
10174 )
10175 {
10176 D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary"));
10177 _res = await_primary_var;
10178 goto done;
10179 }
10180 p->mark = _mark;
10181 D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
10182 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary"));
10183 }
10184 _res = NULL;
10185 done:
10186 D(p->level--);
10187 return _res;
10188}
10189
10190// await_primary: AWAIT primary | primary
10191static expr_ty
10192await_primary_rule(Parser *p)
10193{
10194 D(p->level++);
10195 if (p->error_indicator) {
10196 D(p->level--);
10197 return NULL;
10198 }
10199 expr_ty _res = NULL;
10200 if (_PyPegen_is_memoized(p, await_primary_type, &_res)) {
10201 D(p->level--);
10202 return _res;
10203 }
10204 int _mark = p->mark;
10205 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10206 p->error_indicator = 1;
10207 D(p->level--);
10208 return NULL;
10209 }
10210 int _start_lineno = p->tokens[_mark]->lineno;
10211 UNUSED(_start_lineno); // Only used by EXTRA macro
10212 int _start_col_offset = p->tokens[_mark]->col_offset;
10213 UNUSED(_start_col_offset); // Only used by EXTRA macro
10214 { // AWAIT primary
10215 if (p->error_indicator) {
10216 D(p->level--);
10217 return NULL;
10218 }
10219 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10220 expr_ty a;
10221 Token * await_var;
10222 if (
10223 (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT'
10224 &&
10225 (a = primary_rule(p)) // primary
10226 )
10227 {
10228 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
10229 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10230 if (_token == NULL) {
10231 D(p->level--);
10232 return NULL;
10233 }
10234 int _end_lineno = _token->end_lineno;
10235 UNUSED(_end_lineno); // Only used by EXTRA macro
10236 int _end_col_offset = _token->end_col_offset;
10237 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030010238 _res = CHECK_VERSION ( expr_ty , 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010239 if (_res == NULL && PyErr_Occurred()) {
10240 p->error_indicator = 1;
10241 D(p->level--);
10242 return NULL;
10243 }
10244 goto done;
10245 }
10246 p->mark = _mark;
10247 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10248 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary"));
10249 }
10250 { // primary
10251 if (p->error_indicator) {
10252 D(p->level--);
10253 return NULL;
10254 }
10255 D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary"));
10256 expr_ty primary_var;
10257 if (
10258 (primary_var = primary_rule(p)) // primary
10259 )
10260 {
10261 D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary"));
10262 _res = primary_var;
10263 goto done;
10264 }
10265 p->mark = _mark;
10266 D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
10267 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary"));
10268 }
10269 _res = NULL;
10270 done:
10271 _PyPegen_insert_memo(p, _mark, await_primary_type, _res);
10272 D(p->level--);
10273 return _res;
10274}
10275
10276// Left-recursive
10277// primary:
10278// | primary '.' NAME
10279// | primary genexp
10280// | primary '(' arguments? ')'
10281// | primary '[' slices ']'
10282// | atom
10283static expr_ty primary_raw(Parser *);
10284static expr_ty
10285primary_rule(Parser *p)
10286{
10287 D(p->level++);
10288 expr_ty _res = NULL;
10289 if (_PyPegen_is_memoized(p, primary_type, &_res)) {
10290 D(p->level--);
10291 return _res;
10292 }
10293 int _mark = p->mark;
10294 int _resmark = p->mark;
10295 while (1) {
10296 int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res);
10297 if (tmpvar_7) {
10298 D(p->level--);
10299 return _res;
10300 }
10301 p->mark = _mark;
10302 void *_raw = primary_raw(p);
10303 if (_raw == NULL || p->mark <= _resmark)
10304 break;
10305 _resmark = p->mark;
10306 _res = _raw;
10307 }
10308 p->mark = _resmark;
10309 D(p->level--);
10310 return _res;
10311}
10312static expr_ty
10313primary_raw(Parser *p)
10314{
10315 D(p->level++);
10316 if (p->error_indicator) {
10317 D(p->level--);
10318 return NULL;
10319 }
10320 expr_ty _res = NULL;
10321 int _mark = p->mark;
10322 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10323 p->error_indicator = 1;
10324 D(p->level--);
10325 return NULL;
10326 }
10327 int _start_lineno = p->tokens[_mark]->lineno;
10328 UNUSED(_start_lineno); // Only used by EXTRA macro
10329 int _start_col_offset = p->tokens[_mark]->col_offset;
10330 UNUSED(_start_col_offset); // Only used by EXTRA macro
10331 { // primary '.' NAME
10332 if (p->error_indicator) {
10333 D(p->level--);
10334 return NULL;
10335 }
10336 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10337 Token * _literal;
10338 expr_ty a;
10339 expr_ty b;
10340 if (
10341 (a = primary_rule(p)) // primary
10342 &&
10343 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
10344 &&
10345 (b = _PyPegen_name_token(p)) // NAME
10346 )
10347 {
10348 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
10349 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10350 if (_token == NULL) {
10351 D(p->level--);
10352 return NULL;
10353 }
10354 int _end_lineno = _token->end_lineno;
10355 UNUSED(_end_lineno); // Only used by EXTRA macro
10356 int _end_col_offset = _token->end_col_offset;
10357 UNUSED(_end_col_offset); // Only used by EXTRA macro
10358 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
10359 if (_res == NULL && PyErr_Occurred()) {
10360 p->error_indicator = 1;
10361 D(p->level--);
10362 return NULL;
10363 }
10364 goto done;
10365 }
10366 p->mark = _mark;
10367 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10368 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME"));
10369 }
10370 { // primary genexp
10371 if (p->error_indicator) {
10372 D(p->level--);
10373 return NULL;
10374 }
10375 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10376 expr_ty a;
10377 expr_ty b;
10378 if (
10379 (a = primary_rule(p)) // primary
10380 &&
10381 (b = genexp_rule(p)) // genexp
10382 )
10383 {
10384 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp"));
10385 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10386 if (_token == NULL) {
10387 D(p->level--);
10388 return NULL;
10389 }
10390 int _end_lineno = _token->end_lineno;
10391 UNUSED(_end_lineno); // Only used by EXTRA macro
10392 int _end_col_offset = _token->end_col_offset;
10393 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030010394 _res = _Py_Call ( a , CHECK ( asdl_expr_seq * , ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010395 if (_res == NULL && PyErr_Occurred()) {
10396 p->error_indicator = 1;
10397 D(p->level--);
10398 return NULL;
10399 }
10400 goto done;
10401 }
10402 p->mark = _mark;
10403 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10404 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp"));
10405 }
10406 { // primary '(' arguments? ')'
10407 if (p->error_indicator) {
10408 D(p->level--);
10409 return NULL;
10410 }
10411 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10412 Token * _literal;
10413 Token * _literal_1;
10414 expr_ty a;
10415 void *b;
10416 if (
10417 (a = primary_rule(p)) // primary
10418 &&
10419 (_literal = _PyPegen_expect_token(p, 7)) // token='('
10420 &&
10421 (b = arguments_rule(p), 1) // arguments?
10422 &&
10423 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
10424 )
10425 {
10426 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
10427 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10428 if (_token == NULL) {
10429 D(p->level--);
10430 return NULL;
10431 }
10432 int _end_lineno = _token->end_lineno;
10433 UNUSED(_end_lineno); // Only used by EXTRA macro
10434 int _end_col_offset = _token->end_col_offset;
10435 UNUSED(_end_col_offset); // Only used by EXTRA macro
10436 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
10437 if (_res == NULL && PyErr_Occurred()) {
10438 p->error_indicator = 1;
10439 D(p->level--);
10440 return NULL;
10441 }
10442 goto done;
10443 }
10444 p->mark = _mark;
10445 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10446 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'"));
10447 }
10448 { // primary '[' slices ']'
10449 if (p->error_indicator) {
10450 D(p->level--);
10451 return NULL;
10452 }
10453 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10454 Token * _literal;
10455 Token * _literal_1;
10456 expr_ty a;
10457 expr_ty b;
10458 if (
10459 (a = primary_rule(p)) // primary
10460 &&
10461 (_literal = _PyPegen_expect_token(p, 9)) // token='['
10462 &&
10463 (b = slices_rule(p)) // slices
10464 &&
10465 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
10466 )
10467 {
10468 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
10469 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10470 if (_token == NULL) {
10471 D(p->level--);
10472 return NULL;
10473 }
10474 int _end_lineno = _token->end_lineno;
10475 UNUSED(_end_lineno); // Only used by EXTRA macro
10476 int _end_col_offset = _token->end_col_offset;
10477 UNUSED(_end_col_offset); // Only used by EXTRA macro
10478 _res = _Py_Subscript ( a , b , Load , EXTRA );
10479 if (_res == NULL && PyErr_Occurred()) {
10480 p->error_indicator = 1;
10481 D(p->level--);
10482 return NULL;
10483 }
10484 goto done;
10485 }
10486 p->mark = _mark;
10487 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10488 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'"));
10489 }
10490 { // atom
10491 if (p->error_indicator) {
10492 D(p->level--);
10493 return NULL;
10494 }
10495 D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom"));
10496 expr_ty atom_var;
10497 if (
10498 (atom_var = atom_rule(p)) // atom
10499 )
10500 {
10501 D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom"));
10502 _res = atom_var;
10503 goto done;
10504 }
10505 p->mark = _mark;
10506 D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
10507 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom"));
10508 }
10509 _res = NULL;
10510 done:
10511 D(p->level--);
10512 return _res;
10513}
10514
10515// slices: slice !',' | ','.slice+ ','?
10516static expr_ty
10517slices_rule(Parser *p)
10518{
10519 D(p->level++);
10520 if (p->error_indicator) {
10521 D(p->level--);
10522 return NULL;
10523 }
10524 expr_ty _res = NULL;
10525 int _mark = p->mark;
10526 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10527 p->error_indicator = 1;
10528 D(p->level--);
10529 return NULL;
10530 }
10531 int _start_lineno = p->tokens[_mark]->lineno;
10532 UNUSED(_start_lineno); // Only used by EXTRA macro
10533 int _start_col_offset = p->tokens[_mark]->col_offset;
10534 UNUSED(_start_col_offset); // Only used by EXTRA macro
10535 { // slice !','
10536 if (p->error_indicator) {
10537 D(p->level--);
10538 return NULL;
10539 }
10540 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','"));
10541 expr_ty a;
10542 if (
10543 (a = slice_rule(p)) // slice
10544 &&
10545 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
10546 )
10547 {
10548 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
10549 _res = a;
10550 if (_res == NULL && PyErr_Occurred()) {
10551 p->error_indicator = 1;
10552 D(p->level--);
10553 return NULL;
10554 }
10555 goto done;
10556 }
10557 p->mark = _mark;
10558 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10559 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','"));
10560 }
10561 { // ','.slice+ ','?
10562 if (p->error_indicator) {
10563 D(p->level--);
10564 return NULL;
10565 }
10566 D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10567 void *_opt_var;
10568 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010010569 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010570 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010010571 (a = (asdl_expr_seq*)_gather_94_rule(p)) // ','.slice+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010572 &&
10573 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
10574 )
10575 {
10576 D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
10577 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10578 if (_token == NULL) {
10579 D(p->level--);
10580 return NULL;
10581 }
10582 int _end_lineno = _token->end_lineno;
10583 UNUSED(_end_lineno); // Only used by EXTRA macro
10584 int _end_col_offset = _token->end_col_offset;
10585 UNUSED(_end_col_offset); // Only used by EXTRA macro
10586 _res = _Py_Tuple ( a , Load , EXTRA );
10587 if (_res == NULL && PyErr_Occurred()) {
10588 p->error_indicator = 1;
10589 D(p->level--);
10590 return NULL;
10591 }
10592 goto done;
10593 }
10594 p->mark = _mark;
10595 D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
10596 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?"));
10597 }
10598 _res = NULL;
10599 done:
10600 D(p->level--);
10601 return _res;
10602}
10603
10604// slice: expression? ':' expression? [':' expression?] | expression
10605static expr_ty
10606slice_rule(Parser *p)
10607{
10608 D(p->level++);
10609 if (p->error_indicator) {
10610 D(p->level--);
10611 return NULL;
10612 }
10613 expr_ty _res = NULL;
10614 int _mark = p->mark;
10615 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10616 p->error_indicator = 1;
10617 D(p->level--);
10618 return NULL;
10619 }
10620 int _start_lineno = p->tokens[_mark]->lineno;
10621 UNUSED(_start_lineno); // Only used by EXTRA macro
10622 int _start_col_offset = p->tokens[_mark]->col_offset;
10623 UNUSED(_start_col_offset); // Only used by EXTRA macro
10624 { // expression? ':' expression? [':' expression?]
10625 if (p->error_indicator) {
10626 D(p->level--);
10627 return NULL;
10628 }
10629 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10630 Token * _literal;
10631 void *a;
10632 void *b;
10633 void *c;
10634 if (
10635 (a = expression_rule(p), 1) // expression?
10636 &&
10637 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
10638 &&
10639 (b = expression_rule(p), 1) // expression?
10640 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010641 (c = _tmp_96_rule(p), 1) // [':' expression?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010642 )
10643 {
10644 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10645 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10646 if (_token == NULL) {
10647 D(p->level--);
10648 return NULL;
10649 }
10650 int _end_lineno = _token->end_lineno;
10651 UNUSED(_end_lineno); // Only used by EXTRA macro
10652 int _end_col_offset = _token->end_col_offset;
10653 UNUSED(_end_col_offset); // Only used by EXTRA macro
10654 _res = _Py_Slice ( a , b , c , EXTRA );
10655 if (_res == NULL && PyErr_Occurred()) {
10656 p->error_indicator = 1;
10657 D(p->level--);
10658 return NULL;
10659 }
10660 goto done;
10661 }
10662 p->mark = _mark;
10663 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10664 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
10665 }
10666 { // expression
10667 if (p->error_indicator) {
10668 D(p->level--);
10669 return NULL;
10670 }
10671 D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
10672 expr_ty a;
10673 if (
10674 (a = expression_rule(p)) // expression
10675 )
10676 {
10677 D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
10678 _res = a;
10679 if (_res == NULL && PyErr_Occurred()) {
10680 p->error_indicator = 1;
10681 D(p->level--);
10682 return NULL;
10683 }
10684 goto done;
10685 }
10686 p->mark = _mark;
10687 D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
10688 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
10689 }
10690 _res = NULL;
10691 done:
10692 D(p->level--);
10693 return _res;
10694}
10695
10696// atom:
10697// | NAME
10698// | 'True'
10699// | 'False'
10700// | 'None'
10701// | &STRING strings
10702// | NUMBER
10703// | &'(' (tuple | group | genexp)
10704// | &'[' (list | listcomp)
10705// | &'{' (dict | set | dictcomp | setcomp)
10706// | '...'
10707static expr_ty
10708atom_rule(Parser *p)
10709{
10710 D(p->level++);
10711 if (p->error_indicator) {
10712 D(p->level--);
10713 return NULL;
10714 }
10715 expr_ty _res = NULL;
10716 int _mark = p->mark;
10717 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
10718 p->error_indicator = 1;
10719 D(p->level--);
10720 return NULL;
10721 }
10722 int _start_lineno = p->tokens[_mark]->lineno;
10723 UNUSED(_start_lineno); // Only used by EXTRA macro
10724 int _start_col_offset = p->tokens[_mark]->col_offset;
10725 UNUSED(_start_col_offset); // Only used by EXTRA macro
10726 { // NAME
10727 if (p->error_indicator) {
10728 D(p->level--);
10729 return NULL;
10730 }
10731 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
10732 expr_ty name_var;
10733 if (
10734 (name_var = _PyPegen_name_token(p)) // NAME
10735 )
10736 {
10737 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
10738 _res = name_var;
10739 goto done;
10740 }
10741 p->mark = _mark;
10742 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10743 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
10744 }
10745 { // 'True'
10746 if (p->error_indicator) {
10747 D(p->level--);
10748 return NULL;
10749 }
10750 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
10751 Token * _keyword;
10752 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010753 (_keyword = _PyPegen_expect_token(p, 528)) // token='True'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010754 )
10755 {
10756 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
10757 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10758 if (_token == NULL) {
10759 D(p->level--);
10760 return NULL;
10761 }
10762 int _end_lineno = _token->end_lineno;
10763 UNUSED(_end_lineno); // Only used by EXTRA macro
10764 int _end_col_offset = _token->end_col_offset;
10765 UNUSED(_end_col_offset); // Only used by EXTRA macro
10766 _res = _Py_Constant ( Py_True , NULL , EXTRA );
10767 if (_res == NULL && PyErr_Occurred()) {
10768 p->error_indicator = 1;
10769 D(p->level--);
10770 return NULL;
10771 }
10772 goto done;
10773 }
10774 p->mark = _mark;
10775 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10776 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
10777 }
10778 { // 'False'
10779 if (p->error_indicator) {
10780 D(p->level--);
10781 return NULL;
10782 }
10783 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
10784 Token * _keyword;
10785 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010786 (_keyword = _PyPegen_expect_token(p, 529)) // token='False'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010787 )
10788 {
10789 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
10790 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10791 if (_token == NULL) {
10792 D(p->level--);
10793 return NULL;
10794 }
10795 int _end_lineno = _token->end_lineno;
10796 UNUSED(_end_lineno); // Only used by EXTRA macro
10797 int _end_col_offset = _token->end_col_offset;
10798 UNUSED(_end_col_offset); // Only used by EXTRA macro
10799 _res = _Py_Constant ( Py_False , NULL , EXTRA );
10800 if (_res == NULL && PyErr_Occurred()) {
10801 p->error_indicator = 1;
10802 D(p->level--);
10803 return NULL;
10804 }
10805 goto done;
10806 }
10807 p->mark = _mark;
10808 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10809 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
10810 }
10811 { // 'None'
10812 if (p->error_indicator) {
10813 D(p->level--);
10814 return NULL;
10815 }
10816 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
10817 Token * _keyword;
10818 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010819 (_keyword = _PyPegen_expect_token(p, 530)) // token='None'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010820 )
10821 {
10822 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
10823 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10824 if (_token == NULL) {
10825 D(p->level--);
10826 return NULL;
10827 }
10828 int _end_lineno = _token->end_lineno;
10829 UNUSED(_end_lineno); // Only used by EXTRA macro
10830 int _end_col_offset = _token->end_col_offset;
10831 UNUSED(_end_col_offset); // Only used by EXTRA macro
10832 _res = _Py_Constant ( Py_None , NULL , EXTRA );
10833 if (_res == NULL && PyErr_Occurred()) {
10834 p->error_indicator = 1;
10835 D(p->level--);
10836 return NULL;
10837 }
10838 goto done;
10839 }
10840 p->mark = _mark;
10841 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10842 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
10843 }
10844 { // &STRING strings
10845 if (p->error_indicator) {
10846 D(p->level--);
10847 return NULL;
10848 }
10849 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10850 expr_ty strings_var;
10851 if (
10852 _PyPegen_lookahead(1, _PyPegen_string_token, p)
10853 &&
10854 (strings_var = strings_rule(p)) // strings
10855 )
10856 {
10857 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
10858 _res = strings_var;
10859 goto done;
10860 }
10861 p->mark = _mark;
10862 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10863 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings"));
10864 }
10865 { // NUMBER
10866 if (p->error_indicator) {
10867 D(p->level--);
10868 return NULL;
10869 }
10870 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10871 expr_ty number_var;
10872 if (
10873 (number_var = _PyPegen_number_token(p)) // NUMBER
10874 )
10875 {
10876 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
10877 _res = number_var;
10878 goto done;
10879 }
10880 p->mark = _mark;
10881 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10882 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
10883 }
10884 { // &'(' (tuple | group | genexp)
10885 if (p->error_indicator) {
10886 D(p->level--);
10887 return NULL;
10888 }
10889 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010890 void *_tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010891 if (
10892 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='('
10893 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010894 (_tmp_97_var = _tmp_97_rule(p)) // tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010895 )
10896 {
10897 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 +030010898 _res = _tmp_97_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010899 goto done;
10900 }
10901 p->mark = _mark;
10902 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10903 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)"));
10904 }
10905 { // &'[' (list | listcomp)
10906 if (p->error_indicator) {
10907 D(p->level--);
10908 return NULL;
10909 }
10910 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010911 void *_tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010912 if (
10913 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='['
10914 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010915 (_tmp_98_var = _tmp_98_rule(p)) // list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010916 )
10917 {
10918 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010919 _res = _tmp_98_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010920 goto done;
10921 }
10922 p->mark = _mark;
10923 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10924 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)"));
10925 }
10926 { // &'{' (dict | set | dictcomp | setcomp)
10927 if (p->error_indicator) {
10928 D(p->level--);
10929 return NULL;
10930 }
10931 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 +030010932 void *_tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010933 if (
10934 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{'
10935 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030010936 (_tmp_99_var = _tmp_99_rule(p)) // dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010937 )
10938 {
10939 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 +030010940 _res = _tmp_99_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010010941 goto done;
10942 }
10943 p->mark = _mark;
10944 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10945 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
10946 }
10947 { // '...'
10948 if (p->error_indicator) {
10949 D(p->level--);
10950 return NULL;
10951 }
10952 D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
10953 Token * _literal;
10954 if (
10955 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
10956 )
10957 {
10958 D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
10959 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
10960 if (_token == NULL) {
10961 D(p->level--);
10962 return NULL;
10963 }
10964 int _end_lineno = _token->end_lineno;
10965 UNUSED(_end_lineno); // Only used by EXTRA macro
10966 int _end_col_offset = _token->end_col_offset;
10967 UNUSED(_end_col_offset); // Only used by EXTRA macro
10968 _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
10969 if (_res == NULL && PyErr_Occurred()) {
10970 p->error_indicator = 1;
10971 D(p->level--);
10972 return NULL;
10973 }
10974 goto done;
10975 }
10976 p->mark = _mark;
10977 D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
10978 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
10979 }
10980 _res = NULL;
10981 done:
10982 D(p->level--);
10983 return _res;
10984}
10985
10986// strings: STRING+
10987static expr_ty
10988strings_rule(Parser *p)
10989{
10990 D(p->level++);
10991 if (p->error_indicator) {
10992 D(p->level--);
10993 return NULL;
10994 }
10995 expr_ty _res = NULL;
10996 if (_PyPegen_is_memoized(p, strings_type, &_res)) {
10997 D(p->level--);
10998 return _res;
10999 }
11000 int _mark = p->mark;
11001 { // STRING+
11002 if (p->error_indicator) {
11003 D(p->level--);
11004 return NULL;
11005 }
11006 D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+"));
11007 asdl_seq * a;
11008 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011009 (a = _loop1_100_rule(p)) // STRING+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011010 )
11011 {
11012 D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+"));
11013 _res = _PyPegen_concatenate_strings ( p , a );
11014 if (_res == NULL && PyErr_Occurred()) {
11015 p->error_indicator = 1;
11016 D(p->level--);
11017 return NULL;
11018 }
11019 goto done;
11020 }
11021 p->mark = _mark;
11022 D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
11023 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+"));
11024 }
11025 _res = NULL;
11026 done:
11027 _PyPegen_insert_memo(p, _mark, strings_type, _res);
11028 D(p->level--);
11029 return _res;
11030}
11031
11032// list: '[' star_named_expressions? ']'
11033static expr_ty
11034list_rule(Parser *p)
11035{
11036 D(p->level++);
11037 if (p->error_indicator) {
11038 D(p->level--);
11039 return NULL;
11040 }
11041 expr_ty _res = NULL;
11042 int _mark = p->mark;
11043 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11044 p->error_indicator = 1;
11045 D(p->level--);
11046 return NULL;
11047 }
11048 int _start_lineno = p->tokens[_mark]->lineno;
11049 UNUSED(_start_lineno); // Only used by EXTRA macro
11050 int _start_col_offset = p->tokens[_mark]->col_offset;
11051 UNUSED(_start_col_offset); // Only used by EXTRA macro
11052 { // '[' star_named_expressions? ']'
11053 if (p->error_indicator) {
11054 D(p->level--);
11055 return NULL;
11056 }
11057 D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11058 Token * _literal;
11059 Token * _literal_1;
11060 void *a;
11061 if (
11062 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11063 &&
11064 (a = star_named_expressions_rule(p), 1) // star_named_expressions?
11065 &&
11066 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11067 )
11068 {
11069 D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
11070 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11071 if (_token == NULL) {
11072 D(p->level--);
11073 return NULL;
11074 }
11075 int _end_lineno = _token->end_lineno;
11076 UNUSED(_end_lineno); // Only used by EXTRA macro
11077 int _end_col_offset = _token->end_col_offset;
11078 UNUSED(_end_col_offset); // Only used by EXTRA macro
11079 _res = _Py_List ( a , Load , EXTRA );
11080 if (_res == NULL && PyErr_Occurred()) {
11081 p->error_indicator = 1;
11082 D(p->level--);
11083 return NULL;
11084 }
11085 goto done;
11086 }
11087 p->mark = _mark;
11088 D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
11089 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
11090 }
11091 _res = NULL;
11092 done:
11093 D(p->level--);
11094 return _res;
11095}
11096
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011097// listcomp: '[' named_expression ~ for_if_clauses ']' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011098static expr_ty
11099listcomp_rule(Parser *p)
11100{
11101 D(p->level++);
11102 if (p->error_indicator) {
11103 D(p->level--);
11104 return NULL;
11105 }
11106 expr_ty _res = NULL;
11107 int _mark = p->mark;
11108 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11109 p->error_indicator = 1;
11110 D(p->level--);
11111 return NULL;
11112 }
11113 int _start_lineno = p->tokens[_mark]->lineno;
11114 UNUSED(_start_lineno); // Only used by EXTRA macro
11115 int _start_col_offset = p->tokens[_mark]->col_offset;
11116 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011117 { // '[' named_expression ~ for_if_clauses ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011118 if (p->error_indicator) {
11119 D(p->level--);
11120 return NULL;
11121 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011122 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11123 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011124 Token * _literal;
11125 Token * _literal_1;
11126 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011127 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011128 if (
11129 (_literal = _PyPegen_expect_token(p, 9)) // token='['
11130 &&
11131 (a = named_expression_rule(p)) // named_expression
11132 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011133 (_cut_var = 1)
11134 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011135 (b = for_if_clauses_rule(p)) // for_if_clauses
11136 &&
11137 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
11138 )
11139 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011140 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 +010011141 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11142 if (_token == NULL) {
11143 D(p->level--);
11144 return NULL;
11145 }
11146 int _end_lineno = _token->end_lineno;
11147 UNUSED(_end_lineno); // Only used by EXTRA macro
11148 int _end_col_offset = _token->end_col_offset;
11149 UNUSED(_end_col_offset); // Only used by EXTRA macro
11150 _res = _Py_ListComp ( a , b , EXTRA );
11151 if (_res == NULL && PyErr_Occurred()) {
11152 p->error_indicator = 1;
11153 D(p->level--);
11154 return NULL;
11155 }
11156 goto done;
11157 }
11158 p->mark = _mark;
11159 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011160 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
11161 if (_cut_var) {
11162 D(p->level--);
11163 return NULL;
11164 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011165 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011166 if (p->call_invalid_rules) { // invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011167 if (p->error_indicator) {
11168 D(p->level--);
11169 return NULL;
11170 }
11171 D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11172 void *invalid_comprehension_var;
11173 if (
11174 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11175 )
11176 {
11177 D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11178 _res = invalid_comprehension_var;
11179 goto done;
11180 }
11181 p->mark = _mark;
11182 D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
11183 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11184 }
11185 _res = NULL;
11186 done:
11187 D(p->level--);
11188 return _res;
11189}
11190
11191// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
11192static expr_ty
11193tuple_rule(Parser *p)
11194{
11195 D(p->level++);
11196 if (p->error_indicator) {
11197 D(p->level--);
11198 return NULL;
11199 }
11200 expr_ty _res = NULL;
11201 int _mark = p->mark;
11202 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11203 p->error_indicator = 1;
11204 D(p->level--);
11205 return NULL;
11206 }
11207 int _start_lineno = p->tokens[_mark]->lineno;
11208 UNUSED(_start_lineno); // Only used by EXTRA macro
11209 int _start_col_offset = p->tokens[_mark]->col_offset;
11210 UNUSED(_start_col_offset); // Only used by EXTRA macro
11211 { // '(' [star_named_expression ',' star_named_expressions?] ')'
11212 if (p->error_indicator) {
11213 D(p->level--);
11214 return NULL;
11215 }
11216 D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11217 Token * _literal;
11218 Token * _literal_1;
11219 void *a;
11220 if (
11221 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11222 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011223 (a = _tmp_101_rule(p), 1) // [star_named_expression ',' star_named_expressions?]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011224 &&
11225 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11226 )
11227 {
11228 D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11229 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11230 if (_token == NULL) {
11231 D(p->level--);
11232 return NULL;
11233 }
11234 int _end_lineno = _token->end_lineno;
11235 UNUSED(_end_lineno); // Only used by EXTRA macro
11236 int _end_col_offset = _token->end_col_offset;
11237 UNUSED(_end_col_offset); // Only used by EXTRA macro
11238 _res = _Py_Tuple ( a , Load , EXTRA );
11239 if (_res == NULL && PyErr_Occurred()) {
11240 p->error_indicator = 1;
11241 D(p->level--);
11242 return NULL;
11243 }
11244 goto done;
11245 }
11246 p->mark = _mark;
11247 D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
11248 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
11249 }
11250 _res = NULL;
11251 done:
11252 D(p->level--);
11253 return _res;
11254}
11255
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011256// group: '(' (yield_expr | named_expression) ')' | invalid_group
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011257static expr_ty
11258group_rule(Parser *p)
11259{
11260 D(p->level++);
11261 if (p->error_indicator) {
11262 D(p->level--);
11263 return NULL;
11264 }
11265 expr_ty _res = NULL;
11266 int _mark = p->mark;
11267 { // '(' (yield_expr | named_expression) ')'
11268 if (p->error_indicator) {
11269 D(p->level--);
11270 return NULL;
11271 }
11272 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11273 Token * _literal;
11274 Token * _literal_1;
11275 void *a;
11276 if (
11277 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11278 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011279 (a = _tmp_102_rule(p)) // yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011280 &&
11281 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11282 )
11283 {
11284 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11285 _res = a;
11286 if (_res == NULL && PyErr_Occurred()) {
11287 p->error_indicator = 1;
11288 D(p->level--);
11289 return NULL;
11290 }
11291 goto done;
11292 }
11293 p->mark = _mark;
11294 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11295 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
11296 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011297 if (p->call_invalid_rules) { // invalid_group
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011298 if (p->error_indicator) {
11299 D(p->level--);
11300 return NULL;
11301 }
11302 D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11303 void *invalid_group_var;
11304 if (
11305 (invalid_group_var = invalid_group_rule(p)) // invalid_group
11306 )
11307 {
11308 D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
11309 _res = invalid_group_var;
11310 goto done;
11311 }
11312 p->mark = _mark;
11313 D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
11314 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
11315 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011316 _res = NULL;
11317 done:
11318 D(p->level--);
11319 return _res;
11320}
11321
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011322// genexp: '(' expression ~ for_if_clauses ')' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011323static expr_ty
11324genexp_rule(Parser *p)
11325{
11326 D(p->level++);
11327 if (p->error_indicator) {
11328 D(p->level--);
11329 return NULL;
11330 }
11331 expr_ty _res = NULL;
11332 int _mark = p->mark;
11333 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11334 p->error_indicator = 1;
11335 D(p->level--);
11336 return NULL;
11337 }
11338 int _start_lineno = p->tokens[_mark]->lineno;
11339 UNUSED(_start_lineno); // Only used by EXTRA macro
11340 int _start_col_offset = p->tokens[_mark]->col_offset;
11341 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011342 { // '(' expression ~ for_if_clauses ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011343 if (p->error_indicator) {
11344 D(p->level--);
11345 return NULL;
11346 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011347 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11348 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011349 Token * _literal;
11350 Token * _literal_1;
11351 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011352 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011353 if (
11354 (_literal = _PyPegen_expect_token(p, 7)) // token='('
11355 &&
11356 (a = expression_rule(p)) // expression
11357 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011358 (_cut_var = 1)
11359 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011360 (b = for_if_clauses_rule(p)) // for_if_clauses
11361 &&
11362 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
11363 )
11364 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011365 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 +010011366 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11367 if (_token == NULL) {
11368 D(p->level--);
11369 return NULL;
11370 }
11371 int _end_lineno = _token->end_lineno;
11372 UNUSED(_end_lineno); // Only used by EXTRA macro
11373 int _end_col_offset = _token->end_col_offset;
11374 UNUSED(_end_col_offset); // Only used by EXTRA macro
11375 _res = _Py_GeneratorExp ( a , b , EXTRA );
11376 if (_res == NULL && PyErr_Occurred()) {
11377 p->error_indicator = 1;
11378 D(p->level--);
11379 return NULL;
11380 }
11381 goto done;
11382 }
11383 p->mark = _mark;
11384 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011385 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression ~ for_if_clauses ')'"));
11386 if (_cut_var) {
11387 D(p->level--);
11388 return NULL;
11389 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011390 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011391 if (p->call_invalid_rules) { // invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011392 if (p->error_indicator) {
11393 D(p->level--);
11394 return NULL;
11395 }
11396 D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11397 void *invalid_comprehension_var;
11398 if (
11399 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11400 )
11401 {
11402 D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11403 _res = invalid_comprehension_var;
11404 goto done;
11405 }
11406 p->mark = _mark;
11407 D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
11408 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11409 }
11410 _res = NULL;
11411 done:
11412 D(p->level--);
11413 return _res;
11414}
11415
11416// set: '{' expressions_list '}'
11417static expr_ty
11418set_rule(Parser *p)
11419{
11420 D(p->level++);
11421 if (p->error_indicator) {
11422 D(p->level--);
11423 return NULL;
11424 }
11425 expr_ty _res = NULL;
11426 int _mark = p->mark;
11427 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11428 p->error_indicator = 1;
11429 D(p->level--);
11430 return NULL;
11431 }
11432 int _start_lineno = p->tokens[_mark]->lineno;
11433 UNUSED(_start_lineno); // Only used by EXTRA macro
11434 int _start_col_offset = p->tokens[_mark]->col_offset;
11435 UNUSED(_start_col_offset); // Only used by EXTRA macro
11436 { // '{' expressions_list '}'
11437 if (p->error_indicator) {
11438 D(p->level--);
11439 return NULL;
11440 }
11441 D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11442 Token * _literal;
11443 Token * _literal_1;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011444 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011445 if (
11446 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11447 &&
11448 (a = expressions_list_rule(p)) // expressions_list
11449 &&
11450 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11451 )
11452 {
11453 D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' expressions_list '}'"));
11454 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11455 if (_token == NULL) {
11456 D(p->level--);
11457 return NULL;
11458 }
11459 int _end_lineno = _token->end_lineno;
11460 UNUSED(_end_lineno); // Only used by EXTRA macro
11461 int _end_col_offset = _token->end_col_offset;
11462 UNUSED(_end_col_offset); // Only used by EXTRA macro
11463 _res = _Py_Set ( a , EXTRA );
11464 if (_res == NULL && PyErr_Occurred()) {
11465 p->error_indicator = 1;
11466 D(p->level--);
11467 return NULL;
11468 }
11469 goto done;
11470 }
11471 p->mark = _mark;
11472 D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
11473 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'"));
11474 }
11475 _res = NULL;
11476 done:
11477 D(p->level--);
11478 return _res;
11479}
11480
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011481// setcomp: '{' expression ~ for_if_clauses '}' | invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011482static expr_ty
11483setcomp_rule(Parser *p)
11484{
11485 D(p->level++);
11486 if (p->error_indicator) {
11487 D(p->level--);
11488 return NULL;
11489 }
11490 expr_ty _res = NULL;
11491 int _mark = p->mark;
11492 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11493 p->error_indicator = 1;
11494 D(p->level--);
11495 return NULL;
11496 }
11497 int _start_lineno = p->tokens[_mark]->lineno;
11498 UNUSED(_start_lineno); // Only used by EXTRA macro
11499 int _start_col_offset = p->tokens[_mark]->col_offset;
11500 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011501 { // '{' expression ~ for_if_clauses '}'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011502 if (p->error_indicator) {
11503 D(p->level--);
11504 return NULL;
11505 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011506 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11507 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011508 Token * _literal;
11509 Token * _literal_1;
11510 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011511 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011512 if (
11513 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11514 &&
11515 (a = expression_rule(p)) // expression
11516 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011517 (_cut_var = 1)
11518 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011519 (b = for_if_clauses_rule(p)) // for_if_clauses
11520 &&
11521 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11522 )
11523 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011524 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 +010011525 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11526 if (_token == NULL) {
11527 D(p->level--);
11528 return NULL;
11529 }
11530 int _end_lineno = _token->end_lineno;
11531 UNUSED(_end_lineno); // Only used by EXTRA macro
11532 int _end_col_offset = _token->end_col_offset;
11533 UNUSED(_end_col_offset); // Only used by EXTRA macro
11534 _res = _Py_SetComp ( a , b , EXTRA );
11535 if (_res == NULL && PyErr_Occurred()) {
11536 p->error_indicator = 1;
11537 D(p->level--);
11538 return NULL;
11539 }
11540 goto done;
11541 }
11542 p->mark = _mark;
11543 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011544 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression ~ for_if_clauses '}'"));
11545 if (_cut_var) {
11546 D(p->level--);
11547 return NULL;
11548 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011549 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011550 if (p->call_invalid_rules) { // invalid_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011551 if (p->error_indicator) {
11552 D(p->level--);
11553 return NULL;
11554 }
11555 D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11556 void *invalid_comprehension_var;
11557 if (
11558 (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
11559 )
11560 {
11561 D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
11562 _res = invalid_comprehension_var;
11563 goto done;
11564 }
11565 p->mark = _mark;
11566 D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
11567 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
11568 }
11569 _res = NULL;
11570 done:
11571 D(p->level--);
11572 return _res;
11573}
11574
11575// dict: '{' double_starred_kvpairs? '}'
11576static expr_ty
11577dict_rule(Parser *p)
11578{
11579 D(p->level++);
11580 if (p->error_indicator) {
11581 D(p->level--);
11582 return NULL;
11583 }
11584 expr_ty _res = NULL;
11585 int _mark = p->mark;
11586 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11587 p->error_indicator = 1;
11588 D(p->level--);
11589 return NULL;
11590 }
11591 int _start_lineno = p->tokens[_mark]->lineno;
11592 UNUSED(_start_lineno); // Only used by EXTRA macro
11593 int _start_col_offset = p->tokens[_mark]->col_offset;
11594 UNUSED(_start_col_offset); // Only used by EXTRA macro
11595 { // '{' double_starred_kvpairs? '}'
11596 if (p->error_indicator) {
11597 D(p->level--);
11598 return NULL;
11599 }
11600 D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11601 Token * _literal;
11602 Token * _literal_1;
11603 void *a;
11604 if (
11605 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11606 &&
11607 (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs?
11608 &&
11609 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11610 )
11611 {
11612 D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11613 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11614 if (_token == NULL) {
11615 D(p->level--);
11616 return NULL;
11617 }
11618 int _end_lineno = _token->end_lineno;
11619 UNUSED(_end_lineno); // Only used by EXTRA macro
11620 int _end_col_offset = _token->end_col_offset;
11621 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030011622 _res = _Py_Dict ( CHECK ( asdl_expr_seq * , _PyPegen_get_keys ( p , a ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_values ( p , a ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011623 if (_res == NULL && PyErr_Occurred()) {
11624 p->error_indicator = 1;
11625 D(p->level--);
11626 return NULL;
11627 }
11628 goto done;
11629 }
11630 p->mark = _mark;
11631 D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
11632 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
11633 }
11634 _res = NULL;
11635 done:
11636 D(p->level--);
11637 return _res;
11638}
11639
11640// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
11641static expr_ty
11642dictcomp_rule(Parser *p)
11643{
11644 D(p->level++);
11645 if (p->error_indicator) {
11646 D(p->level--);
11647 return NULL;
11648 }
11649 expr_ty _res = NULL;
11650 int _mark = p->mark;
11651 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
11652 p->error_indicator = 1;
11653 D(p->level--);
11654 return NULL;
11655 }
11656 int _start_lineno = p->tokens[_mark]->lineno;
11657 UNUSED(_start_lineno); // Only used by EXTRA macro
11658 int _start_col_offset = p->tokens[_mark]->col_offset;
11659 UNUSED(_start_col_offset); // Only used by EXTRA macro
11660 { // '{' kvpair for_if_clauses '}'
11661 if (p->error_indicator) {
11662 D(p->level--);
11663 return NULL;
11664 }
11665 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11666 Token * _literal;
11667 Token * _literal_1;
11668 KeyValuePair* a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011669 asdl_comprehension_seq* b;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011670 if (
11671 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
11672 &&
11673 (a = kvpair_rule(p)) // kvpair
11674 &&
11675 (b = for_if_clauses_rule(p)) // for_if_clauses
11676 &&
11677 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
11678 )
11679 {
11680 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11681 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
11682 if (_token == NULL) {
11683 D(p->level--);
11684 return NULL;
11685 }
11686 int _end_lineno = _token->end_lineno;
11687 UNUSED(_end_lineno); // Only used by EXTRA macro
11688 int _end_col_offset = _token->end_col_offset;
11689 UNUSED(_end_col_offset); // Only used by EXTRA macro
11690 _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
11691 if (_res == NULL && PyErr_Occurred()) {
11692 p->error_indicator = 1;
11693 D(p->level--);
11694 return NULL;
11695 }
11696 goto done;
11697 }
11698 p->mark = _mark;
11699 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11700 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
11701 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020011702 if (p->call_invalid_rules) { // invalid_dict_comprehension
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011703 if (p->error_indicator) {
11704 D(p->level--);
11705 return NULL;
11706 }
11707 D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11708 void *invalid_dict_comprehension_var;
11709 if (
11710 (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension
11711 )
11712 {
11713 D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
11714 _res = invalid_dict_comprehension_var;
11715 goto done;
11716 }
11717 p->mark = _mark;
11718 D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
11719 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
11720 }
11721 _res = NULL;
11722 done:
11723 D(p->level--);
11724 return _res;
11725}
11726
11727// double_starred_kvpairs: ','.double_starred_kvpair+ ','?
11728static asdl_seq*
11729double_starred_kvpairs_rule(Parser *p)
11730{
11731 D(p->level++);
11732 if (p->error_indicator) {
11733 D(p->level--);
11734 return NULL;
11735 }
11736 asdl_seq* _res = NULL;
11737 int _mark = p->mark;
11738 { // ','.double_starred_kvpair+ ','?
11739 if (p->error_indicator) {
11740 D(p->level--);
11741 return NULL;
11742 }
11743 D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11744 void *_opt_var;
11745 UNUSED(_opt_var); // Silence compiler warnings
11746 asdl_seq * a;
11747 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011748 (a = _gather_103_rule(p)) // ','.double_starred_kvpair+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011749 &&
11750 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
11751 )
11752 {
11753 D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11754 _res = a;
11755 if (_res == NULL && PyErr_Occurred()) {
11756 p->error_indicator = 1;
11757 D(p->level--);
11758 return NULL;
11759 }
11760 goto done;
11761 }
11762 p->mark = _mark;
11763 D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
11764 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?"));
11765 }
11766 _res = NULL;
11767 done:
11768 D(p->level--);
11769 return _res;
11770}
11771
11772// double_starred_kvpair: '**' bitwise_or | kvpair
11773static KeyValuePair*
11774double_starred_kvpair_rule(Parser *p)
11775{
11776 D(p->level++);
11777 if (p->error_indicator) {
11778 D(p->level--);
11779 return NULL;
11780 }
11781 KeyValuePair* _res = NULL;
11782 int _mark = p->mark;
11783 { // '**' bitwise_or
11784 if (p->error_indicator) {
11785 D(p->level--);
11786 return NULL;
11787 }
11788 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11789 Token * _literal;
11790 expr_ty a;
11791 if (
11792 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
11793 &&
11794 (a = bitwise_or_rule(p)) // bitwise_or
11795 )
11796 {
11797 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
11798 _res = _PyPegen_key_value_pair ( p , NULL , a );
11799 if (_res == NULL && PyErr_Occurred()) {
11800 p->error_indicator = 1;
11801 D(p->level--);
11802 return NULL;
11803 }
11804 goto done;
11805 }
11806 p->mark = _mark;
11807 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11808 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or"));
11809 }
11810 { // kvpair
11811 if (p->error_indicator) {
11812 D(p->level--);
11813 return NULL;
11814 }
11815 D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair"));
11816 KeyValuePair* kvpair_var;
11817 if (
11818 (kvpair_var = kvpair_rule(p)) // kvpair
11819 )
11820 {
11821 D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair"));
11822 _res = kvpair_var;
11823 goto done;
11824 }
11825 p->mark = _mark;
11826 D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11827 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair"));
11828 }
11829 _res = NULL;
11830 done:
11831 D(p->level--);
11832 return _res;
11833}
11834
11835// kvpair: expression ':' expression
11836static KeyValuePair*
11837kvpair_rule(Parser *p)
11838{
11839 D(p->level++);
11840 if (p->error_indicator) {
11841 D(p->level--);
11842 return NULL;
11843 }
11844 KeyValuePair* _res = NULL;
11845 int _mark = p->mark;
11846 { // expression ':' expression
11847 if (p->error_indicator) {
11848 D(p->level--);
11849 return NULL;
11850 }
11851 D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11852 Token * _literal;
11853 expr_ty a;
11854 expr_ty b;
11855 if (
11856 (a = expression_rule(p)) // expression
11857 &&
11858 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
11859 &&
11860 (b = expression_rule(p)) // expression
11861 )
11862 {
11863 D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
11864 _res = _PyPegen_key_value_pair ( p , a , b );
11865 if (_res == NULL && PyErr_Occurred()) {
11866 p->error_indicator = 1;
11867 D(p->level--);
11868 return NULL;
11869 }
11870 goto done;
11871 }
11872 p->mark = _mark;
11873 D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ',
11874 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
11875 }
11876 _res = NULL;
11877 done:
11878 D(p->level--);
11879 return _res;
11880}
11881
11882// for_if_clauses: for_if_clause+
Pablo Galindoa5634c42020-09-16 19:42:00 +010011883static asdl_comprehension_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011884for_if_clauses_rule(Parser *p)
11885{
11886 D(p->level++);
11887 if (p->error_indicator) {
11888 D(p->level--);
11889 return NULL;
11890 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010011891 asdl_comprehension_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011892 int _mark = p->mark;
11893 { // for_if_clause+
11894 if (p->error_indicator) {
11895 D(p->level--);
11896 return NULL;
11897 }
11898 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 +010011899 asdl_comprehension_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011900 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010011901 (a = (asdl_comprehension_seq*)_loop1_105_rule(p)) // for_if_clause+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011902 )
11903 {
11904 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 +010011905 _res = a;
11906 if (_res == NULL && PyErr_Occurred()) {
11907 p->error_indicator = 1;
11908 D(p->level--);
11909 return NULL;
11910 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011911 goto done;
11912 }
11913 p->mark = _mark;
11914 D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ',
11915 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+"));
11916 }
11917 _res = NULL;
11918 done:
11919 D(p->level--);
11920 return _res;
11921}
11922
11923// for_if_clause:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011924// | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11925// | 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
11926// | invalid_for_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011927static comprehension_ty
11928for_if_clause_rule(Parser *p)
11929{
11930 D(p->level++);
11931 if (p->error_indicator) {
11932 D(p->level--);
11933 return NULL;
11934 }
11935 comprehension_ty _res = NULL;
11936 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011937 { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011938 if (p->error_indicator) {
11939 D(p->level--);
11940 return NULL;
11941 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011942 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11943 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011944 Token * _keyword;
11945 Token * _keyword_1;
11946 expr_ty a;
11947 Token * async_var;
11948 expr_ty b;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011949 asdl_expr_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011950 if (
11951 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
11952 &&
11953 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11954 &&
11955 (a = star_targets_rule(p)) // star_targets
11956 &&
11957 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
11958 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011959 (_cut_var = 1)
11960 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011961 (b = disjunction_rule(p)) // disjunction
11962 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +010011963 (c = (asdl_expr_seq*)_loop0_106_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011964 )
11965 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011966 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))*"));
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030011967 _res = CHECK_VERSION ( comprehension_ty , 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011968 if (_res == NULL && PyErr_Occurred()) {
11969 p->error_indicator = 1;
11970 D(p->level--);
11971 return NULL;
11972 }
11973 goto done;
11974 }
11975 p->mark = _mark;
11976 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011977 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11978 if (_cut_var) {
11979 D(p->level--);
11980 return NULL;
11981 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011982 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011983 { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011984 if (p->error_indicator) {
11985 D(p->level--);
11986 return NULL;
11987 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030011988 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
11989 int _cut_var = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011990 Token * _keyword;
11991 Token * _keyword_1;
11992 expr_ty a;
11993 expr_ty b;
Pablo Galindoa5634c42020-09-16 19:42:00 +010011994 asdl_expr_seq* c;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010011995 if (
11996 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
11997 &&
11998 (a = star_targets_rule(p)) // star_targets
11999 &&
12000 (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
12001 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012002 (_cut_var = 1)
12003 &&
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012004 (b = disjunction_rule(p)) // disjunction
12005 &&
Pablo Galindoa5634c42020-09-16 19:42:00 +010012006 (c = (asdl_expr_seq*)_loop0_107_rule(p)) // (('if' disjunction))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012007 )
12008 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012009 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 +010012010 _res = _Py_comprehension ( a , b , c , 0 , p -> arena );
12011 if (_res == NULL && PyErr_Occurred()) {
12012 p->error_indicator = 1;
12013 D(p->level--);
12014 return NULL;
12015 }
12016 goto done;
12017 }
12018 p->mark = _mark;
12019 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012020 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
12021 if (_cut_var) {
12022 D(p->level--);
12023 return NULL;
12024 }
12025 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012026 if (p->call_invalid_rules) { // invalid_for_target
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030012027 if (p->error_indicator) {
12028 D(p->level--);
12029 return NULL;
12030 }
12031 D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12032 void *invalid_for_target_var;
12033 if (
12034 (invalid_for_target_var = invalid_for_target_rule(p)) // invalid_for_target
12035 )
12036 {
12037 D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
12038 _res = invalid_for_target_var;
12039 goto done;
12040 }
12041 p->mark = _mark;
12042 D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
12043 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012044 }
12045 _res = NULL;
12046 done:
12047 D(p->level--);
12048 return _res;
12049}
12050
12051// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
12052static expr_ty
12053yield_expr_rule(Parser *p)
12054{
12055 D(p->level++);
12056 if (p->error_indicator) {
12057 D(p->level--);
12058 return NULL;
12059 }
12060 expr_ty _res = NULL;
12061 int _mark = p->mark;
12062 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12063 p->error_indicator = 1;
12064 D(p->level--);
12065 return NULL;
12066 }
12067 int _start_lineno = p->tokens[_mark]->lineno;
12068 UNUSED(_start_lineno); // Only used by EXTRA macro
12069 int _start_col_offset = p->tokens[_mark]->col_offset;
12070 UNUSED(_start_col_offset); // Only used by EXTRA macro
12071 { // 'yield' 'from' expression
12072 if (p->error_indicator) {
12073 D(p->level--);
12074 return NULL;
12075 }
12076 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12077 Token * _keyword;
12078 Token * _keyword_1;
12079 expr_ty a;
12080 if (
12081 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12082 &&
12083 (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from'
12084 &&
12085 (a = expression_rule(p)) // expression
12086 )
12087 {
12088 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
12089 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12090 if (_token == NULL) {
12091 D(p->level--);
12092 return NULL;
12093 }
12094 int _end_lineno = _token->end_lineno;
12095 UNUSED(_end_lineno); // Only used by EXTRA macro
12096 int _end_col_offset = _token->end_col_offset;
12097 UNUSED(_end_col_offset); // Only used by EXTRA macro
12098 _res = _Py_YieldFrom ( a , EXTRA );
12099 if (_res == NULL && PyErr_Occurred()) {
12100 p->error_indicator = 1;
12101 D(p->level--);
12102 return NULL;
12103 }
12104 goto done;
12105 }
12106 p->mark = _mark;
12107 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12108 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
12109 }
12110 { // 'yield' star_expressions?
12111 if (p->error_indicator) {
12112 D(p->level--);
12113 return NULL;
12114 }
12115 D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12116 Token * _keyword;
12117 void *a;
12118 if (
12119 (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
12120 &&
12121 (a = star_expressions_rule(p), 1) // star_expressions?
12122 )
12123 {
12124 D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
12125 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12126 if (_token == NULL) {
12127 D(p->level--);
12128 return NULL;
12129 }
12130 int _end_lineno = _token->end_lineno;
12131 UNUSED(_end_lineno); // Only used by EXTRA macro
12132 int _end_col_offset = _token->end_col_offset;
12133 UNUSED(_end_col_offset); // Only used by EXTRA macro
12134 _res = _Py_Yield ( a , EXTRA );
12135 if (_res == NULL && PyErr_Occurred()) {
12136 p->error_indicator = 1;
12137 D(p->level--);
12138 return NULL;
12139 }
12140 goto done;
12141 }
12142 p->mark = _mark;
12143 D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
12144 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
12145 }
12146 _res = NULL;
12147 done:
12148 D(p->level--);
12149 return _res;
12150}
12151
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012152// arguments: args ','? &')' | invalid_arguments
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012153static expr_ty
12154arguments_rule(Parser *p)
12155{
12156 D(p->level++);
12157 if (p->error_indicator) {
12158 D(p->level--);
12159 return NULL;
12160 }
12161 expr_ty _res = NULL;
12162 if (_PyPegen_is_memoized(p, arguments_type, &_res)) {
12163 D(p->level--);
12164 return _res;
12165 }
12166 int _mark = p->mark;
12167 { // args ','? &')'
12168 if (p->error_indicator) {
12169 D(p->level--);
12170 return NULL;
12171 }
12172 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12173 void *_opt_var;
12174 UNUSED(_opt_var); // Silence compiler warnings
12175 expr_ty a;
12176 if (
12177 (a = args_rule(p)) // args
12178 &&
12179 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12180 &&
12181 _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
12182 )
12183 {
12184 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
12185 _res = a;
12186 if (_res == NULL && PyErr_Occurred()) {
12187 p->error_indicator = 1;
12188 D(p->level--);
12189 return NULL;
12190 }
12191 goto done;
12192 }
12193 p->mark = _mark;
12194 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
12195 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'"));
12196 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012197 if (p->call_invalid_rules) { // invalid_arguments
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012198 if (p->error_indicator) {
12199 D(p->level--);
12200 return NULL;
12201 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012202 D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
12203 void *invalid_arguments_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012204 if (
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012205 (invalid_arguments_var = invalid_arguments_rule(p)) // invalid_arguments
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012206 )
12207 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012208 D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
12209 _res = invalid_arguments_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012210 goto done;
12211 }
12212 p->mark = _mark;
12213 D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012214 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_arguments"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012215 }
12216 _res = NULL;
12217 done:
12218 _PyPegen_insert_memo(p, _mark, arguments_type, _res);
12219 D(p->level--);
12220 return _res;
12221}
12222
Pablo Galindo4a97b152020-09-02 17:44:19 +010012223// args: ','.(starred_expression | named_expression !'=')+ [',' kwargs] | kwargs
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012224static expr_ty
12225args_rule(Parser *p)
12226{
12227 D(p->level++);
12228 if (p->error_indicator) {
12229 D(p->level--);
12230 return NULL;
12231 }
12232 expr_ty _res = NULL;
12233 int _mark = p->mark;
12234 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12235 p->error_indicator = 1;
12236 D(p->level--);
12237 return NULL;
12238 }
12239 int _start_lineno = p->tokens[_mark]->lineno;
12240 UNUSED(_start_lineno); // Only used by EXTRA macro
12241 int _start_col_offset = p->tokens[_mark]->col_offset;
12242 UNUSED(_start_col_offset); // Only used by EXTRA macro
Pablo Galindo4a97b152020-09-02 17:44:19 +010012243 { // ','.(starred_expression | named_expression !'=')+ [',' kwargs]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012244 if (p->error_indicator) {
12245 D(p->level--);
12246 return NULL;
12247 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010012248 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 +010012249 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012250 void *b;
12251 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010012252 (a = (asdl_expr_seq*)_gather_108_rule(p)) // ','.(starred_expression | named_expression !'=')+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012253 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012254 (b = _tmp_110_rule(p), 1) // [',' kwargs]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012255 )
12256 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010012257 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 +010012258 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12259 if (_token == NULL) {
12260 D(p->level--);
12261 return NULL;
12262 }
12263 int _end_lineno = _token->end_lineno;
12264 UNUSED(_end_lineno); // Only used by EXTRA macro
12265 int _end_col_offset = _token->end_col_offset;
12266 UNUSED(_end_col_offset); // Only used by EXTRA macro
12267 _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012268 if (_res == NULL && PyErr_Occurred()) {
12269 p->error_indicator = 1;
12270 D(p->level--);
12271 return NULL;
12272 }
12273 goto done;
12274 }
12275 p->mark = _mark;
12276 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010012277 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012278 }
12279 { // kwargs
12280 if (p->error_indicator) {
12281 D(p->level--);
12282 return NULL;
12283 }
12284 D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
12285 asdl_seq* a;
12286 if (
12287 (a = kwargs_rule(p)) // kwargs
12288 )
12289 {
12290 D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
12291 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12292 if (_token == NULL) {
12293 D(p->level--);
12294 return NULL;
12295 }
12296 int _end_lineno = _token->end_lineno;
12297 UNUSED(_end_lineno); // Only used by EXTRA macro
12298 int _end_col_offset = _token->end_col_offset;
12299 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012300 _res = _Py_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( asdl_expr_seq * , _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( asdl_keyword_seq * , _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012301 if (_res == NULL && PyErr_Occurred()) {
12302 p->error_indicator = 1;
12303 D(p->level--);
12304 return NULL;
12305 }
12306 goto done;
12307 }
12308 p->mark = _mark;
12309 D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
12310 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
12311 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012312 _res = NULL;
12313 done:
12314 D(p->level--);
12315 return _res;
12316}
12317
12318// kwargs:
12319// | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12320// | ','.kwarg_or_starred+
12321// | ','.kwarg_or_double_starred+
12322static asdl_seq*
12323kwargs_rule(Parser *p)
12324{
12325 D(p->level++);
12326 if (p->error_indicator) {
12327 D(p->level--);
12328 return NULL;
12329 }
12330 asdl_seq* _res = NULL;
12331 int _mark = p->mark;
12332 { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
12333 if (p->error_indicator) {
12334 D(p->level--);
12335 return NULL;
12336 }
12337 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12338 Token * _literal;
12339 asdl_seq * a;
12340 asdl_seq * b;
12341 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012342 (a = _gather_111_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012343 &&
12344 (_literal = _PyPegen_expect_token(p, 12)) // token=','
12345 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012346 (b = _gather_113_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012347 )
12348 {
12349 D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12350 _res = _PyPegen_join_sequences ( p , a , b );
12351 if (_res == NULL && PyErr_Occurred()) {
12352 p->error_indicator = 1;
12353 D(p->level--);
12354 return NULL;
12355 }
12356 goto done;
12357 }
12358 p->mark = _mark;
12359 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12360 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
12361 }
12362 { // ','.kwarg_or_starred+
12363 if (p->error_indicator) {
12364 D(p->level--);
12365 return NULL;
12366 }
12367 D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010012368 asdl_seq * _gather_115_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012369 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012370 (_gather_115_var = _gather_115_rule(p)) // ','.kwarg_or_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012371 )
12372 {
12373 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 +010012374 _res = _gather_115_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012375 goto done;
12376 }
12377 p->mark = _mark;
12378 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12379 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+"));
12380 }
12381 { // ','.kwarg_or_double_starred+
12382 if (p->error_indicator) {
12383 D(p->level--);
12384 return NULL;
12385 }
12386 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 +010012387 asdl_seq * _gather_117_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012388 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010012389 (_gather_117_var = _gather_117_rule(p)) // ','.kwarg_or_double_starred+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012390 )
12391 {
12392 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 +010012393 _res = _gather_117_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012394 goto done;
12395 }
12396 p->mark = _mark;
12397 D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
12398 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+"));
12399 }
12400 _res = NULL;
12401 done:
12402 D(p->level--);
12403 return _res;
12404}
12405
12406// starred_expression: '*' expression
12407static expr_ty
12408starred_expression_rule(Parser *p)
12409{
12410 D(p->level++);
12411 if (p->error_indicator) {
12412 D(p->level--);
12413 return NULL;
12414 }
12415 expr_ty _res = NULL;
12416 int _mark = p->mark;
12417 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12418 p->error_indicator = 1;
12419 D(p->level--);
12420 return NULL;
12421 }
12422 int _start_lineno = p->tokens[_mark]->lineno;
12423 UNUSED(_start_lineno); // Only used by EXTRA macro
12424 int _start_col_offset = p->tokens[_mark]->col_offset;
12425 UNUSED(_start_col_offset); // Only used by EXTRA macro
12426 { // '*' expression
12427 if (p->error_indicator) {
12428 D(p->level--);
12429 return NULL;
12430 }
12431 D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12432 Token * _literal;
12433 expr_ty a;
12434 if (
12435 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12436 &&
12437 (a = expression_rule(p)) // expression
12438 )
12439 {
12440 D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
12441 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12442 if (_token == NULL) {
12443 D(p->level--);
12444 return NULL;
12445 }
12446 int _end_lineno = _token->end_lineno;
12447 UNUSED(_end_lineno); // Only used by EXTRA macro
12448 int _end_col_offset = _token->end_col_offset;
12449 UNUSED(_end_col_offset); // Only used by EXTRA macro
12450 _res = _Py_Starred ( a , Load , EXTRA );
12451 if (_res == NULL && PyErr_Occurred()) {
12452 p->error_indicator = 1;
12453 D(p->level--);
12454 return NULL;
12455 }
12456 goto done;
12457 }
12458 p->mark = _mark;
12459 D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
12460 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
12461 }
12462 _res = NULL;
12463 done:
12464 D(p->level--);
12465 return _res;
12466}
12467
12468// kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg
12469static KeywordOrStarred*
12470kwarg_or_starred_rule(Parser *p)
12471{
12472 D(p->level++);
12473 if (p->error_indicator) {
12474 D(p->level--);
12475 return NULL;
12476 }
12477 KeywordOrStarred* _res = NULL;
12478 int _mark = p->mark;
12479 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12480 p->error_indicator = 1;
12481 D(p->level--);
12482 return NULL;
12483 }
12484 int _start_lineno = p->tokens[_mark]->lineno;
12485 UNUSED(_start_lineno); // Only used by EXTRA macro
12486 int _start_col_offset = p->tokens[_mark]->col_offset;
12487 UNUSED(_start_col_offset); // Only used by EXTRA macro
12488 { // NAME '=' expression
12489 if (p->error_indicator) {
12490 D(p->level--);
12491 return NULL;
12492 }
12493 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12494 Token * _literal;
12495 expr_ty a;
12496 expr_ty b;
12497 if (
12498 (a = _PyPegen_name_token(p)) // NAME
12499 &&
12500 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12501 &&
12502 (b = expression_rule(p)) // expression
12503 )
12504 {
12505 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12506 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12507 if (_token == NULL) {
12508 D(p->level--);
12509 return NULL;
12510 }
12511 int _end_lineno = _token->end_lineno;
12512 UNUSED(_end_lineno); // Only used by EXTRA macro
12513 int _end_col_offset = _token->end_col_offset;
12514 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012515 _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012516 if (_res == NULL && PyErr_Occurred()) {
12517 p->error_indicator = 1;
12518 D(p->level--);
12519 return NULL;
12520 }
12521 goto done;
12522 }
12523 p->mark = _mark;
12524 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12525 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12526 }
12527 { // starred_expression
12528 if (p->error_indicator) {
12529 D(p->level--);
12530 return NULL;
12531 }
12532 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12533 expr_ty a;
12534 if (
12535 (a = starred_expression_rule(p)) // starred_expression
12536 )
12537 {
12538 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
12539 _res = _PyPegen_keyword_or_starred ( p , a , 0 );
12540 if (_res == NULL && PyErr_Occurred()) {
12541 p->error_indicator = 1;
12542 D(p->level--);
12543 return NULL;
12544 }
12545 goto done;
12546 }
12547 p->mark = _mark;
12548 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12549 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
12550 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012551 if (p->call_invalid_rules) { // invalid_kwarg
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012552 if (p->error_indicator) {
12553 D(p->level--);
12554 return NULL;
12555 }
12556 D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12557 void *invalid_kwarg_var;
12558 if (
12559 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12560 )
12561 {
12562 D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12563 _res = invalid_kwarg_var;
12564 goto done;
12565 }
12566 p->mark = _mark;
12567 D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
12568 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12569 }
12570 _res = NULL;
12571 done:
12572 D(p->level--);
12573 return _res;
12574}
12575
12576// kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg
12577static KeywordOrStarred*
12578kwarg_or_double_starred_rule(Parser *p)
12579{
12580 D(p->level++);
12581 if (p->error_indicator) {
12582 D(p->level--);
12583 return NULL;
12584 }
12585 KeywordOrStarred* _res = NULL;
12586 int _mark = p->mark;
12587 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12588 p->error_indicator = 1;
12589 D(p->level--);
12590 return NULL;
12591 }
12592 int _start_lineno = p->tokens[_mark]->lineno;
12593 UNUSED(_start_lineno); // Only used by EXTRA macro
12594 int _start_col_offset = p->tokens[_mark]->col_offset;
12595 UNUSED(_start_col_offset); // Only used by EXTRA macro
12596 { // NAME '=' expression
12597 if (p->error_indicator) {
12598 D(p->level--);
12599 return NULL;
12600 }
12601 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12602 Token * _literal;
12603 expr_ty a;
12604 expr_ty b;
12605 if (
12606 (a = _PyPegen_name_token(p)) // NAME
12607 &&
12608 (_literal = _PyPegen_expect_token(p, 22)) // token='='
12609 &&
12610 (b = expression_rule(p)) // expression
12611 )
12612 {
12613 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
12614 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12615 if (_token == NULL) {
12616 D(p->level--);
12617 return NULL;
12618 }
12619 int _end_lineno = _token->end_lineno;
12620 UNUSED(_end_lineno); // Only used by EXTRA macro
12621 int _end_col_offset = _token->end_col_offset;
12622 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012623 _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012624 if (_res == NULL && PyErr_Occurred()) {
12625 p->error_indicator = 1;
12626 D(p->level--);
12627 return NULL;
12628 }
12629 goto done;
12630 }
12631 p->mark = _mark;
12632 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12633 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
12634 }
12635 { // '**' expression
12636 if (p->error_indicator) {
12637 D(p->level--);
12638 return NULL;
12639 }
12640 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12641 Token * _literal;
12642 expr_ty a;
12643 if (
12644 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
12645 &&
12646 (a = expression_rule(p)) // expression
12647 )
12648 {
12649 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
12650 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12651 if (_token == NULL) {
12652 D(p->level--);
12653 return NULL;
12654 }
12655 int _end_lineno = _token->end_lineno;
12656 UNUSED(_end_lineno); // Only used by EXTRA macro
12657 int _end_col_offset = _token->end_col_offset;
12658 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012659 _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012660 if (_res == NULL && PyErr_Occurred()) {
12661 p->error_indicator = 1;
12662 D(p->level--);
12663 return NULL;
12664 }
12665 goto done;
12666 }
12667 p->mark = _mark;
12668 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12669 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
12670 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020012671 if (p->call_invalid_rules) { // invalid_kwarg
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012672 if (p->error_indicator) {
12673 D(p->level--);
12674 return NULL;
12675 }
12676 D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12677 void *invalid_kwarg_var;
12678 if (
12679 (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg
12680 )
12681 {
12682 D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
12683 _res = invalid_kwarg_var;
12684 goto done;
12685 }
12686 p->mark = _mark;
12687 D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
12688 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
12689 }
12690 _res = NULL;
12691 done:
12692 D(p->level--);
12693 return _res;
12694}
12695
12696// star_targets: star_target !',' | star_target ((',' star_target))* ','?
12697static expr_ty
12698star_targets_rule(Parser *p)
12699{
12700 D(p->level++);
12701 if (p->error_indicator) {
12702 D(p->level--);
12703 return NULL;
12704 }
12705 expr_ty _res = NULL;
12706 int _mark = p->mark;
12707 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12708 p->error_indicator = 1;
12709 D(p->level--);
12710 return NULL;
12711 }
12712 int _start_lineno = p->tokens[_mark]->lineno;
12713 UNUSED(_start_lineno); // Only used by EXTRA macro
12714 int _start_col_offset = p->tokens[_mark]->col_offset;
12715 UNUSED(_start_col_offset); // Only used by EXTRA macro
12716 { // star_target !','
12717 if (p->error_indicator) {
12718 D(p->level--);
12719 return NULL;
12720 }
12721 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12722 expr_ty a;
12723 if (
12724 (a = star_target_rule(p)) // star_target
12725 &&
12726 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=','
12727 )
12728 {
12729 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
12730 _res = a;
12731 if (_res == NULL && PyErr_Occurred()) {
12732 p->error_indicator = 1;
12733 D(p->level--);
12734 return NULL;
12735 }
12736 goto done;
12737 }
12738 p->mark = _mark;
12739 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12740 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','"));
12741 }
12742 { // star_target ((',' star_target))* ','?
12743 if (p->error_indicator) {
12744 D(p->level--);
12745 return NULL;
12746 }
12747 D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12748 void *_opt_var;
12749 UNUSED(_opt_var); // Silence compiler warnings
12750 expr_ty a;
12751 asdl_seq * b;
12752 if (
12753 (a = star_target_rule(p)) // star_target
12754 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012755 (b = _loop0_119_rule(p)) // ((',' star_target))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012756 &&
12757 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12758 )
12759 {
12760 D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
12761 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12762 if (_token == NULL) {
12763 D(p->level--);
12764 return NULL;
12765 }
12766 int _end_lineno = _token->end_lineno;
12767 UNUSED(_end_lineno); // Only used by EXTRA macro
12768 int _end_col_offset = _token->end_col_offset;
12769 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012770 _res = _Py_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012771 if (_res == NULL && PyErr_Occurred()) {
12772 p->error_indicator = 1;
12773 D(p->level--);
12774 return NULL;
12775 }
12776 goto done;
12777 }
12778 p->mark = _mark;
12779 D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
12780 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?"));
12781 }
12782 _res = NULL;
12783 done:
12784 D(p->level--);
12785 return _res;
12786}
12787
12788// star_targets_seq: ','.star_target+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +010012789static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012790star_targets_seq_rule(Parser *p)
12791{
12792 D(p->level++);
12793 if (p->error_indicator) {
12794 D(p->level--);
12795 return NULL;
12796 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010012797 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012798 int _mark = p->mark;
12799 { // ','.star_target+ ','?
12800 if (p->error_indicator) {
12801 D(p->level--);
12802 return NULL;
12803 }
12804 D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12805 void *_opt_var;
12806 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010012807 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012808 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010012809 (a = (asdl_expr_seq*)_gather_120_rule(p)) // ','.star_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012810 &&
12811 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
12812 )
12813 {
12814 D(fprintf(stderr, "%*c+ star_targets_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
12815 _res = a;
12816 if (_res == NULL && PyErr_Occurred()) {
12817 p->error_indicator = 1;
12818 D(p->level--);
12819 return NULL;
12820 }
12821 goto done;
12822 }
12823 p->mark = _mark;
12824 D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ',
12825 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?"));
12826 }
12827 _res = NULL;
12828 done:
12829 D(p->level--);
12830 return _res;
12831}
12832
12833// star_target:
12834// | '*' (!'*' star_target)
12835// | t_primary '.' NAME !t_lookahead
12836// | t_primary '[' slices ']' !t_lookahead
12837// | star_atom
12838static expr_ty
12839star_target_rule(Parser *p)
12840{
12841 D(p->level++);
12842 if (p->error_indicator) {
12843 D(p->level--);
12844 return NULL;
12845 }
12846 expr_ty _res = NULL;
12847 if (_PyPegen_is_memoized(p, star_target_type, &_res)) {
12848 D(p->level--);
12849 return _res;
12850 }
12851 int _mark = p->mark;
12852 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
12853 p->error_indicator = 1;
12854 D(p->level--);
12855 return NULL;
12856 }
12857 int _start_lineno = p->tokens[_mark]->lineno;
12858 UNUSED(_start_lineno); // Only used by EXTRA macro
12859 int _start_col_offset = p->tokens[_mark]->col_offset;
12860 UNUSED(_start_col_offset); // Only used by EXTRA macro
12861 { // '*' (!'*' star_target)
12862 if (p->error_indicator) {
12863 D(p->level--);
12864 return NULL;
12865 }
12866 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12867 Token * _literal;
12868 void *a;
12869 if (
12870 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
12871 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010012872 (a = _tmp_122_rule(p)) // !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012873 )
12874 {
12875 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
12876 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12877 if (_token == NULL) {
12878 D(p->level--);
12879 return NULL;
12880 }
12881 int _end_lineno = _token->end_lineno;
12882 UNUSED(_end_lineno); // Only used by EXTRA macro
12883 int _end_col_offset = _token->end_col_offset;
12884 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030012885 _res = _Py_Starred ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010012886 if (_res == NULL && PyErr_Occurred()) {
12887 p->error_indicator = 1;
12888 D(p->level--);
12889 return NULL;
12890 }
12891 goto done;
12892 }
12893 p->mark = _mark;
12894 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12895 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)"));
12896 }
12897 { // t_primary '.' NAME !t_lookahead
12898 if (p->error_indicator) {
12899 D(p->level--);
12900 return NULL;
12901 }
12902 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12903 Token * _literal;
12904 expr_ty a;
12905 expr_ty b;
12906 if (
12907 (a = t_primary_rule(p)) // t_primary
12908 &&
12909 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
12910 &&
12911 (b = _PyPegen_name_token(p)) // NAME
12912 &&
12913 _PyPegen_lookahead(0, t_lookahead_rule, p)
12914 )
12915 {
12916 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12917 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12918 if (_token == NULL) {
12919 D(p->level--);
12920 return NULL;
12921 }
12922 int _end_lineno = _token->end_lineno;
12923 UNUSED(_end_lineno); // Only used by EXTRA macro
12924 int _end_col_offset = _token->end_col_offset;
12925 UNUSED(_end_col_offset); // Only used by EXTRA macro
12926 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
12927 if (_res == NULL && PyErr_Occurred()) {
12928 p->error_indicator = 1;
12929 D(p->level--);
12930 return NULL;
12931 }
12932 goto done;
12933 }
12934 p->mark = _mark;
12935 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12936 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
12937 }
12938 { // t_primary '[' slices ']' !t_lookahead
12939 if (p->error_indicator) {
12940 D(p->level--);
12941 return NULL;
12942 }
12943 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12944 Token * _literal;
12945 Token * _literal_1;
12946 expr_ty a;
12947 expr_ty b;
12948 if (
12949 (a = t_primary_rule(p)) // t_primary
12950 &&
12951 (_literal = _PyPegen_expect_token(p, 9)) // token='['
12952 &&
12953 (b = slices_rule(p)) // slices
12954 &&
12955 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
12956 &&
12957 _PyPegen_lookahead(0, t_lookahead_rule, p)
12958 )
12959 {
12960 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12961 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
12962 if (_token == NULL) {
12963 D(p->level--);
12964 return NULL;
12965 }
12966 int _end_lineno = _token->end_lineno;
12967 UNUSED(_end_lineno); // Only used by EXTRA macro
12968 int _end_col_offset = _token->end_col_offset;
12969 UNUSED(_end_col_offset); // Only used by EXTRA macro
12970 _res = _Py_Subscript ( a , b , Store , EXTRA );
12971 if (_res == NULL && PyErr_Occurred()) {
12972 p->error_indicator = 1;
12973 D(p->level--);
12974 return NULL;
12975 }
12976 goto done;
12977 }
12978 p->mark = _mark;
12979 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12980 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
12981 }
12982 { // star_atom
12983 if (p->error_indicator) {
12984 D(p->level--);
12985 return NULL;
12986 }
12987 D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom"));
12988 expr_ty star_atom_var;
12989 if (
12990 (star_atom_var = star_atom_rule(p)) // star_atom
12991 )
12992 {
12993 D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom"));
12994 _res = star_atom_var;
12995 goto done;
12996 }
12997 p->mark = _mark;
12998 D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
12999 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom"));
13000 }
13001 _res = NULL;
13002 done:
13003 _PyPegen_insert_memo(p, _mark, star_target_type, _res);
13004 D(p->level--);
13005 return _res;
13006}
13007
13008// star_atom:
13009// | NAME
13010// | '(' star_target ')'
13011// | '(' star_targets_seq? ')'
13012// | '[' star_targets_seq? ']'
13013static expr_ty
13014star_atom_rule(Parser *p)
13015{
13016 D(p->level++);
13017 if (p->error_indicator) {
13018 D(p->level--);
13019 return NULL;
13020 }
13021 expr_ty _res = NULL;
13022 int _mark = p->mark;
13023 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13024 p->error_indicator = 1;
13025 D(p->level--);
13026 return NULL;
13027 }
13028 int _start_lineno = p->tokens[_mark]->lineno;
13029 UNUSED(_start_lineno); // Only used by EXTRA macro
13030 int _start_col_offset = p->tokens[_mark]->col_offset;
13031 UNUSED(_start_col_offset); // Only used by EXTRA macro
13032 { // NAME
13033 if (p->error_indicator) {
13034 D(p->level--);
13035 return NULL;
13036 }
13037 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13038 expr_ty a;
13039 if (
13040 (a = _PyPegen_name_token(p)) // NAME
13041 )
13042 {
13043 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13044 _res = _PyPegen_set_expr_context ( p , a , Store );
13045 if (_res == NULL && PyErr_Occurred()) {
13046 p->error_indicator = 1;
13047 D(p->level--);
13048 return NULL;
13049 }
13050 goto done;
13051 }
13052 p->mark = _mark;
13053 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13054 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13055 }
13056 { // '(' star_target ')'
13057 if (p->error_indicator) {
13058 D(p->level--);
13059 return NULL;
13060 }
13061 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13062 Token * _literal;
13063 Token * _literal_1;
13064 expr_ty a;
13065 if (
13066 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13067 &&
13068 (a = star_target_rule(p)) // star_target
13069 &&
13070 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13071 )
13072 {
13073 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
13074 _res = _PyPegen_set_expr_context ( p , a , Store );
13075 if (_res == NULL && PyErr_Occurred()) {
13076 p->error_indicator = 1;
13077 D(p->level--);
13078 return NULL;
13079 }
13080 goto done;
13081 }
13082 p->mark = _mark;
13083 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13084 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'"));
13085 }
13086 { // '(' star_targets_seq? ')'
13087 if (p->error_indicator) {
13088 D(p->level--);
13089 return NULL;
13090 }
13091 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13092 Token * _literal;
13093 Token * _literal_1;
13094 void *a;
13095 if (
13096 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13097 &&
13098 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13099 &&
13100 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13101 )
13102 {
13103 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
13104 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13105 if (_token == NULL) {
13106 D(p->level--);
13107 return NULL;
13108 }
13109 int _end_lineno = _token->end_lineno;
13110 UNUSED(_end_lineno); // Only used by EXTRA macro
13111 int _end_col_offset = _token->end_col_offset;
13112 UNUSED(_end_col_offset); // Only used by EXTRA macro
13113 _res = _Py_Tuple ( a , Store , EXTRA );
13114 if (_res == NULL && PyErr_Occurred()) {
13115 p->error_indicator = 1;
13116 D(p->level--);
13117 return NULL;
13118 }
13119 goto done;
13120 }
13121 p->mark = _mark;
13122 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13123 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'"));
13124 }
13125 { // '[' star_targets_seq? ']'
13126 if (p->error_indicator) {
13127 D(p->level--);
13128 return NULL;
13129 }
13130 D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13131 Token * _literal;
13132 Token * _literal_1;
13133 void *a;
13134 if (
13135 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13136 &&
13137 (a = star_targets_seq_rule(p), 1) // star_targets_seq?
13138 &&
13139 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13140 )
13141 {
13142 D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
13143 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13144 if (_token == NULL) {
13145 D(p->level--);
13146 return NULL;
13147 }
13148 int _end_lineno = _token->end_lineno;
13149 UNUSED(_end_lineno); // Only used by EXTRA macro
13150 int _end_col_offset = _token->end_col_offset;
13151 UNUSED(_end_col_offset); // Only used by EXTRA macro
13152 _res = _Py_List ( a , Store , EXTRA );
13153 if (_res == NULL && PyErr_Occurred()) {
13154 p->error_indicator = 1;
13155 D(p->level--);
13156 return NULL;
13157 }
13158 goto done;
13159 }
13160 p->mark = _mark;
13161 D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
13162 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'"));
13163 }
13164 _res = NULL;
13165 done:
13166 D(p->level--);
13167 return _res;
13168}
13169
13170// single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
13171static expr_ty
13172single_target_rule(Parser *p)
13173{
13174 D(p->level++);
13175 if (p->error_indicator) {
13176 D(p->level--);
13177 return NULL;
13178 }
13179 expr_ty _res = NULL;
13180 int _mark = p->mark;
13181 { // single_subscript_attribute_target
13182 if (p->error_indicator) {
13183 D(p->level--);
13184 return NULL;
13185 }
13186 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13187 expr_ty single_subscript_attribute_target_var;
13188 if (
13189 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
13190 )
13191 {
13192 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
13193 _res = single_subscript_attribute_target_var;
13194 goto done;
13195 }
13196 p->mark = _mark;
13197 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13198 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
13199 }
13200 { // NAME
13201 if (p->error_indicator) {
13202 D(p->level--);
13203 return NULL;
13204 }
13205 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
13206 expr_ty a;
13207 if (
13208 (a = _PyPegen_name_token(p)) // NAME
13209 )
13210 {
13211 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
13212 _res = _PyPegen_set_expr_context ( p , a , Store );
13213 if (_res == NULL && PyErr_Occurred()) {
13214 p->error_indicator = 1;
13215 D(p->level--);
13216 return NULL;
13217 }
13218 goto done;
13219 }
13220 p->mark = _mark;
13221 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13222 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
13223 }
13224 { // '(' single_target ')'
13225 if (p->error_indicator) {
13226 D(p->level--);
13227 return NULL;
13228 }
13229 D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13230 Token * _literal;
13231 Token * _literal_1;
13232 expr_ty a;
13233 if (
13234 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13235 &&
13236 (a = single_target_rule(p)) // single_target
13237 &&
13238 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13239 )
13240 {
13241 D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
13242 _res = a;
13243 if (_res == NULL && PyErr_Occurred()) {
13244 p->error_indicator = 1;
13245 D(p->level--);
13246 return NULL;
13247 }
13248 goto done;
13249 }
13250 p->mark = _mark;
13251 D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
13252 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
13253 }
13254 _res = NULL;
13255 done:
13256 D(p->level--);
13257 return _res;
13258}
13259
13260// single_subscript_attribute_target:
13261// | t_primary '.' NAME !t_lookahead
13262// | t_primary '[' slices ']' !t_lookahead
13263static expr_ty
13264single_subscript_attribute_target_rule(Parser *p)
13265{
13266 D(p->level++);
13267 if (p->error_indicator) {
13268 D(p->level--);
13269 return NULL;
13270 }
13271 expr_ty _res = NULL;
13272 int _mark = p->mark;
13273 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13274 p->error_indicator = 1;
13275 D(p->level--);
13276 return NULL;
13277 }
13278 int _start_lineno = p->tokens[_mark]->lineno;
13279 UNUSED(_start_lineno); // Only used by EXTRA macro
13280 int _start_col_offset = p->tokens[_mark]->col_offset;
13281 UNUSED(_start_col_offset); // Only used by EXTRA macro
13282 { // t_primary '.' NAME !t_lookahead
13283 if (p->error_indicator) {
13284 D(p->level--);
13285 return NULL;
13286 }
13287 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13288 Token * _literal;
13289 expr_ty a;
13290 expr_ty b;
13291 if (
13292 (a = t_primary_rule(p)) // t_primary
13293 &&
13294 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13295 &&
13296 (b = _PyPegen_name_token(p)) // NAME
13297 &&
13298 _PyPegen_lookahead(0, t_lookahead_rule, p)
13299 )
13300 {
13301 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13302 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13303 if (_token == NULL) {
13304 D(p->level--);
13305 return NULL;
13306 }
13307 int _end_lineno = _token->end_lineno;
13308 UNUSED(_end_lineno); // Only used by EXTRA macro
13309 int _end_col_offset = _token->end_col_offset;
13310 UNUSED(_end_col_offset); // Only used by EXTRA macro
13311 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13312 if (_res == NULL && PyErr_Occurred()) {
13313 p->error_indicator = 1;
13314 D(p->level--);
13315 return NULL;
13316 }
13317 goto done;
13318 }
13319 p->mark = _mark;
13320 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13321 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13322 }
13323 { // t_primary '[' slices ']' !t_lookahead
13324 if (p->error_indicator) {
13325 D(p->level--);
13326 return NULL;
13327 }
13328 D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13329 Token * _literal;
13330 Token * _literal_1;
13331 expr_ty a;
13332 expr_ty b;
13333 if (
13334 (a = t_primary_rule(p)) // t_primary
13335 &&
13336 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13337 &&
13338 (b = slices_rule(p)) // slices
13339 &&
13340 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13341 &&
13342 _PyPegen_lookahead(0, t_lookahead_rule, p)
13343 )
13344 {
13345 D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13346 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13347 if (_token == NULL) {
13348 D(p->level--);
13349 return NULL;
13350 }
13351 int _end_lineno = _token->end_lineno;
13352 UNUSED(_end_lineno); // Only used by EXTRA macro
13353 int _end_col_offset = _token->end_col_offset;
13354 UNUSED(_end_col_offset); // Only used by EXTRA macro
13355 _res = _Py_Subscript ( a , b , Store , EXTRA );
13356 if (_res == NULL && PyErr_Occurred()) {
13357 p->error_indicator = 1;
13358 D(p->level--);
13359 return NULL;
13360 }
13361 goto done;
13362 }
13363 p->mark = _mark;
13364 D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
13365 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13366 }
13367 _res = NULL;
13368 done:
13369 D(p->level--);
13370 return _res;
13371}
13372
13373// del_targets: ','.del_target+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +010013374static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013375del_targets_rule(Parser *p)
13376{
13377 D(p->level++);
13378 if (p->error_indicator) {
13379 D(p->level--);
13380 return NULL;
13381 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010013382 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013383 int _mark = p->mark;
13384 { // ','.del_target+ ','?
13385 if (p->error_indicator) {
13386 D(p->level--);
13387 return NULL;
13388 }
13389 D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13390 void *_opt_var;
13391 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010013392 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013393 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010013394 (a = (asdl_expr_seq*)_gather_123_rule(p)) // ','.del_target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013395 &&
13396 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13397 )
13398 {
13399 D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
13400 _res = a;
13401 if (_res == NULL && PyErr_Occurred()) {
13402 p->error_indicator = 1;
13403 D(p->level--);
13404 return NULL;
13405 }
13406 goto done;
13407 }
13408 p->mark = _mark;
13409 D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ',
13410 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?"));
13411 }
13412 _res = NULL;
13413 done:
13414 D(p->level--);
13415 return _res;
13416}
13417
13418// del_target:
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013419// | t_primary '.' NAME !t_lookahead
13420// | t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013421// | del_t_atom
13422static expr_ty
13423del_target_rule(Parser *p)
13424{
13425 D(p->level++);
13426 if (p->error_indicator) {
13427 D(p->level--);
13428 return NULL;
13429 }
13430 expr_ty _res = NULL;
13431 if (_PyPegen_is_memoized(p, del_target_type, &_res)) {
13432 D(p->level--);
13433 return _res;
13434 }
13435 int _mark = p->mark;
13436 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13437 p->error_indicator = 1;
13438 D(p->level--);
13439 return NULL;
13440 }
13441 int _start_lineno = p->tokens[_mark]->lineno;
13442 UNUSED(_start_lineno); // Only used by EXTRA macro
13443 int _start_col_offset = p->tokens[_mark]->col_offset;
13444 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013445 { // t_primary '.' NAME !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013446 if (p->error_indicator) {
13447 D(p->level--);
13448 return NULL;
13449 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013450 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 +010013451 Token * _literal;
13452 expr_ty a;
13453 expr_ty b;
13454 if (
13455 (a = t_primary_rule(p)) // t_primary
13456 &&
13457 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13458 &&
13459 (b = _PyPegen_name_token(p)) // NAME
13460 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013461 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013462 )
13463 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013464 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 +010013465 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13466 if (_token == NULL) {
13467 D(p->level--);
13468 return NULL;
13469 }
13470 int _end_lineno = _token->end_lineno;
13471 UNUSED(_end_lineno); // Only used by EXTRA macro
13472 int _end_col_offset = _token->end_col_offset;
13473 UNUSED(_end_col_offset); // Only used by EXTRA macro
13474 _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
13475 if (_res == NULL && PyErr_Occurred()) {
13476 p->error_indicator = 1;
13477 D(p->level--);
13478 return NULL;
13479 }
13480 goto done;
13481 }
13482 p->mark = _mark;
13483 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013484 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013485 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013486 { // t_primary '[' slices ']' !t_lookahead
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013487 if (p->error_indicator) {
13488 D(p->level--);
13489 return NULL;
13490 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013491 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 +010013492 Token * _literal;
13493 Token * _literal_1;
13494 expr_ty a;
13495 expr_ty b;
13496 if (
13497 (a = t_primary_rule(p)) // t_primary
13498 &&
13499 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13500 &&
13501 (b = slices_rule(p)) // slices
13502 &&
13503 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13504 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013505 _PyPegen_lookahead(0, t_lookahead_rule, p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013506 )
13507 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013508 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 +010013509 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13510 if (_token == NULL) {
13511 D(p->level--);
13512 return NULL;
13513 }
13514 int _end_lineno = _token->end_lineno;
13515 UNUSED(_end_lineno); // Only used by EXTRA macro
13516 int _end_col_offset = _token->end_col_offset;
13517 UNUSED(_end_col_offset); // Only used by EXTRA macro
13518 _res = _Py_Subscript ( a , b , Del , EXTRA );
13519 if (_res == NULL && PyErr_Occurred()) {
13520 p->error_indicator = 1;
13521 D(p->level--);
13522 return NULL;
13523 }
13524 goto done;
13525 }
13526 p->mark = _mark;
13527 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013528 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013529 }
13530 { // del_t_atom
13531 if (p->error_indicator) {
13532 D(p->level--);
13533 return NULL;
13534 }
13535 D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13536 expr_ty del_t_atom_var;
13537 if (
13538 (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom
13539 )
13540 {
13541 D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
13542 _res = del_t_atom_var;
13543 goto done;
13544 }
13545 p->mark = _mark;
13546 D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
13547 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom"));
13548 }
13549 _res = NULL;
13550 done:
13551 _PyPegen_insert_memo(p, _mark, del_target_type, _res);
13552 D(p->level--);
13553 return _res;
13554}
13555
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013556// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013557static expr_ty
13558del_t_atom_rule(Parser *p)
13559{
13560 D(p->level++);
13561 if (p->error_indicator) {
13562 D(p->level--);
13563 return NULL;
13564 }
13565 expr_ty _res = NULL;
13566 int _mark = p->mark;
13567 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13568 p->error_indicator = 1;
13569 D(p->level--);
13570 return NULL;
13571 }
13572 int _start_lineno = p->tokens[_mark]->lineno;
13573 UNUSED(_start_lineno); // Only used by EXTRA macro
13574 int _start_col_offset = p->tokens[_mark]->col_offset;
13575 UNUSED(_start_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013576 { // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013577 if (p->error_indicator) {
13578 D(p->level--);
13579 return NULL;
13580 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013581 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013582 expr_ty a;
13583 if (
13584 (a = _PyPegen_name_token(p)) // NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013585 )
13586 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013587 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 +010013588 _res = _PyPegen_set_expr_context ( p , a , Del );
13589 if (_res == NULL && PyErr_Occurred()) {
13590 p->error_indicator = 1;
13591 D(p->level--);
13592 return NULL;
13593 }
13594 goto done;
13595 }
13596 p->mark = _mark;
13597 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030013598 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013599 }
13600 { // '(' del_target ')'
13601 if (p->error_indicator) {
13602 D(p->level--);
13603 return NULL;
13604 }
13605 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13606 Token * _literal;
13607 Token * _literal_1;
13608 expr_ty a;
13609 if (
13610 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13611 &&
13612 (a = del_target_rule(p)) // del_target
13613 &&
13614 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13615 )
13616 {
13617 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
13618 _res = _PyPegen_set_expr_context ( p , a , Del );
13619 if (_res == NULL && PyErr_Occurred()) {
13620 p->error_indicator = 1;
13621 D(p->level--);
13622 return NULL;
13623 }
13624 goto done;
13625 }
13626 p->mark = _mark;
13627 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13628 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'"));
13629 }
13630 { // '(' del_targets? ')'
13631 if (p->error_indicator) {
13632 D(p->level--);
13633 return NULL;
13634 }
13635 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13636 Token * _literal;
13637 Token * _literal_1;
13638 void *a;
13639 if (
13640 (_literal = _PyPegen_expect_token(p, 7)) // token='('
13641 &&
13642 (a = del_targets_rule(p), 1) // del_targets?
13643 &&
13644 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
13645 )
13646 {
13647 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
13648 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13649 if (_token == NULL) {
13650 D(p->level--);
13651 return NULL;
13652 }
13653 int _end_lineno = _token->end_lineno;
13654 UNUSED(_end_lineno); // Only used by EXTRA macro
13655 int _end_col_offset = _token->end_col_offset;
13656 UNUSED(_end_col_offset); // Only used by EXTRA macro
13657 _res = _Py_Tuple ( a , Del , EXTRA );
13658 if (_res == NULL && PyErr_Occurred()) {
13659 p->error_indicator = 1;
13660 D(p->level--);
13661 return NULL;
13662 }
13663 goto done;
13664 }
13665 p->mark = _mark;
13666 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13667 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'"));
13668 }
13669 { // '[' del_targets? ']'
13670 if (p->error_indicator) {
13671 D(p->level--);
13672 return NULL;
13673 }
13674 D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13675 Token * _literal;
13676 Token * _literal_1;
13677 void *a;
13678 if (
13679 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13680 &&
13681 (a = del_targets_rule(p), 1) // del_targets?
13682 &&
13683 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13684 )
13685 {
13686 D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
13687 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13688 if (_token == NULL) {
13689 D(p->level--);
13690 return NULL;
13691 }
13692 int _end_lineno = _token->end_lineno;
13693 UNUSED(_end_lineno); // Only used by EXTRA macro
13694 int _end_col_offset = _token->end_col_offset;
13695 UNUSED(_end_col_offset); // Only used by EXTRA macro
13696 _res = _Py_List ( a , Del , EXTRA );
13697 if (_res == NULL && PyErr_Occurred()) {
13698 p->error_indicator = 1;
13699 D(p->level--);
13700 return NULL;
13701 }
13702 goto done;
13703 }
13704 p->mark = _mark;
13705 D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
13706 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'"));
13707 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013708 _res = NULL;
13709 done:
13710 D(p->level--);
13711 return _res;
13712}
13713
13714// targets: ','.target+ ','?
Pablo Galindoa5634c42020-09-16 19:42:00 +010013715static asdl_expr_seq*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013716targets_rule(Parser *p)
13717{
13718 D(p->level++);
13719 if (p->error_indicator) {
13720 D(p->level--);
13721 return NULL;
13722 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010013723 asdl_expr_seq* _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013724 int _mark = p->mark;
13725 { // ','.target+ ','?
13726 if (p->error_indicator) {
13727 D(p->level--);
13728 return NULL;
13729 }
13730 D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13731 void *_opt_var;
13732 UNUSED(_opt_var); // Silence compiler warnings
Pablo Galindoa5634c42020-09-16 19:42:00 +010013733 asdl_expr_seq* a;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013734 if (
Pablo Galindoa5634c42020-09-16 19:42:00 +010013735 (a = (asdl_expr_seq*)_gather_125_rule(p)) // ','.target+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010013736 &&
13737 (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
13738 )
13739 {
13740 D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
13741 _res = a;
13742 if (_res == NULL && PyErr_Occurred()) {
13743 p->error_indicator = 1;
13744 D(p->level--);
13745 return NULL;
13746 }
13747 goto done;
13748 }
13749 p->mark = _mark;
13750 D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ',
13751 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?"));
13752 }
13753 _res = NULL;
13754 done:
13755 D(p->level--);
13756 return _res;
13757}
13758
13759// target:
13760// | t_primary '.' NAME !t_lookahead
13761// | t_primary '[' slices ']' !t_lookahead
13762// | t_atom
13763static expr_ty
13764target_rule(Parser *p)
13765{
13766 D(p->level++);
13767 if (p->error_indicator) {
13768 D(p->level--);
13769 return NULL;
13770 }
13771 expr_ty _res = NULL;
13772 if (_PyPegen_is_memoized(p, target_type, &_res)) {
13773 D(p->level--);
13774 return _res;
13775 }
13776 int _mark = p->mark;
13777 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13778 p->error_indicator = 1;
13779 D(p->level--);
13780 return NULL;
13781 }
13782 int _start_lineno = p->tokens[_mark]->lineno;
13783 UNUSED(_start_lineno); // Only used by EXTRA macro
13784 int _start_col_offset = p->tokens[_mark]->col_offset;
13785 UNUSED(_start_col_offset); // Only used by EXTRA macro
13786 { // t_primary '.' NAME !t_lookahead
13787 if (p->error_indicator) {
13788 D(p->level--);
13789 return NULL;
13790 }
13791 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13792 Token * _literal;
13793 expr_ty a;
13794 expr_ty b;
13795 if (
13796 (a = t_primary_rule(p)) // t_primary
13797 &&
13798 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13799 &&
13800 (b = _PyPegen_name_token(p)) // NAME
13801 &&
13802 _PyPegen_lookahead(0, t_lookahead_rule, p)
13803 )
13804 {
13805 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13806 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13807 if (_token == NULL) {
13808 D(p->level--);
13809 return NULL;
13810 }
13811 int _end_lineno = _token->end_lineno;
13812 UNUSED(_end_lineno); // Only used by EXTRA macro
13813 int _end_col_offset = _token->end_col_offset;
13814 UNUSED(_end_col_offset); // Only used by EXTRA macro
13815 _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
13816 if (_res == NULL && PyErr_Occurred()) {
13817 p->error_indicator = 1;
13818 D(p->level--);
13819 return NULL;
13820 }
13821 goto done;
13822 }
13823 p->mark = _mark;
13824 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13825 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
13826 }
13827 { // t_primary '[' slices ']' !t_lookahead
13828 if (p->error_indicator) {
13829 D(p->level--);
13830 return NULL;
13831 }
13832 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13833 Token * _literal;
13834 Token * _literal_1;
13835 expr_ty a;
13836 expr_ty b;
13837 if (
13838 (a = t_primary_rule(p)) // t_primary
13839 &&
13840 (_literal = _PyPegen_expect_token(p, 9)) // token='['
13841 &&
13842 (b = slices_rule(p)) // slices
13843 &&
13844 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
13845 &&
13846 _PyPegen_lookahead(0, t_lookahead_rule, p)
13847 )
13848 {
13849 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13850 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13851 if (_token == NULL) {
13852 D(p->level--);
13853 return NULL;
13854 }
13855 int _end_lineno = _token->end_lineno;
13856 UNUSED(_end_lineno); // Only used by EXTRA macro
13857 int _end_col_offset = _token->end_col_offset;
13858 UNUSED(_end_col_offset); // Only used by EXTRA macro
13859 _res = _Py_Subscript ( a , b , Store , EXTRA );
13860 if (_res == NULL && PyErr_Occurred()) {
13861 p->error_indicator = 1;
13862 D(p->level--);
13863 return NULL;
13864 }
13865 goto done;
13866 }
13867 p->mark = _mark;
13868 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13869 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
13870 }
13871 { // t_atom
13872 if (p->error_indicator) {
13873 D(p->level--);
13874 return NULL;
13875 }
13876 D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom"));
13877 expr_ty t_atom_var;
13878 if (
13879 (t_atom_var = t_atom_rule(p)) // t_atom
13880 )
13881 {
13882 D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom"));
13883 _res = t_atom_var;
13884 goto done;
13885 }
13886 p->mark = _mark;
13887 D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
13888 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom"));
13889 }
13890 _res = NULL;
13891 done:
13892 _PyPegen_insert_memo(p, _mark, target_type, _res);
13893 D(p->level--);
13894 return _res;
13895}
13896
13897// Left-recursive
13898// t_primary:
13899// | t_primary '.' NAME &t_lookahead
13900// | t_primary '[' slices ']' &t_lookahead
13901// | t_primary genexp &t_lookahead
13902// | t_primary '(' arguments? ')' &t_lookahead
13903// | atom &t_lookahead
13904static expr_ty t_primary_raw(Parser *);
13905static expr_ty
13906t_primary_rule(Parser *p)
13907{
13908 D(p->level++);
13909 expr_ty _res = NULL;
13910 if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
13911 D(p->level--);
13912 return _res;
13913 }
13914 int _mark = p->mark;
13915 int _resmark = p->mark;
13916 while (1) {
13917 int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
13918 if (tmpvar_8) {
13919 D(p->level--);
13920 return _res;
13921 }
13922 p->mark = _mark;
13923 void *_raw = t_primary_raw(p);
13924 if (_raw == NULL || p->mark <= _resmark)
13925 break;
13926 _resmark = p->mark;
13927 _res = _raw;
13928 }
13929 p->mark = _resmark;
13930 D(p->level--);
13931 return _res;
13932}
13933static expr_ty
13934t_primary_raw(Parser *p)
13935{
13936 D(p->level++);
13937 if (p->error_indicator) {
13938 D(p->level--);
13939 return NULL;
13940 }
13941 expr_ty _res = NULL;
13942 int _mark = p->mark;
13943 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
13944 p->error_indicator = 1;
13945 D(p->level--);
13946 return NULL;
13947 }
13948 int _start_lineno = p->tokens[_mark]->lineno;
13949 UNUSED(_start_lineno); // Only used by EXTRA macro
13950 int _start_col_offset = p->tokens[_mark]->col_offset;
13951 UNUSED(_start_col_offset); // Only used by EXTRA macro
13952 { // t_primary '.' NAME &t_lookahead
13953 if (p->error_indicator) {
13954 D(p->level--);
13955 return NULL;
13956 }
13957 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13958 Token * _literal;
13959 expr_ty a;
13960 expr_ty b;
13961 if (
13962 (a = t_primary_rule(p)) // t_primary
13963 &&
13964 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
13965 &&
13966 (b = _PyPegen_name_token(p)) // NAME
13967 &&
13968 _PyPegen_lookahead(1, t_lookahead_rule, p)
13969 )
13970 {
13971 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13972 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
13973 if (_token == NULL) {
13974 D(p->level--);
13975 return NULL;
13976 }
13977 int _end_lineno = _token->end_lineno;
13978 UNUSED(_end_lineno); // Only used by EXTRA macro
13979 int _end_col_offset = _token->end_col_offset;
13980 UNUSED(_end_col_offset); // Only used by EXTRA macro
13981 _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
13982 if (_res == NULL && PyErr_Occurred()) {
13983 p->error_indicator = 1;
13984 D(p->level--);
13985 return NULL;
13986 }
13987 goto done;
13988 }
13989 p->mark = _mark;
13990 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
13991 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
13992 }
13993 { // t_primary '[' slices ']' &t_lookahead
13994 if (p->error_indicator) {
13995 D(p->level--);
13996 return NULL;
13997 }
13998 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
13999 Token * _literal;
14000 Token * _literal_1;
14001 expr_ty a;
14002 expr_ty b;
14003 if (
14004 (a = t_primary_rule(p)) // t_primary
14005 &&
14006 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14007 &&
14008 (b = slices_rule(p)) // slices
14009 &&
14010 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14011 &&
14012 _PyPegen_lookahead(1, t_lookahead_rule, p)
14013 )
14014 {
14015 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14016 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14017 if (_token == NULL) {
14018 D(p->level--);
14019 return NULL;
14020 }
14021 int _end_lineno = _token->end_lineno;
14022 UNUSED(_end_lineno); // Only used by EXTRA macro
14023 int _end_col_offset = _token->end_col_offset;
14024 UNUSED(_end_col_offset); // Only used by EXTRA macro
14025 _res = _Py_Subscript ( a , b , Load , EXTRA );
14026 if (_res == NULL && PyErr_Occurred()) {
14027 p->error_indicator = 1;
14028 D(p->level--);
14029 return NULL;
14030 }
14031 goto done;
14032 }
14033 p->mark = _mark;
14034 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14035 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
14036 }
14037 { // t_primary genexp &t_lookahead
14038 if (p->error_indicator) {
14039 D(p->level--);
14040 return NULL;
14041 }
14042 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14043 expr_ty a;
14044 expr_ty b;
14045 if (
14046 (a = t_primary_rule(p)) // t_primary
14047 &&
14048 (b = genexp_rule(p)) // genexp
14049 &&
14050 _PyPegen_lookahead(1, t_lookahead_rule, p)
14051 )
14052 {
14053 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
14054 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14055 if (_token == NULL) {
14056 D(p->level--);
14057 return NULL;
14058 }
14059 int _end_lineno = _token->end_lineno;
14060 UNUSED(_end_lineno); // Only used by EXTRA macro
14061 int _end_col_offset = _token->end_col_offset;
14062 UNUSED(_end_col_offset); // Only used by EXTRA macro
Lysandros Nikolaou2e5ca9e2020-10-21 22:53:14 +030014063 _res = _Py_Call ( a , CHECK ( asdl_expr_seq * , ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014064 if (_res == NULL && PyErr_Occurred()) {
14065 p->error_indicator = 1;
14066 D(p->level--);
14067 return NULL;
14068 }
14069 goto done;
14070 }
14071 p->mark = _mark;
14072 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14073 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
14074 }
14075 { // t_primary '(' arguments? ')' &t_lookahead
14076 if (p->error_indicator) {
14077 D(p->level--);
14078 return NULL;
14079 }
14080 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14081 Token * _literal;
14082 Token * _literal_1;
14083 expr_ty a;
14084 void *b;
14085 if (
14086 (a = t_primary_rule(p)) // t_primary
14087 &&
14088 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14089 &&
14090 (b = arguments_rule(p), 1) // arguments?
14091 &&
14092 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14093 &&
14094 _PyPegen_lookahead(1, t_lookahead_rule, p)
14095 )
14096 {
14097 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14098 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14099 if (_token == NULL) {
14100 D(p->level--);
14101 return NULL;
14102 }
14103 int _end_lineno = _token->end_lineno;
14104 UNUSED(_end_lineno); // Only used by EXTRA macro
14105 int _end_col_offset = _token->end_col_offset;
14106 UNUSED(_end_col_offset); // Only used by EXTRA macro
14107 _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
14108 if (_res == NULL && PyErr_Occurred()) {
14109 p->error_indicator = 1;
14110 D(p->level--);
14111 return NULL;
14112 }
14113 goto done;
14114 }
14115 p->mark = _mark;
14116 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14117 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
14118 }
14119 { // atom &t_lookahead
14120 if (p->error_indicator) {
14121 D(p->level--);
14122 return NULL;
14123 }
14124 D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14125 expr_ty a;
14126 if (
14127 (a = atom_rule(p)) // atom
14128 &&
14129 _PyPegen_lookahead(1, t_lookahead_rule, p)
14130 )
14131 {
14132 D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
14133 _res = a;
14134 if (_res == NULL && PyErr_Occurred()) {
14135 p->error_indicator = 1;
14136 D(p->level--);
14137 return NULL;
14138 }
14139 goto done;
14140 }
14141 p->mark = _mark;
14142 D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
14143 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
14144 }
14145 _res = NULL;
14146 done:
14147 D(p->level--);
14148 return _res;
14149}
14150
14151// t_lookahead: '(' | '[' | '.'
14152static void *
14153t_lookahead_rule(Parser *p)
14154{
14155 D(p->level++);
14156 if (p->error_indicator) {
14157 D(p->level--);
14158 return NULL;
14159 }
14160 void * _res = NULL;
14161 int _mark = p->mark;
14162 { // '('
14163 if (p->error_indicator) {
14164 D(p->level--);
14165 return NULL;
14166 }
14167 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
14168 Token * _literal;
14169 if (
14170 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14171 )
14172 {
14173 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
14174 _res = _literal;
14175 goto done;
14176 }
14177 p->mark = _mark;
14178 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14179 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
14180 }
14181 { // '['
14182 if (p->error_indicator) {
14183 D(p->level--);
14184 return NULL;
14185 }
14186 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
14187 Token * _literal;
14188 if (
14189 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14190 )
14191 {
14192 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
14193 _res = _literal;
14194 goto done;
14195 }
14196 p->mark = _mark;
14197 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14198 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
14199 }
14200 { // '.'
14201 if (p->error_indicator) {
14202 D(p->level--);
14203 return NULL;
14204 }
14205 D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
14206 Token * _literal;
14207 if (
14208 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
14209 )
14210 {
14211 D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
14212 _res = _literal;
14213 goto done;
14214 }
14215 p->mark = _mark;
14216 D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
14217 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
14218 }
14219 _res = NULL;
14220 done:
14221 D(p->level--);
14222 return _res;
14223}
14224
14225// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
14226static expr_ty
14227t_atom_rule(Parser *p)
14228{
14229 D(p->level++);
14230 if (p->error_indicator) {
14231 D(p->level--);
14232 return NULL;
14233 }
14234 expr_ty _res = NULL;
14235 int _mark = p->mark;
14236 if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
14237 p->error_indicator = 1;
14238 D(p->level--);
14239 return NULL;
14240 }
14241 int _start_lineno = p->tokens[_mark]->lineno;
14242 UNUSED(_start_lineno); // Only used by EXTRA macro
14243 int _start_col_offset = p->tokens[_mark]->col_offset;
14244 UNUSED(_start_col_offset); // Only used by EXTRA macro
14245 { // NAME
14246 if (p->error_indicator) {
14247 D(p->level--);
14248 return NULL;
14249 }
14250 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
14251 expr_ty a;
14252 if (
14253 (a = _PyPegen_name_token(p)) // NAME
14254 )
14255 {
14256 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
14257 _res = _PyPegen_set_expr_context ( p , a , Store );
14258 if (_res == NULL && PyErr_Occurred()) {
14259 p->error_indicator = 1;
14260 D(p->level--);
14261 return NULL;
14262 }
14263 goto done;
14264 }
14265 p->mark = _mark;
14266 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14267 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
14268 }
14269 { // '(' target ')'
14270 if (p->error_indicator) {
14271 D(p->level--);
14272 return NULL;
14273 }
14274 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14275 Token * _literal;
14276 Token * _literal_1;
14277 expr_ty a;
14278 if (
14279 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14280 &&
14281 (a = target_rule(p)) // target
14282 &&
14283 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14284 )
14285 {
14286 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
14287 _res = _PyPegen_set_expr_context ( p , a , Store );
14288 if (_res == NULL && PyErr_Occurred()) {
14289 p->error_indicator = 1;
14290 D(p->level--);
14291 return NULL;
14292 }
14293 goto done;
14294 }
14295 p->mark = _mark;
14296 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14297 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'"));
14298 }
14299 { // '(' targets? ')'
14300 if (p->error_indicator) {
14301 D(p->level--);
14302 return NULL;
14303 }
14304 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14305 Token * _literal;
14306 Token * _literal_1;
14307 void *b;
14308 if (
14309 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14310 &&
14311 (b = targets_rule(p), 1) // targets?
14312 &&
14313 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14314 )
14315 {
14316 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
14317 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14318 if (_token == NULL) {
14319 D(p->level--);
14320 return NULL;
14321 }
14322 int _end_lineno = _token->end_lineno;
14323 UNUSED(_end_lineno); // Only used by EXTRA macro
14324 int _end_col_offset = _token->end_col_offset;
14325 UNUSED(_end_col_offset); // Only used by EXTRA macro
14326 _res = _Py_Tuple ( b , Store , EXTRA );
14327 if (_res == NULL && PyErr_Occurred()) {
14328 p->error_indicator = 1;
14329 D(p->level--);
14330 return NULL;
14331 }
14332 goto done;
14333 }
14334 p->mark = _mark;
14335 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14336 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'"));
14337 }
14338 { // '[' targets? ']'
14339 if (p->error_indicator) {
14340 D(p->level--);
14341 return NULL;
14342 }
14343 D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14344 Token * _literal;
14345 Token * _literal_1;
14346 void *b;
14347 if (
14348 (_literal = _PyPegen_expect_token(p, 9)) // token='['
14349 &&
14350 (b = targets_rule(p), 1) // targets?
14351 &&
14352 (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
14353 )
14354 {
14355 D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
14356 Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
14357 if (_token == NULL) {
14358 D(p->level--);
14359 return NULL;
14360 }
14361 int _end_lineno = _token->end_lineno;
14362 UNUSED(_end_lineno); // Only used by EXTRA macro
14363 int _end_col_offset = _token->end_col_offset;
14364 UNUSED(_end_col_offset); // Only used by EXTRA macro
14365 _res = _Py_List ( b , Store , EXTRA );
14366 if (_res == NULL && PyErr_Occurred()) {
14367 p->error_indicator = 1;
14368 D(p->level--);
14369 return NULL;
14370 }
14371 goto done;
14372 }
14373 p->mark = _mark;
14374 D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
14375 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'"));
14376 }
14377 _res = NULL;
14378 done:
14379 D(p->level--);
14380 return _res;
14381}
14382
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014383// invalid_arguments:
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014384// | args ',' '*'
14385// | expression for_if_clauses ',' [args | expression for_if_clauses]
14386// | args for_if_clauses
14387// | args ',' expression for_if_clauses
14388// | args ',' args
14389static void *
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014390invalid_arguments_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014391{
14392 D(p->level++);
14393 if (p->error_indicator) {
14394 D(p->level--);
14395 return NULL;
14396 }
14397 void * _res = NULL;
14398 int _mark = p->mark;
14399 { // args ',' '*'
14400 if (p->error_indicator) {
14401 D(p->level--);
14402 return NULL;
14403 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014404 D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014405 Token * _literal;
14406 Token * _literal_1;
14407 expr_ty args_var;
14408 if (
14409 (args_var = args_rule(p)) // args
14410 &&
14411 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14412 &&
14413 (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
14414 )
14415 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014416 D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014417 _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
14418 if (_res == NULL && PyErr_Occurred()) {
14419 p->error_indicator = 1;
14420 D(p->level--);
14421 return NULL;
14422 }
14423 goto done;
14424 }
14425 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014426 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014427 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'"));
14428 }
14429 { // expression for_if_clauses ',' [args | expression for_if_clauses]
14430 if (p->error_indicator) {
14431 D(p->level--);
14432 return NULL;
14433 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014434 D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014435 Token * _literal;
14436 void *_opt_var;
14437 UNUSED(_opt_var); // Silence compiler warnings
14438 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010014439 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014440 if (
14441 (a = expression_rule(p)) // expression
14442 &&
14443 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14444 &&
14445 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14446 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014447 (_opt_var = _tmp_127_rule(p), 1) // [args | expression for_if_clauses]
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014448 )
14449 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014450 D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014451 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14452 if (_res == NULL && PyErr_Occurred()) {
14453 p->error_indicator = 1;
14454 D(p->level--);
14455 return NULL;
14456 }
14457 goto done;
14458 }
14459 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014460 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014461 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
14462 }
14463 { // args for_if_clauses
14464 if (p->error_indicator) {
14465 D(p->level--);
14466 return NULL;
14467 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014468 D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014469 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010014470 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014471 if (
14472 (a = args_rule(p)) // args
14473 &&
14474 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14475 )
14476 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014477 D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014478 _res = _PyPegen_nonparen_genexp_in_call ( p , a );
14479 if (_res == NULL && PyErr_Occurred()) {
14480 p->error_indicator = 1;
14481 D(p->level--);
14482 return NULL;
14483 }
14484 goto done;
14485 }
14486 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014487 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014488 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses"));
14489 }
14490 { // args ',' expression for_if_clauses
14491 if (p->error_indicator) {
14492 D(p->level--);
14493 return NULL;
14494 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014495 D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014496 Token * _literal;
14497 expr_ty a;
14498 expr_ty args_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +010014499 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014500 if (
14501 (args_var = args_rule(p)) // args
14502 &&
14503 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14504 &&
14505 (a = expression_rule(p)) // expression
14506 &&
14507 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
14508 )
14509 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014510 D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014511 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
14512 if (_res == NULL && PyErr_Occurred()) {
14513 p->error_indicator = 1;
14514 D(p->level--);
14515 return NULL;
14516 }
14517 goto done;
14518 }
14519 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014520 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014521 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses"));
14522 }
14523 { // args ',' args
14524 if (p->error_indicator) {
14525 D(p->level--);
14526 return NULL;
14527 }
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014528 D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014529 Token * _literal;
14530 expr_ty a;
14531 expr_ty args_var;
14532 if (
14533 (a = args_rule(p)) // args
14534 &&
14535 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14536 &&
14537 (args_var = args_rule(p)) // args
14538 )
14539 {
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014540 D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014541 _res = _PyPegen_arguments_parsing_error ( p , a );
14542 if (_res == NULL && PyErr_Occurred()) {
14543 p->error_indicator = 1;
14544 D(p->level--);
14545 return NULL;
14546 }
14547 goto done;
14548 }
14549 p->mark = _mark;
Lysandros Nikolaoubca70142020-10-27 00:42:04 +020014550 D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014551 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args"));
14552 }
14553 _res = NULL;
14554 done:
14555 D(p->level--);
14556 return _res;
14557}
14558
14559// invalid_kwarg: expression '='
14560static void *
14561invalid_kwarg_rule(Parser *p)
14562{
14563 D(p->level++);
14564 if (p->error_indicator) {
14565 D(p->level--);
14566 return NULL;
14567 }
14568 void * _res = NULL;
14569 int _mark = p->mark;
14570 { // expression '='
14571 if (p->error_indicator) {
14572 D(p->level--);
14573 return NULL;
14574 }
14575 D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='"));
14576 Token * _literal;
14577 expr_ty a;
14578 if (
14579 (a = expression_rule(p)) // expression
14580 &&
14581 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14582 )
14583 {
14584 D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='"));
14585 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" );
14586 if (_res == NULL && PyErr_Occurred()) {
14587 p->error_indicator = 1;
14588 D(p->level--);
14589 return NULL;
14590 }
14591 goto done;
14592 }
14593 p->mark = _mark;
14594 D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
14595 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='"));
14596 }
14597 _res = NULL;
14598 done:
14599 D(p->level--);
14600 return _res;
14601}
14602
14603// invalid_named_expression: expression ':=' expression
14604static void *
14605invalid_named_expression_rule(Parser *p)
14606{
14607 D(p->level++);
14608 if (p->error_indicator) {
14609 D(p->level--);
14610 return NULL;
14611 }
14612 void * _res = NULL;
14613 int _mark = p->mark;
14614 { // expression ':=' expression
14615 if (p->error_indicator) {
14616 D(p->level--);
14617 return NULL;
14618 }
14619 D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14620 Token * _literal;
14621 expr_ty a;
14622 expr_ty expression_var;
14623 if (
14624 (a = expression_rule(p)) // expression
14625 &&
14626 (_literal = _PyPegen_expect_token(p, 53)) // token=':='
14627 &&
14628 (expression_var = expression_rule(p)) // expression
14629 )
14630 {
14631 D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
14632 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
14633 if (_res == NULL && PyErr_Occurred()) {
14634 p->error_indicator = 1;
14635 D(p->level--);
14636 return NULL;
14637 }
14638 goto done;
14639 }
14640 p->mark = _mark;
14641 D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
14642 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression"));
14643 }
14644 _res = NULL;
14645 done:
14646 D(p->level--);
14647 return _res;
14648}
14649
14650// invalid_assignment:
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014651// | invalid_ann_assign_target ':' expression
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014652// | star_named_expression ',' star_named_expressions* ':' expression
14653// | expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014654// | ((star_targets '='))* star_expressions '='
14655// | ((star_targets '='))* yield_expr '='
14656// | star_expressions augassign (yield_expr | star_expressions)
14657static void *
14658invalid_assignment_rule(Parser *p)
14659{
14660 D(p->level++);
14661 if (p->error_indicator) {
14662 D(p->level--);
14663 return NULL;
14664 }
14665 void * _res = NULL;
14666 int _mark = p->mark;
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014667 { // invalid_ann_assign_target ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014668 if (p->error_indicator) {
14669 D(p->level--);
14670 return NULL;
14671 }
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014672 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 +010014673 Token * _literal;
14674 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014675 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014676 if (
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014677 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014678 &&
14679 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014680 &&
14681 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014682 )
14683 {
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014684 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
14685 _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 +010014686 if (_res == NULL && PyErr_Occurred()) {
14687 p->error_indicator = 1;
14688 D(p->level--);
14689 return NULL;
14690 }
14691 goto done;
14692 }
14693 p->mark = _mark;
14694 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014695 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014696 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014697 { // star_named_expression ',' star_named_expressions* ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014698 if (p->error_indicator) {
14699 D(p->level--);
14700 return NULL;
14701 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014702 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 +010014703 Token * _literal;
14704 Token * _literal_1;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014705 asdl_seq * _loop0_128_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014706 expr_ty a;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014707 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014708 if (
14709 (a = star_named_expression_rule(p)) // star_named_expression
14710 &&
14711 (_literal = _PyPegen_expect_token(p, 12)) // token=','
14712 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014713 (_loop0_128_var = _loop0_128_rule(p)) // star_named_expressions*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014714 &&
14715 (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014716 &&
14717 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014718 )
14719 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014720 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 +010014721 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
14722 if (_res == NULL && PyErr_Occurred()) {
14723 p->error_indicator = 1;
14724 D(p->level--);
14725 return NULL;
14726 }
14727 goto done;
14728 }
14729 p->mark = _mark;
14730 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014731 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014732 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014733 { // expression ':' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014734 if (p->error_indicator) {
14735 D(p->level--);
14736 return NULL;
14737 }
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014738 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014739 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014740 expr_ty a;
14741 expr_ty expression_var;
14742 if (
14743 (a = expression_rule(p)) // expression
14744 &&
14745 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
14746 &&
14747 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014748 )
14749 {
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014750 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 +010014751 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
14752 if (_res == NULL && PyErr_Occurred()) {
14753 p->error_indicator = 1;
14754 D(p->level--);
14755 return NULL;
14756 }
14757 goto done;
14758 }
14759 p->mark = _mark;
14760 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030014761 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014762 }
14763 { // ((star_targets '='))* star_expressions '='
14764 if (p->error_indicator) {
14765 D(p->level--);
14766 return NULL;
14767 }
14768 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14769 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014770 asdl_seq * _loop0_129_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014771 expr_ty a;
14772 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010014773 (_loop0_129_var = _loop0_129_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014774 &&
14775 (a = star_expressions_rule(p)) // star_expressions
14776 &&
14777 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14778 )
14779 {
14780 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 +030014781 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014782 if (_res == NULL && PyErr_Occurred()) {
14783 p->error_indicator = 1;
14784 D(p->level--);
14785 return NULL;
14786 }
14787 goto done;
14788 }
14789 p->mark = _mark;
14790 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14791 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='"));
14792 }
14793 { // ((star_targets '='))* yield_expr '='
14794 if (p->error_indicator) {
14795 D(p->level--);
14796 return NULL;
14797 }
14798 D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14799 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010014800 asdl_seq * _loop0_130_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014801 expr_ty a;
14802 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010014803 (_loop0_130_var = _loop0_130_rule(p)) // ((star_targets '='))*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014804 &&
14805 (a = yield_expr_rule(p)) // yield_expr
14806 &&
14807 (_literal = _PyPegen_expect_token(p, 22)) // token='='
14808 )
14809 {
14810 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14811 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
14812 if (_res == NULL && PyErr_Occurred()) {
14813 p->error_indicator = 1;
14814 D(p->level--);
14815 return NULL;
14816 }
14817 goto done;
14818 }
14819 p->mark = _mark;
14820 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14821 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='"));
14822 }
14823 { // star_expressions augassign (yield_expr | star_expressions)
14824 if (p->error_indicator) {
14825 D(p->level--);
14826 return NULL;
14827 }
14828 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 +010014829 void *_tmp_131_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014830 expr_ty a;
14831 AugOperator* augassign_var;
14832 if (
14833 (a = star_expressions_rule(p)) // star_expressions
14834 &&
14835 (augassign_var = augassign_rule(p)) // augassign
14836 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010014837 (_tmp_131_var = _tmp_131_rule(p)) // yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014838 )
14839 {
14840 D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14841 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
14842 if (_res == NULL && PyErr_Occurred()) {
14843 p->error_indicator = 1;
14844 D(p->level--);
14845 return NULL;
14846 }
14847 goto done;
14848 }
14849 p->mark = _mark;
14850 D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
14851 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
14852 }
14853 _res = NULL;
14854 done:
14855 D(p->level--);
14856 return _res;
14857}
14858
Batuhan Taskayac8f29ad2020-06-27 21:33:08 +030014859// invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')'
14860static expr_ty
14861invalid_ann_assign_target_rule(Parser *p)
14862{
14863 D(p->level++);
14864 if (p->error_indicator) {
14865 D(p->level--);
14866 return NULL;
14867 }
14868 expr_ty _res = NULL;
14869 int _mark = p->mark;
14870 { // list
14871 if (p->error_indicator) {
14872 D(p->level--);
14873 return NULL;
14874 }
14875 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
14876 expr_ty list_var;
14877 if (
14878 (list_var = list_rule(p)) // list
14879 )
14880 {
14881 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
14882 _res = list_var;
14883 goto done;
14884 }
14885 p->mark = _mark;
14886 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14887 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
14888 }
14889 { // tuple
14890 if (p->error_indicator) {
14891 D(p->level--);
14892 return NULL;
14893 }
14894 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
14895 expr_ty tuple_var;
14896 if (
14897 (tuple_var = tuple_rule(p)) // tuple
14898 )
14899 {
14900 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
14901 _res = tuple_var;
14902 goto done;
14903 }
14904 p->mark = _mark;
14905 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14906 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
14907 }
14908 { // '(' invalid_ann_assign_target ')'
14909 if (p->error_indicator) {
14910 D(p->level--);
14911 return NULL;
14912 }
14913 D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14914 Token * _literal;
14915 Token * _literal_1;
14916 expr_ty a;
14917 if (
14918 (_literal = _PyPegen_expect_token(p, 7)) // token='('
14919 &&
14920 (a = invalid_ann_assign_target_rule(p)) // invalid_ann_assign_target
14921 &&
14922 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
14923 )
14924 {
14925 D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14926 _res = a;
14927 if (_res == NULL && PyErr_Occurred()) {
14928 p->error_indicator = 1;
14929 D(p->level--);
14930 return NULL;
14931 }
14932 goto done;
14933 }
14934 p->mark = _mark;
14935 D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
14936 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
14937 }
14938 _res = NULL;
14939 done:
14940 D(p->level--);
14941 return _res;
14942}
14943
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014944// invalid_del_stmt: 'del' star_expressions
14945static void *
14946invalid_del_stmt_rule(Parser *p)
14947{
14948 D(p->level++);
14949 if (p->error_indicator) {
14950 D(p->level--);
14951 return NULL;
14952 }
14953 void * _res = NULL;
14954 int _mark = p->mark;
14955 { // 'del' star_expressions
14956 if (p->error_indicator) {
14957 D(p->level--);
14958 return NULL;
14959 }
14960 D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
14961 Token * _keyword;
14962 expr_ty a;
14963 if (
14964 (_keyword = _PyPegen_expect_token(p, 503)) // token='del'
14965 &&
14966 (a = star_expressions_rule(p)) // star_expressions
14967 )
14968 {
14969 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 +030014970 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030014971 if (_res == NULL && PyErr_Occurred()) {
14972 p->error_indicator = 1;
14973 D(p->level--);
14974 return NULL;
14975 }
14976 goto done;
14977 }
14978 p->mark = _mark;
14979 D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
14980 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions"));
14981 }
14982 _res = NULL;
14983 done:
14984 D(p->level--);
14985 return _res;
14986}
14987
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010014988// invalid_block: NEWLINE !INDENT
14989static void *
14990invalid_block_rule(Parser *p)
14991{
14992 D(p->level++);
14993 if (p->error_indicator) {
14994 D(p->level--);
14995 return NULL;
14996 }
14997 void * _res = NULL;
14998 int _mark = p->mark;
14999 { // NEWLINE !INDENT
15000 if (p->error_indicator) {
15001 D(p->level--);
15002 return NULL;
15003 }
15004 D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
15005 Token * newline_var;
15006 if (
15007 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15008 &&
15009 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT
15010 )
15011 {
15012 D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
15013 _res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
15014 if (_res == NULL && PyErr_Occurred()) {
15015 p->error_indicator = 1;
15016 D(p->level--);
15017 return NULL;
15018 }
15019 goto done;
15020 }
15021 p->mark = _mark;
15022 D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ',
15023 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT"));
15024 }
15025 _res = NULL;
15026 done:
15027 D(p->level--);
15028 return _res;
15029}
15030
15031// invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses
15032static void *
15033invalid_comprehension_rule(Parser *p)
15034{
15035 D(p->level++);
15036 if (p->error_indicator) {
15037 D(p->level--);
15038 return NULL;
15039 }
15040 void * _res = NULL;
15041 int _mark = p->mark;
15042 { // ('[' | '(' | '{') starred_expression for_if_clauses
15043 if (p->error_indicator) {
15044 D(p->level--);
15045 return NULL;
15046 }
15047 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 +010015048 void *_tmp_132_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015049 expr_ty a;
Pablo Galindoa5634c42020-09-16 19:42:00 +010015050 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015051 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015052 (_tmp_132_var = _tmp_132_rule(p)) // '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015053 &&
15054 (a = starred_expression_rule(p)) // starred_expression
15055 &&
15056 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15057 )
15058 {
15059 D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15060 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" );
15061 if (_res == NULL && PyErr_Occurred()) {
15062 p->error_indicator = 1;
15063 D(p->level--);
15064 return NULL;
15065 }
15066 goto done;
15067 }
15068 p->mark = _mark;
15069 D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15070 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
15071 }
15072 _res = NULL;
15073 done:
15074 D(p->level--);
15075 return _res;
15076}
15077
15078// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
15079static void *
15080invalid_dict_comprehension_rule(Parser *p)
15081{
15082 D(p->level++);
15083 if (p->error_indicator) {
15084 D(p->level--);
15085 return NULL;
15086 }
15087 void * _res = NULL;
15088 int _mark = p->mark;
15089 { // '{' '**' bitwise_or for_if_clauses '}'
15090 if (p->error_indicator) {
15091 D(p->level--);
15092 return NULL;
15093 }
15094 D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15095 Token * _literal;
15096 Token * _literal_1;
15097 Token * a;
15098 expr_ty bitwise_or_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +010015099 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015100 if (
15101 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
15102 &&
15103 (a = _PyPegen_expect_token(p, 35)) // token='**'
15104 &&
15105 (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or
15106 &&
15107 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
15108 &&
15109 (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
15110 )
15111 {
15112 D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15113 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
15114 if (_res == NULL && PyErr_Occurred()) {
15115 p->error_indicator = 1;
15116 D(p->level--);
15117 return NULL;
15118 }
15119 goto done;
15120 }
15121 p->mark = _mark;
15122 D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
15123 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
15124 }
15125 _res = NULL;
15126 done:
15127 D(p->level--);
15128 return _res;
15129}
15130
15131// invalid_parameters:
15132// | param_no_default* (slash_with_default | param_with_default+) param_no_default
15133static void *
15134invalid_parameters_rule(Parser *p)
15135{
15136 D(p->level++);
15137 if (p->error_indicator) {
15138 D(p->level--);
15139 return NULL;
15140 }
15141 void * _res = NULL;
15142 int _mark = p->mark;
15143 { // param_no_default* (slash_with_default | param_with_default+) param_no_default
15144 if (p->error_indicator) {
15145 D(p->level--);
15146 return NULL;
15147 }
15148 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 +010015149 asdl_seq * _loop0_133_var;
15150 void *_tmp_134_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015151 arg_ty param_no_default_var;
15152 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015153 (_loop0_133_var = _loop0_133_rule(p)) // param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015154 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015155 (_tmp_134_var = _tmp_134_rule(p)) // slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015156 &&
15157 (param_no_default_var = param_no_default_rule(p)) // param_no_default
15158 )
15159 {
15160 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"));
15161 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15162 if (_res == NULL && PyErr_Occurred()) {
15163 p->error_indicator = 1;
15164 D(p->level--);
15165 return NULL;
15166 }
15167 goto done;
15168 }
15169 p->mark = _mark;
15170 D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15171 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
15172 }
15173 _res = NULL;
15174 done:
15175 D(p->level--);
15176 return _res;
15177}
15178
15179// invalid_lambda_parameters:
15180// | lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15181static void *
15182invalid_lambda_parameters_rule(Parser *p)
15183{
15184 D(p->level++);
15185 if (p->error_indicator) {
15186 D(p->level--);
15187 return NULL;
15188 }
15189 void * _res = NULL;
15190 int _mark = p->mark;
15191 { // lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
15192 if (p->error_indicator) {
15193 D(p->level--);
15194 return NULL;
15195 }
15196 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 +010015197 asdl_seq * _loop0_135_var;
15198 void *_tmp_136_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015199 arg_ty lambda_param_no_default_var;
15200 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010015201 (_loop0_135_var = _loop0_135_rule(p)) // lambda_param_no_default*
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015202 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015203 (_tmp_136_var = _tmp_136_rule(p)) // lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015204 &&
15205 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
15206 )
15207 {
15208 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"));
15209 _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
15210 if (_res == NULL && PyErr_Occurred()) {
15211 p->error_indicator = 1;
15212 D(p->level--);
15213 return NULL;
15214 }
15215 goto done;
15216 }
15217 p->mark = _mark;
15218 D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
15219 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
15220 }
15221 _res = NULL;
15222 done:
15223 D(p->level--);
15224 return _res;
15225}
15226
15227// invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT
15228static void *
15229invalid_star_etc_rule(Parser *p)
15230{
15231 D(p->level++);
15232 if (p->error_indicator) {
15233 D(p->level--);
15234 return NULL;
15235 }
15236 void * _res = NULL;
15237 int _mark = p->mark;
15238 { // '*' (')' | ',' (')' | '**'))
15239 if (p->error_indicator) {
15240 D(p->level--);
15241 return NULL;
15242 }
15243 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15244 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010015245 void *_tmp_137_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015246 if (
15247 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15248 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015249 (_tmp_137_var = _tmp_137_rule(p)) // ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015250 )
15251 {
15252 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15253 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15254 if (_res == NULL && PyErr_Occurred()) {
15255 p->error_indicator = 1;
15256 D(p->level--);
15257 return NULL;
15258 }
15259 goto done;
15260 }
15261 p->mark = _mark;
15262 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15263 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
15264 }
15265 { // '*' ',' TYPE_COMMENT
15266 if (p->error_indicator) {
15267 D(p->level--);
15268 return NULL;
15269 }
15270 D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15271 Token * _literal;
15272 Token * _literal_1;
15273 Token * type_comment_var;
15274 if (
15275 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15276 &&
15277 (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
15278 &&
15279 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15280 )
15281 {
15282 D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15283 _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
15284 if (_res == NULL && PyErr_Occurred()) {
15285 p->error_indicator = 1;
15286 D(p->level--);
15287 return NULL;
15288 }
15289 goto done;
15290 }
15291 p->mark = _mark;
15292 D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15293 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT"));
15294 }
15295 _res = NULL;
15296 done:
15297 D(p->level--);
15298 return _res;
15299}
15300
15301// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**'))
15302static void *
15303invalid_lambda_star_etc_rule(Parser *p)
15304{
15305 D(p->level++);
15306 if (p->error_indicator) {
15307 D(p->level--);
15308 return NULL;
15309 }
15310 void * _res = NULL;
15311 int _mark = p->mark;
15312 { // '*' (':' | ',' (':' | '**'))
15313 if (p->error_indicator) {
15314 D(p->level--);
15315 return NULL;
15316 }
15317 D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15318 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010015319 void *_tmp_138_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015320 if (
15321 (_literal = _PyPegen_expect_token(p, 16)) // token='*'
15322 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010015323 (_tmp_138_var = _tmp_138_rule(p)) // ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015324 )
15325 {
15326 D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15327 _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
15328 if (_res == NULL && PyErr_Occurred()) {
15329 p->error_indicator = 1;
15330 D(p->level--);
15331 return NULL;
15332 }
15333 goto done;
15334 }
15335 p->mark = _mark;
15336 D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
15337 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
15338 }
15339 _res = NULL;
15340 done:
15341 D(p->level--);
15342 return _res;
15343}
15344
15345// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15346static void *
15347invalid_double_type_comments_rule(Parser *p)
15348{
15349 D(p->level++);
15350 if (p->error_indicator) {
15351 D(p->level--);
15352 return NULL;
15353 }
15354 void * _res = NULL;
15355 int _mark = p->mark;
15356 { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
15357 if (p->error_indicator) {
15358 D(p->level--);
15359 return NULL;
15360 }
15361 D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15362 Token * indent_var;
15363 Token * newline_var;
15364 Token * newline_var_1;
15365 Token * type_comment_var;
15366 Token * type_comment_var_1;
15367 if (
15368 (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15369 &&
15370 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15371 &&
15372 (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
15373 &&
15374 (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15375 &&
15376 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
15377 )
15378 {
15379 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"));
15380 _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
15381 if (_res == NULL && PyErr_Occurred()) {
15382 p->error_indicator = 1;
15383 D(p->level--);
15384 return NULL;
15385 }
15386 goto done;
15387 }
15388 p->mark = _mark;
15389 D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ',
15390 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
15391 }
15392 _res = NULL;
15393 done:
15394 D(p->level--);
15395 return _res;
15396}
15397
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015398// invalid_with_item: expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015399static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015400invalid_with_item_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015401{
15402 D(p->level++);
15403 if (p->error_indicator) {
15404 D(p->level--);
15405 return NULL;
15406 }
15407 void * _res = NULL;
15408 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015409 { // expression 'as' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015410 if (p->error_indicator) {
15411 D(p->level--);
15412 return NULL;
15413 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015414 D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression"));
15415 Token * _keyword;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015416 expr_ty a;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015417 expr_ty expression_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015418 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015419 (expression_var = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015420 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015421 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
15422 &&
15423 (a = expression_rule(p)) // expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015424 )
15425 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015426 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 +030015427 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015428 if (_res == NULL && PyErr_Occurred()) {
15429 p->error_indicator = 1;
15430 D(p->level--);
15431 return NULL;
15432 }
15433 goto done;
15434 }
15435 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015436 D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ',
15437 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression"));
15438 }
15439 _res = NULL;
15440 done:
15441 D(p->level--);
15442 return _res;
15443}
15444
15445// invalid_for_target: ASYNC? 'for' star_expressions
15446static void *
15447invalid_for_target_rule(Parser *p)
15448{
15449 D(p->level++);
15450 if (p->error_indicator) {
15451 D(p->level--);
15452 return NULL;
15453 }
15454 void * _res = NULL;
15455 int _mark = p->mark;
15456 { // ASYNC? 'for' star_expressions
15457 if (p->error_indicator) {
15458 D(p->level--);
15459 return NULL;
15460 }
15461 D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
15462 Token * _keyword;
15463 void *_opt_var;
15464 UNUSED(_opt_var); // Silence compiler warnings
15465 expr_ty a;
15466 if (
15467 (_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
15468 &&
15469 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
15470 &&
15471 (a = star_expressions_rule(p)) // star_expressions
15472 )
15473 {
15474 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 +030015475 _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030015476 if (_res == NULL && PyErr_Occurred()) {
15477 p->error_indicator = 1;
15478 D(p->level--);
15479 return NULL;
15480 }
15481 goto done;
15482 }
15483 p->mark = _mark;
15484 D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ',
15485 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions"));
15486 }
15487 _res = NULL;
15488 done:
15489 D(p->level--);
15490 return _res;
15491}
15492
15493// invalid_group: '(' starred_expression ')'
15494static void *
15495invalid_group_rule(Parser *p)
15496{
15497 D(p->level++);
15498 if (p->error_indicator) {
15499 D(p->level--);
15500 return NULL;
15501 }
15502 void * _res = NULL;
15503 int _mark = p->mark;
15504 { // '(' starred_expression ')'
15505 if (p->error_indicator) {
15506 D(p->level--);
15507 return NULL;
15508 }
15509 D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15510 Token * _literal;
15511 Token * _literal_1;
15512 expr_ty a;
15513 if (
15514 (_literal = _PyPegen_expect_token(p, 7)) // token='('
15515 &&
15516 (a = starred_expression_rule(p)) // starred_expression
15517 &&
15518 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
15519 )
15520 {
15521 D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
15522 _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "can't use starred expression here" );
15523 if (_res == NULL && PyErr_Occurred()) {
15524 p->error_indicator = 1;
15525 D(p->level--);
15526 return NULL;
15527 }
15528 goto done;
15529 }
15530 p->mark = _mark;
15531 D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
15532 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015533 }
15534 _res = NULL;
15535 done:
15536 D(p->level--);
15537 return _res;
15538}
15539
15540// invalid_import_from_targets: import_from_as_names ','
15541static void *
15542invalid_import_from_targets_rule(Parser *p)
15543{
15544 D(p->level++);
15545 if (p->error_indicator) {
15546 D(p->level--);
15547 return NULL;
15548 }
15549 void * _res = NULL;
15550 int _mark = p->mark;
15551 { // import_from_as_names ','
15552 if (p->error_indicator) {
15553 D(p->level--);
15554 return NULL;
15555 }
15556 D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15557 Token * _literal;
Pablo Galindoa5634c42020-09-16 19:42:00 +010015558 asdl_alias_seq* import_from_as_names_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015559 if (
15560 (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names
15561 &&
15562 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15563 )
15564 {
15565 D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
15566 _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
15567 if (_res == NULL && PyErr_Occurred()) {
15568 p->error_indicator = 1;
15569 D(p->level--);
15570 return NULL;
15571 }
15572 goto done;
15573 }
15574 p->mark = _mark;
15575 D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
15576 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','"));
15577 }
15578 _res = NULL;
15579 done:
15580 D(p->level--);
15581 return _res;
15582}
15583
15584// _loop0_1: NEWLINE
15585static asdl_seq *
15586_loop0_1_rule(Parser *p)
15587{
15588 D(p->level++);
15589 if (p->error_indicator) {
15590 D(p->level--);
15591 return NULL;
15592 }
15593 void *_res = NULL;
15594 int _mark = p->mark;
15595 int _start_mark = p->mark;
15596 void **_children = PyMem_Malloc(sizeof(void *));
15597 if (!_children) {
15598 p->error_indicator = 1;
15599 PyErr_NoMemory();
15600 D(p->level--);
15601 return NULL;
15602 }
15603 ssize_t _children_capacity = 1;
15604 ssize_t _n = 0;
15605 { // NEWLINE
15606 if (p->error_indicator) {
15607 D(p->level--);
15608 return NULL;
15609 }
15610 D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15611 Token * newline_var;
15612 while (
15613 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15614 )
15615 {
15616 _res = newline_var;
15617 if (_n == _children_capacity) {
15618 _children_capacity *= 2;
15619 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15620 if (!_new_children) {
15621 p->error_indicator = 1;
15622 PyErr_NoMemory();
15623 D(p->level--);
15624 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015625 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015626 _children = _new_children;
15627 }
15628 _children[_n++] = _res;
15629 _mark = p->mark;
15630 }
15631 p->mark = _mark;
15632 D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
15633 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15634 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015635 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015636 if (!_seq) {
15637 PyMem_Free(_children);
15638 p->error_indicator = 1;
15639 PyErr_NoMemory();
15640 D(p->level--);
15641 return NULL;
15642 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015643 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015644 PyMem_Free(_children);
15645 _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq);
15646 D(p->level--);
15647 return _seq;
15648}
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015649
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015650// _loop0_2: NEWLINE
15651static asdl_seq *
15652_loop0_2_rule(Parser *p)
15653{
15654 D(p->level++);
15655 if (p->error_indicator) {
15656 D(p->level--);
15657 return NULL;
15658 }
15659 void *_res = NULL;
15660 int _mark = p->mark;
15661 int _start_mark = p->mark;
15662 void **_children = PyMem_Malloc(sizeof(void *));
15663 if (!_children) {
15664 p->error_indicator = 1;
15665 PyErr_NoMemory();
15666 D(p->level--);
15667 return NULL;
15668 }
15669 ssize_t _children_capacity = 1;
15670 ssize_t _n = 0;
15671 { // NEWLINE
15672 if (p->error_indicator) {
15673 D(p->level--);
15674 return NULL;
15675 }
15676 D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
15677 Token * newline_var;
15678 while (
15679 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
15680 )
15681 {
15682 _res = newline_var;
15683 if (_n == _children_capacity) {
15684 _children_capacity *= 2;
15685 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15686 if (!_new_children) {
15687 p->error_indicator = 1;
15688 PyErr_NoMemory();
15689 D(p->level--);
15690 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015691 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015692 _children = _new_children;
15693 }
15694 _children[_n++] = _res;
15695 _mark = p->mark;
15696 }
15697 p->mark = _mark;
15698 D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ',
15699 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
15700 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015701 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015702 if (!_seq) {
15703 PyMem_Free(_children);
15704 p->error_indicator = 1;
15705 PyErr_NoMemory();
15706 D(p->level--);
15707 return NULL;
15708 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015709 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015710 PyMem_Free(_children);
15711 _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq);
15712 D(p->level--);
15713 return _seq;
15714}
15715
15716// _loop0_4: ',' expression
15717static asdl_seq *
15718_loop0_4_rule(Parser *p)
15719{
15720 D(p->level++);
15721 if (p->error_indicator) {
15722 D(p->level--);
15723 return NULL;
15724 }
15725 void *_res = NULL;
15726 int _mark = p->mark;
15727 int _start_mark = p->mark;
15728 void **_children = PyMem_Malloc(sizeof(void *));
15729 if (!_children) {
15730 p->error_indicator = 1;
15731 PyErr_NoMemory();
15732 D(p->level--);
15733 return NULL;
15734 }
15735 ssize_t _children_capacity = 1;
15736 ssize_t _n = 0;
15737 { // ',' expression
15738 if (p->error_indicator) {
15739 D(p->level--);
15740 return NULL;
15741 }
15742 D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15743 Token * _literal;
15744 expr_ty elem;
15745 while (
15746 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15747 &&
15748 (elem = expression_rule(p)) // expression
15749 )
15750 {
15751 _res = elem;
15752 if (_res == NULL && PyErr_Occurred()) {
15753 p->error_indicator = 1;
15754 PyMem_Free(_children);
15755 D(p->level--);
15756 return NULL;
15757 }
15758 if (_n == _children_capacity) {
15759 _children_capacity *= 2;
15760 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15761 if (!_new_children) {
15762 p->error_indicator = 1;
15763 PyErr_NoMemory();
15764 D(p->level--);
15765 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015766 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015767 _children = _new_children;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015768 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015769 _children[_n++] = _res;
15770 _mark = p->mark;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015771 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015772 p->mark = _mark;
15773 D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ',
15774 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015775 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015776 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015777 if (!_seq) {
15778 PyMem_Free(_children);
15779 p->error_indicator = 1;
15780 PyErr_NoMemory();
15781 D(p->level--);
15782 return NULL;
15783 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015784 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015785 PyMem_Free(_children);
15786 _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq);
15787 D(p->level--);
15788 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015789}
15790
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015791// _gather_3: expression _loop0_4
15792static asdl_seq *
15793_gather_3_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015794{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015795 D(p->level++);
15796 if (p->error_indicator) {
15797 D(p->level--);
15798 return NULL;
15799 }
15800 asdl_seq * _res = NULL;
15801 int _mark = p->mark;
15802 { // expression _loop0_4
15803 if (p->error_indicator) {
15804 D(p->level--);
15805 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015806 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015807 D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15808 expr_ty elem;
15809 asdl_seq * seq;
15810 if (
15811 (elem = expression_rule(p)) // expression
15812 &&
15813 (seq = _loop0_4_rule(p)) // _loop0_4
15814 )
15815 {
15816 D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
15817 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15818 goto done;
15819 }
15820 p->mark = _mark;
15821 D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ',
15822 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4"));
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015823 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015824 _res = NULL;
15825 done:
15826 D(p->level--);
15827 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015828}
15829
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015830// _loop0_6: ',' expression
15831static asdl_seq *
15832_loop0_6_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015833{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015834 D(p->level++);
15835 if (p->error_indicator) {
15836 D(p->level--);
15837 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015838 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015839 void *_res = NULL;
15840 int _mark = p->mark;
15841 int _start_mark = p->mark;
15842 void **_children = PyMem_Malloc(sizeof(void *));
15843 if (!_children) {
15844 p->error_indicator = 1;
15845 PyErr_NoMemory();
15846 D(p->level--);
15847 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015848 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015849 ssize_t _children_capacity = 1;
15850 ssize_t _n = 0;
15851 { // ',' expression
15852 if (p->error_indicator) {
15853 D(p->level--);
15854 return NULL;
15855 }
15856 D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15857 Token * _literal;
15858 expr_ty elem;
15859 while (
15860 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15861 &&
15862 (elem = expression_rule(p)) // expression
15863 )
15864 {
15865 _res = elem;
15866 if (_res == NULL && PyErr_Occurred()) {
15867 p->error_indicator = 1;
15868 PyMem_Free(_children);
15869 D(p->level--);
15870 return NULL;
15871 }
15872 if (_n == _children_capacity) {
15873 _children_capacity *= 2;
15874 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15875 if (!_new_children) {
15876 p->error_indicator = 1;
15877 PyErr_NoMemory();
15878 D(p->level--);
15879 return NULL;
15880 }
15881 _children = _new_children;
15882 }
15883 _children[_n++] = _res;
15884 _mark = p->mark;
15885 }
15886 p->mark = _mark;
15887 D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ',
15888 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
15889 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015890 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015891 if (!_seq) {
15892 PyMem_Free(_children);
15893 p->error_indicator = 1;
15894 PyErr_NoMemory();
15895 D(p->level--);
15896 return NULL;
15897 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010015898 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015899 PyMem_Free(_children);
15900 _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq);
15901 D(p->level--);
15902 return _seq;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015903}
15904
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015905// _gather_5: expression _loop0_6
15906static asdl_seq *
15907_gather_5_rule(Parser *p)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015908{
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015909 D(p->level++);
15910 if (p->error_indicator) {
15911 D(p->level--);
15912 return NULL;
Antoine Pitrouf95a1b32010-05-09 15:52:27 +000015913 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015914 asdl_seq * _res = NULL;
15915 int _mark = p->mark;
15916 { // expression _loop0_6
15917 if (p->error_indicator) {
15918 D(p->level--);
15919 return NULL;
15920 }
15921 D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15922 expr_ty elem;
15923 asdl_seq * seq;
15924 if (
15925 (elem = expression_rule(p)) // expression
15926 &&
15927 (seq = _loop0_6_rule(p)) // _loop0_6
15928 )
15929 {
15930 D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
15931 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
15932 goto done;
15933 }
15934 p->mark = _mark;
15935 D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ',
15936 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6"));
15937 }
15938 _res = NULL;
15939 done:
15940 D(p->level--);
15941 return _res;
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000015942}
15943
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010015944// _loop0_8: ',' expression
15945static asdl_seq *
15946_loop0_8_rule(Parser *p)
15947{
15948 D(p->level++);
15949 if (p->error_indicator) {
15950 D(p->level--);
15951 return NULL;
15952 }
15953 void *_res = NULL;
15954 int _mark = p->mark;
15955 int _start_mark = p->mark;
15956 void **_children = PyMem_Malloc(sizeof(void *));
15957 if (!_children) {
15958 p->error_indicator = 1;
15959 PyErr_NoMemory();
15960 D(p->level--);
15961 return NULL;
15962 }
15963 ssize_t _children_capacity = 1;
15964 ssize_t _n = 0;
15965 { // ',' expression
15966 if (p->error_indicator) {
15967 D(p->level--);
15968 return NULL;
15969 }
15970 D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
15971 Token * _literal;
15972 expr_ty elem;
15973 while (
15974 (_literal = _PyPegen_expect_token(p, 12)) // token=','
15975 &&
15976 (elem = expression_rule(p)) // expression
15977 )
15978 {
15979 _res = elem;
15980 if (_res == NULL && PyErr_Occurred()) {
15981 p->error_indicator = 1;
15982 PyMem_Free(_children);
15983 D(p->level--);
15984 return NULL;
15985 }
15986 if (_n == _children_capacity) {
15987 _children_capacity *= 2;
15988 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
15989 if (!_new_children) {
15990 p->error_indicator = 1;
15991 PyErr_NoMemory();
15992 D(p->level--);
15993 return NULL;
15994 }
15995 _children = _new_children;
15996 }
15997 _children[_n++] = _res;
15998 _mark = p->mark;
15999 }
16000 p->mark = _mark;
16001 D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ',
16002 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16003 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016004 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016005 if (!_seq) {
16006 PyMem_Free(_children);
16007 p->error_indicator = 1;
16008 PyErr_NoMemory();
16009 D(p->level--);
16010 return NULL;
16011 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016012 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016013 PyMem_Free(_children);
16014 _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq);
16015 D(p->level--);
16016 return _seq;
16017}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016018
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016019// _gather_7: expression _loop0_8
16020static asdl_seq *
16021_gather_7_rule(Parser *p)
16022{
16023 D(p->level++);
16024 if (p->error_indicator) {
16025 D(p->level--);
16026 return NULL;
16027 }
16028 asdl_seq * _res = NULL;
16029 int _mark = p->mark;
16030 { // expression _loop0_8
16031 if (p->error_indicator) {
16032 D(p->level--);
16033 return NULL;
16034 }
16035 D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16036 expr_ty elem;
16037 asdl_seq * seq;
16038 if (
16039 (elem = expression_rule(p)) // expression
16040 &&
16041 (seq = _loop0_8_rule(p)) // _loop0_8
16042 )
16043 {
16044 D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
16045 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16046 goto done;
16047 }
16048 p->mark = _mark;
16049 D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ',
16050 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8"));
16051 }
16052 _res = NULL;
16053 done:
16054 D(p->level--);
16055 return _res;
16056}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016057
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016058// _loop0_10: ',' expression
16059static asdl_seq *
16060_loop0_10_rule(Parser *p)
16061{
16062 D(p->level++);
16063 if (p->error_indicator) {
16064 D(p->level--);
16065 return NULL;
16066 }
16067 void *_res = NULL;
16068 int _mark = p->mark;
16069 int _start_mark = p->mark;
16070 void **_children = PyMem_Malloc(sizeof(void *));
16071 if (!_children) {
16072 p->error_indicator = 1;
16073 PyErr_NoMemory();
16074 D(p->level--);
16075 return NULL;
16076 }
16077 ssize_t _children_capacity = 1;
16078 ssize_t _n = 0;
16079 { // ',' expression
16080 if (p->error_indicator) {
16081 D(p->level--);
16082 return NULL;
16083 }
16084 D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
16085 Token * _literal;
16086 expr_ty elem;
16087 while (
16088 (_literal = _PyPegen_expect_token(p, 12)) // token=','
16089 &&
16090 (elem = expression_rule(p)) // expression
16091 )
16092 {
16093 _res = elem;
16094 if (_res == NULL && PyErr_Occurred()) {
16095 p->error_indicator = 1;
16096 PyMem_Free(_children);
16097 D(p->level--);
16098 return NULL;
16099 }
16100 if (_n == _children_capacity) {
16101 _children_capacity *= 2;
16102 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16103 if (!_new_children) {
16104 p->error_indicator = 1;
16105 PyErr_NoMemory();
16106 D(p->level--);
16107 return NULL;
16108 }
16109 _children = _new_children;
16110 }
16111 _children[_n++] = _res;
16112 _mark = p->mark;
16113 }
16114 p->mark = _mark;
16115 D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ',
16116 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
16117 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016118 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016119 if (!_seq) {
16120 PyMem_Free(_children);
16121 p->error_indicator = 1;
16122 PyErr_NoMemory();
16123 D(p->level--);
16124 return NULL;
16125 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016126 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016127 PyMem_Free(_children);
16128 _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq);
16129 D(p->level--);
16130 return _seq;
16131}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016132
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016133// _gather_9: expression _loop0_10
16134static asdl_seq *
16135_gather_9_rule(Parser *p)
16136{
16137 D(p->level++);
16138 if (p->error_indicator) {
16139 D(p->level--);
16140 return NULL;
16141 }
16142 asdl_seq * _res = NULL;
16143 int _mark = p->mark;
16144 { // expression _loop0_10
16145 if (p->error_indicator) {
16146 D(p->level--);
16147 return NULL;
16148 }
16149 D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16150 expr_ty elem;
16151 asdl_seq * seq;
16152 if (
16153 (elem = expression_rule(p)) // expression
16154 &&
16155 (seq = _loop0_10_rule(p)) // _loop0_10
16156 )
16157 {
16158 D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
16159 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16160 goto done;
16161 }
16162 p->mark = _mark;
16163 D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ',
16164 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10"));
16165 }
16166 _res = NULL;
16167 done:
16168 D(p->level--);
16169 return _res;
16170}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016171
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016172// _loop1_11: statement
16173static asdl_seq *
16174_loop1_11_rule(Parser *p)
16175{
16176 D(p->level++);
16177 if (p->error_indicator) {
16178 D(p->level--);
16179 return NULL;
16180 }
16181 void *_res = NULL;
16182 int _mark = p->mark;
16183 int _start_mark = p->mark;
16184 void **_children = PyMem_Malloc(sizeof(void *));
16185 if (!_children) {
16186 p->error_indicator = 1;
16187 PyErr_NoMemory();
16188 D(p->level--);
16189 return NULL;
16190 }
16191 ssize_t _children_capacity = 1;
16192 ssize_t _n = 0;
16193 { // statement
16194 if (p->error_indicator) {
16195 D(p->level--);
16196 return NULL;
16197 }
16198 D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
Pablo Galindoa5634c42020-09-16 19:42:00 +010016199 asdl_stmt_seq* statement_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016200 while (
16201 (statement_var = statement_rule(p)) // statement
16202 )
16203 {
16204 _res = statement_var;
16205 if (_n == _children_capacity) {
16206 _children_capacity *= 2;
16207 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16208 if (!_new_children) {
16209 p->error_indicator = 1;
16210 PyErr_NoMemory();
16211 D(p->level--);
16212 return NULL;
16213 }
16214 _children = _new_children;
16215 }
16216 _children[_n++] = _res;
16217 _mark = p->mark;
16218 }
16219 p->mark = _mark;
16220 D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ',
16221 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
16222 }
16223 if (_n == 0 || p->error_indicator) {
16224 PyMem_Free(_children);
16225 D(p->level--);
16226 return NULL;
16227 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016228 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016229 if (!_seq) {
16230 PyMem_Free(_children);
16231 p->error_indicator = 1;
16232 PyErr_NoMemory();
16233 D(p->level--);
16234 return NULL;
16235 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016236 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016237 PyMem_Free(_children);
16238 _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq);
16239 D(p->level--);
16240 return _seq;
16241}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016242
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016243// _loop0_13: ';' small_stmt
16244static asdl_seq *
16245_loop0_13_rule(Parser *p)
16246{
16247 D(p->level++);
16248 if (p->error_indicator) {
16249 D(p->level--);
16250 return NULL;
16251 }
16252 void *_res = NULL;
16253 int _mark = p->mark;
16254 int _start_mark = p->mark;
16255 void **_children = PyMem_Malloc(sizeof(void *));
16256 if (!_children) {
16257 p->error_indicator = 1;
16258 PyErr_NoMemory();
16259 D(p->level--);
16260 return NULL;
16261 }
16262 ssize_t _children_capacity = 1;
16263 ssize_t _n = 0;
16264 { // ';' small_stmt
16265 if (p->error_indicator) {
16266 D(p->level--);
16267 return NULL;
16268 }
16269 D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt"));
16270 Token * _literal;
16271 stmt_ty elem;
16272 while (
16273 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
16274 &&
16275 (elem = small_stmt_rule(p)) // small_stmt
16276 )
16277 {
16278 _res = elem;
16279 if (_res == NULL && PyErr_Occurred()) {
16280 p->error_indicator = 1;
16281 PyMem_Free(_children);
16282 D(p->level--);
16283 return NULL;
16284 }
16285 if (_n == _children_capacity) {
16286 _children_capacity *= 2;
16287 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16288 if (!_new_children) {
16289 p->error_indicator = 1;
16290 PyErr_NoMemory();
16291 D(p->level--);
16292 return NULL;
16293 }
16294 _children = _new_children;
16295 }
16296 _children[_n++] = _res;
16297 _mark = p->mark;
16298 }
16299 p->mark = _mark;
16300 D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ',
16301 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt"));
16302 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016303 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016304 if (!_seq) {
16305 PyMem_Free(_children);
16306 p->error_indicator = 1;
16307 PyErr_NoMemory();
16308 D(p->level--);
16309 return NULL;
16310 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016311 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016312 PyMem_Free(_children);
16313 _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq);
16314 D(p->level--);
16315 return _seq;
16316}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016317
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016318// _gather_12: small_stmt _loop0_13
16319static asdl_seq *
16320_gather_12_rule(Parser *p)
16321{
16322 D(p->level++);
16323 if (p->error_indicator) {
16324 D(p->level--);
16325 return NULL;
16326 }
16327 asdl_seq * _res = NULL;
16328 int _mark = p->mark;
16329 { // small_stmt _loop0_13
16330 if (p->error_indicator) {
16331 D(p->level--);
16332 return NULL;
16333 }
16334 D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16335 stmt_ty elem;
16336 asdl_seq * seq;
16337 if (
16338 (elem = small_stmt_rule(p)) // small_stmt
16339 &&
16340 (seq = _loop0_13_rule(p)) // _loop0_13
16341 )
16342 {
16343 D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
16344 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
16345 goto done;
16346 }
16347 p->mark = _mark;
16348 D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ',
16349 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13"));
16350 }
16351 _res = NULL;
16352 done:
16353 D(p->level--);
16354 return _res;
16355}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016356
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016357// _tmp_14: 'import' | 'from'
16358static void *
16359_tmp_14_rule(Parser *p)
16360{
16361 D(p->level++);
16362 if (p->error_indicator) {
16363 D(p->level--);
16364 return NULL;
16365 }
16366 void * _res = NULL;
16367 int _mark = p->mark;
16368 { // 'import'
16369 if (p->error_indicator) {
16370 D(p->level--);
16371 return NULL;
16372 }
16373 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
16374 Token * _keyword;
16375 if (
16376 (_keyword = _PyPegen_expect_token(p, 513)) // token='import'
16377 )
16378 {
16379 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
16380 _res = _keyword;
16381 goto done;
16382 }
16383 p->mark = _mark;
16384 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16385 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
16386 }
16387 { // 'from'
16388 if (p->error_indicator) {
16389 D(p->level--);
16390 return NULL;
16391 }
16392 D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
16393 Token * _keyword;
16394 if (
16395 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
16396 )
16397 {
16398 D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
16399 _res = _keyword;
16400 goto done;
16401 }
16402 p->mark = _mark;
16403 D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
16404 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
16405 }
16406 _res = NULL;
16407 done:
16408 D(p->level--);
16409 return _res;
16410}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016411
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016412// _tmp_15: 'def' | '@' | ASYNC
16413static void *
16414_tmp_15_rule(Parser *p)
16415{
16416 D(p->level++);
16417 if (p->error_indicator) {
16418 D(p->level--);
16419 return NULL;
16420 }
16421 void * _res = NULL;
16422 int _mark = p->mark;
16423 { // 'def'
16424 if (p->error_indicator) {
16425 D(p->level--);
16426 return NULL;
16427 }
16428 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
16429 Token * _keyword;
16430 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016431 (_keyword = _PyPegen_expect_token(p, 523)) // token='def'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016432 )
16433 {
16434 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
16435 _res = _keyword;
16436 goto done;
16437 }
16438 p->mark = _mark;
16439 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16440 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
16441 }
16442 { // '@'
16443 if (p->error_indicator) {
16444 D(p->level--);
16445 return NULL;
16446 }
16447 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16448 Token * _literal;
16449 if (
16450 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16451 )
16452 {
16453 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16454 _res = _literal;
16455 goto done;
16456 }
16457 p->mark = _mark;
16458 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16459 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16460 }
16461 { // ASYNC
16462 if (p->error_indicator) {
16463 D(p->level--);
16464 return NULL;
16465 }
16466 D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16467 Token * async_var;
16468 if (
16469 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16470 )
16471 {
16472 D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16473 _res = async_var;
16474 goto done;
16475 }
16476 p->mark = _mark;
16477 D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
16478 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16479 }
16480 _res = NULL;
16481 done:
16482 D(p->level--);
16483 return _res;
16484}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016485
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016486// _tmp_16: 'class' | '@'
16487static void *
16488_tmp_16_rule(Parser *p)
16489{
16490 D(p->level++);
16491 if (p->error_indicator) {
16492 D(p->level--);
16493 return NULL;
16494 }
16495 void * _res = NULL;
16496 int _mark = p->mark;
16497 { // 'class'
16498 if (p->error_indicator) {
16499 D(p->level--);
16500 return NULL;
16501 }
16502 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
16503 Token * _keyword;
16504 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030016505 (_keyword = _PyPegen_expect_token(p, 524)) // token='class'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016506 )
16507 {
16508 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
16509 _res = _keyword;
16510 goto done;
16511 }
16512 p->mark = _mark;
16513 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16514 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
16515 }
16516 { // '@'
16517 if (p->error_indicator) {
16518 D(p->level--);
16519 return NULL;
16520 }
16521 D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
16522 Token * _literal;
16523 if (
16524 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
16525 )
16526 {
16527 D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
16528 _res = _literal;
16529 goto done;
16530 }
16531 p->mark = _mark;
16532 D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
16533 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
16534 }
16535 _res = NULL;
16536 done:
16537 D(p->level--);
16538 return _res;
16539}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016540
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016541// _tmp_17: 'with' | ASYNC
16542static void *
16543_tmp_17_rule(Parser *p)
16544{
16545 D(p->level++);
16546 if (p->error_indicator) {
16547 D(p->level--);
16548 return NULL;
16549 }
16550 void * _res = NULL;
16551 int _mark = p->mark;
16552 { // 'with'
16553 if (p->error_indicator) {
16554 D(p->level--);
16555 return NULL;
16556 }
16557 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
16558 Token * _keyword;
16559 if (
16560 (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
16561 )
16562 {
16563 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
16564 _res = _keyword;
16565 goto done;
16566 }
16567 p->mark = _mark;
16568 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16569 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
16570 }
16571 { // ASYNC
16572 if (p->error_indicator) {
16573 D(p->level--);
16574 return NULL;
16575 }
16576 D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16577 Token * async_var;
16578 if (
16579 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16580 )
16581 {
16582 D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16583 _res = async_var;
16584 goto done;
16585 }
16586 p->mark = _mark;
16587 D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
16588 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16589 }
16590 _res = NULL;
16591 done:
16592 D(p->level--);
16593 return _res;
16594}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016595
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016596// _tmp_18: 'for' | ASYNC
16597static void *
16598_tmp_18_rule(Parser *p)
16599{
16600 D(p->level++);
16601 if (p->error_indicator) {
16602 D(p->level--);
16603 return NULL;
16604 }
16605 void * _res = NULL;
16606 int _mark = p->mark;
16607 { // 'for'
16608 if (p->error_indicator) {
16609 D(p->level--);
16610 return NULL;
16611 }
16612 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
16613 Token * _keyword;
16614 if (
16615 (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
16616 )
16617 {
16618 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
16619 _res = _keyword;
16620 goto done;
16621 }
16622 p->mark = _mark;
16623 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16624 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
16625 }
16626 { // ASYNC
16627 if (p->error_indicator) {
16628 D(p->level--);
16629 return NULL;
16630 }
16631 D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16632 Token * async_var;
16633 if (
16634 (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
16635 )
16636 {
16637 D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
16638 _res = async_var;
16639 goto done;
16640 }
16641 p->mark = _mark;
16642 D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
16643 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
16644 }
16645 _res = NULL;
16646 done:
16647 D(p->level--);
16648 return _res;
16649}
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000016650
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016651// _tmp_19: '=' annotated_rhs
16652static void *
16653_tmp_19_rule(Parser *p)
16654{
16655 D(p->level++);
16656 if (p->error_indicator) {
16657 D(p->level--);
16658 return NULL;
16659 }
16660 void * _res = NULL;
16661 int _mark = p->mark;
16662 { // '=' annotated_rhs
16663 if (p->error_indicator) {
16664 D(p->level--);
16665 return NULL;
16666 }
16667 D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16668 Token * _literal;
16669 expr_ty d;
16670 if (
16671 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16672 &&
16673 (d = annotated_rhs_rule(p)) // annotated_rhs
16674 )
16675 {
16676 D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16677 _res = d;
16678 if (_res == NULL && PyErr_Occurred()) {
16679 p->error_indicator = 1;
16680 D(p->level--);
16681 return NULL;
16682 }
16683 goto done;
16684 }
16685 p->mark = _mark;
16686 D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ',
16687 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16688 }
16689 _res = NULL;
16690 done:
16691 D(p->level--);
16692 return _res;
16693}
16694
16695// _tmp_20: '(' single_target ')' | single_subscript_attribute_target
16696static void *
16697_tmp_20_rule(Parser *p)
16698{
16699 D(p->level++);
16700 if (p->error_indicator) {
16701 D(p->level--);
16702 return NULL;
16703 }
16704 void * _res = NULL;
16705 int _mark = p->mark;
16706 { // '(' single_target ')'
16707 if (p->error_indicator) {
16708 D(p->level--);
16709 return NULL;
16710 }
16711 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16712 Token * _literal;
16713 Token * _literal_1;
16714 expr_ty b;
16715 if (
16716 (_literal = _PyPegen_expect_token(p, 7)) // token='('
16717 &&
16718 (b = single_target_rule(p)) // single_target
16719 &&
16720 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
16721 )
16722 {
16723 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
16724 _res = b;
16725 if (_res == NULL && PyErr_Occurred()) {
16726 p->error_indicator = 1;
16727 D(p->level--);
16728 return NULL;
16729 }
16730 goto done;
16731 }
16732 p->mark = _mark;
16733 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16734 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
16735 }
16736 { // single_subscript_attribute_target
16737 if (p->error_indicator) {
16738 D(p->level--);
16739 return NULL;
16740 }
16741 D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16742 expr_ty single_subscript_attribute_target_var;
16743 if (
16744 (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
16745 )
16746 {
16747 D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
16748 _res = single_subscript_attribute_target_var;
16749 goto done;
16750 }
16751 p->mark = _mark;
16752 D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
16753 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
16754 }
16755 _res = NULL;
16756 done:
16757 D(p->level--);
16758 return _res;
16759}
16760
16761// _tmp_21: '=' annotated_rhs
16762static void *
16763_tmp_21_rule(Parser *p)
16764{
16765 D(p->level++);
16766 if (p->error_indicator) {
16767 D(p->level--);
16768 return NULL;
16769 }
16770 void * _res = NULL;
16771 int _mark = p->mark;
16772 { // '=' annotated_rhs
16773 if (p->error_indicator) {
16774 D(p->level--);
16775 return NULL;
16776 }
16777 D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16778 Token * _literal;
16779 expr_ty d;
16780 if (
16781 (_literal = _PyPegen_expect_token(p, 22)) // token='='
16782 &&
16783 (d = annotated_rhs_rule(p)) // annotated_rhs
16784 )
16785 {
16786 D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
16787 _res = d;
16788 if (_res == NULL && PyErr_Occurred()) {
16789 p->error_indicator = 1;
16790 D(p->level--);
16791 return NULL;
16792 }
16793 goto done;
16794 }
16795 p->mark = _mark;
16796 D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ',
16797 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
16798 }
16799 _res = NULL;
16800 done:
16801 D(p->level--);
16802 return _res;
16803}
16804
16805// _loop1_22: (star_targets '=')
16806static asdl_seq *
16807_loop1_22_rule(Parser *p)
16808{
16809 D(p->level++);
16810 if (p->error_indicator) {
16811 D(p->level--);
16812 return NULL;
16813 }
16814 void *_res = NULL;
16815 int _mark = p->mark;
16816 int _start_mark = p->mark;
16817 void **_children = PyMem_Malloc(sizeof(void *));
16818 if (!_children) {
16819 p->error_indicator = 1;
16820 PyErr_NoMemory();
16821 D(p->level--);
16822 return NULL;
16823 }
16824 ssize_t _children_capacity = 1;
16825 ssize_t _n = 0;
16826 { // (star_targets '=')
16827 if (p->error_indicator) {
16828 D(p->level--);
16829 return NULL;
16830 }
16831 D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010016832 void *_tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016833 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010016834 (_tmp_139_var = _tmp_139_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016835 )
16836 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010016837 _res = _tmp_139_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016838 if (_n == _children_capacity) {
16839 _children_capacity *= 2;
16840 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
16841 if (!_new_children) {
16842 p->error_indicator = 1;
16843 PyErr_NoMemory();
16844 D(p->level--);
16845 return NULL;
16846 }
16847 _children = _new_children;
16848 }
16849 _children[_n++] = _res;
16850 _mark = p->mark;
16851 }
16852 p->mark = _mark;
16853 D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ',
16854 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
16855 }
16856 if (_n == 0 || p->error_indicator) {
16857 PyMem_Free(_children);
16858 D(p->level--);
16859 return NULL;
16860 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016861 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016862 if (!_seq) {
16863 PyMem_Free(_children);
16864 p->error_indicator = 1;
16865 PyErr_NoMemory();
16866 D(p->level--);
16867 return NULL;
16868 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010016869 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010016870 PyMem_Free(_children);
16871 _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq);
16872 D(p->level--);
16873 return _seq;
16874}
16875
16876// _tmp_23: yield_expr | star_expressions
16877static void *
16878_tmp_23_rule(Parser *p)
16879{
16880 D(p->level++);
16881 if (p->error_indicator) {
16882 D(p->level--);
16883 return NULL;
16884 }
16885 void * _res = NULL;
16886 int _mark = p->mark;
16887 { // yield_expr
16888 if (p->error_indicator) {
16889 D(p->level--);
16890 return NULL;
16891 }
16892 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16893 expr_ty yield_expr_var;
16894 if (
16895 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16896 )
16897 {
16898 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16899 _res = yield_expr_var;
16900 goto done;
16901 }
16902 p->mark = _mark;
16903 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16904 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16905 }
16906 { // star_expressions
16907 if (p->error_indicator) {
16908 D(p->level--);
16909 return NULL;
16910 }
16911 D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16912 expr_ty star_expressions_var;
16913 if (
16914 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16915 )
16916 {
16917 D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16918 _res = star_expressions_var;
16919 goto done;
16920 }
16921 p->mark = _mark;
16922 D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
16923 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16924 }
16925 _res = NULL;
16926 done:
16927 D(p->level--);
16928 return _res;
16929}
16930
16931// _tmp_24: yield_expr | star_expressions
16932static void *
16933_tmp_24_rule(Parser *p)
16934{
16935 D(p->level++);
16936 if (p->error_indicator) {
16937 D(p->level--);
16938 return NULL;
16939 }
16940 void * _res = NULL;
16941 int _mark = p->mark;
16942 { // yield_expr
16943 if (p->error_indicator) {
16944 D(p->level--);
16945 return NULL;
16946 }
16947 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16948 expr_ty yield_expr_var;
16949 if (
16950 (yield_expr_var = yield_expr_rule(p)) // yield_expr
16951 )
16952 {
16953 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
16954 _res = yield_expr_var;
16955 goto done;
16956 }
16957 p->mark = _mark;
16958 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
16959 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
16960 }
16961 { // star_expressions
16962 if (p->error_indicator) {
16963 D(p->level--);
16964 return NULL;
16965 }
16966 D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16967 expr_ty star_expressions_var;
16968 if (
16969 (star_expressions_var = star_expressions_rule(p)) // star_expressions
16970 )
16971 {
16972 D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
16973 _res = star_expressions_var;
16974 goto done;
16975 }
16976 p->mark = _mark;
16977 D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
16978 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
16979 }
16980 _res = NULL;
16981 done:
16982 D(p->level--);
16983 return _res;
16984}
16985
16986// _loop0_26: ',' NAME
16987static asdl_seq *
16988_loop0_26_rule(Parser *p)
16989{
16990 D(p->level++);
16991 if (p->error_indicator) {
16992 D(p->level--);
16993 return NULL;
16994 }
16995 void *_res = NULL;
16996 int _mark = p->mark;
16997 int _start_mark = p->mark;
16998 void **_children = PyMem_Malloc(sizeof(void *));
16999 if (!_children) {
17000 p->error_indicator = 1;
17001 PyErr_NoMemory();
17002 D(p->level--);
17003 return NULL;
17004 }
17005 ssize_t _children_capacity = 1;
17006 ssize_t _n = 0;
17007 { // ',' NAME
17008 if (p->error_indicator) {
17009 D(p->level--);
17010 return NULL;
17011 }
17012 D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17013 Token * _literal;
17014 expr_ty elem;
17015 while (
17016 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17017 &&
17018 (elem = _PyPegen_name_token(p)) // NAME
17019 )
17020 {
17021 _res = elem;
17022 if (_res == NULL && PyErr_Occurred()) {
17023 p->error_indicator = 1;
17024 PyMem_Free(_children);
17025 D(p->level--);
17026 return NULL;
17027 }
17028 if (_n == _children_capacity) {
17029 _children_capacity *= 2;
17030 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17031 if (!_new_children) {
17032 p->error_indicator = 1;
17033 PyErr_NoMemory();
17034 D(p->level--);
17035 return NULL;
17036 }
17037 _children = _new_children;
17038 }
17039 _children[_n++] = _res;
17040 _mark = p->mark;
17041 }
17042 p->mark = _mark;
17043 D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ',
17044 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17045 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017046 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017047 if (!_seq) {
17048 PyMem_Free(_children);
17049 p->error_indicator = 1;
17050 PyErr_NoMemory();
17051 D(p->level--);
17052 return NULL;
17053 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017054 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017055 PyMem_Free(_children);
17056 _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq);
17057 D(p->level--);
17058 return _seq;
17059}
17060
17061// _gather_25: NAME _loop0_26
17062static asdl_seq *
17063_gather_25_rule(Parser *p)
17064{
17065 D(p->level++);
17066 if (p->error_indicator) {
17067 D(p->level--);
17068 return NULL;
17069 }
17070 asdl_seq * _res = NULL;
17071 int _mark = p->mark;
17072 { // NAME _loop0_26
17073 if (p->error_indicator) {
17074 D(p->level--);
17075 return NULL;
17076 }
17077 D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17078 expr_ty elem;
17079 asdl_seq * seq;
17080 if (
17081 (elem = _PyPegen_name_token(p)) // NAME
17082 &&
17083 (seq = _loop0_26_rule(p)) // _loop0_26
17084 )
17085 {
17086 D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
17087 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17088 goto done;
17089 }
17090 p->mark = _mark;
17091 D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ',
17092 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26"));
17093 }
17094 _res = NULL;
17095 done:
17096 D(p->level--);
17097 return _res;
17098}
17099
17100// _loop0_28: ',' NAME
17101static asdl_seq *
17102_loop0_28_rule(Parser *p)
17103{
17104 D(p->level++);
17105 if (p->error_indicator) {
17106 D(p->level--);
17107 return NULL;
17108 }
17109 void *_res = NULL;
17110 int _mark = p->mark;
17111 int _start_mark = p->mark;
17112 void **_children = PyMem_Malloc(sizeof(void *));
17113 if (!_children) {
17114 p->error_indicator = 1;
17115 PyErr_NoMemory();
17116 D(p->level--);
17117 return NULL;
17118 }
17119 ssize_t _children_capacity = 1;
17120 ssize_t _n = 0;
17121 { // ',' NAME
17122 if (p->error_indicator) {
17123 D(p->level--);
17124 return NULL;
17125 }
17126 D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
17127 Token * _literal;
17128 expr_ty elem;
17129 while (
17130 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17131 &&
17132 (elem = _PyPegen_name_token(p)) // NAME
17133 )
17134 {
17135 _res = elem;
17136 if (_res == NULL && PyErr_Occurred()) {
17137 p->error_indicator = 1;
17138 PyMem_Free(_children);
17139 D(p->level--);
17140 return NULL;
17141 }
17142 if (_n == _children_capacity) {
17143 _children_capacity *= 2;
17144 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17145 if (!_new_children) {
17146 p->error_indicator = 1;
17147 PyErr_NoMemory();
17148 D(p->level--);
17149 return NULL;
17150 }
17151 _children = _new_children;
17152 }
17153 _children[_n++] = _res;
17154 _mark = p->mark;
17155 }
17156 p->mark = _mark;
17157 D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
17158 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
17159 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017160 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017161 if (!_seq) {
17162 PyMem_Free(_children);
17163 p->error_indicator = 1;
17164 PyErr_NoMemory();
17165 D(p->level--);
17166 return NULL;
17167 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017168 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017169 PyMem_Free(_children);
17170 _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq);
17171 D(p->level--);
17172 return _seq;
17173}
17174
17175// _gather_27: NAME _loop0_28
17176static asdl_seq *
17177_gather_27_rule(Parser *p)
17178{
17179 D(p->level++);
17180 if (p->error_indicator) {
17181 D(p->level--);
17182 return NULL;
17183 }
17184 asdl_seq * _res = NULL;
17185 int _mark = p->mark;
17186 { // NAME _loop0_28
17187 if (p->error_indicator) {
17188 D(p->level--);
17189 return NULL;
17190 }
17191 D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17192 expr_ty elem;
17193 asdl_seq * seq;
17194 if (
17195 (elem = _PyPegen_name_token(p)) // NAME
17196 &&
17197 (seq = _loop0_28_rule(p)) // _loop0_28
17198 )
17199 {
17200 D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
17201 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17202 goto done;
17203 }
17204 p->mark = _mark;
17205 D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ',
17206 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28"));
17207 }
17208 _res = NULL;
17209 done:
17210 D(p->level--);
17211 return _res;
17212}
17213
17214// _tmp_29: ',' expression
17215static void *
17216_tmp_29_rule(Parser *p)
17217{
17218 D(p->level++);
17219 if (p->error_indicator) {
17220 D(p->level--);
17221 return NULL;
17222 }
17223 void * _res = NULL;
17224 int _mark = p->mark;
17225 { // ',' expression
17226 if (p->error_indicator) {
17227 D(p->level--);
17228 return NULL;
17229 }
17230 D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
17231 Token * _literal;
17232 expr_ty z;
17233 if (
17234 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17235 &&
17236 (z = expression_rule(p)) // expression
17237 )
17238 {
17239 D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
17240 _res = z;
17241 if (_res == NULL && PyErr_Occurred()) {
17242 p->error_indicator = 1;
17243 D(p->level--);
17244 return NULL;
17245 }
17246 goto done;
17247 }
17248 p->mark = _mark;
17249 D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ',
17250 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
17251 }
17252 _res = NULL;
17253 done:
17254 D(p->level--);
17255 return _res;
17256}
17257
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017258// _tmp_30: ';' | NEWLINE
17259static void *
17260_tmp_30_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017261{
17262 D(p->level++);
17263 if (p->error_indicator) {
17264 D(p->level--);
17265 return NULL;
17266 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017267 void * _res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017268 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017269 { // ';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017270 if (p->error_indicator) {
17271 D(p->level--);
17272 return NULL;
17273 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017274 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
17275 Token * _literal;
17276 if (
17277 (_literal = _PyPegen_expect_token(p, 13)) // token=';'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017278 )
17279 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017280 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
17281 _res = _literal;
17282 goto done;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017283 }
17284 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017285 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17286 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017287 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017288 { // NEWLINE
17289 if (p->error_indicator) {
17290 D(p->level--);
17291 return NULL;
17292 }
17293 D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17294 Token * newline_var;
17295 if (
17296 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
17297 )
17298 {
17299 D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
17300 _res = newline_var;
17301 goto done;
17302 }
17303 p->mark = _mark;
17304 D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
17305 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017306 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017307 _res = NULL;
17308 done:
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017309 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017310 return _res;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017311}
17312
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017313// _loop0_31: ('.' | '...')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017314static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017315_loop0_31_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017316{
17317 D(p->level++);
17318 if (p->error_indicator) {
17319 D(p->level--);
17320 return NULL;
17321 }
17322 void *_res = NULL;
17323 int _mark = p->mark;
17324 int _start_mark = p->mark;
17325 void **_children = PyMem_Malloc(sizeof(void *));
17326 if (!_children) {
17327 p->error_indicator = 1;
17328 PyErr_NoMemory();
17329 D(p->level--);
17330 return NULL;
17331 }
17332 ssize_t _children_capacity = 1;
17333 ssize_t _n = 0;
17334 { // ('.' | '...')
17335 if (p->error_indicator) {
17336 D(p->level--);
17337 return NULL;
17338 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017339 D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010017340 void *_tmp_140_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017341 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010017342 (_tmp_140_var = _tmp_140_rule(p)) // '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017343 )
17344 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010017345 _res = _tmp_140_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017346 if (_n == _children_capacity) {
17347 _children_capacity *= 2;
17348 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17349 if (!_new_children) {
17350 p->error_indicator = 1;
17351 PyErr_NoMemory();
17352 D(p->level--);
17353 return NULL;
17354 }
17355 _children = _new_children;
17356 }
17357 _children[_n++] = _res;
17358 _mark = p->mark;
17359 }
17360 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017361 D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ',
17362 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17363 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017364 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017365 if (!_seq) {
17366 PyMem_Free(_children);
17367 p->error_indicator = 1;
17368 PyErr_NoMemory();
17369 D(p->level--);
17370 return NULL;
17371 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017372 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017373 PyMem_Free(_children);
17374 _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq);
17375 D(p->level--);
17376 return _seq;
17377}
17378
17379// _loop1_32: ('.' | '...')
17380static asdl_seq *
17381_loop1_32_rule(Parser *p)
17382{
17383 D(p->level++);
17384 if (p->error_indicator) {
17385 D(p->level--);
17386 return NULL;
17387 }
17388 void *_res = NULL;
17389 int _mark = p->mark;
17390 int _start_mark = p->mark;
17391 void **_children = PyMem_Malloc(sizeof(void *));
17392 if (!_children) {
17393 p->error_indicator = 1;
17394 PyErr_NoMemory();
17395 D(p->level--);
17396 return NULL;
17397 }
17398 ssize_t _children_capacity = 1;
17399 ssize_t _n = 0;
17400 { // ('.' | '...')
17401 if (p->error_indicator) {
17402 D(p->level--);
17403 return NULL;
17404 }
17405 D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010017406 void *_tmp_141_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017407 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010017408 (_tmp_141_var = _tmp_141_rule(p)) // '.' | '...'
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017409 )
17410 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010017411 _res = _tmp_141_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017412 if (_n == _children_capacity) {
17413 _children_capacity *= 2;
17414 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17415 if (!_new_children) {
17416 p->error_indicator = 1;
17417 PyErr_NoMemory();
17418 D(p->level--);
17419 return NULL;
17420 }
17421 _children = _new_children;
17422 }
17423 _children[_n++] = _res;
17424 _mark = p->mark;
17425 }
17426 p->mark = _mark;
17427 D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017428 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
17429 }
17430 if (_n == 0 || p->error_indicator) {
17431 PyMem_Free(_children);
17432 D(p->level--);
17433 return NULL;
17434 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017435 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017436 if (!_seq) {
17437 PyMem_Free(_children);
17438 p->error_indicator = 1;
17439 PyErr_NoMemory();
17440 D(p->level--);
17441 return NULL;
17442 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017443 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017444 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017445 _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017446 D(p->level--);
17447 return _seq;
17448}
17449
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017450// _loop0_34: ',' import_from_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017451static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017452_loop0_34_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017453{
17454 D(p->level++);
17455 if (p->error_indicator) {
17456 D(p->level--);
17457 return NULL;
17458 }
17459 void *_res = NULL;
17460 int _mark = p->mark;
17461 int _start_mark = p->mark;
17462 void **_children = PyMem_Malloc(sizeof(void *));
17463 if (!_children) {
17464 p->error_indicator = 1;
17465 PyErr_NoMemory();
17466 D(p->level--);
17467 return NULL;
17468 }
17469 ssize_t _children_capacity = 1;
17470 ssize_t _n = 0;
17471 { // ',' import_from_as_name
17472 if (p->error_indicator) {
17473 D(p->level--);
17474 return NULL;
17475 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017476 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 +010017477 Token * _literal;
17478 alias_ty elem;
17479 while (
17480 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17481 &&
17482 (elem = import_from_as_name_rule(p)) // import_from_as_name
17483 )
17484 {
17485 _res = elem;
17486 if (_res == NULL && PyErr_Occurred()) {
17487 p->error_indicator = 1;
17488 PyMem_Free(_children);
17489 D(p->level--);
17490 return NULL;
17491 }
17492 if (_n == _children_capacity) {
17493 _children_capacity *= 2;
17494 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17495 if (!_new_children) {
17496 p->error_indicator = 1;
17497 PyErr_NoMemory();
17498 D(p->level--);
17499 return NULL;
17500 }
17501 _children = _new_children;
17502 }
17503 _children[_n++] = _res;
17504 _mark = p->mark;
17505 }
17506 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017507 D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017508 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
17509 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017510 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017511 if (!_seq) {
17512 PyMem_Free(_children);
17513 p->error_indicator = 1;
17514 PyErr_NoMemory();
17515 D(p->level--);
17516 return NULL;
17517 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017518 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017519 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017520 _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017521 D(p->level--);
17522 return _seq;
17523}
17524
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017525// _gather_33: import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017526static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017527_gather_33_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017528{
17529 D(p->level++);
17530 if (p->error_indicator) {
17531 D(p->level--);
17532 return NULL;
17533 }
17534 asdl_seq * _res = NULL;
17535 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017536 { // import_from_as_name _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017537 if (p->error_indicator) {
17538 D(p->level--);
17539 return NULL;
17540 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017541 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 +010017542 alias_ty elem;
17543 asdl_seq * seq;
17544 if (
17545 (elem = import_from_as_name_rule(p)) // import_from_as_name
17546 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017547 (seq = _loop0_34_rule(p)) // _loop0_34
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017548 )
17549 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017550 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 +010017551 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17552 goto done;
17553 }
17554 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017555 D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ',
17556 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_34"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017557 }
17558 _res = NULL;
17559 done:
17560 D(p->level--);
17561 return _res;
17562}
17563
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017564// _tmp_35: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017565static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017566_tmp_35_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017567{
17568 D(p->level++);
17569 if (p->error_indicator) {
17570 D(p->level--);
17571 return NULL;
17572 }
17573 void * _res = NULL;
17574 int _mark = p->mark;
17575 { // 'as' NAME
17576 if (p->error_indicator) {
17577 D(p->level--);
17578 return NULL;
17579 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017580 D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017581 Token * _keyword;
17582 expr_ty z;
17583 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017584 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017585 &&
17586 (z = _PyPegen_name_token(p)) // NAME
17587 )
17588 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017589 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 +010017590 _res = z;
17591 if (_res == NULL && PyErr_Occurred()) {
17592 p->error_indicator = 1;
17593 D(p->level--);
17594 return NULL;
17595 }
17596 goto done;
17597 }
17598 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017599 D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017600 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17601 }
17602 _res = NULL;
17603 done:
17604 D(p->level--);
17605 return _res;
17606}
17607
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017608// _loop0_37: ',' dotted_as_name
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017609static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017610_loop0_37_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017611{
17612 D(p->level++);
17613 if (p->error_indicator) {
17614 D(p->level--);
17615 return NULL;
17616 }
17617 void *_res = NULL;
17618 int _mark = p->mark;
17619 int _start_mark = p->mark;
17620 void **_children = PyMem_Malloc(sizeof(void *));
17621 if (!_children) {
17622 p->error_indicator = 1;
17623 PyErr_NoMemory();
17624 D(p->level--);
17625 return NULL;
17626 }
17627 ssize_t _children_capacity = 1;
17628 ssize_t _n = 0;
17629 { // ',' dotted_as_name
17630 if (p->error_indicator) {
17631 D(p->level--);
17632 return NULL;
17633 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017634 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 +010017635 Token * _literal;
17636 alias_ty elem;
17637 while (
17638 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17639 &&
17640 (elem = dotted_as_name_rule(p)) // dotted_as_name
17641 )
17642 {
17643 _res = elem;
17644 if (_res == NULL && PyErr_Occurred()) {
17645 p->error_indicator = 1;
17646 PyMem_Free(_children);
17647 D(p->level--);
17648 return NULL;
17649 }
17650 if (_n == _children_capacity) {
17651 _children_capacity *= 2;
17652 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17653 if (!_new_children) {
17654 p->error_indicator = 1;
17655 PyErr_NoMemory();
17656 D(p->level--);
17657 return NULL;
17658 }
17659 _children = _new_children;
17660 }
17661 _children[_n++] = _res;
17662 _mark = p->mark;
17663 }
17664 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017665 D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017666 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
17667 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017668 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017669 if (!_seq) {
17670 PyMem_Free(_children);
17671 p->error_indicator = 1;
17672 PyErr_NoMemory();
17673 D(p->level--);
17674 return NULL;
17675 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017676 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017677 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017678 _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017679 D(p->level--);
17680 return _seq;
17681}
17682
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017683// _gather_36: dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017684static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017685_gather_36_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017686{
17687 D(p->level++);
17688 if (p->error_indicator) {
17689 D(p->level--);
17690 return NULL;
17691 }
17692 asdl_seq * _res = NULL;
17693 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017694 { // dotted_as_name _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017695 if (p->error_indicator) {
17696 D(p->level--);
17697 return NULL;
17698 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017699 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 +010017700 alias_ty elem;
17701 asdl_seq * seq;
17702 if (
17703 (elem = dotted_as_name_rule(p)) // dotted_as_name
17704 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017705 (seq = _loop0_37_rule(p)) // _loop0_37
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017706 )
17707 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017708 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 +010017709 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17710 goto done;
17711 }
17712 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017713 D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ',
17714 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017715 }
17716 _res = NULL;
17717 done:
17718 D(p->level--);
17719 return _res;
17720}
17721
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017722// _tmp_38: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017723static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017724_tmp_38_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017725{
17726 D(p->level++);
17727 if (p->error_indicator) {
17728 D(p->level--);
17729 return NULL;
17730 }
17731 void * _res = NULL;
17732 int _mark = p->mark;
17733 { // 'as' NAME
17734 if (p->error_indicator) {
17735 D(p->level--);
17736 return NULL;
17737 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017738 D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017739 Token * _keyword;
17740 expr_ty z;
17741 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017742 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017743 &&
17744 (z = _PyPegen_name_token(p)) // NAME
17745 )
17746 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017747 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 +010017748 _res = z;
17749 if (_res == NULL && PyErr_Occurred()) {
17750 p->error_indicator = 1;
17751 D(p->level--);
17752 return NULL;
17753 }
17754 goto done;
17755 }
17756 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017757 D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017758 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
17759 }
17760 _res = NULL;
17761 done:
17762 D(p->level--);
17763 return _res;
17764}
17765
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017766// _loop0_40: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017767static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017768_loop0_40_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017769{
17770 D(p->level++);
17771 if (p->error_indicator) {
17772 D(p->level--);
17773 return NULL;
17774 }
17775 void *_res = NULL;
17776 int _mark = p->mark;
17777 int _start_mark = p->mark;
17778 void **_children = PyMem_Malloc(sizeof(void *));
17779 if (!_children) {
17780 p->error_indicator = 1;
17781 PyErr_NoMemory();
17782 D(p->level--);
17783 return NULL;
17784 }
17785 ssize_t _children_capacity = 1;
17786 ssize_t _n = 0;
17787 { // ',' with_item
17788 if (p->error_indicator) {
17789 D(p->level--);
17790 return NULL;
17791 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017792 D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017793 Token * _literal;
17794 withitem_ty elem;
17795 while (
17796 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17797 &&
17798 (elem = with_item_rule(p)) // with_item
17799 )
17800 {
17801 _res = elem;
17802 if (_res == NULL && PyErr_Occurred()) {
17803 p->error_indicator = 1;
17804 PyMem_Free(_children);
17805 D(p->level--);
17806 return NULL;
17807 }
17808 if (_n == _children_capacity) {
17809 _children_capacity *= 2;
17810 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17811 if (!_new_children) {
17812 p->error_indicator = 1;
17813 PyErr_NoMemory();
17814 D(p->level--);
17815 return NULL;
17816 }
17817 _children = _new_children;
17818 }
17819 _children[_n++] = _res;
17820 _mark = p->mark;
17821 }
17822 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017823 D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017824 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17825 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017826 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017827 if (!_seq) {
17828 PyMem_Free(_children);
17829 p->error_indicator = 1;
17830 PyErr_NoMemory();
17831 D(p->level--);
17832 return NULL;
17833 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017834 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017835 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017836 _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017837 D(p->level--);
17838 return _seq;
17839}
17840
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017841// _gather_39: with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017842static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017843_gather_39_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017844{
17845 D(p->level++);
17846 if (p->error_indicator) {
17847 D(p->level--);
17848 return NULL;
17849 }
17850 asdl_seq * _res = NULL;
17851 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017852 { // with_item _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017853 if (p->error_indicator) {
17854 D(p->level--);
17855 return NULL;
17856 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017857 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 +010017858 withitem_ty elem;
17859 asdl_seq * seq;
17860 if (
17861 (elem = with_item_rule(p)) // with_item
17862 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017863 (seq = _loop0_40_rule(p)) // _loop0_40
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017864 )
17865 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017866 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 +010017867 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17868 goto done;
17869 }
17870 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017871 D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ',
17872 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017873 }
17874 _res = NULL;
17875 done:
17876 D(p->level--);
17877 return _res;
17878}
17879
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017880// _loop0_42: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017881static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017882_loop0_42_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017883{
17884 D(p->level++);
17885 if (p->error_indicator) {
17886 D(p->level--);
17887 return NULL;
17888 }
17889 void *_res = NULL;
17890 int _mark = p->mark;
17891 int _start_mark = p->mark;
17892 void **_children = PyMem_Malloc(sizeof(void *));
17893 if (!_children) {
17894 p->error_indicator = 1;
17895 PyErr_NoMemory();
17896 D(p->level--);
17897 return NULL;
17898 }
17899 ssize_t _children_capacity = 1;
17900 ssize_t _n = 0;
17901 { // ',' with_item
17902 if (p->error_indicator) {
17903 D(p->level--);
17904 return NULL;
17905 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017906 D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017907 Token * _literal;
17908 withitem_ty elem;
17909 while (
17910 (_literal = _PyPegen_expect_token(p, 12)) // token=','
17911 &&
17912 (elem = with_item_rule(p)) // with_item
17913 )
17914 {
17915 _res = elem;
17916 if (_res == NULL && PyErr_Occurred()) {
17917 p->error_indicator = 1;
17918 PyMem_Free(_children);
17919 D(p->level--);
17920 return NULL;
17921 }
17922 if (_n == _children_capacity) {
17923 _children_capacity *= 2;
17924 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
17925 if (!_new_children) {
17926 p->error_indicator = 1;
17927 PyErr_NoMemory();
17928 D(p->level--);
17929 return NULL;
17930 }
17931 _children = _new_children;
17932 }
17933 _children[_n++] = _res;
17934 _mark = p->mark;
17935 }
17936 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017937 D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017938 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
17939 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017940 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017941 if (!_seq) {
17942 PyMem_Free(_children);
17943 p->error_indicator = 1;
17944 PyErr_NoMemory();
17945 D(p->level--);
17946 return NULL;
17947 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010017948 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017949 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017950 _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017951 D(p->level--);
17952 return _seq;
17953}
17954
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017955// _gather_41: with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017956static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017957_gather_41_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017958{
17959 D(p->level++);
17960 if (p->error_indicator) {
17961 D(p->level--);
17962 return NULL;
17963 }
17964 asdl_seq * _res = NULL;
17965 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017966 { // with_item _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017967 if (p->error_indicator) {
17968 D(p->level--);
17969 return NULL;
17970 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017971 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 +010017972 withitem_ty elem;
17973 asdl_seq * seq;
17974 if (
17975 (elem = with_item_rule(p)) // with_item
17976 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017977 (seq = _loop0_42_rule(p)) // _loop0_42
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017978 )
17979 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017980 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 +010017981 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
17982 goto done;
17983 }
17984 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017985 D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ',
17986 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017987 }
17988 _res = NULL;
17989 done:
17990 D(p->level--);
17991 return _res;
17992}
17993
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017994// _loop0_44: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017995static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030017996_loop0_44_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010017997{
17998 D(p->level++);
17999 if (p->error_indicator) {
18000 D(p->level--);
18001 return NULL;
18002 }
18003 void *_res = NULL;
18004 int _mark = p->mark;
18005 int _start_mark = p->mark;
18006 void **_children = PyMem_Malloc(sizeof(void *));
18007 if (!_children) {
18008 p->error_indicator = 1;
18009 PyErr_NoMemory();
18010 D(p->level--);
18011 return NULL;
18012 }
18013 ssize_t _children_capacity = 1;
18014 ssize_t _n = 0;
18015 { // ',' with_item
18016 if (p->error_indicator) {
18017 D(p->level--);
18018 return NULL;
18019 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018020 D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018021 Token * _literal;
18022 withitem_ty elem;
18023 while (
18024 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18025 &&
18026 (elem = with_item_rule(p)) // with_item
18027 )
18028 {
18029 _res = elem;
18030 if (_res == NULL && PyErr_Occurred()) {
18031 p->error_indicator = 1;
18032 PyMem_Free(_children);
18033 D(p->level--);
18034 return NULL;
18035 }
18036 if (_n == _children_capacity) {
18037 _children_capacity *= 2;
18038 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18039 if (!_new_children) {
18040 p->error_indicator = 1;
18041 PyErr_NoMemory();
18042 D(p->level--);
18043 return NULL;
18044 }
18045 _children = _new_children;
18046 }
18047 _children[_n++] = _res;
18048 _mark = p->mark;
18049 }
18050 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018051 D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018052 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18053 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018054 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018055 if (!_seq) {
18056 PyMem_Free(_children);
18057 p->error_indicator = 1;
18058 PyErr_NoMemory();
18059 D(p->level--);
18060 return NULL;
18061 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018062 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018063 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018064 _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018065 D(p->level--);
18066 return _seq;
18067}
18068
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018069// _gather_43: with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018070static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018071_gather_43_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018072{
18073 D(p->level++);
18074 if (p->error_indicator) {
18075 D(p->level--);
18076 return NULL;
18077 }
18078 asdl_seq * _res = NULL;
18079 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018080 { // with_item _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018081 if (p->error_indicator) {
18082 D(p->level--);
18083 return NULL;
18084 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018085 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 +010018086 withitem_ty elem;
18087 asdl_seq * seq;
18088 if (
18089 (elem = with_item_rule(p)) // with_item
18090 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018091 (seq = _loop0_44_rule(p)) // _loop0_44
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018092 )
18093 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018094 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 +010018095 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18096 goto done;
18097 }
18098 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018099 D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ',
18100 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018101 }
18102 _res = NULL;
18103 done:
18104 D(p->level--);
18105 return _res;
18106}
18107
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018108// _loop0_46: ',' with_item
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018109static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018110_loop0_46_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018111{
18112 D(p->level++);
18113 if (p->error_indicator) {
18114 D(p->level--);
18115 return NULL;
18116 }
18117 void *_res = NULL;
18118 int _mark = p->mark;
18119 int _start_mark = p->mark;
18120 void **_children = PyMem_Malloc(sizeof(void *));
18121 if (!_children) {
18122 p->error_indicator = 1;
18123 PyErr_NoMemory();
18124 D(p->level--);
18125 return NULL;
18126 }
18127 ssize_t _children_capacity = 1;
18128 ssize_t _n = 0;
18129 { // ',' with_item
18130 if (p->error_indicator) {
18131 D(p->level--);
18132 return NULL;
18133 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018134 D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018135 Token * _literal;
18136 withitem_ty elem;
18137 while (
18138 (_literal = _PyPegen_expect_token(p, 12)) // token=','
18139 &&
18140 (elem = with_item_rule(p)) // with_item
18141 )
18142 {
18143 _res = elem;
18144 if (_res == NULL && PyErr_Occurred()) {
18145 p->error_indicator = 1;
18146 PyMem_Free(_children);
18147 D(p->level--);
18148 return NULL;
18149 }
18150 if (_n == _children_capacity) {
18151 _children_capacity *= 2;
18152 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18153 if (!_new_children) {
18154 p->error_indicator = 1;
18155 PyErr_NoMemory();
18156 D(p->level--);
18157 return NULL;
18158 }
18159 _children = _new_children;
18160 }
18161 _children[_n++] = _res;
18162 _mark = p->mark;
18163 }
18164 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018165 D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018166 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
18167 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018168 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018169 if (!_seq) {
18170 PyMem_Free(_children);
18171 p->error_indicator = 1;
18172 PyErr_NoMemory();
18173 D(p->level--);
18174 return NULL;
18175 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018176 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018177 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018178 _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018179 D(p->level--);
18180 return _seq;
18181}
18182
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018183// _gather_45: with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018184static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018185_gather_45_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018186{
18187 D(p->level++);
18188 if (p->error_indicator) {
18189 D(p->level--);
18190 return NULL;
18191 }
18192 asdl_seq * _res = NULL;
18193 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018194 { // with_item _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018195 if (p->error_indicator) {
18196 D(p->level--);
18197 return NULL;
18198 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018199 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 +010018200 withitem_ty elem;
18201 asdl_seq * seq;
18202 if (
18203 (elem = with_item_rule(p)) // with_item
18204 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018205 (seq = _loop0_46_rule(p)) // _loop0_46
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018206 )
18207 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018208 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 +010018209 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
18210 goto done;
18211 }
18212 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018213 D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ',
18214 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018215 }
18216 _res = NULL;
18217 done:
18218 D(p->level--);
18219 return _res;
18220}
18221
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018222// _tmp_47: ',' | ')' | ':'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018223static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018224_tmp_47_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018225{
18226 D(p->level++);
18227 if (p->error_indicator) {
18228 D(p->level--);
18229 return NULL;
18230 }
18231 void * _res = NULL;
18232 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018233 { // ','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018234 if (p->error_indicator) {
18235 D(p->level--);
18236 return NULL;
18237 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018238 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
18239 Token * _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018240 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018241 (_literal = _PyPegen_expect_token(p, 12)) // token=','
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018242 )
18243 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018244 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
18245 _res = _literal;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018246 goto done;
18247 }
18248 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018249 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18250 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
18251 }
18252 { // ')'
18253 if (p->error_indicator) {
18254 D(p->level--);
18255 return NULL;
18256 }
18257 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
18258 Token * _literal;
18259 if (
18260 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
18261 )
18262 {
18263 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
18264 _res = _literal;
18265 goto done;
18266 }
18267 p->mark = _mark;
18268 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18269 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
18270 }
18271 { // ':'
18272 if (p->error_indicator) {
18273 D(p->level--);
18274 return NULL;
18275 }
18276 D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
18277 Token * _literal;
18278 if (
18279 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
18280 )
18281 {
18282 D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
18283 _res = _literal;
18284 goto done;
18285 }
18286 p->mark = _mark;
18287 D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
18288 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018289 }
18290 _res = NULL;
18291 done:
18292 D(p->level--);
18293 return _res;
18294}
18295
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018296// _loop1_48: except_block
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018297static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018298_loop1_48_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018299{
18300 D(p->level++);
18301 if (p->error_indicator) {
18302 D(p->level--);
18303 return NULL;
18304 }
18305 void *_res = NULL;
18306 int _mark = p->mark;
18307 int _start_mark = p->mark;
18308 void **_children = PyMem_Malloc(sizeof(void *));
18309 if (!_children) {
18310 p->error_indicator = 1;
18311 PyErr_NoMemory();
18312 D(p->level--);
18313 return NULL;
18314 }
18315 ssize_t _children_capacity = 1;
18316 ssize_t _n = 0;
18317 { // except_block
18318 if (p->error_indicator) {
18319 D(p->level--);
18320 return NULL;
18321 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018322 D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018323 excepthandler_ty except_block_var;
18324 while (
18325 (except_block_var = except_block_rule(p)) // except_block
18326 )
18327 {
18328 _res = except_block_var;
18329 if (_n == _children_capacity) {
18330 _children_capacity *= 2;
18331 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18332 if (!_new_children) {
18333 p->error_indicator = 1;
18334 PyErr_NoMemory();
18335 D(p->level--);
18336 return NULL;
18337 }
18338 _children = _new_children;
18339 }
18340 _children[_n++] = _res;
18341 _mark = p->mark;
18342 }
18343 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018344 D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018345 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
18346 }
18347 if (_n == 0 || p->error_indicator) {
18348 PyMem_Free(_children);
18349 D(p->level--);
18350 return NULL;
18351 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018352 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018353 if (!_seq) {
18354 PyMem_Free(_children);
18355 p->error_indicator = 1;
18356 PyErr_NoMemory();
18357 D(p->level--);
18358 return NULL;
18359 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018360 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018361 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018362 _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018363 D(p->level--);
18364 return _seq;
18365}
18366
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018367// _tmp_49: 'as' NAME
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018368static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018369_tmp_49_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018370{
18371 D(p->level++);
18372 if (p->error_indicator) {
18373 D(p->level--);
18374 return NULL;
18375 }
18376 void * _res = NULL;
18377 int _mark = p->mark;
18378 { // 'as' NAME
18379 if (p->error_indicator) {
18380 D(p->level--);
18381 return NULL;
18382 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018383 D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018384 Token * _keyword;
18385 expr_ty z;
18386 if (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018387 (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018388 &&
18389 (z = _PyPegen_name_token(p)) // NAME
18390 )
18391 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018392 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 +010018393 _res = z;
18394 if (_res == NULL && PyErr_Occurred()) {
18395 p->error_indicator = 1;
18396 D(p->level--);
18397 return NULL;
18398 }
18399 goto done;
18400 }
18401 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018402 D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018403 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
18404 }
18405 _res = NULL;
18406 done:
18407 D(p->level--);
18408 return _res;
18409}
18410
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018411// _tmp_50: 'from' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018412static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018413_tmp_50_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018414{
18415 D(p->level++);
18416 if (p->error_indicator) {
18417 D(p->level--);
18418 return NULL;
18419 }
18420 void * _res = NULL;
18421 int _mark = p->mark;
18422 { // 'from' expression
18423 if (p->error_indicator) {
18424 D(p->level--);
18425 return NULL;
18426 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018427 D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018428 Token * _keyword;
18429 expr_ty z;
18430 if (
18431 (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
18432 &&
18433 (z = expression_rule(p)) // expression
18434 )
18435 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018436 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 +010018437 _res = z;
18438 if (_res == NULL && PyErr_Occurred()) {
18439 p->error_indicator = 1;
18440 D(p->level--);
18441 return NULL;
18442 }
18443 goto done;
18444 }
18445 p->mark = _mark;
18446 D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018447 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018448 }
18449 _res = NULL;
18450 done:
18451 D(p->level--);
18452 return _res;
18453}
18454
18455// _tmp_51: '->' expression
18456static void *
18457_tmp_51_rule(Parser *p)
18458{
18459 D(p->level++);
18460 if (p->error_indicator) {
18461 D(p->level--);
18462 return NULL;
18463 }
18464 void * _res = NULL;
18465 int _mark = p->mark;
18466 { // '->' expression
18467 if (p->error_indicator) {
18468 D(p->level--);
18469 return NULL;
18470 }
18471 D(fprintf(stderr, "%*c> _tmp_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18472 Token * _literal;
18473 expr_ty z;
18474 if (
18475 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18476 &&
18477 (z = expression_rule(p)) // expression
18478 )
18479 {
18480 D(fprintf(stderr, "%*c+ _tmp_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18481 _res = z;
18482 if (_res == NULL && PyErr_Occurred()) {
18483 p->error_indicator = 1;
18484 D(p->level--);
18485 return NULL;
18486 }
18487 goto done;
18488 }
18489 p->mark = _mark;
18490 D(fprintf(stderr, "%*c%s _tmp_51[%d-%d]: %s failed!\n", p->level, ' ',
18491 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18492 }
18493 _res = NULL;
18494 done:
18495 D(p->level--);
18496 return _res;
18497}
18498
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018499// _tmp_52: '->' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018500static void *
18501_tmp_52_rule(Parser *p)
18502{
18503 D(p->level++);
18504 if (p->error_indicator) {
18505 D(p->level--);
18506 return NULL;
18507 }
18508 void * _res = NULL;
18509 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018510 { // '->' expression
18511 if (p->error_indicator) {
18512 D(p->level--);
18513 return NULL;
18514 }
18515 D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18516 Token * _literal;
18517 expr_ty z;
18518 if (
18519 (_literal = _PyPegen_expect_token(p, 51)) // token='->'
18520 &&
18521 (z = expression_rule(p)) // expression
18522 )
18523 {
18524 D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
18525 _res = z;
18526 if (_res == NULL && PyErr_Occurred()) {
18527 p->error_indicator = 1;
18528 D(p->level--);
18529 return NULL;
18530 }
18531 goto done;
18532 }
18533 p->mark = _mark;
18534 D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ',
18535 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
18536 }
18537 _res = NULL;
18538 done:
18539 D(p->level--);
18540 return _res;
18541}
18542
18543// _tmp_53: NEWLINE INDENT
18544static void *
18545_tmp_53_rule(Parser *p)
18546{
18547 D(p->level++);
18548 if (p->error_indicator) {
18549 D(p->level--);
18550 return NULL;
18551 }
18552 void * _res = NULL;
18553 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018554 { // NEWLINE INDENT
18555 if (p->error_indicator) {
18556 D(p->level--);
18557 return NULL;
18558 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018559 D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018560 Token * indent_var;
18561 Token * newline_var;
18562 if (
18563 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
18564 &&
18565 (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
18566 )
18567 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018568 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 +010018569 _res = _PyPegen_dummy_name(p, newline_var, indent_var);
18570 goto done;
18571 }
18572 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018573 D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018574 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
18575 }
18576 _res = NULL;
18577 done:
18578 D(p->level--);
18579 return _res;
18580}
18581
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018582// _loop0_54: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018583static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018584_loop0_54_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018585{
18586 D(p->level++);
18587 if (p->error_indicator) {
18588 D(p->level--);
18589 return NULL;
18590 }
18591 void *_res = NULL;
18592 int _mark = p->mark;
18593 int _start_mark = p->mark;
18594 void **_children = PyMem_Malloc(sizeof(void *));
18595 if (!_children) {
18596 p->error_indicator = 1;
18597 PyErr_NoMemory();
18598 D(p->level--);
18599 return NULL;
18600 }
18601 ssize_t _children_capacity = 1;
18602 ssize_t _n = 0;
18603 { // param_no_default
18604 if (p->error_indicator) {
18605 D(p->level--);
18606 return NULL;
18607 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018608 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 +010018609 arg_ty param_no_default_var;
18610 while (
18611 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18612 )
18613 {
18614 _res = param_no_default_var;
18615 if (_n == _children_capacity) {
18616 _children_capacity *= 2;
18617 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18618 if (!_new_children) {
18619 p->error_indicator = 1;
18620 PyErr_NoMemory();
18621 D(p->level--);
18622 return NULL;
18623 }
18624 _children = _new_children;
18625 }
18626 _children[_n++] = _res;
18627 _mark = p->mark;
18628 }
18629 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018630 D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018631 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018632 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018633 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018634 if (!_seq) {
18635 PyMem_Free(_children);
18636 p->error_indicator = 1;
18637 PyErr_NoMemory();
18638 D(p->level--);
18639 return NULL;
18640 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018641 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018642 PyMem_Free(_children);
18643 _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq);
18644 D(p->level--);
18645 return _seq;
18646}
18647
18648// _loop0_55: param_with_default
18649static asdl_seq *
18650_loop0_55_rule(Parser *p)
18651{
18652 D(p->level++);
18653 if (p->error_indicator) {
18654 D(p->level--);
18655 return NULL;
18656 }
18657 void *_res = NULL;
18658 int _mark = p->mark;
18659 int _start_mark = p->mark;
18660 void **_children = PyMem_Malloc(sizeof(void *));
18661 if (!_children) {
18662 p->error_indicator = 1;
18663 PyErr_NoMemory();
18664 D(p->level--);
18665 return NULL;
18666 }
18667 ssize_t _children_capacity = 1;
18668 ssize_t _n = 0;
18669 { // param_with_default
18670 if (p->error_indicator) {
18671 D(p->level--);
18672 return NULL;
18673 }
18674 D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18675 NameDefaultPair* param_with_default_var;
18676 while (
18677 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18678 )
18679 {
18680 _res = param_with_default_var;
18681 if (_n == _children_capacity) {
18682 _children_capacity *= 2;
18683 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18684 if (!_new_children) {
18685 p->error_indicator = 1;
18686 PyErr_NoMemory();
18687 D(p->level--);
18688 return NULL;
18689 }
18690 _children = _new_children;
18691 }
18692 _children[_n++] = _res;
18693 _mark = p->mark;
18694 }
18695 p->mark = _mark;
18696 D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ',
18697 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18698 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018699 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018700 if (!_seq) {
18701 PyMem_Free(_children);
18702 p->error_indicator = 1;
18703 PyErr_NoMemory();
18704 D(p->level--);
18705 return NULL;
18706 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018707 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018708 PyMem_Free(_children);
18709 _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq);
18710 D(p->level--);
18711 return _seq;
18712}
18713
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018714// _loop0_56: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018715static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018716_loop0_56_rule(Parser *p)
18717{
18718 D(p->level++);
18719 if (p->error_indicator) {
18720 D(p->level--);
18721 return NULL;
18722 }
18723 void *_res = NULL;
18724 int _mark = p->mark;
18725 int _start_mark = p->mark;
18726 void **_children = PyMem_Malloc(sizeof(void *));
18727 if (!_children) {
18728 p->error_indicator = 1;
18729 PyErr_NoMemory();
18730 D(p->level--);
18731 return NULL;
18732 }
18733 ssize_t _children_capacity = 1;
18734 ssize_t _n = 0;
18735 { // param_with_default
18736 if (p->error_indicator) {
18737 D(p->level--);
18738 return NULL;
18739 }
18740 D(fprintf(stderr, "%*c> _loop0_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18741 NameDefaultPair* param_with_default_var;
18742 while (
18743 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18744 )
18745 {
18746 _res = param_with_default_var;
18747 if (_n == _children_capacity) {
18748 _children_capacity *= 2;
18749 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18750 if (!_new_children) {
18751 p->error_indicator = 1;
18752 PyErr_NoMemory();
18753 D(p->level--);
18754 return NULL;
18755 }
18756 _children = _new_children;
18757 }
18758 _children[_n++] = _res;
18759 _mark = p->mark;
18760 }
18761 p->mark = _mark;
18762 D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ',
18763 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18764 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018765 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018766 if (!_seq) {
18767 PyMem_Free(_children);
18768 p->error_indicator = 1;
18769 PyErr_NoMemory();
18770 D(p->level--);
18771 return NULL;
18772 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018773 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018774 PyMem_Free(_children);
18775 _PyPegen_insert_memo(p, _start_mark, _loop0_56_type, _seq);
18776 D(p->level--);
18777 return _seq;
18778}
18779
18780// _loop1_57: param_no_default
18781static asdl_seq *
18782_loop1_57_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018783{
18784 D(p->level++);
18785 if (p->error_indicator) {
18786 D(p->level--);
18787 return NULL;
18788 }
18789 void *_res = NULL;
18790 int _mark = p->mark;
18791 int _start_mark = p->mark;
18792 void **_children = PyMem_Malloc(sizeof(void *));
18793 if (!_children) {
18794 p->error_indicator = 1;
18795 PyErr_NoMemory();
18796 D(p->level--);
18797 return NULL;
18798 }
18799 ssize_t _children_capacity = 1;
18800 ssize_t _n = 0;
18801 { // param_no_default
18802 if (p->error_indicator) {
18803 D(p->level--);
18804 return NULL;
18805 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018806 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 +010018807 arg_ty param_no_default_var;
18808 while (
18809 (param_no_default_var = param_no_default_rule(p)) // param_no_default
18810 )
18811 {
18812 _res = param_no_default_var;
18813 if (_n == _children_capacity) {
18814 _children_capacity *= 2;
18815 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18816 if (!_new_children) {
18817 p->error_indicator = 1;
18818 PyErr_NoMemory();
18819 D(p->level--);
18820 return NULL;
18821 }
18822 _children = _new_children;
18823 }
18824 _children[_n++] = _res;
18825 _mark = p->mark;
18826 }
18827 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018828 D(fprintf(stderr, "%*c%s _loop1_57[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018829 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
18830 }
18831 if (_n == 0 || p->error_indicator) {
18832 PyMem_Free(_children);
18833 D(p->level--);
18834 return NULL;
18835 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018836 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018837 if (!_seq) {
18838 PyMem_Free(_children);
18839 p->error_indicator = 1;
18840 PyErr_NoMemory();
18841 D(p->level--);
18842 return NULL;
18843 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018844 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018845 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018846 _PyPegen_insert_memo(p, _start_mark, _loop1_57_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018847 D(p->level--);
18848 return _seq;
18849}
18850
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018851// _loop0_58: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018852static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018853_loop0_58_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018854{
18855 D(p->level++);
18856 if (p->error_indicator) {
18857 D(p->level--);
18858 return NULL;
18859 }
18860 void *_res = NULL;
18861 int _mark = p->mark;
18862 int _start_mark = p->mark;
18863 void **_children = PyMem_Malloc(sizeof(void *));
18864 if (!_children) {
18865 p->error_indicator = 1;
18866 PyErr_NoMemory();
18867 D(p->level--);
18868 return NULL;
18869 }
18870 ssize_t _children_capacity = 1;
18871 ssize_t _n = 0;
18872 { // param_with_default
18873 if (p->error_indicator) {
18874 D(p->level--);
18875 return NULL;
18876 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018877 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 +010018878 NameDefaultPair* param_with_default_var;
18879 while (
18880 (param_with_default_var = param_with_default_rule(p)) // param_with_default
18881 )
18882 {
18883 _res = param_with_default_var;
18884 if (_n == _children_capacity) {
18885 _children_capacity *= 2;
18886 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18887 if (!_new_children) {
18888 p->error_indicator = 1;
18889 PyErr_NoMemory();
18890 D(p->level--);
18891 return NULL;
18892 }
18893 _children = _new_children;
18894 }
18895 _children[_n++] = _res;
18896 _mark = p->mark;
18897 }
18898 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018899 D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018900 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
18901 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018902 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018903 if (!_seq) {
18904 PyMem_Free(_children);
18905 p->error_indicator = 1;
18906 PyErr_NoMemory();
18907 D(p->level--);
18908 return NULL;
18909 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018910 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018911 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018912 _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018913 D(p->level--);
18914 return _seq;
18915}
18916
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018917// _loop1_59: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018918static asdl_seq *
18919_loop1_59_rule(Parser *p)
18920{
18921 D(p->level++);
18922 if (p->error_indicator) {
18923 D(p->level--);
18924 return NULL;
18925 }
18926 void *_res = NULL;
18927 int _mark = p->mark;
18928 int _start_mark = p->mark;
18929 void **_children = PyMem_Malloc(sizeof(void *));
18930 if (!_children) {
18931 p->error_indicator = 1;
18932 PyErr_NoMemory();
18933 D(p->level--);
18934 return NULL;
18935 }
18936 ssize_t _children_capacity = 1;
18937 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018938 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018939 if (p->error_indicator) {
18940 D(p->level--);
18941 return NULL;
18942 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018943 D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
18944 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018945 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018946 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018947 )
18948 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018949 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018950 if (_n == _children_capacity) {
18951 _children_capacity *= 2;
18952 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
18953 if (!_new_children) {
18954 p->error_indicator = 1;
18955 PyErr_NoMemory();
18956 D(p->level--);
18957 return NULL;
18958 }
18959 _children = _new_children;
18960 }
18961 _children[_n++] = _res;
18962 _mark = p->mark;
18963 }
18964 p->mark = _mark;
18965 D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030018966 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018967 }
18968 if (_n == 0 || p->error_indicator) {
18969 PyMem_Free(_children);
18970 D(p->level--);
18971 return NULL;
18972 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018973 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018974 if (!_seq) {
18975 PyMem_Free(_children);
18976 p->error_indicator = 1;
18977 PyErr_NoMemory();
18978 D(p->level--);
18979 return NULL;
18980 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010018981 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010018982 PyMem_Free(_children);
18983 _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq);
18984 D(p->level--);
18985 return _seq;
18986}
18987
18988// _loop1_60: param_no_default
18989static asdl_seq *
18990_loop1_60_rule(Parser *p)
18991{
18992 D(p->level++);
18993 if (p->error_indicator) {
18994 D(p->level--);
18995 return NULL;
18996 }
18997 void *_res = NULL;
18998 int _mark = p->mark;
18999 int _start_mark = p->mark;
19000 void **_children = PyMem_Malloc(sizeof(void *));
19001 if (!_children) {
19002 p->error_indicator = 1;
19003 PyErr_NoMemory();
19004 D(p->level--);
19005 return NULL;
19006 }
19007 ssize_t _children_capacity = 1;
19008 ssize_t _n = 0;
19009 { // param_no_default
19010 if (p->error_indicator) {
19011 D(p->level--);
19012 return NULL;
19013 }
19014 D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19015 arg_ty param_no_default_var;
19016 while (
19017 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19018 )
19019 {
19020 _res = param_no_default_var;
19021 if (_n == _children_capacity) {
19022 _children_capacity *= 2;
19023 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19024 if (!_new_children) {
19025 p->error_indicator = 1;
19026 PyErr_NoMemory();
19027 D(p->level--);
19028 return NULL;
19029 }
19030 _children = _new_children;
19031 }
19032 _children[_n++] = _res;
19033 _mark = p->mark;
19034 }
19035 p->mark = _mark;
19036 D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ',
19037 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19038 }
19039 if (_n == 0 || p->error_indicator) {
19040 PyMem_Free(_children);
19041 D(p->level--);
19042 return NULL;
19043 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019044 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019045 if (!_seq) {
19046 PyMem_Free(_children);
19047 p->error_indicator = 1;
19048 PyErr_NoMemory();
19049 D(p->level--);
19050 return NULL;
19051 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019052 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019053 PyMem_Free(_children);
19054 _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq);
19055 D(p->level--);
19056 return _seq;
19057}
19058
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019059// _loop1_61: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019060static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019061_loop1_61_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019062{
19063 D(p->level++);
19064 if (p->error_indicator) {
19065 D(p->level--);
19066 return NULL;
19067 }
19068 void *_res = NULL;
19069 int _mark = p->mark;
19070 int _start_mark = p->mark;
19071 void **_children = PyMem_Malloc(sizeof(void *));
19072 if (!_children) {
19073 p->error_indicator = 1;
19074 PyErr_NoMemory();
19075 D(p->level--);
19076 return NULL;
19077 }
19078 ssize_t _children_capacity = 1;
19079 ssize_t _n = 0;
19080 { // param_no_default
19081 if (p->error_indicator) {
19082 D(p->level--);
19083 return NULL;
19084 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019085 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 +010019086 arg_ty param_no_default_var;
19087 while (
19088 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19089 )
19090 {
19091 _res = param_no_default_var;
19092 if (_n == _children_capacity) {
19093 _children_capacity *= 2;
19094 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19095 if (!_new_children) {
19096 p->error_indicator = 1;
19097 PyErr_NoMemory();
19098 D(p->level--);
19099 return NULL;
19100 }
19101 _children = _new_children;
19102 }
19103 _children[_n++] = _res;
19104 _mark = p->mark;
19105 }
19106 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019107 D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019108 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19109 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019110 if (_n == 0 || p->error_indicator) {
19111 PyMem_Free(_children);
19112 D(p->level--);
19113 return NULL;
19114 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019115 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019116 if (!_seq) {
19117 PyMem_Free(_children);
19118 p->error_indicator = 1;
19119 PyErr_NoMemory();
19120 D(p->level--);
19121 return NULL;
19122 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019123 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019124 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019125 _PyPegen_insert_memo(p, _start_mark, _loop1_61_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019126 D(p->level--);
19127 return _seq;
19128}
19129
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019130// _loop0_62: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019131static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019132_loop0_62_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019133{
19134 D(p->level++);
19135 if (p->error_indicator) {
19136 D(p->level--);
19137 return NULL;
19138 }
19139 void *_res = NULL;
19140 int _mark = p->mark;
19141 int _start_mark = p->mark;
19142 void **_children = PyMem_Malloc(sizeof(void *));
19143 if (!_children) {
19144 p->error_indicator = 1;
19145 PyErr_NoMemory();
19146 D(p->level--);
19147 return NULL;
19148 }
19149 ssize_t _children_capacity = 1;
19150 ssize_t _n = 0;
19151 { // param_no_default
19152 if (p->error_indicator) {
19153 D(p->level--);
19154 return NULL;
19155 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019156 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 +010019157 arg_ty param_no_default_var;
19158 while (
19159 (param_no_default_var = param_no_default_rule(p)) // param_no_default
19160 )
19161 {
19162 _res = param_no_default_var;
19163 if (_n == _children_capacity) {
19164 _children_capacity *= 2;
19165 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19166 if (!_new_children) {
19167 p->error_indicator = 1;
19168 PyErr_NoMemory();
19169 D(p->level--);
19170 return NULL;
19171 }
19172 _children = _new_children;
19173 }
19174 _children[_n++] = _res;
19175 _mark = p->mark;
19176 }
19177 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019178 D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019179 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
19180 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019181 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019182 if (!_seq) {
19183 PyMem_Free(_children);
19184 p->error_indicator = 1;
19185 PyErr_NoMemory();
19186 D(p->level--);
19187 return NULL;
19188 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019189 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019190 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019191 _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019192 D(p->level--);
19193 return _seq;
19194}
19195
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019196// _loop1_63: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019197static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019198_loop1_63_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019199{
19200 D(p->level++);
19201 if (p->error_indicator) {
19202 D(p->level--);
19203 return NULL;
19204 }
19205 void *_res = NULL;
19206 int _mark = p->mark;
19207 int _start_mark = p->mark;
19208 void **_children = PyMem_Malloc(sizeof(void *));
19209 if (!_children) {
19210 p->error_indicator = 1;
19211 PyErr_NoMemory();
19212 D(p->level--);
19213 return NULL;
19214 }
19215 ssize_t _children_capacity = 1;
19216 ssize_t _n = 0;
19217 { // param_with_default
19218 if (p->error_indicator) {
19219 D(p->level--);
19220 return NULL;
19221 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019222 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 +010019223 NameDefaultPair* param_with_default_var;
19224 while (
19225 (param_with_default_var = param_with_default_rule(p)) // param_with_default
19226 )
19227 {
19228 _res = param_with_default_var;
19229 if (_n == _children_capacity) {
19230 _children_capacity *= 2;
19231 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19232 if (!_new_children) {
19233 p->error_indicator = 1;
19234 PyErr_NoMemory();
19235 D(p->level--);
19236 return NULL;
19237 }
19238 _children = _new_children;
19239 }
19240 _children[_n++] = _res;
19241 _mark = p->mark;
19242 }
19243 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019244 D(fprintf(stderr, "%*c%s _loop1_63[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019245 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
19246 }
19247 if (_n == 0 || p->error_indicator) {
19248 PyMem_Free(_children);
19249 D(p->level--);
19250 return NULL;
19251 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019252 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019253 if (!_seq) {
19254 PyMem_Free(_children);
19255 p->error_indicator = 1;
19256 PyErr_NoMemory();
19257 D(p->level--);
19258 return NULL;
19259 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019260 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019261 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019262 _PyPegen_insert_memo(p, _start_mark, _loop1_63_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019263 D(p->level--);
19264 return _seq;
19265}
19266
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019267// _loop0_64: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019268static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019269_loop0_64_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019270{
19271 D(p->level++);
19272 if (p->error_indicator) {
19273 D(p->level--);
19274 return NULL;
19275 }
19276 void *_res = NULL;
19277 int _mark = p->mark;
19278 int _start_mark = p->mark;
19279 void **_children = PyMem_Malloc(sizeof(void *));
19280 if (!_children) {
19281 p->error_indicator = 1;
19282 PyErr_NoMemory();
19283 D(p->level--);
19284 return NULL;
19285 }
19286 ssize_t _children_capacity = 1;
19287 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019288 { // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019289 if (p->error_indicator) {
19290 D(p->level--);
19291 return NULL;
19292 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019293 D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
19294 arg_ty param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019295 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019296 (param_no_default_var = param_no_default_rule(p)) // param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019297 )
19298 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019299 _res = param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019300 if (_n == _children_capacity) {
19301 _children_capacity *= 2;
19302 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19303 if (!_new_children) {
19304 p->error_indicator = 1;
19305 PyErr_NoMemory();
19306 D(p->level--);
19307 return NULL;
19308 }
19309 _children = _new_children;
19310 }
19311 _children[_n++] = _res;
19312 _mark = p->mark;
19313 }
19314 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019315 D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ',
19316 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019317 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019318 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019319 if (!_seq) {
19320 PyMem_Free(_children);
19321 p->error_indicator = 1;
19322 PyErr_NoMemory();
19323 D(p->level--);
19324 return NULL;
19325 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019326 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019327 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019328 _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019329 D(p->level--);
19330 return _seq;
19331}
19332
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019333// _loop1_65: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019334static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019335_loop1_65_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019336{
19337 D(p->level++);
19338 if (p->error_indicator) {
19339 D(p->level--);
19340 return NULL;
19341 }
19342 void *_res = NULL;
19343 int _mark = p->mark;
19344 int _start_mark = p->mark;
19345 void **_children = PyMem_Malloc(sizeof(void *));
19346 if (!_children) {
19347 p->error_indicator = 1;
19348 PyErr_NoMemory();
19349 D(p->level--);
19350 return NULL;
19351 }
19352 ssize_t _children_capacity = 1;
19353 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019354 { // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019355 if (p->error_indicator) {
19356 D(p->level--);
19357 return NULL;
19358 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019359 D(fprintf(stderr, "%*c> _loop1_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
19360 NameDefaultPair* param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019361 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019362 (param_with_default_var = param_with_default_rule(p)) // param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019363 )
19364 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019365 _res = param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019366 if (_n == _children_capacity) {
19367 _children_capacity *= 2;
19368 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19369 if (!_new_children) {
19370 p->error_indicator = 1;
19371 PyErr_NoMemory();
19372 D(p->level--);
19373 return NULL;
19374 }
19375 _children = _new_children;
19376 }
19377 _children[_n++] = _res;
19378 _mark = p->mark;
19379 }
19380 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019381 D(fprintf(stderr, "%*c%s _loop1_65[%d-%d]: %s failed!\n", p->level, ' ',
19382 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019383 }
19384 if (_n == 0 || p->error_indicator) {
19385 PyMem_Free(_children);
19386 D(p->level--);
19387 return NULL;
19388 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019389 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019390 if (!_seq) {
19391 PyMem_Free(_children);
19392 p->error_indicator = 1;
19393 PyErr_NoMemory();
19394 D(p->level--);
19395 return NULL;
19396 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019397 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019398 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019399 _PyPegen_insert_memo(p, _start_mark, _loop1_65_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019400 D(p->level--);
19401 return _seq;
19402}
19403
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019404// _loop0_66: param_maybe_default
19405static asdl_seq *
19406_loop0_66_rule(Parser *p)
19407{
19408 D(p->level++);
19409 if (p->error_indicator) {
19410 D(p->level--);
19411 return NULL;
19412 }
19413 void *_res = NULL;
19414 int _mark = p->mark;
19415 int _start_mark = p->mark;
19416 void **_children = PyMem_Malloc(sizeof(void *));
19417 if (!_children) {
19418 p->error_indicator = 1;
19419 PyErr_NoMemory();
19420 D(p->level--);
19421 return NULL;
19422 }
19423 ssize_t _children_capacity = 1;
19424 ssize_t _n = 0;
19425 { // param_maybe_default
19426 if (p->error_indicator) {
19427 D(p->level--);
19428 return NULL;
19429 }
19430 D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19431 NameDefaultPair* param_maybe_default_var;
19432 while (
19433 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19434 )
19435 {
19436 _res = param_maybe_default_var;
19437 if (_n == _children_capacity) {
19438 _children_capacity *= 2;
19439 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19440 if (!_new_children) {
19441 p->error_indicator = 1;
19442 PyErr_NoMemory();
19443 D(p->level--);
19444 return NULL;
19445 }
19446 _children = _new_children;
19447 }
19448 _children[_n++] = _res;
19449 _mark = p->mark;
19450 }
19451 p->mark = _mark;
19452 D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ',
19453 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19454 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019455 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019456 if (!_seq) {
19457 PyMem_Free(_children);
19458 p->error_indicator = 1;
19459 PyErr_NoMemory();
19460 D(p->level--);
19461 return NULL;
19462 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019463 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019464 PyMem_Free(_children);
19465 _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq);
19466 D(p->level--);
19467 return _seq;
19468}
19469
19470// _loop1_67: param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019471static asdl_seq *
19472_loop1_67_rule(Parser *p)
19473{
19474 D(p->level++);
19475 if (p->error_indicator) {
19476 D(p->level--);
19477 return NULL;
19478 }
19479 void *_res = NULL;
19480 int _mark = p->mark;
19481 int _start_mark = p->mark;
19482 void **_children = PyMem_Malloc(sizeof(void *));
19483 if (!_children) {
19484 p->error_indicator = 1;
19485 PyErr_NoMemory();
19486 D(p->level--);
19487 return NULL;
19488 }
19489 ssize_t _children_capacity = 1;
19490 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019491 { // param_maybe_default
19492 if (p->error_indicator) {
19493 D(p->level--);
19494 return NULL;
19495 }
19496 D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
19497 NameDefaultPair* param_maybe_default_var;
19498 while (
19499 (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
19500 )
19501 {
19502 _res = param_maybe_default_var;
19503 if (_n == _children_capacity) {
19504 _children_capacity *= 2;
19505 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19506 if (!_new_children) {
19507 p->error_indicator = 1;
19508 PyErr_NoMemory();
19509 D(p->level--);
19510 return NULL;
19511 }
19512 _children = _new_children;
19513 }
19514 _children[_n++] = _res;
19515 _mark = p->mark;
19516 }
19517 p->mark = _mark;
19518 D(fprintf(stderr, "%*c%s _loop1_67[%d-%d]: %s failed!\n", p->level, ' ',
19519 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
19520 }
19521 if (_n == 0 || p->error_indicator) {
19522 PyMem_Free(_children);
19523 D(p->level--);
19524 return NULL;
19525 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019526 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019527 if (!_seq) {
19528 PyMem_Free(_children);
19529 p->error_indicator = 1;
19530 PyErr_NoMemory();
19531 D(p->level--);
19532 return NULL;
19533 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019534 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019535 PyMem_Free(_children);
19536 _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq);
19537 D(p->level--);
19538 return _seq;
19539}
19540
19541// _loop1_68: ('@' named_expression NEWLINE)
19542static asdl_seq *
19543_loop1_68_rule(Parser *p)
19544{
19545 D(p->level++);
19546 if (p->error_indicator) {
19547 D(p->level--);
19548 return NULL;
19549 }
19550 void *_res = NULL;
19551 int _mark = p->mark;
19552 int _start_mark = p->mark;
19553 void **_children = PyMem_Malloc(sizeof(void *));
19554 if (!_children) {
19555 p->error_indicator = 1;
19556 PyErr_NoMemory();
19557 D(p->level--);
19558 return NULL;
19559 }
19560 ssize_t _children_capacity = 1;
19561 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019562 { // ('@' named_expression NEWLINE)
19563 if (p->error_indicator) {
19564 D(p->level--);
19565 return NULL;
19566 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019567 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 +010019568 void *_tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019569 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019570 (_tmp_142_var = _tmp_142_rule(p)) // '@' named_expression NEWLINE
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019571 )
19572 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019573 _res = _tmp_142_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019574 if (_n == _children_capacity) {
19575 _children_capacity *= 2;
19576 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19577 if (!_new_children) {
19578 p->error_indicator = 1;
19579 PyErr_NoMemory();
19580 D(p->level--);
19581 return NULL;
19582 }
19583 _children = _new_children;
19584 }
19585 _children[_n++] = _res;
19586 _mark = p->mark;
19587 }
19588 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019589 D(fprintf(stderr, "%*c%s _loop1_68[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019590 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
19591 }
19592 if (_n == 0 || p->error_indicator) {
19593 PyMem_Free(_children);
19594 D(p->level--);
19595 return NULL;
19596 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019597 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019598 if (!_seq) {
19599 PyMem_Free(_children);
19600 p->error_indicator = 1;
19601 PyErr_NoMemory();
19602 D(p->level--);
19603 return NULL;
19604 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019605 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019606 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019607 _PyPegen_insert_memo(p, _start_mark, _loop1_68_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019608 D(p->level--);
19609 return _seq;
19610}
19611
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019612// _tmp_69: '(' arguments? ')'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019613static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019614_tmp_69_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019615{
19616 D(p->level++);
19617 if (p->error_indicator) {
19618 D(p->level--);
19619 return NULL;
19620 }
19621 void * _res = NULL;
19622 int _mark = p->mark;
19623 { // '(' arguments? ')'
19624 if (p->error_indicator) {
19625 D(p->level--);
19626 return NULL;
19627 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019628 D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019629 Token * _literal;
19630 Token * _literal_1;
19631 void *z;
19632 if (
19633 (_literal = _PyPegen_expect_token(p, 7)) // token='('
19634 &&
19635 (z = arguments_rule(p), 1) // arguments?
19636 &&
19637 (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
19638 )
19639 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019640 D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019641 _res = z;
19642 if (_res == NULL && PyErr_Occurred()) {
19643 p->error_indicator = 1;
19644 D(p->level--);
19645 return NULL;
19646 }
19647 goto done;
19648 }
19649 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019650 D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019651 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
19652 }
19653 _res = NULL;
19654 done:
19655 D(p->level--);
19656 return _res;
19657}
19658
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019659// _loop0_71: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019660static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019661_loop0_71_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019662{
19663 D(p->level++);
19664 if (p->error_indicator) {
19665 D(p->level--);
19666 return NULL;
19667 }
19668 void *_res = NULL;
19669 int _mark = p->mark;
19670 int _start_mark = p->mark;
19671 void **_children = PyMem_Malloc(sizeof(void *));
19672 if (!_children) {
19673 p->error_indicator = 1;
19674 PyErr_NoMemory();
19675 D(p->level--);
19676 return NULL;
19677 }
19678 ssize_t _children_capacity = 1;
19679 ssize_t _n = 0;
19680 { // ',' star_expression
19681 if (p->error_indicator) {
19682 D(p->level--);
19683 return NULL;
19684 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019685 D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019686 Token * _literal;
19687 expr_ty elem;
19688 while (
19689 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19690 &&
19691 (elem = star_expression_rule(p)) // star_expression
19692 )
19693 {
19694 _res = elem;
19695 if (_res == NULL && PyErr_Occurred()) {
19696 p->error_indicator = 1;
19697 PyMem_Free(_children);
19698 D(p->level--);
19699 return NULL;
19700 }
19701 if (_n == _children_capacity) {
19702 _children_capacity *= 2;
19703 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19704 if (!_new_children) {
19705 p->error_indicator = 1;
19706 PyErr_NoMemory();
19707 D(p->level--);
19708 return NULL;
19709 }
19710 _children = _new_children;
19711 }
19712 _children[_n++] = _res;
19713 _mark = p->mark;
19714 }
19715 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019716 D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019717 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
19718 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019719 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019720 if (!_seq) {
19721 PyMem_Free(_children);
19722 p->error_indicator = 1;
19723 PyErr_NoMemory();
19724 D(p->level--);
19725 return NULL;
19726 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019727 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019728 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019729 _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019730 D(p->level--);
19731 return _seq;
19732}
19733
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019734// _gather_70: star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019735static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019736_gather_70_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019737{
19738 D(p->level++);
19739 if (p->error_indicator) {
19740 D(p->level--);
19741 return NULL;
19742 }
19743 asdl_seq * _res = NULL;
19744 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019745 { // star_expression _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019746 if (p->error_indicator) {
19747 D(p->level--);
19748 return NULL;
19749 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019750 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 +010019751 expr_ty elem;
19752 asdl_seq * seq;
19753 if (
19754 (elem = star_expression_rule(p)) // star_expression
19755 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019756 (seq = _loop0_71_rule(p)) // _loop0_71
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019757 )
19758 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019759 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 +010019760 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19761 goto done;
19762 }
19763 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019764 D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ',
19765 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_71"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019766 }
19767 _res = NULL;
19768 done:
19769 D(p->level--);
19770 return _res;
19771}
19772
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019773// _loop1_72: (',' star_expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019774static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019775_loop1_72_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019776{
19777 D(p->level++);
19778 if (p->error_indicator) {
19779 D(p->level--);
19780 return NULL;
19781 }
19782 void *_res = NULL;
19783 int _mark = p->mark;
19784 int _start_mark = p->mark;
19785 void **_children = PyMem_Malloc(sizeof(void *));
19786 if (!_children) {
19787 p->error_indicator = 1;
19788 PyErr_NoMemory();
19789 D(p->level--);
19790 return NULL;
19791 }
19792 ssize_t _children_capacity = 1;
19793 ssize_t _n = 0;
19794 { // (',' star_expression)
19795 if (p->error_indicator) {
19796 D(p->level--);
19797 return NULL;
19798 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019799 D(fprintf(stderr, "%*c> _loop1_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010019800 void *_tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019801 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019802 (_tmp_143_var = _tmp_143_rule(p)) // ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019803 )
19804 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019805 _res = _tmp_143_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019806 if (_n == _children_capacity) {
19807 _children_capacity *= 2;
19808 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19809 if (!_new_children) {
19810 p->error_indicator = 1;
19811 PyErr_NoMemory();
19812 D(p->level--);
19813 return NULL;
19814 }
19815 _children = _new_children;
19816 }
19817 _children[_n++] = _res;
19818 _mark = p->mark;
19819 }
19820 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019821 D(fprintf(stderr, "%*c%s _loop1_72[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019822 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
19823 }
19824 if (_n == 0 || p->error_indicator) {
19825 PyMem_Free(_children);
19826 D(p->level--);
19827 return NULL;
19828 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019829 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019830 if (!_seq) {
19831 PyMem_Free(_children);
19832 p->error_indicator = 1;
19833 PyErr_NoMemory();
19834 D(p->level--);
19835 return NULL;
19836 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019837 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019838 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019839 _PyPegen_insert_memo(p, _start_mark, _loop1_72_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019840 D(p->level--);
19841 return _seq;
19842}
19843
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019844// _loop0_74: ',' star_named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019845static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019846_loop0_74_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019847{
19848 D(p->level++);
19849 if (p->error_indicator) {
19850 D(p->level--);
19851 return NULL;
19852 }
19853 void *_res = NULL;
19854 int _mark = p->mark;
19855 int _start_mark = p->mark;
19856 void **_children = PyMem_Malloc(sizeof(void *));
19857 if (!_children) {
19858 p->error_indicator = 1;
19859 PyErr_NoMemory();
19860 D(p->level--);
19861 return NULL;
19862 }
19863 ssize_t _children_capacity = 1;
19864 ssize_t _n = 0;
19865 { // ',' star_named_expression
19866 if (p->error_indicator) {
19867 D(p->level--);
19868 return NULL;
19869 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019870 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 +010019871 Token * _literal;
19872 expr_ty elem;
19873 while (
19874 (_literal = _PyPegen_expect_token(p, 12)) // token=','
19875 &&
19876 (elem = star_named_expression_rule(p)) // star_named_expression
19877 )
19878 {
19879 _res = elem;
19880 if (_res == NULL && PyErr_Occurred()) {
19881 p->error_indicator = 1;
19882 PyMem_Free(_children);
19883 D(p->level--);
19884 return NULL;
19885 }
19886 if (_n == _children_capacity) {
19887 _children_capacity *= 2;
19888 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19889 if (!_new_children) {
19890 p->error_indicator = 1;
19891 PyErr_NoMemory();
19892 D(p->level--);
19893 return NULL;
19894 }
19895 _children = _new_children;
19896 }
19897 _children[_n++] = _res;
19898 _mark = p->mark;
19899 }
19900 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019901 D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019902 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
19903 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019904 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019905 if (!_seq) {
19906 PyMem_Free(_children);
19907 p->error_indicator = 1;
19908 PyErr_NoMemory();
19909 D(p->level--);
19910 return NULL;
19911 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010019912 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019913 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019914 _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019915 D(p->level--);
19916 return _seq;
19917}
19918
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019919// _gather_73: star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019920static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019921_gather_73_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019922{
19923 D(p->level++);
19924 if (p->error_indicator) {
19925 D(p->level--);
19926 return NULL;
19927 }
19928 asdl_seq * _res = NULL;
19929 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019930 { // star_named_expression _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019931 if (p->error_indicator) {
19932 D(p->level--);
19933 return NULL;
19934 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019935 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 +010019936 expr_ty elem;
19937 asdl_seq * seq;
19938 if (
19939 (elem = star_named_expression_rule(p)) // star_named_expression
19940 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019941 (seq = _loop0_74_rule(p)) // _loop0_74
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019942 )
19943 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019944 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 +010019945 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
19946 goto done;
19947 }
19948 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019949 D(fprintf(stderr, "%*c%s _gather_73[%d-%d]: %s failed!\n", p->level, ' ',
19950 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_74"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019951 }
19952 _res = NULL;
19953 done:
19954 D(p->level--);
19955 return _res;
19956}
19957
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019958// _loop1_75: (',' expression)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019959static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019960_loop1_75_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019961{
19962 D(p->level++);
19963 if (p->error_indicator) {
19964 D(p->level--);
19965 return NULL;
19966 }
19967 void *_res = NULL;
19968 int _mark = p->mark;
19969 int _start_mark = p->mark;
19970 void **_children = PyMem_Malloc(sizeof(void *));
19971 if (!_children) {
19972 p->error_indicator = 1;
19973 PyErr_NoMemory();
19974 D(p->level--);
19975 return NULL;
19976 }
19977 ssize_t _children_capacity = 1;
19978 ssize_t _n = 0;
19979 { // (',' expression)
19980 if (p->error_indicator) {
19981 D(p->level--);
19982 return NULL;
19983 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030019984 D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010019985 void *_tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019986 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010019987 (_tmp_144_var = _tmp_144_rule(p)) // ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019988 )
19989 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010019990 _res = _tmp_144_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010019991 if (_n == _children_capacity) {
19992 _children_capacity *= 2;
19993 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
19994 if (!_new_children) {
19995 p->error_indicator = 1;
19996 PyErr_NoMemory();
19997 D(p->level--);
19998 return NULL;
19999 }
20000 _children = _new_children;
20001 }
20002 _children[_n++] = _res;
20003 _mark = p->mark;
20004 }
20005 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020006 D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020007 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
20008 }
20009 if (_n == 0 || p->error_indicator) {
20010 PyMem_Free(_children);
20011 D(p->level--);
20012 return NULL;
20013 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020014 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020015 if (!_seq) {
20016 PyMem_Free(_children);
20017 p->error_indicator = 1;
20018 PyErr_NoMemory();
20019 D(p->level--);
20020 return NULL;
20021 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020022 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020023 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020024 _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020025 D(p->level--);
20026 return _seq;
20027}
20028
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020029// _loop0_76: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020030static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020031_loop0_76_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020032{
20033 D(p->level++);
20034 if (p->error_indicator) {
20035 D(p->level--);
20036 return NULL;
20037 }
20038 void *_res = NULL;
20039 int _mark = p->mark;
20040 int _start_mark = p->mark;
20041 void **_children = PyMem_Malloc(sizeof(void *));
20042 if (!_children) {
20043 p->error_indicator = 1;
20044 PyErr_NoMemory();
20045 D(p->level--);
20046 return NULL;
20047 }
20048 ssize_t _children_capacity = 1;
20049 ssize_t _n = 0;
20050 { // lambda_param_no_default
20051 if (p->error_indicator) {
20052 D(p->level--);
20053 return NULL;
20054 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020055 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 +010020056 arg_ty lambda_param_no_default_var;
20057 while (
20058 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20059 )
20060 {
20061 _res = lambda_param_no_default_var;
20062 if (_n == _children_capacity) {
20063 _children_capacity *= 2;
20064 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20065 if (!_new_children) {
20066 p->error_indicator = 1;
20067 PyErr_NoMemory();
20068 D(p->level--);
20069 return NULL;
20070 }
20071 _children = _new_children;
20072 }
20073 _children[_n++] = _res;
20074 _mark = p->mark;
20075 }
20076 p->mark = _mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020077 D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020078 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020079 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020080 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020081 if (!_seq) {
20082 PyMem_Free(_children);
20083 p->error_indicator = 1;
20084 PyErr_NoMemory();
20085 D(p->level--);
20086 return NULL;
20087 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020088 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020089 PyMem_Free(_children);
20090 _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq);
20091 D(p->level--);
20092 return _seq;
20093}
20094
20095// _loop0_77: lambda_param_with_default
20096static asdl_seq *
20097_loop0_77_rule(Parser *p)
20098{
20099 D(p->level++);
20100 if (p->error_indicator) {
20101 D(p->level--);
20102 return NULL;
20103 }
20104 void *_res = NULL;
20105 int _mark = p->mark;
20106 int _start_mark = p->mark;
20107 void **_children = PyMem_Malloc(sizeof(void *));
20108 if (!_children) {
20109 p->error_indicator = 1;
20110 PyErr_NoMemory();
20111 D(p->level--);
20112 return NULL;
20113 }
20114 ssize_t _children_capacity = 1;
20115 ssize_t _n = 0;
20116 { // lambda_param_with_default
20117 if (p->error_indicator) {
20118 D(p->level--);
20119 return NULL;
20120 }
20121 D(fprintf(stderr, "%*c> _loop0_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20122 NameDefaultPair* lambda_param_with_default_var;
20123 while (
20124 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20125 )
20126 {
20127 _res = lambda_param_with_default_var;
20128 if (_n == _children_capacity) {
20129 _children_capacity *= 2;
20130 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20131 if (!_new_children) {
20132 p->error_indicator = 1;
20133 PyErr_NoMemory();
20134 D(p->level--);
20135 return NULL;
20136 }
20137 _children = _new_children;
20138 }
20139 _children[_n++] = _res;
20140 _mark = p->mark;
20141 }
20142 p->mark = _mark;
20143 D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ',
20144 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20145 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020146 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020147 if (!_seq) {
20148 PyMem_Free(_children);
20149 p->error_indicator = 1;
20150 PyErr_NoMemory();
20151 D(p->level--);
20152 return NULL;
20153 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020154 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020155 PyMem_Free(_children);
20156 _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq);
20157 D(p->level--);
20158 return _seq;
20159}
20160
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020161// _loop0_78: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020162static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020163_loop0_78_rule(Parser *p)
20164{
20165 D(p->level++);
20166 if (p->error_indicator) {
20167 D(p->level--);
20168 return NULL;
20169 }
20170 void *_res = NULL;
20171 int _mark = p->mark;
20172 int _start_mark = p->mark;
20173 void **_children = PyMem_Malloc(sizeof(void *));
20174 if (!_children) {
20175 p->error_indicator = 1;
20176 PyErr_NoMemory();
20177 D(p->level--);
20178 return NULL;
20179 }
20180 ssize_t _children_capacity = 1;
20181 ssize_t _n = 0;
20182 { // lambda_param_with_default
20183 if (p->error_indicator) {
20184 D(p->level--);
20185 return NULL;
20186 }
20187 D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20188 NameDefaultPair* lambda_param_with_default_var;
20189 while (
20190 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20191 )
20192 {
20193 _res = lambda_param_with_default_var;
20194 if (_n == _children_capacity) {
20195 _children_capacity *= 2;
20196 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20197 if (!_new_children) {
20198 p->error_indicator = 1;
20199 PyErr_NoMemory();
20200 D(p->level--);
20201 return NULL;
20202 }
20203 _children = _new_children;
20204 }
20205 _children[_n++] = _res;
20206 _mark = p->mark;
20207 }
20208 p->mark = _mark;
20209 D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
20210 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20211 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020212 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020213 if (!_seq) {
20214 PyMem_Free(_children);
20215 p->error_indicator = 1;
20216 PyErr_NoMemory();
20217 D(p->level--);
20218 return NULL;
20219 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020220 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020221 PyMem_Free(_children);
20222 _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq);
20223 D(p->level--);
20224 return _seq;
20225}
20226
20227// _loop1_79: lambda_param_no_default
20228static asdl_seq *
20229_loop1_79_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020230{
20231 D(p->level++);
20232 if (p->error_indicator) {
20233 D(p->level--);
20234 return NULL;
20235 }
20236 void *_res = NULL;
20237 int _mark = p->mark;
20238 int _start_mark = p->mark;
20239 void **_children = PyMem_Malloc(sizeof(void *));
20240 if (!_children) {
20241 p->error_indicator = 1;
20242 PyErr_NoMemory();
20243 D(p->level--);
20244 return NULL;
20245 }
20246 ssize_t _children_capacity = 1;
20247 ssize_t _n = 0;
20248 { // lambda_param_no_default
20249 if (p->error_indicator) {
20250 D(p->level--);
20251 return NULL;
20252 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020253 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 +010020254 arg_ty lambda_param_no_default_var;
20255 while (
20256 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20257 )
20258 {
20259 _res = lambda_param_no_default_var;
20260 if (_n == _children_capacity) {
20261 _children_capacity *= 2;
20262 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20263 if (!_new_children) {
20264 p->error_indicator = 1;
20265 PyErr_NoMemory();
20266 D(p->level--);
20267 return NULL;
20268 }
20269 _children = _new_children;
20270 }
20271 _children[_n++] = _res;
20272 _mark = p->mark;
20273 }
20274 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020275 D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020276 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20277 }
20278 if (_n == 0 || p->error_indicator) {
20279 PyMem_Free(_children);
20280 D(p->level--);
20281 return NULL;
20282 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020283 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020284 if (!_seq) {
20285 PyMem_Free(_children);
20286 p->error_indicator = 1;
20287 PyErr_NoMemory();
20288 D(p->level--);
20289 return NULL;
20290 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020291 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020292 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020293 _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020294 D(p->level--);
20295 return _seq;
20296}
20297
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020298// _loop0_80: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020299static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020300_loop0_80_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020301{
20302 D(p->level++);
20303 if (p->error_indicator) {
20304 D(p->level--);
20305 return NULL;
20306 }
20307 void *_res = NULL;
20308 int _mark = p->mark;
20309 int _start_mark = p->mark;
20310 void **_children = PyMem_Malloc(sizeof(void *));
20311 if (!_children) {
20312 p->error_indicator = 1;
20313 PyErr_NoMemory();
20314 D(p->level--);
20315 return NULL;
20316 }
20317 ssize_t _children_capacity = 1;
20318 ssize_t _n = 0;
20319 { // lambda_param_with_default
20320 if (p->error_indicator) {
20321 D(p->level--);
20322 return NULL;
20323 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020324 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 +010020325 NameDefaultPair* lambda_param_with_default_var;
20326 while (
20327 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20328 )
20329 {
20330 _res = lambda_param_with_default_var;
20331 if (_n == _children_capacity) {
20332 _children_capacity *= 2;
20333 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20334 if (!_new_children) {
20335 p->error_indicator = 1;
20336 PyErr_NoMemory();
20337 D(p->level--);
20338 return NULL;
20339 }
20340 _children = _new_children;
20341 }
20342 _children[_n++] = _res;
20343 _mark = p->mark;
20344 }
20345 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020346 D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020347 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20348 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020349 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020350 if (!_seq) {
20351 PyMem_Free(_children);
20352 p->error_indicator = 1;
20353 PyErr_NoMemory();
20354 D(p->level--);
20355 return NULL;
20356 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020357 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020358 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020359 _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020360 D(p->level--);
20361 return _seq;
20362}
20363
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020364// _loop1_81: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020365static asdl_seq *
20366_loop1_81_rule(Parser *p)
20367{
20368 D(p->level++);
20369 if (p->error_indicator) {
20370 D(p->level--);
20371 return NULL;
20372 }
20373 void *_res = NULL;
20374 int _mark = p->mark;
20375 int _start_mark = p->mark;
20376 void **_children = PyMem_Malloc(sizeof(void *));
20377 if (!_children) {
20378 p->error_indicator = 1;
20379 PyErr_NoMemory();
20380 D(p->level--);
20381 return NULL;
20382 }
20383 ssize_t _children_capacity = 1;
20384 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020385 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020386 if (p->error_indicator) {
20387 D(p->level--);
20388 return NULL;
20389 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020390 D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20391 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020392 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020393 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020394 )
20395 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020396 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020397 if (_n == _children_capacity) {
20398 _children_capacity *= 2;
20399 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20400 if (!_new_children) {
20401 p->error_indicator = 1;
20402 PyErr_NoMemory();
20403 D(p->level--);
20404 return NULL;
20405 }
20406 _children = _new_children;
20407 }
20408 _children[_n++] = _res;
20409 _mark = p->mark;
20410 }
20411 p->mark = _mark;
20412 D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020413 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020414 }
20415 if (_n == 0 || p->error_indicator) {
20416 PyMem_Free(_children);
20417 D(p->level--);
20418 return NULL;
20419 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020420 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020421 if (!_seq) {
20422 PyMem_Free(_children);
20423 p->error_indicator = 1;
20424 PyErr_NoMemory();
20425 D(p->level--);
20426 return NULL;
20427 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020428 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020429 PyMem_Free(_children);
20430 _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
20431 D(p->level--);
20432 return _seq;
20433}
20434
20435// _loop1_82: lambda_param_no_default
20436static asdl_seq *
20437_loop1_82_rule(Parser *p)
20438{
20439 D(p->level++);
20440 if (p->error_indicator) {
20441 D(p->level--);
20442 return NULL;
20443 }
20444 void *_res = NULL;
20445 int _mark = p->mark;
20446 int _start_mark = p->mark;
20447 void **_children = PyMem_Malloc(sizeof(void *));
20448 if (!_children) {
20449 p->error_indicator = 1;
20450 PyErr_NoMemory();
20451 D(p->level--);
20452 return NULL;
20453 }
20454 ssize_t _children_capacity = 1;
20455 ssize_t _n = 0;
20456 { // lambda_param_no_default
20457 if (p->error_indicator) {
20458 D(p->level--);
20459 return NULL;
20460 }
20461 D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20462 arg_ty lambda_param_no_default_var;
20463 while (
20464 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20465 )
20466 {
20467 _res = lambda_param_no_default_var;
20468 if (_n == _children_capacity) {
20469 _children_capacity *= 2;
20470 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20471 if (!_new_children) {
20472 p->error_indicator = 1;
20473 PyErr_NoMemory();
20474 D(p->level--);
20475 return NULL;
20476 }
20477 _children = _new_children;
20478 }
20479 _children[_n++] = _res;
20480 _mark = p->mark;
20481 }
20482 p->mark = _mark;
20483 D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ',
20484 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20485 }
20486 if (_n == 0 || p->error_indicator) {
20487 PyMem_Free(_children);
20488 D(p->level--);
20489 return NULL;
20490 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020491 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020492 if (!_seq) {
20493 PyMem_Free(_children);
20494 p->error_indicator = 1;
20495 PyErr_NoMemory();
20496 D(p->level--);
20497 return NULL;
20498 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020499 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020500 PyMem_Free(_children);
20501 _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq);
20502 D(p->level--);
20503 return _seq;
20504}
20505
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020506// _loop1_83: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020507static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020508_loop1_83_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020509{
20510 D(p->level++);
20511 if (p->error_indicator) {
20512 D(p->level--);
20513 return NULL;
20514 }
20515 void *_res = NULL;
20516 int _mark = p->mark;
20517 int _start_mark = p->mark;
20518 void **_children = PyMem_Malloc(sizeof(void *));
20519 if (!_children) {
20520 p->error_indicator = 1;
20521 PyErr_NoMemory();
20522 D(p->level--);
20523 return NULL;
20524 }
20525 ssize_t _children_capacity = 1;
20526 ssize_t _n = 0;
20527 { // lambda_param_no_default
20528 if (p->error_indicator) {
20529 D(p->level--);
20530 return NULL;
20531 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020532 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 +010020533 arg_ty lambda_param_no_default_var;
20534 while (
20535 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20536 )
20537 {
20538 _res = lambda_param_no_default_var;
20539 if (_n == _children_capacity) {
20540 _children_capacity *= 2;
20541 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20542 if (!_new_children) {
20543 p->error_indicator = 1;
20544 PyErr_NoMemory();
20545 D(p->level--);
20546 return NULL;
20547 }
20548 _children = _new_children;
20549 }
20550 _children[_n++] = _res;
20551 _mark = p->mark;
20552 }
20553 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020554 D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020555 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20556 }
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020557 if (_n == 0 || p->error_indicator) {
20558 PyMem_Free(_children);
20559 D(p->level--);
20560 return NULL;
20561 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020562 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020563 if (!_seq) {
20564 PyMem_Free(_children);
20565 p->error_indicator = 1;
20566 PyErr_NoMemory();
20567 D(p->level--);
20568 return NULL;
20569 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020570 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020571 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020572 _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020573 D(p->level--);
20574 return _seq;
20575}
20576
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020577// _loop0_84: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020578static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020579_loop0_84_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020580{
20581 D(p->level++);
20582 if (p->error_indicator) {
20583 D(p->level--);
20584 return NULL;
20585 }
20586 void *_res = NULL;
20587 int _mark = p->mark;
20588 int _start_mark = p->mark;
20589 void **_children = PyMem_Malloc(sizeof(void *));
20590 if (!_children) {
20591 p->error_indicator = 1;
20592 PyErr_NoMemory();
20593 D(p->level--);
20594 return NULL;
20595 }
20596 ssize_t _children_capacity = 1;
20597 ssize_t _n = 0;
20598 { // lambda_param_no_default
20599 if (p->error_indicator) {
20600 D(p->level--);
20601 return NULL;
20602 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020603 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 +010020604 arg_ty lambda_param_no_default_var;
20605 while (
20606 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
20607 )
20608 {
20609 _res = lambda_param_no_default_var;
20610 if (_n == _children_capacity) {
20611 _children_capacity *= 2;
20612 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20613 if (!_new_children) {
20614 p->error_indicator = 1;
20615 PyErr_NoMemory();
20616 D(p->level--);
20617 return NULL;
20618 }
20619 _children = _new_children;
20620 }
20621 _children[_n++] = _res;
20622 _mark = p->mark;
20623 }
20624 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020625 D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020626 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
20627 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020628 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020629 if (!_seq) {
20630 PyMem_Free(_children);
20631 p->error_indicator = 1;
20632 PyErr_NoMemory();
20633 D(p->level--);
20634 return NULL;
20635 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020636 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020637 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020638 _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020639 D(p->level--);
20640 return _seq;
20641}
20642
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020643// _loop1_85: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020644static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020645_loop1_85_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020646{
20647 D(p->level++);
20648 if (p->error_indicator) {
20649 D(p->level--);
20650 return NULL;
20651 }
20652 void *_res = NULL;
20653 int _mark = p->mark;
20654 int _start_mark = p->mark;
20655 void **_children = PyMem_Malloc(sizeof(void *));
20656 if (!_children) {
20657 p->error_indicator = 1;
20658 PyErr_NoMemory();
20659 D(p->level--);
20660 return NULL;
20661 }
20662 ssize_t _children_capacity = 1;
20663 ssize_t _n = 0;
20664 { // lambda_param_with_default
20665 if (p->error_indicator) {
20666 D(p->level--);
20667 return NULL;
20668 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020669 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 +010020670 NameDefaultPair* lambda_param_with_default_var;
20671 while (
20672 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
20673 )
20674 {
20675 _res = lambda_param_with_default_var;
20676 if (_n == _children_capacity) {
20677 _children_capacity *= 2;
20678 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20679 if (!_new_children) {
20680 p->error_indicator = 1;
20681 PyErr_NoMemory();
20682 D(p->level--);
20683 return NULL;
20684 }
20685 _children = _new_children;
20686 }
20687 _children[_n++] = _res;
20688 _mark = p->mark;
20689 }
20690 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020691 D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020692 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
20693 }
20694 if (_n == 0 || p->error_indicator) {
20695 PyMem_Free(_children);
20696 D(p->level--);
20697 return NULL;
20698 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020699 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020700 if (!_seq) {
20701 PyMem_Free(_children);
20702 p->error_indicator = 1;
20703 PyErr_NoMemory();
20704 D(p->level--);
20705 return NULL;
20706 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020707 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020708 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020709 _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020710 D(p->level--);
20711 return _seq;
20712}
20713
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020714// _loop0_86: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020715static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020716_loop0_86_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020717{
20718 D(p->level++);
20719 if (p->error_indicator) {
20720 D(p->level--);
20721 return NULL;
20722 }
20723 void *_res = NULL;
20724 int _mark = p->mark;
20725 int _start_mark = p->mark;
20726 void **_children = PyMem_Malloc(sizeof(void *));
20727 if (!_children) {
20728 p->error_indicator = 1;
20729 PyErr_NoMemory();
20730 D(p->level--);
20731 return NULL;
20732 }
20733 ssize_t _children_capacity = 1;
20734 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020735 { // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020736 if (p->error_indicator) {
20737 D(p->level--);
20738 return NULL;
20739 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020740 D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
20741 arg_ty lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020742 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020743 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020744 )
20745 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020746 _res = lambda_param_no_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020747 if (_n == _children_capacity) {
20748 _children_capacity *= 2;
20749 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20750 if (!_new_children) {
20751 p->error_indicator = 1;
20752 PyErr_NoMemory();
20753 D(p->level--);
20754 return NULL;
20755 }
20756 _children = _new_children;
20757 }
20758 _children[_n++] = _res;
20759 _mark = p->mark;
20760 }
20761 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020762 D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ',
20763 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020764 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020765 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020766 if (!_seq) {
20767 PyMem_Free(_children);
20768 p->error_indicator = 1;
20769 PyErr_NoMemory();
20770 D(p->level--);
20771 return NULL;
20772 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020773 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020774 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020775 _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020776 D(p->level--);
20777 return _seq;
20778}
20779
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020780// _loop1_87: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020781static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020782_loop1_87_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020783{
20784 D(p->level++);
20785 if (p->error_indicator) {
20786 D(p->level--);
20787 return NULL;
20788 }
20789 void *_res = NULL;
20790 int _mark = p->mark;
20791 int _start_mark = p->mark;
20792 void **_children = PyMem_Malloc(sizeof(void *));
20793 if (!_children) {
20794 p->error_indicator = 1;
20795 PyErr_NoMemory();
20796 D(p->level--);
20797 return NULL;
20798 }
20799 ssize_t _children_capacity = 1;
20800 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020801 { // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020802 if (p->error_indicator) {
20803 D(p->level--);
20804 return NULL;
20805 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020806 D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
20807 NameDefaultPair* lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020808 while (
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020809 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020810 )
20811 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020812 _res = lambda_param_with_default_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020813 if (_n == _children_capacity) {
20814 _children_capacity *= 2;
20815 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20816 if (!_new_children) {
20817 p->error_indicator = 1;
20818 PyErr_NoMemory();
20819 D(p->level--);
20820 return NULL;
20821 }
20822 _children = _new_children;
20823 }
20824 _children[_n++] = _res;
20825 _mark = p->mark;
20826 }
20827 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020828 D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ',
20829 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020830 }
20831 if (_n == 0 || p->error_indicator) {
20832 PyMem_Free(_children);
20833 D(p->level--);
20834 return NULL;
20835 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020836 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020837 if (!_seq) {
20838 PyMem_Free(_children);
20839 p->error_indicator = 1;
20840 PyErr_NoMemory();
20841 D(p->level--);
20842 return NULL;
20843 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020844 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020845 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020846 _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020847 D(p->level--);
20848 return _seq;
20849}
20850
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020851// _loop0_88: lambda_param_maybe_default
20852static asdl_seq *
20853_loop0_88_rule(Parser *p)
20854{
20855 D(p->level++);
20856 if (p->error_indicator) {
20857 D(p->level--);
20858 return NULL;
20859 }
20860 void *_res = NULL;
20861 int _mark = p->mark;
20862 int _start_mark = p->mark;
20863 void **_children = PyMem_Malloc(sizeof(void *));
20864 if (!_children) {
20865 p->error_indicator = 1;
20866 PyErr_NoMemory();
20867 D(p->level--);
20868 return NULL;
20869 }
20870 ssize_t _children_capacity = 1;
20871 ssize_t _n = 0;
20872 { // lambda_param_maybe_default
20873 if (p->error_indicator) {
20874 D(p->level--);
20875 return NULL;
20876 }
20877 D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20878 NameDefaultPair* lambda_param_maybe_default_var;
20879 while (
20880 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20881 )
20882 {
20883 _res = lambda_param_maybe_default_var;
20884 if (_n == _children_capacity) {
20885 _children_capacity *= 2;
20886 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20887 if (!_new_children) {
20888 p->error_indicator = 1;
20889 PyErr_NoMemory();
20890 D(p->level--);
20891 return NULL;
20892 }
20893 _children = _new_children;
20894 }
20895 _children[_n++] = _res;
20896 _mark = p->mark;
20897 }
20898 p->mark = _mark;
20899 D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ',
20900 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20901 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020902 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020903 if (!_seq) {
20904 PyMem_Free(_children);
20905 p->error_indicator = 1;
20906 PyErr_NoMemory();
20907 D(p->level--);
20908 return NULL;
20909 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020910 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020911 PyMem_Free(_children);
20912 _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq);
20913 D(p->level--);
20914 return _seq;
20915}
20916
20917// _loop1_89: lambda_param_maybe_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010020918static asdl_seq *
20919_loop1_89_rule(Parser *p)
20920{
20921 D(p->level++);
20922 if (p->error_indicator) {
20923 D(p->level--);
20924 return NULL;
20925 }
20926 void *_res = NULL;
20927 int _mark = p->mark;
20928 int _start_mark = p->mark;
20929 void **_children = PyMem_Malloc(sizeof(void *));
20930 if (!_children) {
20931 p->error_indicator = 1;
20932 PyErr_NoMemory();
20933 D(p->level--);
20934 return NULL;
20935 }
20936 ssize_t _children_capacity = 1;
20937 ssize_t _n = 0;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020938 { // lambda_param_maybe_default
20939 if (p->error_indicator) {
20940 D(p->level--);
20941 return NULL;
20942 }
20943 D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
20944 NameDefaultPair* lambda_param_maybe_default_var;
20945 while (
20946 (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
20947 )
20948 {
20949 _res = lambda_param_maybe_default_var;
20950 if (_n == _children_capacity) {
20951 _children_capacity *= 2;
20952 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
20953 if (!_new_children) {
20954 p->error_indicator = 1;
20955 PyErr_NoMemory();
20956 D(p->level--);
20957 return NULL;
20958 }
20959 _children = _new_children;
20960 }
20961 _children[_n++] = _res;
20962 _mark = p->mark;
20963 }
20964 p->mark = _mark;
20965 D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ',
20966 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
20967 }
20968 if (_n == 0 || p->error_indicator) {
20969 PyMem_Free(_children);
20970 D(p->level--);
20971 return NULL;
20972 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020973 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020974 if (!_seq) {
20975 PyMem_Free(_children);
20976 p->error_indicator = 1;
20977 PyErr_NoMemory();
20978 D(p->level--);
20979 return NULL;
20980 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010020981 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030020982 PyMem_Free(_children);
20983 _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq);
20984 D(p->level--);
20985 return _seq;
20986}
20987
20988// _loop1_90: ('or' conjunction)
20989static asdl_seq *
20990_loop1_90_rule(Parser *p)
20991{
20992 D(p->level++);
20993 if (p->error_indicator) {
20994 D(p->level--);
20995 return NULL;
20996 }
20997 void *_res = NULL;
20998 int _mark = p->mark;
20999 int _start_mark = p->mark;
21000 void **_children = PyMem_Malloc(sizeof(void *));
21001 if (!_children) {
21002 p->error_indicator = 1;
21003 PyErr_NoMemory();
21004 D(p->level--);
21005 return NULL;
21006 }
21007 ssize_t _children_capacity = 1;
21008 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021009 { // ('or' conjunction)
21010 if (p->error_indicator) {
21011 D(p->level--);
21012 return NULL;
21013 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021014 D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010021015 void *_tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021016 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010021017 (_tmp_145_var = _tmp_145_rule(p)) // 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021018 )
21019 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021020 _res = _tmp_145_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021021 if (_n == _children_capacity) {
21022 _children_capacity *= 2;
21023 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21024 if (!_new_children) {
21025 p->error_indicator = 1;
21026 PyErr_NoMemory();
21027 D(p->level--);
21028 return NULL;
21029 }
21030 _children = _new_children;
21031 }
21032 _children[_n++] = _res;
21033 _mark = p->mark;
21034 }
21035 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021036 D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021037 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
21038 }
21039 if (_n == 0 || p->error_indicator) {
21040 PyMem_Free(_children);
21041 D(p->level--);
21042 return NULL;
21043 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021044 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021045 if (!_seq) {
21046 PyMem_Free(_children);
21047 p->error_indicator = 1;
21048 PyErr_NoMemory();
21049 D(p->level--);
21050 return NULL;
21051 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021052 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021053 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021054 _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021055 D(p->level--);
21056 return _seq;
21057}
21058
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021059// _loop1_91: ('and' inversion)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021060static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021061_loop1_91_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021062{
21063 D(p->level++);
21064 if (p->error_indicator) {
21065 D(p->level--);
21066 return NULL;
21067 }
21068 void *_res = NULL;
21069 int _mark = p->mark;
21070 int _start_mark = p->mark;
21071 void **_children = PyMem_Malloc(sizeof(void *));
21072 if (!_children) {
21073 p->error_indicator = 1;
21074 PyErr_NoMemory();
21075 D(p->level--);
21076 return NULL;
21077 }
21078 ssize_t _children_capacity = 1;
21079 ssize_t _n = 0;
21080 { // ('and' inversion)
21081 if (p->error_indicator) {
21082 D(p->level--);
21083 return NULL;
21084 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021085 D(fprintf(stderr, "%*c> _loop1_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010021086 void *_tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021087 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010021088 (_tmp_146_var = _tmp_146_rule(p)) // 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021089 )
21090 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010021091 _res = _tmp_146_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021092 if (_n == _children_capacity) {
21093 _children_capacity *= 2;
21094 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21095 if (!_new_children) {
21096 p->error_indicator = 1;
21097 PyErr_NoMemory();
21098 D(p->level--);
21099 return NULL;
21100 }
21101 _children = _new_children;
21102 }
21103 _children[_n++] = _res;
21104 _mark = p->mark;
21105 }
21106 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021107 D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021108 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
21109 }
21110 if (_n == 0 || p->error_indicator) {
21111 PyMem_Free(_children);
21112 D(p->level--);
21113 return NULL;
21114 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021115 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021116 if (!_seq) {
21117 PyMem_Free(_children);
21118 p->error_indicator = 1;
21119 PyErr_NoMemory();
21120 D(p->level--);
21121 return NULL;
21122 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021123 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021124 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021125 _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021126 D(p->level--);
21127 return _seq;
21128}
21129
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021130// _loop1_92: compare_op_bitwise_or_pair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021131static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021132_loop1_92_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021133{
21134 D(p->level++);
21135 if (p->error_indicator) {
21136 D(p->level--);
21137 return NULL;
21138 }
21139 void *_res = NULL;
21140 int _mark = p->mark;
21141 int _start_mark = p->mark;
21142 void **_children = PyMem_Malloc(sizeof(void *));
21143 if (!_children) {
21144 p->error_indicator = 1;
21145 PyErr_NoMemory();
21146 D(p->level--);
21147 return NULL;
21148 }
21149 ssize_t _children_capacity = 1;
21150 ssize_t _n = 0;
21151 { // compare_op_bitwise_or_pair
21152 if (p->error_indicator) {
21153 D(p->level--);
21154 return NULL;
21155 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021156 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 +010021157 CmpopExprPair* compare_op_bitwise_or_pair_var;
21158 while (
21159 (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair
21160 )
21161 {
21162 _res = compare_op_bitwise_or_pair_var;
21163 if (_n == _children_capacity) {
21164 _children_capacity *= 2;
21165 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21166 if (!_new_children) {
21167 p->error_indicator = 1;
21168 PyErr_NoMemory();
21169 D(p->level--);
21170 return NULL;
21171 }
21172 _children = _new_children;
21173 }
21174 _children[_n++] = _res;
21175 _mark = p->mark;
21176 }
21177 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021178 D(fprintf(stderr, "%*c%s _loop1_92[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021179 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
21180 }
21181 if (_n == 0 || p->error_indicator) {
21182 PyMem_Free(_children);
21183 D(p->level--);
21184 return NULL;
21185 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021186 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021187 if (!_seq) {
21188 PyMem_Free(_children);
21189 p->error_indicator = 1;
21190 PyErr_NoMemory();
21191 D(p->level--);
21192 return NULL;
21193 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021194 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021195 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021196 _PyPegen_insert_memo(p, _start_mark, _loop1_92_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021197 D(p->level--);
21198 return _seq;
21199}
21200
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021201// _tmp_93: '!='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021202static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021203_tmp_93_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021204{
21205 D(p->level++);
21206 if (p->error_indicator) {
21207 D(p->level--);
21208 return NULL;
21209 }
21210 void * _res = NULL;
21211 int _mark = p->mark;
21212 { // '!='
21213 if (p->error_indicator) {
21214 D(p->level--);
21215 return NULL;
21216 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021217 D(fprintf(stderr, "%*c> _tmp_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021218 Token * tok;
21219 if (
21220 (tok = _PyPegen_expect_token(p, 28)) // token='!='
21221 )
21222 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021223 D(fprintf(stderr, "%*c+ _tmp_93[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021224 _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok;
21225 if (_res == NULL && PyErr_Occurred()) {
21226 p->error_indicator = 1;
21227 D(p->level--);
21228 return NULL;
21229 }
21230 goto done;
21231 }
21232 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021233 D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021234 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
21235 }
21236 _res = NULL;
21237 done:
21238 D(p->level--);
21239 return _res;
21240}
21241
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021242// _loop0_95: ',' slice
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021243static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021244_loop0_95_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021245{
21246 D(p->level++);
21247 if (p->error_indicator) {
21248 D(p->level--);
21249 return NULL;
21250 }
21251 void *_res = NULL;
21252 int _mark = p->mark;
21253 int _start_mark = p->mark;
21254 void **_children = PyMem_Malloc(sizeof(void *));
21255 if (!_children) {
21256 p->error_indicator = 1;
21257 PyErr_NoMemory();
21258 D(p->level--);
21259 return NULL;
21260 }
21261 ssize_t _children_capacity = 1;
21262 ssize_t _n = 0;
21263 { // ',' slice
21264 if (p->error_indicator) {
21265 D(p->level--);
21266 return NULL;
21267 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021268 D(fprintf(stderr, "%*c> _loop0_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021269 Token * _literal;
21270 expr_ty elem;
21271 while (
21272 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21273 &&
21274 (elem = slice_rule(p)) // slice
21275 )
21276 {
21277 _res = elem;
21278 if (_res == NULL && PyErr_Occurred()) {
21279 p->error_indicator = 1;
21280 PyMem_Free(_children);
21281 D(p->level--);
21282 return NULL;
21283 }
21284 if (_n == _children_capacity) {
21285 _children_capacity *= 2;
21286 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21287 if (!_new_children) {
21288 p->error_indicator = 1;
21289 PyErr_NoMemory();
21290 D(p->level--);
21291 return NULL;
21292 }
21293 _children = _new_children;
21294 }
21295 _children[_n++] = _res;
21296 _mark = p->mark;
21297 }
21298 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021299 D(fprintf(stderr, "%*c%s _loop0_95[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021300 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
21301 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021302 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021303 if (!_seq) {
21304 PyMem_Free(_children);
21305 p->error_indicator = 1;
21306 PyErr_NoMemory();
21307 D(p->level--);
21308 return NULL;
21309 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021310 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021311 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021312 _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021313 D(p->level--);
21314 return _seq;
21315}
21316
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021317// _gather_94: slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021318static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021319_gather_94_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021320{
21321 D(p->level++);
21322 if (p->error_indicator) {
21323 D(p->level--);
21324 return NULL;
21325 }
21326 asdl_seq * _res = NULL;
21327 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021328 { // slice _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021329 if (p->error_indicator) {
21330 D(p->level--);
21331 return NULL;
21332 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021333 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 +010021334 expr_ty elem;
21335 asdl_seq * seq;
21336 if (
21337 (elem = slice_rule(p)) // slice
21338 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021339 (seq = _loop0_95_rule(p)) // _loop0_95
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021340 )
21341 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021342 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 +010021343 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21344 goto done;
21345 }
21346 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021347 D(fprintf(stderr, "%*c%s _gather_94[%d-%d]: %s failed!\n", p->level, ' ',
21348 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_95"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021349 }
21350 _res = NULL;
21351 done:
21352 D(p->level--);
21353 return _res;
21354}
21355
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021356// _tmp_96: ':' expression?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021357static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021358_tmp_96_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021359{
21360 D(p->level++);
21361 if (p->error_indicator) {
21362 D(p->level--);
21363 return NULL;
21364 }
21365 void * _res = NULL;
21366 int _mark = p->mark;
21367 { // ':' expression?
21368 if (p->error_indicator) {
21369 D(p->level--);
21370 return NULL;
21371 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021372 D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021373 Token * _literal;
21374 void *d;
21375 if (
21376 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
21377 &&
21378 (d = expression_rule(p), 1) // expression?
21379 )
21380 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021381 D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021382 _res = d;
21383 if (_res == NULL && PyErr_Occurred()) {
21384 p->error_indicator = 1;
21385 D(p->level--);
21386 return NULL;
21387 }
21388 goto done;
21389 }
21390 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021391 D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021392 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
21393 }
21394 _res = NULL;
21395 done:
21396 D(p->level--);
21397 return _res;
21398}
21399
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021400// _tmp_97: tuple | group | genexp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021401static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021402_tmp_97_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021403{
21404 D(p->level++);
21405 if (p->error_indicator) {
21406 D(p->level--);
21407 return NULL;
21408 }
21409 void * _res = NULL;
21410 int _mark = p->mark;
21411 { // tuple
21412 if (p->error_indicator) {
21413 D(p->level--);
21414 return NULL;
21415 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021416 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021417 expr_ty tuple_var;
21418 if (
21419 (tuple_var = tuple_rule(p)) // tuple
21420 )
21421 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021422 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021423 _res = tuple_var;
21424 goto done;
21425 }
21426 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021427 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021428 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
21429 }
21430 { // group
21431 if (p->error_indicator) {
21432 D(p->level--);
21433 return NULL;
21434 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021435 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021436 expr_ty group_var;
21437 if (
21438 (group_var = group_rule(p)) // group
21439 )
21440 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021441 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021442 _res = group_var;
21443 goto done;
21444 }
21445 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021446 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021447 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
21448 }
21449 { // genexp
21450 if (p->error_indicator) {
21451 D(p->level--);
21452 return NULL;
21453 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021454 D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021455 expr_ty genexp_var;
21456 if (
21457 (genexp_var = genexp_rule(p)) // genexp
21458 )
21459 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021460 D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021461 _res = genexp_var;
21462 goto done;
21463 }
21464 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021465 D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021466 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
21467 }
21468 _res = NULL;
21469 done:
21470 D(p->level--);
21471 return _res;
21472}
21473
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021474// _tmp_98: list | listcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021475static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021476_tmp_98_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021477{
21478 D(p->level++);
21479 if (p->error_indicator) {
21480 D(p->level--);
21481 return NULL;
21482 }
21483 void * _res = NULL;
21484 int _mark = p->mark;
21485 { // list
21486 if (p->error_indicator) {
21487 D(p->level--);
21488 return NULL;
21489 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021490 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021491 expr_ty list_var;
21492 if (
21493 (list_var = list_rule(p)) // list
21494 )
21495 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021496 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021497 _res = list_var;
21498 goto done;
21499 }
21500 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021501 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021502 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
21503 }
21504 { // listcomp
21505 if (p->error_indicator) {
21506 D(p->level--);
21507 return NULL;
21508 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021509 D(fprintf(stderr, "%*c> _tmp_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021510 expr_ty listcomp_var;
21511 if (
21512 (listcomp_var = listcomp_rule(p)) // listcomp
21513 )
21514 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021515 D(fprintf(stderr, "%*c+ _tmp_98[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021516 _res = listcomp_var;
21517 goto done;
21518 }
21519 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021520 D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021521 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
21522 }
21523 _res = NULL;
21524 done:
21525 D(p->level--);
21526 return _res;
21527}
21528
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021529// _tmp_99: dict | set | dictcomp | setcomp
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021530static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021531_tmp_99_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021532{
21533 D(p->level++);
21534 if (p->error_indicator) {
21535 D(p->level--);
21536 return NULL;
21537 }
21538 void * _res = NULL;
21539 int _mark = p->mark;
21540 { // dict
21541 if (p->error_indicator) {
21542 D(p->level--);
21543 return NULL;
21544 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021545 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021546 expr_ty dict_var;
21547 if (
21548 (dict_var = dict_rule(p)) // dict
21549 )
21550 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021551 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021552 _res = dict_var;
21553 goto done;
21554 }
21555 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021556 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021557 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
21558 }
21559 { // set
21560 if (p->error_indicator) {
21561 D(p->level--);
21562 return NULL;
21563 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021564 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021565 expr_ty set_var;
21566 if (
21567 (set_var = set_rule(p)) // set
21568 )
21569 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021570 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021571 _res = set_var;
21572 goto done;
21573 }
21574 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021575 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021576 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
21577 }
21578 { // dictcomp
21579 if (p->error_indicator) {
21580 D(p->level--);
21581 return NULL;
21582 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021583 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021584 expr_ty dictcomp_var;
21585 if (
21586 (dictcomp_var = dictcomp_rule(p)) // dictcomp
21587 )
21588 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021589 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021590 _res = dictcomp_var;
21591 goto done;
21592 }
21593 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021594 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021595 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
21596 }
21597 { // setcomp
21598 if (p->error_indicator) {
21599 D(p->level--);
21600 return NULL;
21601 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021602 D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021603 expr_ty setcomp_var;
21604 if (
21605 (setcomp_var = setcomp_rule(p)) // setcomp
21606 )
21607 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021608 D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021609 _res = setcomp_var;
21610 goto done;
21611 }
21612 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021613 D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021614 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
21615 }
21616 _res = NULL;
21617 done:
21618 D(p->level--);
21619 return _res;
21620}
21621
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021622// _loop1_100: STRING
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021623static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021624_loop1_100_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021625{
21626 D(p->level++);
21627 if (p->error_indicator) {
21628 D(p->level--);
21629 return NULL;
21630 }
21631 void *_res = NULL;
21632 int _mark = p->mark;
21633 int _start_mark = p->mark;
21634 void **_children = PyMem_Malloc(sizeof(void *));
21635 if (!_children) {
21636 p->error_indicator = 1;
21637 PyErr_NoMemory();
21638 D(p->level--);
21639 return NULL;
21640 }
21641 ssize_t _children_capacity = 1;
21642 ssize_t _n = 0;
21643 { // STRING
21644 if (p->error_indicator) {
21645 D(p->level--);
21646 return NULL;
21647 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021648 D(fprintf(stderr, "%*c> _loop1_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021649 expr_ty string_var;
21650 while (
21651 (string_var = _PyPegen_string_token(p)) // STRING
21652 )
21653 {
21654 _res = string_var;
21655 if (_n == _children_capacity) {
21656 _children_capacity *= 2;
21657 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21658 if (!_new_children) {
21659 p->error_indicator = 1;
21660 PyErr_NoMemory();
21661 D(p->level--);
21662 return NULL;
21663 }
21664 _children = _new_children;
21665 }
21666 _children[_n++] = _res;
21667 _mark = p->mark;
21668 }
21669 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021670 D(fprintf(stderr, "%*c%s _loop1_100[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021671 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
21672 }
21673 if (_n == 0 || p->error_indicator) {
21674 PyMem_Free(_children);
21675 D(p->level--);
21676 return NULL;
21677 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021678 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021679 if (!_seq) {
21680 PyMem_Free(_children);
21681 p->error_indicator = 1;
21682 PyErr_NoMemory();
21683 D(p->level--);
21684 return NULL;
21685 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021686 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021687 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021688 _PyPegen_insert_memo(p, _start_mark, _loop1_100_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021689 D(p->level--);
21690 return _seq;
21691}
21692
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021693// _tmp_101: star_named_expression ',' star_named_expressions?
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021694static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021695_tmp_101_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021696{
21697 D(p->level++);
21698 if (p->error_indicator) {
21699 D(p->level--);
21700 return NULL;
21701 }
21702 void * _res = NULL;
21703 int _mark = p->mark;
21704 { // star_named_expression ',' star_named_expressions?
21705 if (p->error_indicator) {
21706 D(p->level--);
21707 return NULL;
21708 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021709 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 +010021710 Token * _literal;
21711 expr_ty y;
21712 void *z;
21713 if (
21714 (y = star_named_expression_rule(p)) // star_named_expression
21715 &&
21716 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21717 &&
21718 (z = star_named_expressions_rule(p), 1) // star_named_expressions?
21719 )
21720 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021721 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 +010021722 _res = _PyPegen_seq_insert_in_front ( p , y , z );
21723 if (_res == NULL && PyErr_Occurred()) {
21724 p->error_indicator = 1;
21725 D(p->level--);
21726 return NULL;
21727 }
21728 goto done;
21729 }
21730 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021731 D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021732 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
21733 }
21734 _res = NULL;
21735 done:
21736 D(p->level--);
21737 return _res;
21738}
21739
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021740// _tmp_102: yield_expr | named_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021741static void *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021742_tmp_102_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021743{
21744 D(p->level++);
21745 if (p->error_indicator) {
21746 D(p->level--);
21747 return NULL;
21748 }
21749 void * _res = NULL;
21750 int _mark = p->mark;
21751 { // yield_expr
21752 if (p->error_indicator) {
21753 D(p->level--);
21754 return NULL;
21755 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021756 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021757 expr_ty yield_expr_var;
21758 if (
21759 (yield_expr_var = yield_expr_rule(p)) // yield_expr
21760 )
21761 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021762 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 +010021763 _res = yield_expr_var;
21764 goto done;
21765 }
21766 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021767 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021768 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
21769 }
21770 { // named_expression
21771 if (p->error_indicator) {
21772 D(p->level--);
21773 return NULL;
21774 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021775 D(fprintf(stderr, "%*c> _tmp_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021776 expr_ty named_expression_var;
21777 if (
21778 (named_expression_var = named_expression_rule(p)) // named_expression
21779 )
21780 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021781 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 +010021782 _res = named_expression_var;
21783 goto done;
21784 }
21785 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021786 D(fprintf(stderr, "%*c%s _tmp_102[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021787 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
21788 }
21789 _res = NULL;
21790 done:
21791 D(p->level--);
21792 return _res;
21793}
21794
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021795// _loop0_104: ',' double_starred_kvpair
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021796static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021797_loop0_104_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021798{
21799 D(p->level++);
21800 if (p->error_indicator) {
21801 D(p->level--);
21802 return NULL;
21803 }
21804 void *_res = NULL;
21805 int _mark = p->mark;
21806 int _start_mark = p->mark;
21807 void **_children = PyMem_Malloc(sizeof(void *));
21808 if (!_children) {
21809 p->error_indicator = 1;
21810 PyErr_NoMemory();
21811 D(p->level--);
21812 return NULL;
21813 }
21814 ssize_t _children_capacity = 1;
21815 ssize_t _n = 0;
21816 { // ',' double_starred_kvpair
21817 if (p->error_indicator) {
21818 D(p->level--);
21819 return NULL;
21820 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021821 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 +010021822 Token * _literal;
21823 KeyValuePair* elem;
21824 while (
21825 (_literal = _PyPegen_expect_token(p, 12)) // token=','
21826 &&
21827 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21828 )
21829 {
21830 _res = elem;
21831 if (_res == NULL && PyErr_Occurred()) {
21832 p->error_indicator = 1;
21833 PyMem_Free(_children);
21834 D(p->level--);
21835 return NULL;
21836 }
21837 if (_n == _children_capacity) {
21838 _children_capacity *= 2;
21839 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21840 if (!_new_children) {
21841 p->error_indicator = 1;
21842 PyErr_NoMemory();
21843 D(p->level--);
21844 return NULL;
21845 }
21846 _children = _new_children;
21847 }
21848 _children[_n++] = _res;
21849 _mark = p->mark;
21850 }
21851 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021852 D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021853 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
21854 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021855 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021856 if (!_seq) {
21857 PyMem_Free(_children);
21858 p->error_indicator = 1;
21859 PyErr_NoMemory();
21860 D(p->level--);
21861 return NULL;
21862 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021863 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021864 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021865 _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021866 D(p->level--);
21867 return _seq;
21868}
21869
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021870// _gather_103: double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021871static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021872_gather_103_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021873{
21874 D(p->level++);
21875 if (p->error_indicator) {
21876 D(p->level--);
21877 return NULL;
21878 }
21879 asdl_seq * _res = NULL;
21880 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021881 { // double_starred_kvpair _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021882 if (p->error_indicator) {
21883 D(p->level--);
21884 return NULL;
21885 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021886 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 +010021887 KeyValuePair* elem;
21888 asdl_seq * seq;
21889 if (
21890 (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
21891 &&
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021892 (seq = _loop0_104_rule(p)) // _loop0_104
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021893 )
21894 {
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021895 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 +010021896 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
21897 goto done;
21898 }
21899 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021900 D(fprintf(stderr, "%*c%s _gather_103[%d-%d]: %s failed!\n", p->level, ' ',
21901 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_104"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021902 }
21903 _res = NULL;
21904 done:
21905 D(p->level--);
21906 return _res;
21907}
21908
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021909// _loop1_105: for_if_clause
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021910static asdl_seq *
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021911_loop1_105_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021912{
21913 D(p->level++);
21914 if (p->error_indicator) {
21915 D(p->level--);
21916 return NULL;
21917 }
21918 void *_res = NULL;
21919 int _mark = p->mark;
21920 int _start_mark = p->mark;
21921 void **_children = PyMem_Malloc(sizeof(void *));
21922 if (!_children) {
21923 p->error_indicator = 1;
21924 PyErr_NoMemory();
21925 D(p->level--);
21926 return NULL;
21927 }
21928 ssize_t _children_capacity = 1;
21929 ssize_t _n = 0;
21930 { // for_if_clause
21931 if (p->error_indicator) {
21932 D(p->level--);
21933 return NULL;
21934 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021935 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 +010021936 comprehension_ty for_if_clause_var;
21937 while (
21938 (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause
21939 )
21940 {
21941 _res = for_if_clause_var;
21942 if (_n == _children_capacity) {
21943 _children_capacity *= 2;
21944 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
21945 if (!_new_children) {
21946 p->error_indicator = 1;
21947 PyErr_NoMemory();
21948 D(p->level--);
21949 return NULL;
21950 }
21951 _children = _new_children;
21952 }
21953 _children[_n++] = _res;
21954 _mark = p->mark;
21955 }
21956 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021957 D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021958 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
21959 }
21960 if (_n == 0 || p->error_indicator) {
21961 PyMem_Free(_children);
21962 D(p->level--);
21963 return NULL;
21964 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021965 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021966 if (!_seq) {
21967 PyMem_Free(_children);
21968 p->error_indicator = 1;
21969 PyErr_NoMemory();
21970 D(p->level--);
21971 return NULL;
21972 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010021973 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021974 PyMem_Free(_children);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030021975 _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010021976 D(p->level--);
21977 return _seq;
21978}
21979
21980// _loop0_106: ('if' disjunction)
21981static asdl_seq *
21982_loop0_106_rule(Parser *p)
21983{
21984 D(p->level++);
21985 if (p->error_indicator) {
21986 D(p->level--);
21987 return NULL;
21988 }
21989 void *_res = NULL;
21990 int _mark = p->mark;
21991 int _start_mark = p->mark;
21992 void **_children = PyMem_Malloc(sizeof(void *));
21993 if (!_children) {
21994 p->error_indicator = 1;
21995 PyErr_NoMemory();
21996 D(p->level--);
21997 return NULL;
21998 }
21999 ssize_t _children_capacity = 1;
22000 ssize_t _n = 0;
22001 { // ('if' disjunction)
22002 if (p->error_indicator) {
22003 D(p->level--);
22004 return NULL;
22005 }
22006 D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010022007 void *_tmp_147_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022008 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022009 (_tmp_147_var = _tmp_147_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022010 )
22011 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022012 _res = _tmp_147_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022013 if (_n == _children_capacity) {
22014 _children_capacity *= 2;
22015 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22016 if (!_new_children) {
22017 p->error_indicator = 1;
22018 PyErr_NoMemory();
22019 D(p->level--);
22020 return NULL;
22021 }
22022 _children = _new_children;
22023 }
22024 _children[_n++] = _res;
22025 _mark = p->mark;
22026 }
22027 p->mark = _mark;
22028 D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ',
22029 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
22030 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022031 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022032 if (!_seq) {
22033 PyMem_Free(_children);
22034 p->error_indicator = 1;
22035 PyErr_NoMemory();
22036 D(p->level--);
22037 return NULL;
22038 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022039 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022040 PyMem_Free(_children);
22041 _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq);
22042 D(p->level--);
22043 return _seq;
22044}
22045
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022046// _loop0_107: ('if' disjunction)
22047static asdl_seq *
22048_loop0_107_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022049{
22050 D(p->level++);
22051 if (p->error_indicator) {
22052 D(p->level--);
22053 return NULL;
22054 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022055 void *_res = NULL;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022056 int _mark = p->mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022057 int _start_mark = p->mark;
22058 void **_children = PyMem_Malloc(sizeof(void *));
22059 if (!_children) {
22060 p->error_indicator = 1;
22061 PyErr_NoMemory();
22062 D(p->level--);
22063 return NULL;
22064 }
22065 ssize_t _children_capacity = 1;
22066 ssize_t _n = 0;
22067 { // ('if' disjunction)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022068 if (p->error_indicator) {
22069 D(p->level--);
22070 return NULL;
22071 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022072 D(fprintf(stderr, "%*c> _loop0_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010022073 void *_tmp_148_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022074 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022075 (_tmp_148_var = _tmp_148_rule(p)) // 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022076 )
22077 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022078 _res = _tmp_148_var;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022079 if (_n == _children_capacity) {
22080 _children_capacity *= 2;
22081 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22082 if (!_new_children) {
22083 p->error_indicator = 1;
22084 PyErr_NoMemory();
22085 D(p->level--);
22086 return NULL;
22087 }
22088 _children = _new_children;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022089 }
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022090 _children[_n++] = _res;
22091 _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022092 }
22093 p->mark = _mark;
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022094 D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ',
22095 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022096 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022097 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022098 if (!_seq) {
22099 PyMem_Free(_children);
22100 p->error_indicator = 1;
22101 PyErr_NoMemory();
22102 D(p->level--);
22103 return NULL;
22104 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022105 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022106 PyMem_Free(_children);
22107 _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022108 D(p->level--);
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022109 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022110}
22111
Pablo Galindo4a97b152020-09-02 17:44:19 +010022112// _loop0_109: ',' (starred_expression | named_expression !'=')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022113static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022114_loop0_109_rule(Parser *p)
22115{
22116 D(p->level++);
22117 if (p->error_indicator) {
22118 D(p->level--);
22119 return NULL;
22120 }
22121 void *_res = NULL;
22122 int _mark = p->mark;
22123 int _start_mark = p->mark;
22124 void **_children = PyMem_Malloc(sizeof(void *));
22125 if (!_children) {
22126 p->error_indicator = 1;
22127 PyErr_NoMemory();
22128 D(p->level--);
22129 return NULL;
22130 }
22131 ssize_t _children_capacity = 1;
22132 ssize_t _n = 0;
22133 { // ',' (starred_expression | named_expression !'=')
22134 if (p->error_indicator) {
22135 D(p->level--);
22136 return NULL;
22137 }
22138 D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
22139 Token * _literal;
22140 void *elem;
22141 while (
22142 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22143 &&
22144 (elem = _tmp_149_rule(p)) // starred_expression | named_expression !'='
22145 )
22146 {
22147 _res = elem;
22148 if (_res == NULL && PyErr_Occurred()) {
22149 p->error_indicator = 1;
22150 PyMem_Free(_children);
22151 D(p->level--);
22152 return NULL;
22153 }
22154 if (_n == _children_capacity) {
22155 _children_capacity *= 2;
22156 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22157 if (!_new_children) {
22158 p->error_indicator = 1;
22159 PyErr_NoMemory();
22160 D(p->level--);
22161 return NULL;
22162 }
22163 _children = _new_children;
22164 }
22165 _children[_n++] = _res;
22166 _mark = p->mark;
22167 }
22168 p->mark = _mark;
22169 D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ',
22170 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
22171 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022172 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022173 if (!_seq) {
22174 PyMem_Free(_children);
22175 p->error_indicator = 1;
22176 PyErr_NoMemory();
22177 D(p->level--);
22178 return NULL;
22179 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022180 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022181 PyMem_Free(_children);
22182 _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq);
22183 D(p->level--);
22184 return _seq;
22185}
22186
22187// _gather_108: (starred_expression | named_expression !'=') _loop0_109
22188static asdl_seq *
22189_gather_108_rule(Parser *p)
22190{
22191 D(p->level++);
22192 if (p->error_indicator) {
22193 D(p->level--);
22194 return NULL;
22195 }
22196 asdl_seq * _res = NULL;
22197 int _mark = p->mark;
22198 { // (starred_expression | named_expression !'=') _loop0_109
22199 if (p->error_indicator) {
22200 D(p->level--);
22201 return NULL;
22202 }
22203 D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22204 void *elem;
22205 asdl_seq * seq;
22206 if (
22207 (elem = _tmp_149_rule(p)) // starred_expression | named_expression !'='
22208 &&
22209 (seq = _loop0_109_rule(p)) // _loop0_109
22210 )
22211 {
22212 D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22213 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22214 goto done;
22215 }
22216 p->mark = _mark;
22217 D(fprintf(stderr, "%*c%s _gather_108[%d-%d]: %s failed!\n", p->level, ' ',
22218 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_109"));
22219 }
22220 _res = NULL;
22221 done:
22222 D(p->level--);
22223 return _res;
22224}
22225
22226// _tmp_110: ',' kwargs
22227static void *
22228_tmp_110_rule(Parser *p)
22229{
22230 D(p->level++);
22231 if (p->error_indicator) {
22232 D(p->level--);
22233 return NULL;
22234 }
22235 void * _res = NULL;
22236 int _mark = p->mark;
22237 { // ',' kwargs
22238 if (p->error_indicator) {
22239 D(p->level--);
22240 return NULL;
22241 }
22242 D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
22243 Token * _literal;
22244 asdl_seq* k;
22245 if (
22246 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22247 &&
22248 (k = kwargs_rule(p)) // kwargs
22249 )
22250 {
22251 D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
22252 _res = k;
22253 if (_res == NULL && PyErr_Occurred()) {
22254 p->error_indicator = 1;
22255 D(p->level--);
22256 return NULL;
22257 }
22258 goto done;
22259 }
22260 p->mark = _mark;
22261 D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ',
22262 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs"));
22263 }
22264 _res = NULL;
22265 done:
22266 D(p->level--);
22267 return _res;
22268}
22269
22270// _loop0_112: ',' kwarg_or_starred
22271static asdl_seq *
22272_loop0_112_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022273{
22274 D(p->level++);
22275 if (p->error_indicator) {
22276 D(p->level--);
22277 return NULL;
22278 }
22279 void *_res = NULL;
22280 int _mark = p->mark;
22281 int _start_mark = p->mark;
22282 void **_children = PyMem_Malloc(sizeof(void *));
22283 if (!_children) {
22284 p->error_indicator = 1;
22285 PyErr_NoMemory();
22286 D(p->level--);
22287 return NULL;
22288 }
22289 ssize_t _children_capacity = 1;
22290 ssize_t _n = 0;
22291 { // ',' kwarg_or_starred
22292 if (p->error_indicator) {
22293 D(p->level--);
22294 return NULL;
22295 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022296 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 +010022297 Token * _literal;
22298 KeywordOrStarred* elem;
22299 while (
22300 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22301 &&
22302 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22303 )
22304 {
22305 _res = elem;
22306 if (_res == NULL && PyErr_Occurred()) {
22307 p->error_indicator = 1;
22308 PyMem_Free(_children);
22309 D(p->level--);
22310 return NULL;
22311 }
22312 if (_n == _children_capacity) {
22313 _children_capacity *= 2;
22314 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22315 if (!_new_children) {
22316 p->error_indicator = 1;
22317 PyErr_NoMemory();
22318 D(p->level--);
22319 return NULL;
22320 }
22321 _children = _new_children;
22322 }
22323 _children[_n++] = _res;
22324 _mark = p->mark;
22325 }
22326 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022327 D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022328 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22329 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022330 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022331 if (!_seq) {
22332 PyMem_Free(_children);
22333 p->error_indicator = 1;
22334 PyErr_NoMemory();
22335 D(p->level--);
22336 return NULL;
22337 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022338 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022339 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022340 _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022341 D(p->level--);
22342 return _seq;
22343}
22344
Pablo Galindo4a97b152020-09-02 17:44:19 +010022345// _gather_111: kwarg_or_starred _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022346static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022347_gather_111_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022348{
22349 D(p->level++);
22350 if (p->error_indicator) {
22351 D(p->level--);
22352 return NULL;
22353 }
22354 asdl_seq * _res = NULL;
22355 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022356 { // kwarg_or_starred _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022357 if (p->error_indicator) {
22358 D(p->level--);
22359 return NULL;
22360 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022361 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 +010022362 KeywordOrStarred* elem;
22363 asdl_seq * seq;
22364 if (
22365 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22366 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022367 (seq = _loop0_112_rule(p)) // _loop0_112
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022368 )
22369 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022370 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 +010022371 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22372 goto done;
22373 }
22374 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022375 D(fprintf(stderr, "%*c%s _gather_111[%d-%d]: %s failed!\n", p->level, ' ',
22376 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_112"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022377 }
22378 _res = NULL;
22379 done:
22380 D(p->level--);
22381 return _res;
22382}
22383
Pablo Galindo4a97b152020-09-02 17:44:19 +010022384// _loop0_114: ',' kwarg_or_double_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022385static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022386_loop0_114_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022387{
22388 D(p->level++);
22389 if (p->error_indicator) {
22390 D(p->level--);
22391 return NULL;
22392 }
22393 void *_res = NULL;
22394 int _mark = p->mark;
22395 int _start_mark = p->mark;
22396 void **_children = PyMem_Malloc(sizeof(void *));
22397 if (!_children) {
22398 p->error_indicator = 1;
22399 PyErr_NoMemory();
22400 D(p->level--);
22401 return NULL;
22402 }
22403 ssize_t _children_capacity = 1;
22404 ssize_t _n = 0;
22405 { // ',' kwarg_or_double_starred
22406 if (p->error_indicator) {
22407 D(p->level--);
22408 return NULL;
22409 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022410 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 +010022411 Token * _literal;
22412 KeywordOrStarred* elem;
22413 while (
22414 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22415 &&
22416 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22417 )
22418 {
22419 _res = elem;
22420 if (_res == NULL && PyErr_Occurred()) {
22421 p->error_indicator = 1;
22422 PyMem_Free(_children);
22423 D(p->level--);
22424 return NULL;
22425 }
22426 if (_n == _children_capacity) {
22427 _children_capacity *= 2;
22428 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22429 if (!_new_children) {
22430 p->error_indicator = 1;
22431 PyErr_NoMemory();
22432 D(p->level--);
22433 return NULL;
22434 }
22435 _children = _new_children;
22436 }
22437 _children[_n++] = _res;
22438 _mark = p->mark;
22439 }
22440 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022441 D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022442 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22443 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022444 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022445 if (!_seq) {
22446 PyMem_Free(_children);
22447 p->error_indicator = 1;
22448 PyErr_NoMemory();
22449 D(p->level--);
22450 return NULL;
22451 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022452 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022453 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022454 _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022455 D(p->level--);
22456 return _seq;
22457}
22458
Pablo Galindo4a97b152020-09-02 17:44:19 +010022459// _gather_113: kwarg_or_double_starred _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022460static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022461_gather_113_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022462{
22463 D(p->level++);
22464 if (p->error_indicator) {
22465 D(p->level--);
22466 return NULL;
22467 }
22468 asdl_seq * _res = NULL;
22469 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022470 { // kwarg_or_double_starred _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022471 if (p->error_indicator) {
22472 D(p->level--);
22473 return NULL;
22474 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022475 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 +010022476 KeywordOrStarred* elem;
22477 asdl_seq * seq;
22478 if (
22479 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22480 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022481 (seq = _loop0_114_rule(p)) // _loop0_114
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022482 )
22483 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022484 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 +010022485 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22486 goto done;
22487 }
22488 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022489 D(fprintf(stderr, "%*c%s _gather_113[%d-%d]: %s failed!\n", p->level, ' ',
22490 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_114"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022491 }
22492 _res = NULL;
22493 done:
22494 D(p->level--);
22495 return _res;
22496}
22497
Pablo Galindo4a97b152020-09-02 17:44:19 +010022498// _loop0_116: ',' kwarg_or_starred
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022499static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022500_loop0_116_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022501{
22502 D(p->level++);
22503 if (p->error_indicator) {
22504 D(p->level--);
22505 return NULL;
22506 }
22507 void *_res = NULL;
22508 int _mark = p->mark;
22509 int _start_mark = p->mark;
22510 void **_children = PyMem_Malloc(sizeof(void *));
22511 if (!_children) {
22512 p->error_indicator = 1;
22513 PyErr_NoMemory();
22514 D(p->level--);
22515 return NULL;
22516 }
22517 ssize_t _children_capacity = 1;
22518 ssize_t _n = 0;
22519 { // ',' kwarg_or_starred
22520 if (p->error_indicator) {
22521 D(p->level--);
22522 return NULL;
22523 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022524 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 +010022525 Token * _literal;
22526 KeywordOrStarred* elem;
22527 while (
22528 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22529 &&
22530 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22531 )
22532 {
22533 _res = elem;
22534 if (_res == NULL && PyErr_Occurred()) {
22535 p->error_indicator = 1;
22536 PyMem_Free(_children);
22537 D(p->level--);
22538 return NULL;
22539 }
22540 if (_n == _children_capacity) {
22541 _children_capacity *= 2;
22542 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22543 if (!_new_children) {
22544 p->error_indicator = 1;
22545 PyErr_NoMemory();
22546 D(p->level--);
22547 return NULL;
22548 }
22549 _children = _new_children;
22550 }
22551 _children[_n++] = _res;
22552 _mark = p->mark;
22553 }
22554 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022555 D(fprintf(stderr, "%*c%s _loop0_116[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022556 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
22557 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022558 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022559 if (!_seq) {
22560 PyMem_Free(_children);
22561 p->error_indicator = 1;
22562 PyErr_NoMemory();
22563 D(p->level--);
22564 return NULL;
22565 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022566 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022567 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022568 _PyPegen_insert_memo(p, _start_mark, _loop0_116_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022569 D(p->level--);
22570 return _seq;
22571}
22572
Pablo Galindo4a97b152020-09-02 17:44:19 +010022573// _gather_115: kwarg_or_starred _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022574static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022575_gather_115_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022576{
22577 D(p->level++);
22578 if (p->error_indicator) {
22579 D(p->level--);
22580 return NULL;
22581 }
22582 asdl_seq * _res = NULL;
22583 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022584 { // kwarg_or_starred _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022585 if (p->error_indicator) {
22586 D(p->level--);
22587 return NULL;
22588 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022589 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 +010022590 KeywordOrStarred* elem;
22591 asdl_seq * seq;
22592 if (
22593 (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
22594 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022595 (seq = _loop0_116_rule(p)) // _loop0_116
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022596 )
22597 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022598 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 +010022599 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22600 goto done;
22601 }
22602 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022603 D(fprintf(stderr, "%*c%s _gather_115[%d-%d]: %s failed!\n", p->level, ' ',
22604 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_116"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022605 }
22606 _res = NULL;
22607 done:
22608 D(p->level--);
22609 return _res;
22610}
22611
Pablo Galindo4a97b152020-09-02 17:44:19 +010022612// _loop0_118: ',' kwarg_or_double_starred
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030022613static asdl_seq *
22614_loop0_118_rule(Parser *p)
22615{
22616 D(p->level++);
22617 if (p->error_indicator) {
22618 D(p->level--);
22619 return NULL;
22620 }
22621 void *_res = NULL;
22622 int _mark = p->mark;
22623 int _start_mark = p->mark;
22624 void **_children = PyMem_Malloc(sizeof(void *));
22625 if (!_children) {
22626 p->error_indicator = 1;
22627 PyErr_NoMemory();
22628 D(p->level--);
22629 return NULL;
22630 }
22631 ssize_t _children_capacity = 1;
22632 ssize_t _n = 0;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022633 { // ',' kwarg_or_double_starred
22634 if (p->error_indicator) {
22635 D(p->level--);
22636 return NULL;
22637 }
22638 D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
22639 Token * _literal;
22640 KeywordOrStarred* elem;
22641 while (
22642 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22643 &&
22644 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22645 )
22646 {
22647 _res = elem;
22648 if (_res == NULL && PyErr_Occurred()) {
22649 p->error_indicator = 1;
22650 PyMem_Free(_children);
22651 D(p->level--);
22652 return NULL;
22653 }
22654 if (_n == _children_capacity) {
22655 _children_capacity *= 2;
22656 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22657 if (!_new_children) {
22658 p->error_indicator = 1;
22659 PyErr_NoMemory();
22660 D(p->level--);
22661 return NULL;
22662 }
22663 _children = _new_children;
22664 }
22665 _children[_n++] = _res;
22666 _mark = p->mark;
22667 }
22668 p->mark = _mark;
22669 D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ',
22670 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
22671 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022672 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022673 if (!_seq) {
22674 PyMem_Free(_children);
22675 p->error_indicator = 1;
22676 PyErr_NoMemory();
22677 D(p->level--);
22678 return NULL;
22679 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022680 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022681 PyMem_Free(_children);
22682 _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq);
22683 D(p->level--);
22684 return _seq;
22685}
22686
22687// _gather_117: kwarg_or_double_starred _loop0_118
22688static asdl_seq *
22689_gather_117_rule(Parser *p)
22690{
22691 D(p->level++);
22692 if (p->error_indicator) {
22693 D(p->level--);
22694 return NULL;
22695 }
22696 asdl_seq * _res = NULL;
22697 int _mark = p->mark;
22698 { // kwarg_or_double_starred _loop0_118
22699 if (p->error_indicator) {
22700 D(p->level--);
22701 return NULL;
22702 }
22703 D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22704 KeywordOrStarred* elem;
22705 asdl_seq * seq;
22706 if (
22707 (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
22708 &&
22709 (seq = _loop0_118_rule(p)) // _loop0_118
22710 )
22711 {
22712 D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22713 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22714 goto done;
22715 }
22716 p->mark = _mark;
22717 D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ',
22718 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_118"));
22719 }
22720 _res = NULL;
22721 done:
22722 D(p->level--);
22723 return _res;
22724}
22725
22726// _loop0_119: (',' star_target)
22727static asdl_seq *
22728_loop0_119_rule(Parser *p)
22729{
22730 D(p->level++);
22731 if (p->error_indicator) {
22732 D(p->level--);
22733 return NULL;
22734 }
22735 void *_res = NULL;
22736 int _mark = p->mark;
22737 int _start_mark = p->mark;
22738 void **_children = PyMem_Malloc(sizeof(void *));
22739 if (!_children) {
22740 p->error_indicator = 1;
22741 PyErr_NoMemory();
22742 D(p->level--);
22743 return NULL;
22744 }
22745 ssize_t _children_capacity = 1;
22746 ssize_t _n = 0;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022747 { // (',' star_target)
22748 if (p->error_indicator) {
22749 D(p->level--);
22750 return NULL;
22751 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022752 D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
22753 void *_tmp_150_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022754 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010022755 (_tmp_150_var = _tmp_150_rule(p)) // ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022756 )
22757 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022758 _res = _tmp_150_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022759 if (_n == _children_capacity) {
22760 _children_capacity *= 2;
22761 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22762 if (!_new_children) {
22763 p->error_indicator = 1;
22764 PyErr_NoMemory();
22765 D(p->level--);
22766 return NULL;
22767 }
22768 _children = _new_children;
22769 }
22770 _children[_n++] = _res;
22771 _mark = p->mark;
22772 }
22773 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022774 D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022775 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
22776 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022777 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022778 if (!_seq) {
22779 PyMem_Free(_children);
22780 p->error_indicator = 1;
22781 PyErr_NoMemory();
22782 D(p->level--);
22783 return NULL;
22784 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022785 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022786 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022787 _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022788 D(p->level--);
22789 return _seq;
22790}
22791
Pablo Galindo4a97b152020-09-02 17:44:19 +010022792// _loop0_121: ',' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022793static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022794_loop0_121_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022795{
22796 D(p->level++);
22797 if (p->error_indicator) {
22798 D(p->level--);
22799 return NULL;
22800 }
22801 void *_res = NULL;
22802 int _mark = p->mark;
22803 int _start_mark = p->mark;
22804 void **_children = PyMem_Malloc(sizeof(void *));
22805 if (!_children) {
22806 p->error_indicator = 1;
22807 PyErr_NoMemory();
22808 D(p->level--);
22809 return NULL;
22810 }
22811 ssize_t _children_capacity = 1;
22812 ssize_t _n = 0;
22813 { // ',' star_target
22814 if (p->error_indicator) {
22815 D(p->level--);
22816 return NULL;
22817 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022818 D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022819 Token * _literal;
22820 expr_ty elem;
22821 while (
22822 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22823 &&
22824 (elem = star_target_rule(p)) // star_target
22825 )
22826 {
22827 _res = elem;
22828 if (_res == NULL && PyErr_Occurred()) {
22829 p->error_indicator = 1;
22830 PyMem_Free(_children);
22831 D(p->level--);
22832 return NULL;
22833 }
22834 if (_n == _children_capacity) {
22835 _children_capacity *= 2;
22836 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22837 if (!_new_children) {
22838 p->error_indicator = 1;
22839 PyErr_NoMemory();
22840 D(p->level--);
22841 return NULL;
22842 }
22843 _children = _new_children;
22844 }
22845 _children[_n++] = _res;
22846 _mark = p->mark;
22847 }
22848 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022849 D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022850 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
22851 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022852 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022853 if (!_seq) {
22854 PyMem_Free(_children);
22855 p->error_indicator = 1;
22856 PyErr_NoMemory();
22857 D(p->level--);
22858 return NULL;
22859 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010022860 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022861 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010022862 _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022863 D(p->level--);
22864 return _seq;
22865}
22866
Pablo Galindo4a97b152020-09-02 17:44:19 +010022867// _gather_120: star_target _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022868static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022869_gather_120_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022870{
22871 D(p->level++);
22872 if (p->error_indicator) {
22873 D(p->level--);
22874 return NULL;
22875 }
22876 asdl_seq * _res = NULL;
22877 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022878 { // star_target _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022879 if (p->error_indicator) {
22880 D(p->level--);
22881 return NULL;
22882 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022883 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 +010022884 expr_ty elem;
22885 asdl_seq * seq;
22886 if (
22887 (elem = star_target_rule(p)) // star_target
22888 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010022889 (seq = _loop0_121_rule(p)) // _loop0_121
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022890 )
22891 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022892 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 +010022893 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
22894 goto done;
22895 }
22896 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022897 D(fprintf(stderr, "%*c%s _gather_120[%d-%d]: %s failed!\n", p->level, ' ',
22898 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_121"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022899 }
22900 _res = NULL;
22901 done:
22902 D(p->level--);
22903 return _res;
22904}
22905
Pablo Galindo4a97b152020-09-02 17:44:19 +010022906// _tmp_122: !'*' star_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022907static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022908_tmp_122_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022909{
22910 D(p->level++);
22911 if (p->error_indicator) {
22912 D(p->level--);
22913 return NULL;
22914 }
22915 void * _res = NULL;
22916 int _mark = p->mark;
22917 { // !'*' star_target
22918 if (p->error_indicator) {
22919 D(p->level--);
22920 return NULL;
22921 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022922 D(fprintf(stderr, "%*c> _tmp_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022923 expr_ty star_target_var;
22924 if (
22925 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*'
22926 &&
22927 (star_target_var = star_target_rule(p)) // star_target
22928 )
22929 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010022930 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 +010022931 _res = star_target_var;
22932 goto done;
22933 }
22934 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010022935 D(fprintf(stderr, "%*c%s _tmp_122[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022936 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
22937 }
22938 _res = NULL;
22939 done:
22940 D(p->level--);
22941 return _res;
22942}
22943
Pablo Galindo4a97b152020-09-02 17:44:19 +010022944// _loop0_124: ',' del_target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022945static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010022946_loop0_124_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022947{
22948 D(p->level++);
22949 if (p->error_indicator) {
22950 D(p->level--);
22951 return NULL;
22952 }
22953 void *_res = NULL;
22954 int _mark = p->mark;
22955 int _start_mark = p->mark;
22956 void **_children = PyMem_Malloc(sizeof(void *));
22957 if (!_children) {
22958 p->error_indicator = 1;
22959 PyErr_NoMemory();
22960 D(p->level--);
22961 return NULL;
22962 }
22963 ssize_t _children_capacity = 1;
22964 ssize_t _n = 0;
22965 { // ',' del_target
22966 if (p->error_indicator) {
22967 D(p->level--);
22968 return NULL;
22969 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010022970 D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010022971 Token * _literal;
22972 expr_ty elem;
22973 while (
22974 (_literal = _PyPegen_expect_token(p, 12)) // token=','
22975 &&
22976 (elem = del_target_rule(p)) // del_target
22977 )
22978 {
22979 _res = elem;
22980 if (_res == NULL && PyErr_Occurred()) {
22981 p->error_indicator = 1;
22982 PyMem_Free(_children);
22983 D(p->level--);
22984 return NULL;
22985 }
22986 if (_n == _children_capacity) {
22987 _children_capacity *= 2;
22988 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
22989 if (!_new_children) {
22990 p->error_indicator = 1;
22991 PyErr_NoMemory();
22992 D(p->level--);
22993 return NULL;
22994 }
22995 _children = _new_children;
22996 }
22997 _children[_n++] = _res;
22998 _mark = p->mark;
22999 }
23000 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023001 D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023002 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
23003 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023004 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023005 if (!_seq) {
23006 PyMem_Free(_children);
23007 p->error_indicator = 1;
23008 PyErr_NoMemory();
23009 D(p->level--);
23010 return NULL;
23011 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023012 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023013 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023014 _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023015 D(p->level--);
23016 return _seq;
23017}
23018
Pablo Galindo4a97b152020-09-02 17:44:19 +010023019// _gather_123: del_target _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023020static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023021_gather_123_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023022{
23023 D(p->level++);
23024 if (p->error_indicator) {
23025 D(p->level--);
23026 return NULL;
23027 }
23028 asdl_seq * _res = NULL;
23029 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023030 { // del_target _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023031 if (p->error_indicator) {
23032 D(p->level--);
23033 return NULL;
23034 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023035 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 +010023036 expr_ty elem;
23037 asdl_seq * seq;
23038 if (
23039 (elem = del_target_rule(p)) // del_target
23040 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023041 (seq = _loop0_124_rule(p)) // _loop0_124
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023042 )
23043 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023044 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 +010023045 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23046 goto done;
23047 }
23048 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023049 D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ',
23050 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_124"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023051 }
23052 _res = NULL;
23053 done:
23054 D(p->level--);
23055 return _res;
23056}
23057
Pablo Galindo4a97b152020-09-02 17:44:19 +010023058// _loop0_126: ',' target
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023059static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023060_loop0_126_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023061{
23062 D(p->level++);
23063 if (p->error_indicator) {
23064 D(p->level--);
23065 return NULL;
23066 }
23067 void *_res = NULL;
23068 int _mark = p->mark;
23069 int _start_mark = p->mark;
23070 void **_children = PyMem_Malloc(sizeof(void *));
23071 if (!_children) {
23072 p->error_indicator = 1;
23073 PyErr_NoMemory();
23074 D(p->level--);
23075 return NULL;
23076 }
23077 ssize_t _children_capacity = 1;
23078 ssize_t _n = 0;
23079 { // ',' target
23080 if (p->error_indicator) {
23081 D(p->level--);
23082 return NULL;
23083 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023084 D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023085 Token * _literal;
23086 expr_ty elem;
23087 while (
23088 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23089 &&
23090 (elem = target_rule(p)) // target
23091 )
23092 {
23093 _res = elem;
23094 if (_res == NULL && PyErr_Occurred()) {
23095 p->error_indicator = 1;
23096 PyMem_Free(_children);
23097 D(p->level--);
23098 return NULL;
23099 }
23100 if (_n == _children_capacity) {
23101 _children_capacity *= 2;
23102 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23103 if (!_new_children) {
23104 p->error_indicator = 1;
23105 PyErr_NoMemory();
23106 D(p->level--);
23107 return NULL;
23108 }
23109 _children = _new_children;
23110 }
23111 _children[_n++] = _res;
23112 _mark = p->mark;
23113 }
23114 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023115 D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023116 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target"));
23117 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023118 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023119 if (!_seq) {
23120 PyMem_Free(_children);
23121 p->error_indicator = 1;
23122 PyErr_NoMemory();
23123 D(p->level--);
23124 return NULL;
23125 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023126 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023127 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023128 _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023129 D(p->level--);
23130 return _seq;
23131}
23132
Pablo Galindo4a97b152020-09-02 17:44:19 +010023133// _gather_125: target _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023134static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023135_gather_125_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023136{
23137 D(p->level++);
23138 if (p->error_indicator) {
23139 D(p->level--);
23140 return NULL;
23141 }
23142 asdl_seq * _res = NULL;
23143 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023144 { // target _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023145 if (p->error_indicator) {
23146 D(p->level--);
23147 return NULL;
23148 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023149 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 +010023150 expr_ty elem;
23151 asdl_seq * seq;
23152 if (
23153 (elem = target_rule(p)) // target
23154 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023155 (seq = _loop0_126_rule(p)) // _loop0_126
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023156 )
23157 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023158 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 +010023159 _res = _PyPegen_seq_insert_in_front(p, elem, seq);
23160 goto done;
23161 }
23162 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023163 D(fprintf(stderr, "%*c%s _gather_125[%d-%d]: %s failed!\n", p->level, ' ',
23164 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_126"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023165 }
23166 _res = NULL;
23167 done:
23168 D(p->level--);
23169 return _res;
23170}
23171
Pablo Galindo4a97b152020-09-02 17:44:19 +010023172// _tmp_127: args | expression for_if_clauses
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023173static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023174_tmp_127_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023175{
23176 D(p->level++);
23177 if (p->error_indicator) {
23178 D(p->level--);
23179 return NULL;
23180 }
23181 void * _res = NULL;
23182 int _mark = p->mark;
23183 { // args
23184 if (p->error_indicator) {
23185 D(p->level--);
23186 return NULL;
23187 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023188 D(fprintf(stderr, "%*c> _tmp_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023189 expr_ty args_var;
23190 if (
23191 (args_var = args_rule(p)) // args
23192 )
23193 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023194 D(fprintf(stderr, "%*c+ _tmp_127[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023195 _res = args_var;
23196 goto done;
23197 }
23198 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023199 D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023200 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args"));
23201 }
23202 { // expression for_if_clauses
23203 if (p->error_indicator) {
23204 D(p->level--);
23205 return NULL;
23206 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023207 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 +010023208 expr_ty expression_var;
Pablo Galindoa5634c42020-09-16 19:42:00 +010023209 asdl_comprehension_seq* for_if_clauses_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023210 if (
23211 (expression_var = expression_rule(p)) // expression
23212 &&
23213 (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses
23214 )
23215 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023216 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 +010023217 _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
23218 goto done;
23219 }
23220 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023221 D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023222 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses"));
23223 }
23224 _res = NULL;
23225 done:
23226 D(p->level--);
23227 return _res;
23228}
23229
Pablo Galindo4a97b152020-09-02 17:44:19 +010023230// _loop0_128: star_named_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023231static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023232_loop0_128_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023233{
23234 D(p->level++);
23235 if (p->error_indicator) {
23236 D(p->level--);
23237 return NULL;
23238 }
23239 void *_res = NULL;
23240 int _mark = p->mark;
23241 int _start_mark = p->mark;
23242 void **_children = PyMem_Malloc(sizeof(void *));
23243 if (!_children) {
23244 p->error_indicator = 1;
23245 PyErr_NoMemory();
23246 D(p->level--);
23247 return NULL;
23248 }
23249 ssize_t _children_capacity = 1;
23250 ssize_t _n = 0;
23251 { // star_named_expressions
23252 if (p->error_indicator) {
23253 D(p->level--);
23254 return NULL;
23255 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023256 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 +010023257 asdl_expr_seq* star_named_expressions_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023258 while (
23259 (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions
23260 )
23261 {
23262 _res = star_named_expressions_var;
23263 if (_n == _children_capacity) {
23264 _children_capacity *= 2;
23265 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23266 if (!_new_children) {
23267 p->error_indicator = 1;
23268 PyErr_NoMemory();
23269 D(p->level--);
23270 return NULL;
23271 }
23272 _children = _new_children;
23273 }
23274 _children[_n++] = _res;
23275 _mark = p->mark;
23276 }
23277 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023278 D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010023279 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023280 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023281 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023282 if (!_seq) {
23283 PyMem_Free(_children);
23284 p->error_indicator = 1;
23285 PyErr_NoMemory();
23286 D(p->level--);
23287 return NULL;
23288 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023289 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023290 PyMem_Free(_children);
23291 _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023292 D(p->level--);
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030023293 return _seq;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023294}
23295
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023296// _loop0_129: (star_targets '=')
23297static asdl_seq *
23298_loop0_129_rule(Parser *p)
23299{
23300 D(p->level++);
23301 if (p->error_indicator) {
23302 D(p->level--);
23303 return NULL;
23304 }
23305 void *_res = NULL;
23306 int _mark = p->mark;
23307 int _start_mark = p->mark;
23308 void **_children = PyMem_Malloc(sizeof(void *));
23309 if (!_children) {
23310 p->error_indicator = 1;
23311 PyErr_NoMemory();
23312 D(p->level--);
23313 return NULL;
23314 }
23315 ssize_t _children_capacity = 1;
23316 ssize_t _n = 0;
23317 { // (star_targets '=')
23318 if (p->error_indicator) {
23319 D(p->level--);
23320 return NULL;
23321 }
23322 D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
Pablo Galindo4a97b152020-09-02 17:44:19 +010023323 void *_tmp_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023324 while (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023325 (_tmp_151_var = _tmp_151_rule(p)) // star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023326 )
23327 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023328 _res = _tmp_151_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023329 if (_n == _children_capacity) {
23330 _children_capacity *= 2;
23331 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23332 if (!_new_children) {
23333 p->error_indicator = 1;
23334 PyErr_NoMemory();
23335 D(p->level--);
23336 return NULL;
23337 }
23338 _children = _new_children;
23339 }
23340 _children[_n++] = _res;
23341 _mark = p->mark;
23342 }
23343 p->mark = _mark;
23344 D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ',
23345 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23346 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023347 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023348 if (!_seq) {
23349 PyMem_Free(_children);
23350 p->error_indicator = 1;
23351 PyErr_NoMemory();
23352 D(p->level--);
23353 return NULL;
23354 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023355 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023356 PyMem_Free(_children);
23357 _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq);
23358 D(p->level--);
23359 return _seq;
23360}
23361
Pablo Galindo4a97b152020-09-02 17:44:19 +010023362// _loop0_130: (star_targets '=')
23363static asdl_seq *
23364_loop0_130_rule(Parser *p)
23365{
23366 D(p->level++);
23367 if (p->error_indicator) {
23368 D(p->level--);
23369 return NULL;
23370 }
23371 void *_res = NULL;
23372 int _mark = p->mark;
23373 int _start_mark = p->mark;
23374 void **_children = PyMem_Malloc(sizeof(void *));
23375 if (!_children) {
23376 p->error_indicator = 1;
23377 PyErr_NoMemory();
23378 D(p->level--);
23379 return NULL;
23380 }
23381 ssize_t _children_capacity = 1;
23382 ssize_t _n = 0;
23383 { // (star_targets '=')
23384 if (p->error_indicator) {
23385 D(p->level--);
23386 return NULL;
23387 }
23388 D(fprintf(stderr, "%*c> _loop0_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
23389 void *_tmp_152_var;
23390 while (
23391 (_tmp_152_var = _tmp_152_rule(p)) // star_targets '='
23392 )
23393 {
23394 _res = _tmp_152_var;
23395 if (_n == _children_capacity) {
23396 _children_capacity *= 2;
23397 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23398 if (!_new_children) {
23399 p->error_indicator = 1;
23400 PyErr_NoMemory();
23401 D(p->level--);
23402 return NULL;
23403 }
23404 _children = _new_children;
23405 }
23406 _children[_n++] = _res;
23407 _mark = p->mark;
23408 }
23409 p->mark = _mark;
23410 D(fprintf(stderr, "%*c%s _loop0_130[%d-%d]: %s failed!\n", p->level, ' ',
23411 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
23412 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023413 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023414 if (!_seq) {
23415 PyMem_Free(_children);
23416 p->error_indicator = 1;
23417 PyErr_NoMemory();
23418 D(p->level--);
23419 return NULL;
23420 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023421 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023422 PyMem_Free(_children);
23423 _PyPegen_insert_memo(p, _start_mark, _loop0_130_type, _seq);
23424 D(p->level--);
23425 return _seq;
23426}
23427
23428// _tmp_131: yield_expr | star_expressions
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023429static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023430_tmp_131_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023431{
23432 D(p->level++);
23433 if (p->error_indicator) {
23434 D(p->level--);
23435 return NULL;
23436 }
23437 void * _res = NULL;
23438 int _mark = p->mark;
23439 { // yield_expr
23440 if (p->error_indicator) {
23441 D(p->level--);
23442 return NULL;
23443 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023444 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023445 expr_ty yield_expr_var;
23446 if (
23447 (yield_expr_var = yield_expr_rule(p)) // yield_expr
23448 )
23449 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023450 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 +010023451 _res = yield_expr_var;
23452 goto done;
23453 }
23454 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023455 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023456 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
23457 }
23458 { // star_expressions
23459 if (p->error_indicator) {
23460 D(p->level--);
23461 return NULL;
23462 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023463 D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023464 expr_ty star_expressions_var;
23465 if (
23466 (star_expressions_var = star_expressions_rule(p)) // star_expressions
23467 )
23468 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023469 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 +010023470 _res = star_expressions_var;
23471 goto done;
23472 }
23473 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023474 D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023475 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
23476 }
23477 _res = NULL;
23478 done:
23479 D(p->level--);
23480 return _res;
23481}
23482
Pablo Galindo4a97b152020-09-02 17:44:19 +010023483// _tmp_132: '[' | '(' | '{'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023484static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023485_tmp_132_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023486{
23487 D(p->level++);
23488 if (p->error_indicator) {
23489 D(p->level--);
23490 return NULL;
23491 }
23492 void * _res = NULL;
23493 int _mark = p->mark;
23494 { // '['
23495 if (p->error_indicator) {
23496 D(p->level--);
23497 return NULL;
23498 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023499 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023500 Token * _literal;
23501 if (
23502 (_literal = _PyPegen_expect_token(p, 9)) // token='['
23503 )
23504 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023505 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023506 _res = _literal;
23507 goto done;
23508 }
23509 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023510 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023511 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
23512 }
23513 { // '('
23514 if (p->error_indicator) {
23515 D(p->level--);
23516 return NULL;
23517 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023518 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023519 Token * _literal;
23520 if (
23521 (_literal = _PyPegen_expect_token(p, 7)) // token='('
23522 )
23523 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023524 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023525 _res = _literal;
23526 goto done;
23527 }
23528 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023529 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023530 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
23531 }
23532 { // '{'
23533 if (p->error_indicator) {
23534 D(p->level--);
23535 return NULL;
23536 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023537 D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023538 Token * _literal;
23539 if (
23540 (_literal = _PyPegen_expect_token(p, 25)) // token='{'
23541 )
23542 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023543 D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023544 _res = _literal;
23545 goto done;
23546 }
23547 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023548 D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023549 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
23550 }
23551 _res = NULL;
23552 done:
23553 D(p->level--);
23554 return _res;
23555}
23556
Pablo Galindo4a97b152020-09-02 17:44:19 +010023557// _loop0_133: param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023558static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023559_loop0_133_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023560{
23561 D(p->level++);
23562 if (p->error_indicator) {
23563 D(p->level--);
23564 return NULL;
23565 }
23566 void *_res = NULL;
23567 int _mark = p->mark;
23568 int _start_mark = p->mark;
23569 void **_children = PyMem_Malloc(sizeof(void *));
23570 if (!_children) {
23571 p->error_indicator = 1;
23572 PyErr_NoMemory();
23573 D(p->level--);
23574 return NULL;
23575 }
23576 ssize_t _children_capacity = 1;
23577 ssize_t _n = 0;
23578 { // param_no_default
23579 if (p->error_indicator) {
23580 D(p->level--);
23581 return NULL;
23582 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023583 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 +010023584 arg_ty param_no_default_var;
23585 while (
23586 (param_no_default_var = param_no_default_rule(p)) // param_no_default
23587 )
23588 {
23589 _res = param_no_default_var;
23590 if (_n == _children_capacity) {
23591 _children_capacity *= 2;
23592 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23593 if (!_new_children) {
23594 p->error_indicator = 1;
23595 PyErr_NoMemory();
23596 D(p->level--);
23597 return NULL;
23598 }
23599 _children = _new_children;
23600 }
23601 _children[_n++] = _res;
23602 _mark = p->mark;
23603 }
23604 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023605 D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023606 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
23607 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023608 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023609 if (!_seq) {
23610 PyMem_Free(_children);
23611 p->error_indicator = 1;
23612 PyErr_NoMemory();
23613 D(p->level--);
23614 return NULL;
23615 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023616 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023617 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023618 _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023619 D(p->level--);
23620 return _seq;
23621}
23622
Pablo Galindo4a97b152020-09-02 17:44:19 +010023623// _tmp_134: slash_with_default | param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023624static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023625_tmp_134_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023626{
23627 D(p->level++);
23628 if (p->error_indicator) {
23629 D(p->level--);
23630 return NULL;
23631 }
23632 void * _res = NULL;
23633 int _mark = p->mark;
23634 { // slash_with_default
23635 if (p->error_indicator) {
23636 D(p->level--);
23637 return NULL;
23638 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023639 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 +010023640 SlashWithDefault* slash_with_default_var;
23641 if (
23642 (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default
23643 )
23644 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023645 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 +010023646 _res = slash_with_default_var;
23647 goto done;
23648 }
23649 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023650 D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023651 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
23652 }
23653 { // param_with_default+
23654 if (p->error_indicator) {
23655 D(p->level--);
23656 return NULL;
23657 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023658 D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23659 asdl_seq * _loop1_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023660 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023661 (_loop1_153_var = _loop1_153_rule(p)) // param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023662 )
23663 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023664 D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
23665 _res = _loop1_153_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023666 goto done;
23667 }
23668 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023669 D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023670 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+"));
23671 }
23672 _res = NULL;
23673 done:
23674 D(p->level--);
23675 return _res;
23676}
23677
Pablo Galindo4a97b152020-09-02 17:44:19 +010023678// _loop0_135: lambda_param_no_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023679static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023680_loop0_135_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023681{
23682 D(p->level++);
23683 if (p->error_indicator) {
23684 D(p->level--);
23685 return NULL;
23686 }
23687 void *_res = NULL;
23688 int _mark = p->mark;
23689 int _start_mark = p->mark;
23690 void **_children = PyMem_Malloc(sizeof(void *));
23691 if (!_children) {
23692 p->error_indicator = 1;
23693 PyErr_NoMemory();
23694 D(p->level--);
23695 return NULL;
23696 }
23697 ssize_t _children_capacity = 1;
23698 ssize_t _n = 0;
23699 { // lambda_param_no_default
23700 if (p->error_indicator) {
23701 D(p->level--);
23702 return NULL;
23703 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023704 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 +010023705 arg_ty lambda_param_no_default_var;
23706 while (
23707 (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
23708 )
23709 {
23710 _res = lambda_param_no_default_var;
23711 if (_n == _children_capacity) {
23712 _children_capacity *= 2;
23713 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
23714 if (!_new_children) {
23715 p->error_indicator = 1;
23716 PyErr_NoMemory();
23717 D(p->level--);
23718 return NULL;
23719 }
23720 _children = _new_children;
23721 }
23722 _children[_n++] = _res;
23723 _mark = p->mark;
23724 }
23725 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023726 D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023727 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
23728 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023729 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023730 if (!_seq) {
23731 PyMem_Free(_children);
23732 p->error_indicator = 1;
23733 PyErr_NoMemory();
23734 D(p->level--);
23735 return NULL;
23736 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010023737 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023738 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010023739 _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023740 D(p->level--);
23741 return _seq;
23742}
23743
Pablo Galindo4a97b152020-09-02 17:44:19 +010023744// _tmp_136: lambda_slash_with_default | lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023745static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023746_tmp_136_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023747{
23748 D(p->level++);
23749 if (p->error_indicator) {
23750 D(p->level--);
23751 return NULL;
23752 }
23753 void * _res = NULL;
23754 int _mark = p->mark;
23755 { // lambda_slash_with_default
23756 if (p->error_indicator) {
23757 D(p->level--);
23758 return NULL;
23759 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023760 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 +010023761 SlashWithDefault* lambda_slash_with_default_var;
23762 if (
23763 (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
23764 )
23765 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023766 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 +010023767 _res = lambda_slash_with_default_var;
23768 goto done;
23769 }
23770 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023771 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023772 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
23773 }
23774 { // lambda_param_with_default+
23775 if (p->error_indicator) {
23776 D(p->level--);
23777 return NULL;
23778 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023779 D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23780 asdl_seq * _loop1_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023781 if (
Pablo Galindo4a97b152020-09-02 17:44:19 +010023782 (_loop1_154_var = _loop1_154_rule(p)) // lambda_param_with_default+
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023783 )
23784 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023785 D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
23786 _res = _loop1_154_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023787 goto done;
23788 }
23789 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023790 D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023791 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+"));
23792 }
23793 _res = NULL;
23794 done:
23795 D(p->level--);
23796 return _res;
23797}
23798
Pablo Galindo4a97b152020-09-02 17:44:19 +010023799// _tmp_137: ')' | ',' (')' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023800static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023801_tmp_137_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023802{
23803 D(p->level++);
23804 if (p->error_indicator) {
23805 D(p->level--);
23806 return NULL;
23807 }
23808 void * _res = NULL;
23809 int _mark = p->mark;
23810 { // ')'
23811 if (p->error_indicator) {
23812 D(p->level--);
23813 return NULL;
23814 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023815 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023816 Token * _literal;
23817 if (
23818 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
23819 )
23820 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023821 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023822 _res = _literal;
23823 goto done;
23824 }
23825 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023826 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023827 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
23828 }
23829 { // ',' (')' | '**')
23830 if (p->error_indicator) {
23831 D(p->level--);
23832 return NULL;
23833 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023834 D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023835 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023836 void *_tmp_155_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023837 if (
23838 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23839 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023840 (_tmp_155_var = _tmp_155_rule(p)) // ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023841 )
23842 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023843 D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
23844 _res = _PyPegen_dummy_name(p, _literal, _tmp_155_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023845 goto done;
23846 }
23847 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023848 D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023849 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')"));
23850 }
23851 _res = NULL;
23852 done:
23853 D(p->level--);
23854 return _res;
23855}
23856
Pablo Galindo4a97b152020-09-02 17:44:19 +010023857// _tmp_138: ':' | ',' (':' | '**')
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023858static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023859_tmp_138_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023860{
23861 D(p->level++);
23862 if (p->error_indicator) {
23863 D(p->level--);
23864 return NULL;
23865 }
23866 void * _res = NULL;
23867 int _mark = p->mark;
23868 { // ':'
23869 if (p->error_indicator) {
23870 D(p->level--);
23871 return NULL;
23872 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023873 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023874 Token * _literal;
23875 if (
23876 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
23877 )
23878 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023879 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023880 _res = _literal;
23881 goto done;
23882 }
23883 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023884 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023885 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
23886 }
23887 { // ',' (':' | '**')
23888 if (p->error_indicator) {
23889 D(p->level--);
23890 return NULL;
23891 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023892 D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023893 Token * _literal;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023894 void *_tmp_156_var;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023895 if (
23896 (_literal = _PyPegen_expect_token(p, 12)) // token=','
23897 &&
Pablo Galindo4a97b152020-09-02 17:44:19 +010023898 (_tmp_156_var = _tmp_156_rule(p)) // ':' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023899 )
23900 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023901 D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
23902 _res = _PyPegen_dummy_name(p, _literal, _tmp_156_var);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023903 goto done;
23904 }
23905 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023906 D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023907 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')"));
23908 }
23909 _res = NULL;
23910 done:
23911 D(p->level--);
23912 return _res;
23913}
23914
Pablo Galindo4a97b152020-09-02 17:44:19 +010023915// _tmp_139: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023916static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010023917_tmp_139_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023918{
23919 D(p->level++);
23920 if (p->error_indicator) {
23921 D(p->level--);
23922 return NULL;
23923 }
23924 void * _res = NULL;
23925 int _mark = p->mark;
23926 { // star_targets '='
23927 if (p->error_indicator) {
23928 D(p->level--);
23929 return NULL;
23930 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010023931 D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023932 Token * _literal;
23933 expr_ty z;
23934 if (
23935 (z = star_targets_rule(p)) // star_targets
23936 &&
23937 (_literal = _PyPegen_expect_token(p, 22)) // token='='
23938 )
23939 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010023940 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 +010023941 _res = z;
23942 if (_res == NULL && PyErr_Occurred()) {
23943 p->error_indicator = 1;
23944 D(p->level--);
23945 return NULL;
23946 }
23947 goto done;
23948 }
23949 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010023950 D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023951 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
23952 }
23953 _res = NULL;
23954 done:
23955 D(p->level--);
23956 return _res;
23957}
23958
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010023959// _tmp_140: '.' | '...'
23960static void *
23961_tmp_140_rule(Parser *p)
23962{
23963 D(p->level++);
23964 if (p->error_indicator) {
23965 D(p->level--);
23966 return NULL;
23967 }
23968 void * _res = NULL;
23969 int _mark = p->mark;
23970 { // '.'
23971 if (p->error_indicator) {
23972 D(p->level--);
23973 return NULL;
23974 }
23975 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
23976 Token * _literal;
23977 if (
23978 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
23979 )
23980 {
23981 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
23982 _res = _literal;
23983 goto done;
23984 }
23985 p->mark = _mark;
23986 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
23987 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
23988 }
23989 { // '...'
23990 if (p->error_indicator) {
23991 D(p->level--);
23992 return NULL;
23993 }
23994 D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
23995 Token * _literal;
23996 if (
23997 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
23998 )
23999 {
24000 D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
24001 _res = _literal;
24002 goto done;
24003 }
24004 p->mark = _mark;
24005 D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
24006 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
24007 }
24008 _res = NULL;
24009 done:
24010 D(p->level--);
24011 return _res;
24012}
24013
Pablo Galindo4a97b152020-09-02 17:44:19 +010024014// _tmp_141: '.' | '...'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024015static void *
24016_tmp_141_rule(Parser *p)
24017{
24018 D(p->level++);
24019 if (p->error_indicator) {
24020 D(p->level--);
24021 return NULL;
24022 }
24023 void * _res = NULL;
24024 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024025 { // '.'
24026 if (p->error_indicator) {
24027 D(p->level--);
24028 return NULL;
24029 }
24030 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
24031 Token * _literal;
24032 if (
24033 (_literal = _PyPegen_expect_token(p, 23)) // token='.'
24034 )
24035 {
24036 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
24037 _res = _literal;
24038 goto done;
24039 }
24040 p->mark = _mark;
24041 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
24042 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
24043 }
24044 { // '...'
24045 if (p->error_indicator) {
24046 D(p->level--);
24047 return NULL;
24048 }
24049 D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
24050 Token * _literal;
24051 if (
24052 (_literal = _PyPegen_expect_token(p, 52)) // token='...'
24053 )
24054 {
24055 D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
24056 _res = _literal;
24057 goto done;
24058 }
24059 p->mark = _mark;
24060 D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
24061 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
24062 }
24063 _res = NULL;
24064 done:
24065 D(p->level--);
24066 return _res;
24067}
24068
24069// _tmp_142: '@' named_expression NEWLINE
24070static void *
24071_tmp_142_rule(Parser *p)
24072{
24073 D(p->level++);
24074 if (p->error_indicator) {
24075 D(p->level--);
24076 return NULL;
24077 }
24078 void * _res = NULL;
24079 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024080 { // '@' named_expression NEWLINE
24081 if (p->error_indicator) {
24082 D(p->level--);
24083 return NULL;
24084 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024085 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 +010024086 Token * _literal;
24087 expr_ty f;
24088 Token * newline_var;
24089 if (
24090 (_literal = _PyPegen_expect_token(p, 49)) // token='@'
24091 &&
24092 (f = named_expression_rule(p)) // named_expression
24093 &&
24094 (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
24095 )
24096 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024097 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 +010024098 _res = f;
24099 if (_res == NULL && PyErr_Occurred()) {
24100 p->error_indicator = 1;
24101 D(p->level--);
24102 return NULL;
24103 }
24104 goto done;
24105 }
24106 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024107 D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024108 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE"));
24109 }
24110 _res = NULL;
24111 done:
24112 D(p->level--);
24113 return _res;
24114}
24115
Pablo Galindo4a97b152020-09-02 17:44:19 +010024116// _tmp_143: ',' star_expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024117static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024118_tmp_143_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024119{
24120 D(p->level++);
24121 if (p->error_indicator) {
24122 D(p->level--);
24123 return NULL;
24124 }
24125 void * _res = NULL;
24126 int _mark = p->mark;
24127 { // ',' star_expression
24128 if (p->error_indicator) {
24129 D(p->level--);
24130 return NULL;
24131 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024132 D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024133 Token * _literal;
24134 expr_ty c;
24135 if (
24136 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24137 &&
24138 (c = star_expression_rule(p)) // star_expression
24139 )
24140 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024141 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 +010024142 _res = c;
24143 if (_res == NULL && PyErr_Occurred()) {
24144 p->error_indicator = 1;
24145 D(p->level--);
24146 return NULL;
24147 }
24148 goto done;
24149 }
24150 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024151 D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024152 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
24153 }
24154 _res = NULL;
24155 done:
24156 D(p->level--);
24157 return _res;
24158}
24159
Pablo Galindo4a97b152020-09-02 17:44:19 +010024160// _tmp_144: ',' expression
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024161static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024162_tmp_144_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024163{
24164 D(p->level++);
24165 if (p->error_indicator) {
24166 D(p->level--);
24167 return NULL;
24168 }
24169 void * _res = NULL;
24170 int _mark = p->mark;
24171 { // ',' expression
24172 if (p->error_indicator) {
24173 D(p->level--);
24174 return NULL;
24175 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024176 D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024177 Token * _literal;
24178 expr_ty c;
24179 if (
24180 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24181 &&
24182 (c = expression_rule(p)) // expression
24183 )
24184 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024185 D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024186 _res = c;
24187 if (_res == NULL && PyErr_Occurred()) {
24188 p->error_indicator = 1;
24189 D(p->level--);
24190 return NULL;
24191 }
24192 goto done;
24193 }
24194 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024195 D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024196 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
24197 }
24198 _res = NULL;
24199 done:
24200 D(p->level--);
24201 return _res;
24202}
24203
Pablo Galindo4a97b152020-09-02 17:44:19 +010024204// _tmp_145: 'or' conjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024205static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024206_tmp_145_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024207{
24208 D(p->level++);
24209 if (p->error_indicator) {
24210 D(p->level--);
24211 return NULL;
24212 }
24213 void * _res = NULL;
24214 int _mark = p->mark;
24215 { // 'or' conjunction
24216 if (p->error_indicator) {
24217 D(p->level--);
24218 return NULL;
24219 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024220 D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024221 Token * _keyword;
24222 expr_ty c;
24223 if (
24224 (_keyword = _PyPegen_expect_token(p, 531)) // token='or'
24225 &&
24226 (c = conjunction_rule(p)) // conjunction
24227 )
24228 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024229 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 +010024230 _res = c;
24231 if (_res == NULL && PyErr_Occurred()) {
24232 p->error_indicator = 1;
24233 D(p->level--);
24234 return NULL;
24235 }
24236 goto done;
24237 }
24238 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024239 D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024240 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction"));
24241 }
24242 _res = NULL;
24243 done:
24244 D(p->level--);
24245 return _res;
24246}
24247
Pablo Galindo4a97b152020-09-02 17:44:19 +010024248// _tmp_146: 'and' inversion
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024249static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024250_tmp_146_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024251{
24252 D(p->level++);
24253 if (p->error_indicator) {
24254 D(p->level--);
24255 return NULL;
24256 }
24257 void * _res = NULL;
24258 int _mark = p->mark;
24259 { // 'and' inversion
24260 if (p->error_indicator) {
24261 D(p->level--);
24262 return NULL;
24263 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024264 D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024265 Token * _keyword;
24266 expr_ty c;
24267 if (
24268 (_keyword = _PyPegen_expect_token(p, 532)) // token='and'
24269 &&
24270 (c = inversion_rule(p)) // inversion
24271 )
24272 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024273 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 +010024274 _res = c;
24275 if (_res == NULL && PyErr_Occurred()) {
24276 p->error_indicator = 1;
24277 D(p->level--);
24278 return NULL;
24279 }
24280 goto done;
24281 }
24282 p->mark = _mark;
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024283 D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo4a97b152020-09-02 17:44:19 +010024284 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024285 }
24286 _res = NULL;
24287 done:
24288 D(p->level--);
24289 return _res;
24290}
24291
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024292// _tmp_147: 'if' disjunction
24293static void *
24294_tmp_147_rule(Parser *p)
24295{
24296 D(p->level++);
24297 if (p->error_indicator) {
24298 D(p->level--);
24299 return NULL;
24300 }
24301 void * _res = NULL;
24302 int _mark = p->mark;
24303 { // 'if' disjunction
24304 if (p->error_indicator) {
24305 D(p->level--);
24306 return NULL;
24307 }
24308 D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24309 Token * _keyword;
24310 expr_ty z;
24311 if (
24312 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24313 &&
24314 (z = disjunction_rule(p)) // disjunction
24315 )
24316 {
24317 D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24318 _res = z;
24319 if (_res == NULL && PyErr_Occurred()) {
24320 p->error_indicator = 1;
24321 D(p->level--);
24322 return NULL;
24323 }
24324 goto done;
24325 }
24326 p->mark = _mark;
24327 D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
24328 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24329 }
24330 _res = NULL;
24331 done:
24332 D(p->level--);
24333 return _res;
24334}
24335
Pablo Galindo4a97b152020-09-02 17:44:19 +010024336// _tmp_148: 'if' disjunction
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024337static void *
24338_tmp_148_rule(Parser *p)
24339{
24340 D(p->level++);
24341 if (p->error_indicator) {
24342 D(p->level--);
24343 return NULL;
24344 }
24345 void * _res = NULL;
24346 int _mark = p->mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024347 { // 'if' disjunction
24348 if (p->error_indicator) {
24349 D(p->level--);
24350 return NULL;
24351 }
24352 D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24353 Token * _keyword;
24354 expr_ty z;
24355 if (
24356 (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
24357 &&
24358 (z = disjunction_rule(p)) // disjunction
24359 )
24360 {
24361 D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24362 _res = z;
24363 if (_res == NULL && PyErr_Occurred()) {
24364 p->error_indicator = 1;
24365 D(p->level--);
24366 return NULL;
24367 }
24368 goto done;
24369 }
24370 p->mark = _mark;
24371 D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
24372 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
24373 }
24374 _res = NULL;
24375 done:
24376 D(p->level--);
24377 return _res;
24378}
24379
24380// _tmp_149: starred_expression | named_expression !'='
24381static void *
24382_tmp_149_rule(Parser *p)
24383{
24384 D(p->level++);
24385 if (p->error_indicator) {
24386 D(p->level--);
24387 return NULL;
24388 }
24389 void * _res = NULL;
24390 int _mark = p->mark;
24391 { // starred_expression
24392 if (p->error_indicator) {
24393 D(p->level--);
24394 return NULL;
24395 }
24396 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
24397 expr_ty starred_expression_var;
24398 if (
24399 (starred_expression_var = starred_expression_rule(p)) // starred_expression
24400 )
24401 {
24402 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
24403 _res = starred_expression_var;
24404 goto done;
24405 }
24406 p->mark = _mark;
24407 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24408 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
24409 }
24410 { // named_expression !'='
24411 if (p->error_indicator) {
24412 D(p->level--);
24413 return NULL;
24414 }
24415 D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
24416 expr_ty named_expression_var;
24417 if (
24418 (named_expression_var = named_expression_rule(p)) // named_expression
24419 &&
24420 _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
24421 )
24422 {
24423 D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
24424 _res = named_expression_var;
24425 goto done;
24426 }
24427 p->mark = _mark;
24428 D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
24429 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression !'='"));
24430 }
24431 _res = NULL;
24432 done:
24433 D(p->level--);
24434 return _res;
24435}
24436
24437// _tmp_150: ',' star_target
24438static void *
24439_tmp_150_rule(Parser *p)
24440{
24441 D(p->level++);
24442 if (p->error_indicator) {
24443 D(p->level--);
24444 return NULL;
24445 }
24446 void * _res = NULL;
24447 int _mark = p->mark;
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024448 { // ',' star_target
24449 if (p->error_indicator) {
24450 D(p->level--);
24451 return NULL;
24452 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024453 D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024454 Token * _literal;
24455 expr_ty c;
24456 if (
24457 (_literal = _PyPegen_expect_token(p, 12)) // token=','
24458 &&
24459 (c = star_target_rule(p)) // star_target
24460 )
24461 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024462 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 +010024463 _res = c;
24464 if (_res == NULL && PyErr_Occurred()) {
24465 p->error_indicator = 1;
24466 D(p->level--);
24467 return NULL;
24468 }
24469 goto done;
24470 }
24471 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024472 D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou01ece632020-06-19 02:10:43 +030024473 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024474 }
24475 _res = NULL;
24476 done:
24477 D(p->level--);
24478 return _res;
24479}
24480
Pablo Galindo4a97b152020-09-02 17:44:19 +010024481// _tmp_151: star_targets '='
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024482static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024483_tmp_151_rule(Parser *p)
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024484{
24485 D(p->level++);
24486 if (p->error_indicator) {
24487 D(p->level--);
24488 return NULL;
24489 }
24490 void * _res = NULL;
24491 int _mark = p->mark;
24492 { // star_targets '='
24493 if (p->error_indicator) {
24494 D(p->level--);
24495 return NULL;
24496 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024497 D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024498 Token * _literal;
24499 expr_ty star_targets_var;
24500 if (
24501 (star_targets_var = star_targets_rule(p)) // star_targets
24502 &&
24503 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24504 )
24505 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024506 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 +030024507 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24508 goto done;
24509 }
24510 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024511 D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024512 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24513 }
24514 _res = NULL;
24515 done:
24516 D(p->level--);
24517 return _res;
24518}
24519
Pablo Galindo4a97b152020-09-02 17:44:19 +010024520// _tmp_152: star_targets '='
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024521static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024522_tmp_152_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024523{
24524 D(p->level++);
24525 if (p->error_indicator) {
24526 D(p->level--);
24527 return NULL;
24528 }
24529 void * _res = NULL;
24530 int _mark = p->mark;
24531 { // star_targets '='
24532 if (p->error_indicator) {
24533 D(p->level--);
24534 return NULL;
24535 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024536 D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024537 Token * _literal;
24538 expr_ty star_targets_var;
24539 if (
24540 (star_targets_var = star_targets_rule(p)) // star_targets
24541 &&
24542 (_literal = _PyPegen_expect_token(p, 22)) // token='='
24543 )
24544 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024545 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 +010024546 _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
24547 goto done;
24548 }
24549 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024550 D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024551 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
24552 }
24553 _res = NULL;
24554 done:
24555 D(p->level--);
24556 return _res;
24557}
24558
Pablo Galindo4a97b152020-09-02 17:44:19 +010024559// _loop1_153: param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024560static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024561_loop1_153_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024562{
24563 D(p->level++);
24564 if (p->error_indicator) {
24565 D(p->level--);
24566 return NULL;
24567 }
24568 void *_res = NULL;
24569 int _mark = p->mark;
24570 int _start_mark = p->mark;
24571 void **_children = PyMem_Malloc(sizeof(void *));
24572 if (!_children) {
24573 p->error_indicator = 1;
24574 PyErr_NoMemory();
24575 D(p->level--);
24576 return NULL;
24577 }
24578 ssize_t _children_capacity = 1;
24579 ssize_t _n = 0;
24580 { // param_with_default
24581 if (p->error_indicator) {
24582 D(p->level--);
24583 return NULL;
24584 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024585 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 +010024586 NameDefaultPair* param_with_default_var;
24587 while (
24588 (param_with_default_var = param_with_default_rule(p)) // param_with_default
24589 )
24590 {
24591 _res = param_with_default_var;
24592 if (_n == _children_capacity) {
24593 _children_capacity *= 2;
24594 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24595 if (!_new_children) {
24596 p->error_indicator = 1;
24597 PyErr_NoMemory();
24598 D(p->level--);
24599 return NULL;
24600 }
24601 _children = _new_children;
24602 }
24603 _children[_n++] = _res;
24604 _mark = p->mark;
24605 }
24606 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024607 D(fprintf(stderr, "%*c%s _loop1_153[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024608 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
24609 }
24610 if (_n == 0 || p->error_indicator) {
24611 PyMem_Free(_children);
24612 D(p->level--);
24613 return NULL;
24614 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024615 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024616 if (!_seq) {
24617 PyMem_Free(_children);
24618 p->error_indicator = 1;
24619 PyErr_NoMemory();
24620 D(p->level--);
24621 return NULL;
24622 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024623 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024624 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010024625 _PyPegen_insert_memo(p, _start_mark, _loop1_153_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024626 D(p->level--);
24627 return _seq;
24628}
24629
Pablo Galindo4a97b152020-09-02 17:44:19 +010024630// _loop1_154: lambda_param_with_default
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024631static asdl_seq *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024632_loop1_154_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024633{
24634 D(p->level++);
24635 if (p->error_indicator) {
24636 D(p->level--);
24637 return NULL;
24638 }
24639 void *_res = NULL;
24640 int _mark = p->mark;
24641 int _start_mark = p->mark;
24642 void **_children = PyMem_Malloc(sizeof(void *));
24643 if (!_children) {
24644 p->error_indicator = 1;
24645 PyErr_NoMemory();
24646 D(p->level--);
24647 return NULL;
24648 }
24649 ssize_t _children_capacity = 1;
24650 ssize_t _n = 0;
24651 { // lambda_param_with_default
24652 if (p->error_indicator) {
24653 D(p->level--);
24654 return NULL;
24655 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024656 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 +010024657 NameDefaultPair* lambda_param_with_default_var;
24658 while (
24659 (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
24660 )
24661 {
24662 _res = lambda_param_with_default_var;
24663 if (_n == _children_capacity) {
24664 _children_capacity *= 2;
24665 void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
24666 if (!_new_children) {
24667 p->error_indicator = 1;
24668 PyErr_NoMemory();
24669 D(p->level--);
24670 return NULL;
24671 }
24672 _children = _new_children;
24673 }
24674 _children[_n++] = _res;
24675 _mark = p->mark;
24676 }
24677 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024678 D(fprintf(stderr, "%*c%s _loop1_154[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024679 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
24680 }
24681 if (_n == 0 || p->error_indicator) {
24682 PyMem_Free(_children);
24683 D(p->level--);
24684 return NULL;
24685 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024686 asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024687 if (!_seq) {
24688 PyMem_Free(_children);
24689 p->error_indicator = 1;
24690 PyErr_NoMemory();
24691 D(p->level--);
24692 return NULL;
24693 }
Pablo Galindoa5634c42020-09-16 19:42:00 +010024694 for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024695 PyMem_Free(_children);
Pablo Galindo4a97b152020-09-02 17:44:19 +010024696 _PyPegen_insert_memo(p, _start_mark, _loop1_154_type, _seq);
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024697 D(p->level--);
24698 return _seq;
24699}
24700
Pablo Galindo4a97b152020-09-02 17:44:19 +010024701// _tmp_155: ')' | '**'
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024702static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024703_tmp_155_rule(Parser *p)
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024704{
24705 D(p->level++);
24706 if (p->error_indicator) {
24707 D(p->level--);
24708 return NULL;
24709 }
24710 void * _res = NULL;
24711 int _mark = p->mark;
24712 { // ')'
24713 if (p->error_indicator) {
24714 D(p->level--);
24715 return NULL;
24716 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024717 D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024718 Token * _literal;
24719 if (
24720 (_literal = _PyPegen_expect_token(p, 8)) // token=')'
24721 )
24722 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024723 D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024724 _res = _literal;
24725 goto done;
24726 }
24727 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024728 D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024729 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
24730 }
24731 { // '**'
24732 if (p->error_indicator) {
24733 D(p->level--);
24734 return NULL;
24735 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024736 D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024737 Token * _literal;
24738 if (
24739 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24740 )
24741 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024742 D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024743 _res = _literal;
24744 goto done;
24745 }
24746 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024747 D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024748 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24749 }
24750 _res = NULL;
24751 done:
24752 D(p->level--);
24753 return _res;
24754}
24755
Pablo Galindo4a97b152020-09-02 17:44:19 +010024756// _tmp_156: ':' | '**'
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024757static void *
Pablo Galindo4a97b152020-09-02 17:44:19 +010024758_tmp_156_rule(Parser *p)
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024759{
24760 D(p->level++);
24761 if (p->error_indicator) {
24762 D(p->level--);
24763 return NULL;
24764 }
24765 void * _res = NULL;
24766 int _mark = p->mark;
24767 { // ':'
24768 if (p->error_indicator) {
24769 D(p->level--);
24770 return NULL;
24771 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024772 D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024773 Token * _literal;
24774 if (
24775 (_literal = _PyPegen_expect_token(p, 11)) // token=':'
24776 )
24777 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024778 D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024779 _res = _literal;
24780 goto done;
24781 }
24782 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024783 D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
Lysandros Nikolaou4b85e602020-06-26 02:22:36 +030024784 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024785 }
24786 { // '**'
24787 if (p->error_indicator) {
24788 D(p->level--);
24789 return NULL;
24790 }
Pablo Galindo4a97b152020-09-02 17:44:19 +010024791 D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024792 Token * _literal;
24793 if (
24794 (_literal = _PyPegen_expect_token(p, 35)) // token='**'
24795 )
24796 {
Pablo Galindo4a97b152020-09-02 17:44:19 +010024797 D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024798 _res = _literal;
24799 goto done;
24800 }
24801 p->mark = _mark;
Pablo Galindo4a97b152020-09-02 17:44:19 +010024802 D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ',
Pablo Galindo1ed83ad2020-06-11 17:30:46 +010024803 p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
24804 }
24805 _res = NULL;
24806 done:
24807 D(p->level--);
24808 return _res;
24809}
24810
24811void *
24812_PyPegen_parse(Parser *p)
24813{
24814 // Initialize keywords
24815 p->keywords = reserved_keywords;
24816 p->n_keyword_lists = n_keyword_lists;
24817
24818 // Run parser
24819 void *result = NULL;
24820 if (p->start_rule == Py_file_input) {
24821 result = file_rule(p);
24822 } else if (p->start_rule == Py_single_input) {
24823 result = interactive_rule(p);
24824 } else if (p->start_rule == Py_eval_input) {
24825 result = eval_rule(p);
24826 } else if (p->start_rule == Py_func_type_input) {
24827 result = func_type_rule(p);
24828 } else if (p->start_rule == Py_fstring_input) {
24829 result = fstring_rule(p);
24830 }
24831
24832 return result;
24833}
24834
24835// The end